diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 08fd371176c..75fcb5f4de4 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -361,3 +361,4 @@ f900d5afd9c83a0df8f36161c27c5e4c86a66f4c jdk-9+111 6743a8e0cab7b5f6f4a0575f6664892f0ab740af jdk-9+116 e882bcdbdac436523f3d5681611d3118a3804ea7 jdk-9+117 047f95de8f918d8ff5e8cd2636a2abb5c3c8adb8 jdk-9+118 +3463a3f14f0f0e8a68f29ac6405454f2fa2f598a jdk-9+119 diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4 index f295a46d3c4..6a64c47b964 100644 --- a/common/autoconf/basics.m4 +++ b/common/autoconf/basics.m4 @@ -484,6 +484,8 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], BASIC_REQUIRE_PROGS(FILE, file) BASIC_REQUIRE_PROGS(FIND, find) BASIC_REQUIRE_PROGS(HEAD, head) + BASIC_REQUIRE_PROGS(GUNZIP, gunzip) + BASIC_REQUIRE_PROGS(GZIP, pigz gzip) BASIC_REQUIRE_PROGS(LN, ln) BASIC_REQUIRE_PROGS(LS, ls) BASIC_REQUIRE_PROGS(MKDIR, mkdir) @@ -496,7 +498,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS], BASIC_REQUIRE_PROGS(SH, sh) BASIC_REQUIRE_PROGS(SORT, sort) BASIC_REQUIRE_PROGS(TAIL, tail) - BASIC_REQUIRE_PROGS(TAR, tar) + BASIC_REQUIRE_PROGS(TAR, gtar tar) BASIC_REQUIRE_PROGS(TEE, tee) BASIC_REQUIRE_PROGS(TOUCH, touch) BASIC_REQUIRE_PROGS(TR, tr) @@ -839,8 +841,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], # The spec.gmk file contains all variables for the make system. AC_CONFIG_FILES([$OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in]) - # The hotspot-spec.gmk file contains legacy variables for the hotspot make system. - AC_CONFIG_FILES([$OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in]) # The bootcycle-spec.gmk file contains support for boot cycle builds. AC_CONFIG_FILES([$OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in]) # The buildjdk-spec.gmk file contains support for building a buildjdk when cross compiling. @@ -1009,11 +1009,36 @@ AC_DEFUN([BASIC_CHECK_FIND_DELETE], AC_SUBST(FIND_DELETE) ]) +AC_DEFUN([BASIC_CHECK_TAR], +[ + # Test which kind of tar was found + if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then + TAR_TYPE="gnu" + elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then + TAR_TYPE="bsd" + elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then + TAR_TYPE="solaris" + fi + AC_MSG_CHECKING([what type of tar was found]) + AC_MSG_RESULT([$TAR_TYPE]) + + if test "x$TAR_TYPE" = "xgnu"; then + TAR_INCLUDE_PARAM="T" + TAR_SUPPORTS_TRANSFORM="true" + else + TAR_INCLUDE_PARAM="I" + TAR_SUPPORTS_TRANSFORM="false" + fi + AC_SUBST(TAR_INCLUDE_PARAM) + AC_SUBST(TAR_SUPPORTS_TRANSFORM) +]) + AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS], [ BASIC_CHECK_GNU_MAKE BASIC_CHECK_FIND_DELETE + BASIC_CHECK_TAR # These tools might not be installed by default, # need hint on how to install them. diff --git a/common/autoconf/buildjdk-spec.gmk.in b/common/autoconf/buildjdk-spec.gmk.in index 818f21eed95..c4b7d9051cc 100644 --- a/common/autoconf/buildjdk-spec.gmk.in +++ b/common/autoconf/buildjdk-spec.gmk.in @@ -134,8 +134,9 @@ ifeq ($(JVM_INTERPRETER), cpp) endif HOTSPOT_MAKE_ARGS := product docs export_product -# Control wether Hotspot runs Queens test after building -TEST_IN_BUILD := false + +# Control wether Hotspot builds gtest tests +BUILD_GTEST := false USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@ diff --git a/common/autoconf/compare.sh.in b/common/autoconf/compare.sh.in index 67a69ff73bd..f7e2003ca32 100644 --- a/common/autoconf/compare.sh.in +++ b/common/autoconf/compare.sh.in @@ -48,6 +48,7 @@ export EXPR="@EXPR@" export FILE="@FILE@" export FIND="@FIND@" export GREP="@GREP@" +export GUNZIP="@GUNZIP@" export LDD="@LDD@" export LN="@LN@" export MKDIR="@MKDIR@" @@ -63,10 +64,11 @@ export SED="@SED@" export SORT="@SORT@" export STAT="@STAT@" export STRIP="@STRIP@ @STRIPFLAGS@" +export TAR="@TAR@" export TEE="@TEE@" export UNIQ="@UNIQ@" export UNPACK200="@FIXPATH@ @BOOT_JDK@/bin/unpack200" -export UNARCHIVE="@UNZIP@ -q" +export UNARCHIVE="@UNZIP@ -q -o" export SRC_ROOT="@TOPDIR@" export OUTPUT_ROOT="@OUTPUT_ROOT@" diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac index 291851f8d10..0079a944dac 100644 --- a/common/autoconf/configure.ac +++ b/common/autoconf/configure.ac @@ -207,6 +207,7 @@ JDKOPT_SETUP_CODE_COVERAGE # Need toolchain to setup dtrace HOTSPOT_SETUP_DTRACE HOTSPOT_SETUP_JVM_FEATURES +HOTSPOT_ENABLE_DISABLE_GTEST ############################################################################### # @@ -226,7 +227,6 @@ LIB_SETUP_LIBRARIES # ############################################################################### -HOTSPOT_SETUP_LEGACY_BUILD JDKOPT_DETECT_INTREE_EC JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index f40198f8da3..ef4a2674e9f 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -652,21 +652,7 @@ MEMORY_SIZE NUM_CORES BUILD_FAILURE_HANDLER ENABLE_INTREE_EC -JVM_VARIANT_CORE -JVM_VARIANT_ZEROSHARK -JVM_VARIANT_ZERO -JVM_VARIANT_HOTSPOT -JVM_VARIANT_MINIMAL1 -JVM_VARIANT_CLIENT -JVM_VARIANT_SERVER -JVM_VARIANTS_COMMA -TEST_IN_BUILD -HOTSPOT_MAKE_ARGS -MACOSX_UNIVERSAL -DEBUG_CLASSFILES -FASTDEBUG -VARIANT -USE_NEW_HOTSPOT_BUILD +STLPORT_LIB LIBZIP_CAN_USE_MMAP LIBDL LIBM @@ -702,6 +688,7 @@ LIBCXX STATIC_CXX_SETTING FIXPATH_DETACH_FLAG FIXPATH +BUILD_GTEST VALID_JVM_FEATURES JVM_FEATURES_custom JVM_FEATURES_zeroshark @@ -963,6 +950,8 @@ OTOOL LDD ZIP UNZIP +TAR_SUPPORTS_TRANSFORM +TAR_INCLUDE_PARAM FIND_DELETE OUTPUT_SYNC OUTPUT_SYNC_SUPPORTED @@ -995,6 +984,9 @@ HOTSPOT_BUILD_CPU_ARCH HOTSPOT_BUILD_CPU HOTSPOT_BUILD_OS_TYPE HOTSPOT_BUILD_OS +OPENJDK_BUILD_BUNDLE_PLATFORM +OPENJDK_BUILD_CPU_BUNDLE +OPENJDK_BUILD_OS_BUNDLE OPENJDK_BUILD_OS_EXPORT_DIR OPENJDK_BUILD_CPU_JLI_CFLAGS OPENJDK_BUILD_CPU_OSARCH @@ -1009,6 +1001,9 @@ HOTSPOT_TARGET_OS_TYPE HOTSPOT_TARGET_OS DEFINE_CROSS_COMPILE_ARCH LP64 +OPENJDK_TARGET_BUNDLE_PLATFORM +OPENJDK_TARGET_CPU_BUNDLE +OPENJDK_TARGET_OS_BUNDLE OPENJDK_TARGET_OS_EXPORT_DIR OPENJDK_TARGET_CPU_JLI_CFLAGS OPENJDK_TARGET_CPU_OSARCH @@ -1078,6 +1073,8 @@ MKTEMP MKDIR LS LN +GZIP +GUNZIP HEAD FIND FILE @@ -1202,6 +1199,7 @@ enable_native_coverage enable_dtrace with_jvm_features with_jvm_interpreter +enable_hotspot_gtest with_stdc__lib with_msvcr_dll with_msvcp_dll @@ -1227,8 +1225,6 @@ with_lcms with_dxsdk with_dxsdk_lib with_dxsdk_include -enable_new_hotspot_build -enable_hotspot_test_in_build enable_jtreg_failure_handler with_num_cores with_memory_size @@ -1262,6 +1258,8 @@ EXPR FILE FIND HEAD +GUNZIP +GZIP LN LS MKDIR @@ -1996,15 +1994,11 @@ Optional Features: --enable-dtrace[=yes/no/auto] enable dtrace. Default is auto, where dtrace is enabled if all dependencies are present. + --disable-hotspot-gtest Disables building of the Hotspot unit tests --disable-freetype-bundling disable bundling of the freetype library with the build result [enabled on Windows or when using --with-freetype, disabled otherwise] - --disable-new-hotspot-build - disable the new hotspot build system (use the old) - [enabled] - --enable-hotspot-test-in-build - run the Queens test after Hotspot build [disabled] --enable-jtreg-failure-handler forces build of the jtreg failure handler to be enabled, missing dependencies become fatal errors. @@ -2205,6 +2199,8 @@ Some influential environment variables: FILE Override default value for FILE FIND Override default value for FIND HEAD Override default value for HEAD + GUNZIP Override default value for GUNZIP + GZIP Override default value for GZIP LN Override default value for LN LS Override default value for LS MKDIR Override default value for MKDIR @@ -3707,6 +3703,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + # Check if build directory is on local disk. If not possible to determine, # we prefer to claim it's local. # Argument 1: directory to test @@ -4303,9 +4301,8 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom" # -############################################################################### -# Support for old hotspot build. Remove once new hotspot build has proven -# to work satisfactory. +################################################################################ +# Check if gtest should be built # @@ -4732,6 +4729,13 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom" ################################################################################ +################################################################################ +# libstlport.so.1 is needed for running gtest on Solaris. Find it to +# redistribute it in the test image. +################################################################################ + + + # # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -5076,7 +5080,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1462970869 +DATE_WHEN_GENERATED=1463732692 ############################################################################### # @@ -8401,6 +8405,414 @@ $as_echo "$tool_specified" >&6; } + # Publish this variable in the help. + + + if [ -z "${GUNZIP+x}" ]; then + # The variable is not set by user, try to locate tool using the code snippet + for ac_prog in gunzip +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_GUNZIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GUNZIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GUNZIP="$GUNZIP" # 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_GUNZIP="$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 +GUNZIP=$ac_cv_path_GUNZIP +if test -n "$GUNZIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUNZIP" >&5 +$as_echo "$GUNZIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$GUNZIP" && break +done + + else + # The variable is set, but is it from the command line or the environment? + + # Try to remove the string !GUNZIP! from our list. + try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!GUNZIP!/} + 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 "xGUNZIP" != xBASH; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of GUNZIP from the environment. Use command line variables instead." >&5 +$as_echo "$as_me: WARNING: Ignoring value of GUNZIP from the environment. Use command line variables instead." >&2;} + fi + # Try to locate tool using the code snippet + for ac_prog in gunzip +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_GUNZIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GUNZIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GUNZIP="$GUNZIP" # 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_GUNZIP="$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 +GUNZIP=$ac_cv_path_GUNZIP +if test -n "$GUNZIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUNZIP" >&5 +$as_echo "$GUNZIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$GUNZIP" && 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$GUNZIP" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool GUNZIP= (no value)" >&5 +$as_echo "$as_me: Setting user supplied tool GUNZIP= (no value)" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GUNZIP" >&5 +$as_echo_n "checking for GUNZIP... " >&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="$GUNZIP" + 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 GUNZIP=$tool_basename" >&5 +$as_echo "$as_me: Will search for user supplied tool GUNZIP=$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_GUNZIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GUNZIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GUNZIP="$GUNZIP" # 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_GUNZIP="$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 +GUNZIP=$ac_cv_path_GUNZIP +if test -n "$GUNZIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUNZIP" >&5 +$as_echo "$GUNZIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$GUNZIP" = 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 GUNZIP=$tool_specified" >&5 +$as_echo "$as_me: Will use user supplied tool GUNZIP=$tool_specified" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GUNZIP" >&5 +$as_echo_n "checking for GUNZIP... " >&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 GUNZIP=$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 + + + + if test "x$GUNZIP" = x; then + as_fn_error $? "Could not find required tool for GUNZIP" "$LINENO" 5 + fi + + + + + + # Publish this variable in the help. + + + if [ -z "${GZIP+x}" ]; then + # The variable is not set by user, try to locate tool using the code snippet + for ac_prog in pigz gzip +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_GZIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GZIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GZIP="$GZIP" # 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_GZIP="$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 +GZIP=$ac_cv_path_GZIP +if test -n "$GZIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5 +$as_echo "$GZIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$GZIP" && break +done + + else + # The variable is set, but is it from the command line or the environment? + + # Try to remove the string !GZIP! from our list. + try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!GZIP!/} + 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 "xGZIP" != xBASH; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring value of GZIP from the environment. Use command line variables instead." >&5 +$as_echo "$as_me: WARNING: Ignoring value of GZIP from the environment. Use command line variables instead." >&2;} + fi + # Try to locate tool using the code snippet + for ac_prog in pigz gzip +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_GZIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GZIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GZIP="$GZIP" # 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_GZIP="$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 +GZIP=$ac_cv_path_GZIP +if test -n "$GZIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5 +$as_echo "$GZIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$GZIP" && 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$GZIP" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Setting user supplied tool GZIP= (no value)" >&5 +$as_echo "$as_me: Setting user supplied tool GZIP= (no value)" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GZIP" >&5 +$as_echo_n "checking for GZIP... " >&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="$GZIP" + 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 GZIP=$tool_basename" >&5 +$as_echo "$as_me: Will search for user supplied tool GZIP=$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_GZIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $GZIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GZIP="$GZIP" # 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_GZIP="$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 +GZIP=$ac_cv_path_GZIP +if test -n "$GZIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5 +$as_echo "$GZIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$GZIP" = 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 GZIP=$tool_specified" >&5 +$as_echo "$as_me: Will use user supplied tool GZIP=$tool_specified" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GZIP" >&5 +$as_echo_n "checking for GZIP... " >&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 GZIP=$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 + + + + if test "x$GZIP" = x; then + as_fn_error $? "Could not find required tool for GZIP" "$LINENO" 5 + fi + + + + + # Publish this variable in the help. @@ -10854,7 +11266,7 @@ $as_echo "$tool_specified" >&6; } if [ -z "${TAR+x}" ]; then # The variable is not set by user, try to locate tool using the code snippet - for ac_prog in tar + for ac_prog in gtar tar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -10912,7 +11324,7 @@ done $as_echo "$as_me: WARNING: Ignoring value of TAR from the environment. Use command line variables instead." >&2;} fi # Try to locate tool using the code snippet - for ac_prog in tar + for ac_prog in gtar tar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -15428,6 +15840,23 @@ $as_echo "$COMPILE_TYPE" >&6; } fi + # The new version string in JDK 9 also defined new naming of OS and ARCH for bundles + # Macosx is osx and x86_64 is x64 + if test "x$OPENJDK_TARGET_OS" = xmacosx; then + OPENJDK_TARGET_OS_BUNDLE="osx" + else + OPENJDK_TARGET_OS_BUNDLE="$OPENJDK_TARGET_OS" + fi + if test "x$OPENJDK_TARGET_CPU" = xx86_64; then + OPENJDK_TARGET_CPU_BUNDLE="x64" + else + OPENJDK_TARGET_CPU_BUNDLE="$OPENJDK_TARGET_CPU" + fi + OPENJDK_TARGET_BUNDLE_PLATFORM="${OPENJDK_TARGET_OS_BUNDLE}-${OPENJDK_TARGET_CPU_BUNDLE}" + + + + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then A_LP64="LP64:=" # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in @@ -15584,6 +16013,23 @@ $as_echo "$COMPILE_TYPE" >&6; } fi + # The new version string in JDK 9 also defined new naming of OS and ARCH for bundles + # Macosx is osx and x86_64 is x64 + if test "x$OPENJDK_BUILD_OS" = xmacosx; then + OPENJDK_BUILD_OS_BUNDLE="osx" + else + OPENJDK_BUILD_OS_BUNDLE="$OPENJDK_TARGET_OS" + fi + if test "x$OPENJDK_BUILD_CPU" = xx86_64; then + OPENJDK_BUILD_CPU_BUNDLE="x64" + else + OPENJDK_BUILD_CPU_BUNDLE="$OPENJDK_BUILD_CPU" + fi + OPENJDK_BUILD_BUNDLE_PLATFORM="${OPENJDK_BUILD_OS_BUNDLE}-${OPENJDK_BUILD_CPU_BUNDLE}" + + + + if test "x$OPENJDK_BUILD_CPU_BITS" = x64; then A_LP64="LP64:=" # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in @@ -16297,7 +16743,10 @@ $as_echo "$JVM_VARIANTS" >&6; } # Check that the selected variants are valid # grep filter function inspired by a comment to http://stackoverflow.com/a/1617326 - INVALID_VARIANTS=`$GREP -Fvx "${VALID_JVM_VARIANTS// /$'\n'}" <<< "${JVM_VARIANTS// /$'\n'}"` + # Notice that the original variant failes on SLES 10 and 11 + NEEDLE=${VALID_JVM_VARIANTS// /$'\n'} + STACK=${JVM_VARIANTS// /$'\n'} + INVALID_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"` if test "x$INVALID_VARIANTS" != x; then { $as_echo "$as_me:${as_lineno-$LINENO}: Unknown variant(s) specified: $INVALID_VARIANTS" >&5 $as_echo "$as_me: Unknown variant(s) specified: $INVALID_VARIANTS" >&6;} @@ -16306,7 +16755,9 @@ $as_echo "$as_me: Unknown variant(s) specified: $INVALID_VARIANTS" >&6;} # All "special" variants share the same output directory ("server") VALID_MULTIPLE_JVM_VARIANTS="server client minimal" - INVALID_MULTIPLE_VARIANTS=`$GREP -Fvx "${VALID_MULTIPLE_JVM_VARIANTS// /$'\n'}" <<< "${JVM_VARIANTS// /$'\n'}"` + NEEDLE=${VALID_MULTIPLE_JVM_VARIANTS// /$'\n'} + STACK=${JVM_VARIANTS// /$'\n'} + INVALID_MULTIPLE_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"` if test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then as_fn_error $? "You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS." "$LINENO" 5 fi @@ -17016,9 +17467,6 @@ $as_echo "$as_me: The path of OUTPUT_ROOT, which resolves as \"$path\", is inval # The spec.gmk file contains all variables for the make system. ac_config_files="$ac_config_files $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" - # The hotspot-spec.gmk file contains legacy variables for the hotspot make system. - ac_config_files="$ac_config_files $OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in" - # The bootcycle-spec.gmk file contains support for boot cycle builds. ac_config_files="$ac_config_files $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" @@ -20699,6 +21147,30 @@ $as_echo "yes" >&6; } + # Test which kind of tar was found + if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then + TAR_TYPE="gnu" + elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then + TAR_TYPE="bsd" + elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then + TAR_TYPE="solaris" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking what type of tar was found" >&5 +$as_echo_n "checking what type of tar was found... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR_TYPE" >&5 +$as_echo "$TAR_TYPE" >&6; } + + if test "x$TAR_TYPE" = "xgnu"; then + TAR_INCLUDE_PARAM="T" + TAR_SUPPORTS_TRANSFORM="true" + else + TAR_INCLUDE_PARAM="I" + TAR_SUPPORTS_TRANSFORM="false" + fi + + + + # These tools might not be installed by default, # need hint on how to install them. @@ -23790,9 +24262,6 @@ fi if test "x$OPENJDK_TARGET_OS" = xaix ; then INCLUDE_SA=false fi - if test "x$OPENJDK_TARGET_CPU" = xaarch64; then - INCLUDE_SA=false - fi # Compress jars @@ -52948,6 +53417,49 @@ fi + # Check whether --enable-hotspot-gtest was given. +if test "${enable_hotspot_gtest+set}" = set; then : + enableval=$enable_hotspot_gtest; +fi + + + if test -e "$HOTSPOT_TOPDIR/test/native"; then + GTEST_DIR_EXISTS="true" + else + GTEST_DIR_EXISTS="false" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Hotspot gtest unit tests should be built" >&5 +$as_echo_n "checking if Hotspot gtest unit tests should be built... " >&6; } + if test "x$enable_hotspot_gtest" = "xyes"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5 +$as_echo "yes, forced" >&6; } + BUILD_GTEST="true" + else + as_fn_error $? "Cannot build gtest without the test source" "$LINENO" 5 + fi + elif test "x$enable_hotspot_gtest" = "xno"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5 +$as_echo "no, forced" >&6; } + BUILD_GTEST="false" + elif test "x$enable_hotspot_gtest" = "x"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + BUILD_GTEST="true" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + BUILD_GTEST="false" + fi + else + as_fn_error $? "--enable-gtest must be either yes or no" "$LINENO" 5 + fi + + + + ############################################################################### # # Check dependencies for external and internal libraries. @@ -64076,6 +64588,157 @@ fi + if test "$OPENJDK_TARGET_OS" = "solaris"; then + # Find the root of the Solaris Studio installation from the compiler path + SOLARIS_STUDIO_DIR="$(dirname $CC)/.." + STLPORT_LIB="$SOLARIS_STUDIO_DIR/lib/stlport4$OPENJDK_TARGET_CPU_ISADIR/libstlport.so.1" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libstlport.so.1" >&5 +$as_echo_n "checking for libstlport.so.1... " >&6; } + if test -f "$STLPORT_LIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, $STLPORT_LIB" >&5 +$as_echo "yes, $STLPORT_LIB" >&6; } + + # Only process if variable expands to non-empty + + if test "x$STLPORT_LIB" != x; then + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$STLPORT_LIB" + new_path=`$CYGPATH -u "$path"` + + # Cygwin tries to hide some aspects of the Windows file system, such that binaries are + # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered + # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then + # "foo.exe" is OK but "foo" is an error. + # + # This test is therefore slightly more accurate than "test -f" to check for file precense. + # It is also a way to make sure we got the proper file name for the real test later on. + test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null` + if test "x$test_shortpath" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STLPORT_LIB, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of STLPORT_LIB, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of STLPORT_LIB" "$LINENO" 5 + fi + + # Call helper function which possibly converts this using DOS-style short mode. + # If so, the updated path is stored in $new_path. + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + shortmode_path=`$CYGPATH -s -m -a "$input_path"` + path_after_shortmode=`$CYGPATH -u "$shortmode_path"` + if test "x$path_after_shortmode" != "x$input_to_shortpath"; then + # Going to short mode and back again did indeed matter. Since short mode is + # case insensitive, let's make it lowercase to improve readability. + shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Now convert it back to Unix-style (cygpath) + input_path=`$CYGPATH -u "$shortmode_path"` + new_path="$input_path" + fi + fi + + test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/` + if test "x$test_cygdrive_prefix" = x; then + # As a simple fix, exclude /usr/bin since it's not a real path. + if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then + # The path is in a Cygwin special directory (e.g. /home). We need this converted to + # a path prefixed by /cygdrive for fixpath to work. + new_path="$CYGWIN_ROOT_PATH$input_path" + fi + fi + + + if test "x$path" != "x$new_path"; then + STLPORT_LIB="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STLPORT_LIB to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting STLPORT_LIB to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$STLPORT_LIB" + has_colon=`$ECHO $path | $GREP ^.:` + new_path="$path" + if test "x$has_colon" = x; then + # Not in mixed or Windows style, start by that. + new_path=`cmd //c echo $path` + fi + + + input_path="$new_path" + # Check if we need to convert this using DOS-style short mode. If the path + # contains just simple characters, use it. Otherwise (spaces, weird characters), + # take no chances and rewrite it. + # Note: m4 eats our [], so we need to use [ and ] instead. + has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]` + if test "x$has_forbidden_chars" != x; then + # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \) + new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + fi + + + windows_path="$new_path" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + new_path="$unix_path" + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'` + new_path="$unix_path" + fi + + if test "x$path" != "x$new_path"; then + STLPORT_LIB="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting STLPORT_LIB to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting STLPORT_LIB to \"$new_path\"" >&6;} + fi + + # Save the first 10 bytes of this path to the storage, so fixpath can work. + all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}") + + else + # We're on a unix platform. Hooray! :) + path="$STLPORT_LIB" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of STLPORT_LIB, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of STLPORT_LIB, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5 + fi + + # Use eval to expand a potential ~ + eval path="$path" + if test ! -f "$path" && test ! -d "$path"; then + as_fn_error $? "The path of STLPORT_LIB, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + if test -d "$path"; then + STLPORT_LIB="`cd "$path"; $THEPWDCMD -L`" + else + dir="`$DIRNAME "$path"`" + base="`$BASENAME "$path"`" + STLPORT_LIB="`cd "$dir"; $THEPWDCMD -L`/$base" + fi + fi + fi + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, not found at $STLPORT_LIB" >&5 +$as_echo "no, not found at $STLPORT_LIB" >&6; } + as_fn_error $? "Failed to find libstlport.so.1, cannot build Hotspot gtests" "$LINENO" 5 + fi + + fi + + + @@ -64094,144 +64757,6 @@ fi ############################################################################### - # Check whether --enable-new-hotspot-build was given. -if test "${enable_new_hotspot_build+set}" = set; then : - enableval=$enable_new_hotspot_build; -fi - - - if test "x$enable_new_hotspot_build" = "x" || test "x$enable_new_hotspot_build" = "xyes"; then - USE_NEW_HOTSPOT_BUILD=true - else - USE_NEW_HOTSPOT_BUILD=false - fi - - - case $HOTSPOT_DEBUG_LEVEL in - product ) - VARIANT="OPT" - FASTDEBUG="false" - DEBUG_CLASSFILES="false" - ;; - fastdebug ) - VARIANT="DBG" - FASTDEBUG="true" - DEBUG_CLASSFILES="true" - ;; - debug ) - VARIANT="DBG" - FASTDEBUG="false" - DEBUG_CLASSFILES="true" - ;; - optimized ) - VARIANT="OPT" - FASTDEBUG="false" - DEBUG_CLASSFILES="false" - ;; - esac - - - - - if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - MACOSX_UNIVERSAL="true" - fi - - - - # Make sure JVM_VARIANTS_COMMA use minimal1 for backwards compatibility - JVM_VARIANTS_COMMA=`$ECHO ,$JVM_VARIANTS_OPT, | $SED -e 's/,minimal,/,minimal1,/'` - - JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'` - JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` - JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,minimal1\?,/!s/.*/false/g' -e '/,minimal1\?,/s/.*/true/g'` - JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'` - JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'` - JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'` - JVM_VARIANT_CUSTOM=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,custom,/!s/.*/false/g' -e '/,custom,/s/.*/true/g'` - - ##### - # Generate the legacy makefile targets for hotspot. - HOTSPOT_TARGET="" - - if test "x$JVM_VARIANT_SERVER" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} " - fi - - if test "x$JVM_VARIANT_CLIENT" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 " - fi - - if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 " - fi - - if test "x$JVM_VARIANT_ZERO" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero " - fi - - if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark " - fi - - if test "x$JVM_VARIANT_CORE" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}core " - fi - - HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_DEBUG_LEVEL" - - # On Macosx universal binaries are produced, but they only contain - # 64 bit intel. This invalidates control of which jvms are built - # from configure, but only server is valid anyway. Fix this - # when hotspot makefiles are rewritten. - if test "x$MACOSX_UNIVERSAL" = xtrue; then - HOTSPOT_TARGET=universal_${HOTSPOT_DEBUG_LEVEL} - fi - - HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET" - - - # Control wether Hotspot runs Queens test after build. - # Check whether --enable-hotspot-test-in-build was given. -if test "${enable_hotspot_test_in_build+set}" = set; then : - enableval=$enable_hotspot_test_in_build; -else - enable_hotspot_test_in_build=no -fi - - if test "x$enable_hotspot_test_in_build" = "xyes"; then - TEST_IN_BUILD=true - else - TEST_IN_BUILD=false - fi - - - if test "x$USE_NEW_HOTSPOT_BUILD" = xfalse; then - if test "x$JVM_VARIANT_CLIENT" = xtrue; then - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - as_fn_error $? "You cannot build a client JVM for a 64-bit machine." "$LINENO" 5 - fi - fi - if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - as_fn_error $? "You cannot build a minimal JVM for a 64-bit machine." "$LINENO" 5 - fi - fi - if test "x$JVM_VARIANT_CUSTOM" = xtrue; then - as_fn_error $? "You cannot build a custom JVM using the old hotspot build system." "$LINENO" 5 - fi - fi - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if elliptic curve crypto implementation is present" >&5 $as_echo_n "checking if elliptic curve crypto implementation is present... " >&6; } @@ -65977,7 +66502,9 @@ $as_echo_n "checking JVM features for JVM variant '$variant'... " >&6; } JVM_FEATURES_TO_TEST=${!features_var_name} { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JVM_FEATURES_TO_TEST" >&5 $as_echo "$JVM_FEATURES_TO_TEST" >&6; } - INVALID_FEATURES=`$GREP -Fvx "${VALID_JVM_FEATURES// /$'\n'}" <<< "${JVM_FEATURES_TO_TEST// /$'\n'}"` + NEEDLE=${VALID_JVM_FEATURES// /$'\n'} + STACK=${JVM_FEATURES_TO_TEST// /$'\n'} + INVALID_FEATURES=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"` if test "x$INVALID_FEATURES" != x; then as_fn_error $? "Invalid JVM feature(s): $INVALID_FEATURES" "$LINENO" 5 fi @@ -66697,7 +67224,6 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "$OUTPUT_ROOT/spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/spec.gmk:$AUTOCONF_DIR/spec.gmk.in" ;; - "$OUTPUT_ROOT/hotspot-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/hotspot-spec.gmk:$AUTOCONF_DIR/hotspot-spec.gmk.in" ;; "$OUTPUT_ROOT/bootcycle-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/bootcycle-spec.gmk:$AUTOCONF_DIR/bootcycle-spec.gmk.in" ;; "$OUTPUT_ROOT/buildjdk-spec.gmk") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/buildjdk-spec.gmk:$AUTOCONF_DIR/buildjdk-spec.gmk.in" ;; "$OUTPUT_ROOT/compare.sh") CONFIG_FILES="$CONFIG_FILES $OUTPUT_ROOT/compare.sh:$AUTOCONF_DIR/compare.sh.in" ;; diff --git a/common/autoconf/hotspot-spec.gmk.in b/common/autoconf/hotspot-spec.gmk.in deleted file mode 100644 index 50d790876a6..00000000000 --- a/common/autoconf/hotspot-spec.gmk.in +++ /dev/null @@ -1,158 +0,0 @@ -# -# Copyright (c) 2011, 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. 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. -# - - -# Chaining of spec files -HOTSPOT_SPEC:=$(dir $(SPEC))hotspot-spec.gmk -override SPEC=$(HOTSPOT_SPEC) -# Now include the base spec.gmk file -include $(BASE_SPEC) - -# Additional legacy variables defined for Hotspot - -@SET_OPENJDK@ -@HOTSPOT_SET_WARNINGS_AS_ERRORS@ - -# Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options. -@BUILD_HEADLESS@ - -JVM_VARIANTS:=@JVM_VARIANTS_COMMA@ - -JVM_VARIANT_SERVER:=@JVM_VARIANT_SERVER@ -JVM_VARIANT_CLIENT:=@JVM_VARIANT_CLIENT@ -JVM_VARIANT_MINIMAL1:=@JVM_VARIANT_MINIMAL1@ -JVM_VARIANT_CORE:=@JVM_VARIANT_CORE@ -JVM_VARIANT_ZERO:=@JVM_VARIANT_ZERO@ -JVM_VARIANT_ZEROSHARK:=@JVM_VARIANT_ZEROSHARK@ -JVM_VARIANT_CUSTOM:=@JVM_VARIANT_HOTSPOT@ - -# Legacy setting: OPT or DBG -VARIANT:=@VARIANT@ -# Legacy setting: true or false -FASTDEBUG:=@FASTDEBUG@ -# Legacy setting: debugging the class files? -DEBUG_CLASSFILES:=@DEBUG_CLASSFILES@ - -ALT_CUPS_HEADERS_PATH:=$(patsubst -I%,%,$(filter -I%,@CUPS_CFLAGS@)) - -# The HOSTCC/HOSTCXX is Hotspot terminology for the BUILD_CC/BUILD_CXX, i.e. the -# compiler that produces code that can be run on the build platform. -HOSTCC:=@FIXPATH@ @BUILD_ICECC@ @BUILD_CC@ $(BUILD_SYSROOT_CFLAGS) -HOSTCXX:=@FIXPATH@ @BUILD_ICECC@ @BUILD_CXX@ $(BUILD_SYSROOT_CFLAGS) - -#################################################### -# -# Legacy Hotspot support - -# If cross compiling, then define CROSS_COMPILE_ARCH:=cpu_name here. -@DEFINE_CROSS_COMPILE_ARCH@ - -# Old name for OPENJDK_TARGET_OS (aix,bsd,hpux,linux,macosx,solaris,windows etc) -PLATFORM=$(OPENJDK_TARGET_OS) -# 32 or 64 bit -ARCH_DATA_MODEL=$(OPENJDK_TARGET_CPU_BITS) - -ALT_BOOTDIR=$(BOOT_JDK) -# Can be /sparcv9 or /amd64 on Solaris -ISA_DIR=$(OPENJDK_TARGET_CPU_ISADIR) -# Yet another name for arch used for an extra subdir below the jvm lib. -# Uses i386 and amd64, instead of x86 and x86_64. -LIBARCH=$(OPENJDK_TARGET_CPU_LEGACY_LIB) -# Set the cpu architecture -ARCH=$(OPENJDK_TARGET_CPU_ARCH) -# Legacy setting for building for a 64 bit machine. -# If yes then this expands to _LP64:=1 -@LP64@ - -# Legacy settings for zero -ZERO_ENDIANNESS=$(OPENJDK_TARGET_CPU_ENDIAN) -ZERO_LIBARCH=$(OPENJDK_TARGET_CPU_LEGACY_LIB) -ZERO_ARCHDEF=@ZERO_ARCHDEF@ -ZERO_ARCHFLAG=@ZERO_ARCHFLAG@ -LIBFFI_CFLAGS=@LIBFFI_CFLAGS@ -LIBFFI_LIBS=@LIBFFI_LIBS@ - -# Legacy settings for zeroshark -LLVM_CFLAGS=@LLVM_CFLAGS@ -LLVM_LIBS=@LLVM_LIBS@ -LLVM_LDFLAGS=@LLVM_LDFLAGS@ - -ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR) -ALT_EXPORT_PATH=$(HOTSPOT_DIST) - -ifeq ($(HOTSPOT_TARGET_CPU), zero) - CC_INTERP=true -endif - -HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@ @STATIC_CXX_SETTING@ -# Control wether Hotspot runs Queens test after building -TEST_IN_BUILD=@TEST_IN_BUILD@ - -USE_CLANG := @USE_CLANG@ - -# For hotspot, override compiler/tools definition to not include FIXPATH prefix. -# Hotspot has its own handling on the Windows path situation. -CXX:=@CCACHE@ @ICECC@ @HOTSPOT_CXX@ -LD:=@HOTSPOT_LD@ -MT:=@HOTSPOT_MT@ -RC:=@HOTSPOT_RC@ - -EXTRA_CFLAGS=@LEGACY_EXTRA_CFLAGS@ $(CFLAGS_CCACHE) $(NO_NULL_POINTER_CHECK_FLAG) \ - $(NO_LIFETIME_DSE_CFLAG) $(CXXSTD_CXXFLAG) -EXTRA_CXXFLAGS=@LEGACY_EXTRA_CXXFLAGS@ $(CFLAGS_CCACHE) -EXTRA_LDFLAGS=@LEGACY_EXTRA_LDFLAGS@ - -USE_PRECOMPILED_HEADER=@USE_PRECOMPILED_HEADER@ - -# Hotspot expects the variable FULL_DEBUG_SYMBOLS=1/0 to control debug symbols -# creation. -ifeq ($(COPY_DEBUG_SYMBOLS), true) - FULL_DEBUG_SYMBOLS=1 - # Ensure hotspot uses the objcopy that configure located - ALT_OBJCOPY:=$(OBJCOPY) -else - FULL_DEBUG_SYMBOLS=0 -endif - -# Hotspot expects the variable ZIP_DEBUGINFO_FILES=1/0 and not true/false. -ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) - ZIP_DEBUGINFO_FILES:=1 -else - ZIP_DEBUGINFO_FILES:=0 -endif - -DEBUG_BINARIES := @DEBUG_BINARIES@ -STRIP_POLICY := @STRIP_POLICY@ - -ifeq ($(OPENJDK_TARGET_OS), windows) - # On Windows, the Visual Studio toolchain needs the LIB and INCLUDE - # environment variables (in Windows path style). - export INCLUDE:=@VS_INCLUDE@ - export LIB:=@VS_LIB@ -endif - -# Sneak this in via the spec.gmk file, since we don't want to mess around too much with the Hotspot make files. -# This is needed to get the LOG setting to work properly. -include $(SRC_ROOT)/make/common/MakeBase.gmk diff --git a/common/autoconf/hotspot.m4 b/common/autoconf/hotspot.m4 index 4fffa86983d..18b6ec0aa21 100644 --- a/common/autoconf/hotspot.m4 +++ b/common/autoconf/hotspot.m4 @@ -93,7 +93,10 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], # Check that the selected variants are valid # grep filter function inspired by a comment to http://stackoverflow.com/a/1617326 - INVALID_VARIANTS=`$GREP -Fvx "${VALID_JVM_VARIANTS// /$'\n'}" <<< "${JVM_VARIANTS// /$'\n'}"` + # Notice that the original variant failes on SLES 10 and 11 + NEEDLE=${VALID_JVM_VARIANTS// /$'\n'} + STACK=${JVM_VARIANTS// /$'\n'} + INVALID_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"` if test "x$INVALID_VARIANTS" != x; then AC_MSG_NOTICE([Unknown variant(s) specified: $INVALID_VARIANTS]) AC_MSG_ERROR([The available JVM variants are: $VALID_JVM_VARIANTS]) @@ -101,7 +104,9 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS], # All "special" variants share the same output directory ("server") VALID_MULTIPLE_JVM_VARIANTS="server client minimal" - INVALID_MULTIPLE_VARIANTS=`$GREP -Fvx "${VALID_MULTIPLE_JVM_VARIANTS// /$'\n'}" <<< "${JVM_VARIANTS// /$'\n'}"` + NEEDLE=${VALID_MULTIPLE_JVM_VARIANTS// /$'\n'} + STACK=${JVM_VARIANTS// /$'\n'} + INVALID_MULTIPLE_VARIANTS=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"` if test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.]) fi @@ -293,146 +298,51 @@ AC_DEFUN_ONCE([HOTSPOT_VALIDATE_JVM_FEATURES], features_var_name=JVM_FEATURES_$variant JVM_FEATURES_TO_TEST=${!features_var_name} AC_MSG_RESULT([$JVM_FEATURES_TO_TEST]) - INVALID_FEATURES=`$GREP -Fvx "${VALID_JVM_FEATURES// /$'\n'}" <<< "${JVM_FEATURES_TO_TEST// /$'\n'}"` + NEEDLE=${VALID_JVM_FEATURES// /$'\n'} + STACK=${JVM_FEATURES_TO_TEST// /$'\n'} + INVALID_FEATURES=`$GREP -Fvx "${NEEDLE}" <<< "${STACK}"` if test "x$INVALID_FEATURES" != x; then AC_MSG_ERROR([Invalid JVM feature(s): $INVALID_FEATURES]) fi done ]) -############################################################################### -# Support for old hotspot build. Remove once new hotspot build has proven -# to work satisfactory. +################################################################################ +# Check if gtest should be built # -AC_DEFUN_ONCE([HOTSPOT_SETUP_LEGACY_BUILD], +AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST], [ - AC_ARG_ENABLE(new-hotspot-build, [AS_HELP_STRING([--disable-new-hotspot-build], - [disable the new hotspot build system (use the old) @<:@enabled@:>@])]) + AC_ARG_ENABLE([hotspot-gtest], [AS_HELP_STRING([--disable-hotspot-gtest], + [Disables building of the Hotspot unit tests])]) - if test "x$enable_new_hotspot_build" = "x" || test "x$enable_new_hotspot_build" = "xyes"; then - USE_NEW_HOTSPOT_BUILD=true - else - USE_NEW_HOTSPOT_BUILD=false - fi - AC_SUBST(USE_NEW_HOTSPOT_BUILD) - - case $HOTSPOT_DEBUG_LEVEL in - product ) - VARIANT="OPT" - FASTDEBUG="false" - DEBUG_CLASSFILES="false" - ;; - fastdebug ) - VARIANT="DBG" - FASTDEBUG="true" - DEBUG_CLASSFILES="true" - ;; - debug ) - VARIANT="DBG" - FASTDEBUG="false" - DEBUG_CLASSFILES="true" - ;; - optimized ) - VARIANT="OPT" - FASTDEBUG="false" - DEBUG_CLASSFILES="false" - ;; - esac - AC_SUBST(VARIANT) - AC_SUBST(FASTDEBUG) - AC_SUBST(DEBUG_CLASSFILES) - - if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then - MACOSX_UNIVERSAL="true" - fi - - AC_SUBST(MACOSX_UNIVERSAL) - - # Make sure JVM_VARIANTS_COMMA use minimal1 for backwards compatibility - JVM_VARIANTS_COMMA=`$ECHO ,$JVM_VARIANTS_OPT, | $SED -e 's/,minimal,/,minimal1,/'` - - JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'` - JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` - JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,minimal1\?,/!s/.*/false/g' -e '/,minimal1\?,/s/.*/true/g'` - JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'` - JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'` - JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'` - JVM_VARIANT_CUSTOM=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,custom,/!s/.*/false/g' -e '/,custom,/s/.*/true/g'` - - ##### - # Generate the legacy makefile targets for hotspot. - HOTSPOT_TARGET="" - - if test "x$JVM_VARIANT_SERVER" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} " - fi - - if test "x$JVM_VARIANT_CLIENT" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 " - fi - - if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 " - fi - - if test "x$JVM_VARIANT_ZERO" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero " - fi - - if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark " - fi - - if test "x$JVM_VARIANT_CORE" = xtrue; then - HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}core " - fi - - HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_DEBUG_LEVEL" - - # On Macosx universal binaries are produced, but they only contain - # 64 bit intel. This invalidates control of which jvms are built - # from configure, but only server is valid anyway. Fix this - # when hotspot makefiles are rewritten. - if test "x$MACOSX_UNIVERSAL" = xtrue; then - HOTSPOT_TARGET=universal_${HOTSPOT_DEBUG_LEVEL} - fi - - HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET" - AC_SUBST(HOTSPOT_MAKE_ARGS) - - # Control wether Hotspot runs Queens test after build. - AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build], - [run the Queens test after Hotspot build @<:@disabled@:>@])],, - [enable_hotspot_test_in_build=no]) - if test "x$enable_hotspot_test_in_build" = "xyes"; then - TEST_IN_BUILD=true + if test -e "$HOTSPOT_TOPDIR/test/native"; then + GTEST_DIR_EXISTS="true" else - TEST_IN_BUILD=false - fi - AC_SUBST(TEST_IN_BUILD) - - if test "x$USE_NEW_HOTSPOT_BUILD" = xfalse; then - if test "x$JVM_VARIANT_CLIENT" = xtrue; then - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.]) - fi - fi - if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - AC_MSG_ERROR([You cannot build a minimal JVM for a 64-bit machine.]) - fi - fi - if test "x$JVM_VARIANT_CUSTOM" = xtrue; then - AC_MSG_ERROR([You cannot build a custom JVM using the old hotspot build system.]) - fi + GTEST_DIR_EXISTS="false" fi - AC_SUBST(JVM_VARIANTS_COMMA) - AC_SUBST(JVM_VARIANT_SERVER) - AC_SUBST(JVM_VARIANT_CLIENT) - AC_SUBST(JVM_VARIANT_MINIMAL1) - AC_SUBST(JVM_VARIANT_HOTSPOT) - AC_SUBST(JVM_VARIANT_ZERO) - AC_SUBST(JVM_VARIANT_ZEROSHARK) - AC_SUBST(JVM_VARIANT_CORE) + AC_MSG_CHECKING([if Hotspot gtest unit tests should be built]) + if test "x$enable_hotspot_gtest" = "xyes"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + AC_MSG_RESULT([yes, forced]) + BUILD_GTEST="true" + else + AC_MSG_ERROR([Cannot build gtest without the test source]) + fi + elif test "x$enable_hotspot_gtest" = "xno"; then + AC_MSG_RESULT([no, forced]) + BUILD_GTEST="false" + elif test "x$enable_hotspot_gtest" = "x"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + AC_MSG_RESULT([yes]) + BUILD_GTEST="true" + else + AC_MSG_RESULT([no]) + BUILD_GTEST="false" + fi + else + AC_MSG_ERROR([--enable-gtest must be either yes or no]) + fi + + AC_SUBST(BUILD_GTEST) ]) diff --git a/common/autoconf/jdk-options.m4 b/common/autoconf/jdk-options.m4 index e34e4d927dd..076b6cfaa09 100644 --- a/common/autoconf/jdk-options.m4 +++ b/common/autoconf/jdk-options.m4 @@ -209,9 +209,6 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], if test "x$OPENJDK_TARGET_OS" = xaix ; then INCLUDE_SA=false fi - if test "x$OPENJDK_TARGET_CPU" = xaarch64; then - INCLUDE_SA=false - fi AC_SUBST(INCLUDE_SA) # Compress jars diff --git a/common/autoconf/libraries.m4 b/common/autoconf/libraries.m4 index e1e91d678d6..4238a17fe82 100644 --- a/common/autoconf/libraries.m4 +++ b/common/autoconf/libraries.m4 @@ -95,6 +95,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES], LIB_SETUP_LLVM LIB_SETUP_BUNDLED_LIBS LIB_SETUP_MISC_LIBS + LIB_SETUP_SOLARIS_STLPORT ]) ################################################################################ @@ -189,3 +190,26 @@ AC_DEFUN_ONCE([LIB_SETUP_MISC_LIBS], LIBZIP_CAN_USE_MMAP=true AC_SUBST(LIBZIP_CAN_USE_MMAP) ]) + +################################################################################ +# libstlport.so.1 is needed for running gtest on Solaris. Find it to +# redistribute it in the test image. +################################################################################ +AC_DEFUN_ONCE([LIB_SETUP_SOLARIS_STLPORT], +[ + if test "$OPENJDK_TARGET_OS" = "solaris"; then + # Find the root of the Solaris Studio installation from the compiler path + SOLARIS_STUDIO_DIR="$(dirname $CC)/.." + STLPORT_LIB="$SOLARIS_STUDIO_DIR/lib/stlport4$OPENJDK_TARGET_CPU_ISADIR/libstlport.so.1" + AC_MSG_CHECKING([for libstlport.so.1]) + if test -f "$STLPORT_LIB"; then + AC_MSG_RESULT([yes, $STLPORT_LIB]) + BASIC_FIXUP_PATH([STLPORT_LIB]) + else + AC_MSG_RESULT([no, not found at $STLPORT_LIB]) + AC_MSG_ERROR([Failed to find libstlport.so.1, cannot build Hotspot gtests]) + fi + AC_SUBST(STLPORT_LIB) + fi +]) + diff --git a/common/autoconf/platform.m4 b/common/autoconf/platform.m4 index 2e99c452694..2fbac1d0dd3 100644 --- a/common/autoconf/platform.m4 +++ b/common/autoconf/platform.m4 @@ -366,6 +366,23 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER], fi AC_SUBST(OPENJDK_$1_OS_EXPORT_DIR) + # The new version string in JDK 9 also defined new naming of OS and ARCH for bundles + # Macosx is osx and x86_64 is x64 + if test "x$OPENJDK_$1_OS" = xmacosx; then + OPENJDK_$1_OS_BUNDLE="osx" + else + OPENJDK_$1_OS_BUNDLE="$OPENJDK_TARGET_OS" + fi + if test "x$OPENJDK_$1_CPU" = xx86_64; then + OPENJDK_$1_CPU_BUNDLE="x64" + else + OPENJDK_$1_CPU_BUNDLE="$OPENJDK_$1_CPU" + fi + OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}" + AC_SUBST(OPENJDK_$1_OS_BUNDLE) + AC_SUBST(OPENJDK_$1_CPU_BUNDLE) + AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM) + if test "x$OPENJDK_$1_CPU_BITS" = x64; then A_LP64="LP64:=" # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 467cc304b20..cace1439818 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -89,6 +89,10 @@ HOTSPOT_TARGET_CPU := @HOTSPOT_TARGET_CPU@ HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_TARGET_CPU_ARCH@ HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_TARGET_CPU_DEFINE@ +OPENJDK_TARGET_CPU_BUNDLE:=@OPENJDK_TARGET_CPU_BUNDLE@ +OPENJDK_TARGET_OS_BUNDLE:=@OPENJDK_TARGET_OS_BUNDLE@ +OPENJDK_TARGET_BUNDLE_PLATFORM:=@OPENJDK_TARGET_BUNDLE_PLATFORM@ + # We are building on this build system. # When not cross-compiling, it is the same as the target. OPENJDK_BUILD_OS:=@OPENJDK_BUILD_OS@ @@ -232,6 +236,9 @@ JVM_FEATURES_custom := @JVM_FEATURES_custom@ VALID_JVM_FEATURES := @VALID_JVM_FEATURES@ VALID_JVM_VARIANTS := @VALID_JVM_VARIANTS@ +# Control wether Hotspot builds gtest tests +BUILD_GTEST := @BUILD_GTEST@ + # Control use of precompiled header in hotspot libjvm build USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@ @@ -265,6 +272,7 @@ BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images +BUNDLES_OUTPUTDIR=$(BUILD_OUTPUT)/bundles TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/test-make MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support # This does not get overridden in a bootcycle build @@ -629,6 +637,7 @@ ECHO:=@ECHO@ EGREP:=@EGREP@ FGREP:=@FGREP@ GREP:=@GREP@ +GZIP:=@GZIP@ HEAD:=@HEAD@ LS:=@LS@ LN:=@LN@ @@ -676,6 +685,9 @@ XCODEBUILD=@XCODEBUILD@ DTRACE := @DTRACE@ FIXPATH:=@FIXPATH@ +TAR_INCLUDE_PARAM:=@TAR_INCLUDE_PARAM@ +TAR_SUPPORTS_TRANSFORM:=@TAR_SUPPORTS_TRANSFORM@ + # Build setup ENABLE_JFR=@ENABLE_JFR@ ENABLE_INTREE_EC=@ENABLE_INTREE_EC@ @@ -685,6 +697,7 @@ USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@ LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@ MSVCR_DLL:=@MSVCR_DLL@ MSVCP_DLL:=@MSVCP_DLL@ +STLPORT_LIB:=@STLPORT_LIB@ #################################################### # @@ -781,11 +794,46 @@ SYMBOLS_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(SYMBOLS_IMAGE_SUBDIR) # Interim image INTERIM_IMAGE_DIR := $(SUPPORT_OUTPUTDIR)/interim-image +# Docs image +DOCS_IMAGE_SUBDIR := docs +DOCS_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(DOCS_IMAGE_SUBDIR) + # Macosx bundles directory definitions -JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle/jdk-$(VERSION_NUMBER).jdk/Contents -JRE_MACOSX_BUNDLE_SUBDIR=jre-bundle/jre-$(VERSION_NUMBER).jre/Contents +JDK_MACOSX_BUNDLE_SUBDIR=jdk-bundle +JRE_MACOSX_BUNDLE_SUBDIR=jre-bundle JDK_MACOSX_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_MACOSX_BUNDLE_SUBDIR) JRE_MACOSX_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_MACOSX_BUNDLE_SUBDIR) +JDK_MACOSX_CONTENTS_SUBDIR=jdk-$(VERSION_NUMBER).jdk/Contents +JRE_MACOSX_CONTENTS_SUBDIR=jre-$(VERSION_NUMBER).jre/Contents +JDK_MACOSX_CONTENTS_DIR=$(JDK_MACOSX_BUNDLE_DIR)/$(JDK_MACOSX_CONTENTS_SUBDIR) +JRE_MACOSX_CONTENTS_DIR=$(JRE_MACOSX_BUNDLE_DIR)/$(JRE_MACOSX_CONTENTS_SUBDIR) + +# Bundle names +BASE_NAME := $(VERSION_SHORT)+$(VERSION_BUILD)_$(OPENJDK_TARGET_BUNDLE_PLATFORM) +ifeq ($(DEBUG_LEVEL), fastdebug) + DEBUG_PART := -debug +else ifneq ($(DEBUG_LEVEL), release) + DEBUG_PART := -$(DEBUG_LEVEL) +endif +JDK_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART).tar.gz +JRE_BUNDLE_NAME := jre-$(BASE_NAME)_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 + +JDK_BUNDLE := $(BUNDLES_OUTPUTDIR)/$(JDK_BUNDLE_NAME) +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) # This macro is called to allow inclusion of closed source counterparts. # Unless overridden in closed sources, it expands to nothing. diff --git a/common/bin/compare.sh b/common/bin/compare.sh index db73426481d..0126b9c23ce 100644 --- a/common/bin/compare.sh +++ b/common/bin/compare.sh @@ -274,14 +274,19 @@ compare_file_types() { $MKDIR -p $WORK_DIR + FILE_TYPES_FILTER="$SED \ + -e 's/BuildID[^,]*//' \ + -e 's/last modified: .*//' \ + " + echo -n File types... found="" for f in `cd $OTHER_DIR && $FIND . ! -type d` do if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi if [ ! -f ${THIS_DIR}/$f ]; then continue; fi - OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` - TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` + OF=$(cd ${OTHER_DIR} && $FILE -h $f | eval $FILE_TYPES_FILTER) + TF=$(cd ${THIS_DIR} && $FILE -h $f | eval $FILE_TYPES_FILTER) if [ "$OF" != "$TF" ] then if [ "`echo $OF | $GREP -c 'Zip archive data'`" -gt 0 ] \ @@ -320,7 +325,7 @@ compare_general_files() { ! -name "*.obj" ! -name "*.o" ! -name "JavaControlPanelHelper" \ ! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \ ! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \ - ! -name "finish_installation" ! -name "Sparkle" \ + ! -name "finish_installation" ! -name "Sparkle" ! -name "*.tar.gz" \ | $GREP -v "./bin/" | $SORT | $FILTER) echo Other files with binary differences... @@ -423,6 +428,10 @@ compare_zip_file() { then (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP) (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP) + elif [ "$TYPE" = "gz" ] + then + (cd $THIS_UNZIPDIR && $GUNZIP -c $THIS_ZIP | $TAR xf -) + (cd $OTHER_UNZIPDIR && $GUNZIP -c $OTHER_ZIP | $TAR xf -) else (cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP) (cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP) @@ -526,10 +535,11 @@ compare_all_zip_files() { OTHER_DIR=$2 WORK_DIR=$3 - ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER ) + ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" -o -name "*.tar.gz" \ + | $SORT | $FILTER ) if [ -n "$ZIPS" ]; then - echo Zip files... + echo Zip/tar.gz files... return_value=0 for f in $ZIPS; do @@ -913,7 +923,7 @@ compare_bin_file() { FULLDUMP_MSG=" " DIFF_FULLDUMP= if [[ "$KNOWN_FULLDUMP_DIFF $ACCEPTED_FULLDUMP_DIFF" = *"$BIN_FILE"* ]]; then - FULLDUMP_MSG=" ! " + FULLDUMP_MSG=" ! " fi fi fi diff --git a/common/bin/idea.sh b/common/bin/idea.sh index 911d309c070..2cd6f92bbb9 100644 --- a/common/bin/idea.sh +++ b/common/bin/idea.sh @@ -155,6 +155,14 @@ addBuildDir() { printf "%s\n" "$mn" >> $IDEA_ANT } +JTREG_HOME=" " + +addJtregHome() { + DIR=`dirname $SPEC` + mn="`echo "$JTREG_HOME" | sed -e s@"\(.*\)####\(.*\)"@"\1$JT_HOME\2"@`" + printf "%s\n" "$mn" >> $IDEA_ANT +} + ### Generate ant.xml rm -f $IDEA_ANT @@ -162,6 +170,8 @@ while IFS= read -r line do if echo "$line" | egrep "^ .* /dev/null ; then addModuleName + elif echo "$line" | egrep "^ .* /dev/null ; then + addJtregHome elif echo "$line" | egrep "^ .* /dev/null ; then addBuildDir else diff --git a/common/conf/jib-profiles.js b/common/conf/jib-profiles.js index 2b7164741b1..2d752fd1074 100644 --- a/common/conf/jib-profiles.js +++ b/common/conf/jib-profiles.js @@ -215,11 +215,11 @@ var getJibProfilesCommon = function (input) { var common = {}; common.dependencies = ["boot_jdk", "gnumake", "jtreg"], - common.default_make_targets = ["product-images", "test-image"], + common.default_make_targets = ["product-bundles", "test-bundles"], common.default_make_targets_debug = common.default_make_targets; common.default_make_targets_slowdebug = common.default_make_targets; common.configure_args = ["--enable-jtreg-failure-handler"], - common.configure_args_32bit = ["--with-target-bits=32", "--with-jvm-variants=client,server"], + common.configure_args_32bit = ["--with-target-bits=32"], common.configure_args_debug = ["--enable-debug"], common.configure_args_slowdebug = ["--with-debug-level=slowdebug"], common.organization = "jpg.infra.builddeps" @@ -245,7 +245,7 @@ var getJibProfilesProfiles = function (input, common) { target_cpu: "x64", dependencies: concat(common.dependencies, "devkit"), configure_args: concat(common.configure_args, "--with-zlib=system"), - default_make_targets: concat(common.default_make_targets, "docs-image") + default_make_targets: concat(common.default_make_targets, "docs-bundles") }, "linux-x86": { @@ -254,7 +254,7 @@ var getJibProfilesProfiles = function (input, common) { build_cpu: "x64", dependencies: concat(common.dependencies, "devkit"), configure_args: concat(common.configure_args, common.configure_args_32bit, - "--with-zlib=system"), + "--with-jvm-variants=minimal,client,server", "--with-zlib=system"), default_make_targets: common.default_make_targets }, @@ -295,7 +295,8 @@ var getJibProfilesProfiles = function (input, common) { target_cpu: "x86", build_cpu: "x64", dependencies: concat(common.dependencies, "devkit", "freetype"), - configure_args: concat(common.configure_args, common.configure_args_32bit), + configure_args: concat(common.configure_args, + "--with-jvm-variants=client,server", common.configure_args_32bit), default_make_targets: common.default_make_targets } }; diff --git a/corba/.hgtags b/corba/.hgtags index feea5f070eb..db59b1cf556 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -361,3 +361,4 @@ cc30faa2da498c478e89ab062ff160653ca1b170 jdk-9+113 7dfa7377a5e601b8f740741a9a80e04c72dd04d6 jdk-9+116 7a1b36bf2fe55a9a7732489ccdd326c910329a7e jdk-9+117 8c2c2d17f7ce92a31c9ccb44a122ec62f5a85ace jdk-9+118 +daf533920b1266603b5cbdab31908d2a931c5361 jdk-9+119 diff --git a/hotspot/.hgtags b/hotspot/.hgtags index c2bf9fb792d..754ebb60e4b 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -521,3 +521,4 @@ b64432bae5271735fd53300b2005b713e98ef411 jdk-9+114 61a214186dae6811dd989e9165e42f7dbf02acde jdk-9+116 88170d3642905b9e6cac03e8efcc976885a7e6da jdk-9+117 9b1075cac08dc836ec32e7b368415cbe3aceaf8c jdk-9+118 +15f3fe264872766bcb205696198f0c1502420e17 jdk-9+119 diff --git a/hotspot/.mx.jvmci/suite.py b/hotspot/.mx.jvmci/suite.py index 514994c5190..3da6124dbca 100644 --- a/hotspot/.mx.jvmci/suite.py +++ b/hotspot/.mx.jvmci/suite.py @@ -83,6 +83,21 @@ suite = { "workingSets" : "API,JVMCI", }, + "jdk.vm.ci.code.test" : { + "subDir" : "test/compiler/jvmci", + "sourceDirs" : ["src"], + "dependencies" : [ + "mx:JUNIT", + "jdk.vm.ci.amd64", + "jdk.vm.ci.sparc", + "jdk.vm.ci.code", + "jdk.vm.ci.hotspot", + ], + "checkstyle" : "jdk.vm.ci.services", + "javaCompliance" : "1.8", + "workingSets" : "API,JVMCI", + }, + "jdk.vm.ci.runtime" : { "subDir" : "src/jdk.vm.ci/share/classes", "sourceDirs" : ["src"], @@ -164,7 +179,7 @@ suite = { "subDir" : "test/compiler/jvmci", "sourceDirs" : ["src"], "dependencies" : [ - "mx:TESTNG", + "TESTNG", "jdk.vm.ci.hotspot", ], "checkstyle" : "jdk.vm.ci.services", diff --git a/hotspot/makefiles/BuildHotspot.gmk b/hotspot/make/BuildHotspot.gmk similarity index 100% rename from hotspot/makefiles/BuildHotspot.gmk rename to hotspot/make/BuildHotspot.gmk diff --git a/hotspot/makefiles/Dist.gmk b/hotspot/make/Dist.gmk similarity index 100% rename from hotspot/makefiles/Dist.gmk rename to hotspot/make/Dist.gmk diff --git a/hotspot/makefiles/HotspotCommon.gmk b/hotspot/make/HotspotCommon.gmk similarity index 100% rename from hotspot/makefiles/HotspotCommon.gmk rename to hotspot/make/HotspotCommon.gmk diff --git a/hotspot/make/Makefile b/hotspot/make/Makefile deleted file mode 100644 index db2b96e25e0..00000000000 --- a/hotspot/make/Makefile +++ /dev/null @@ -1,895 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Top level gnumake file for hotspot builds -# -# Default is to build the both product images and construct an export dir. -# The default export directory name is `pwd`/export-$(PLATFORM). -# -# Use: 'gnumake help' for more information. -# -# This makefile uses the default settings for where to find compilers and -# tools, and obeys the ALT_* variable settings used by the other JDK -# workspaces. -# - -# Expected/optional make variables defined on make command line: -# LP64=1 or ARCH_DATA_MODEL=64 for 64bit build -# -# Expected/optional make variables or environment variables: -# ALT_SLASH_JAVA Location of /java or J: -# ALT_BOOTDIR Previous JDK home directory for javac compiler -# ALT_OUTPUTDIR Output directory to use for hotspot build -# ALT_EXPORT_PATH Directory to export hotspot build to -# ALT_JDK_IMPORT_PATH Current JDK build (only for create_jdk rules) -# ALT_JDK_TARGET_IMPORT_PATH Current JDK build when cross-compiling -# -# Version strings and numbers: -# VERSION_SHORT Current JDK version (e.g. 9.0.0) -# JDK_PREVIOUS_VERSION Previous (bootdir) JDK version (e.g. 1.5.0) (Only needed -# to facilitate standalone build.) -# VERSION_STRING Full version string to use (e.g. "9.0.0-ea-b42") -# VERSION_MAJOR Major number for version (e.g. 9) -# VERSION_MINOR Minor number for version (e.g. 0) -# VERSION_SECURITY Security number for version (e.g. 0) -# VERSION_PATCH Patch number for version (e.g. 0) -# - -# Default is build both product fastdebug and create export area - -# Allow to build HotSpot in local directory from sources specified by GAMMADIR. -# After make/defs.make GAMMADIR is defined. -ifdef GAMMADIR - ifndef ALT_OUTPUTDIR - ALT_OUTPUTDIR := $(shell pwd) - endif - include $(GAMMADIR)/make/defs.make -else - include defs.make -endif - -include $(GAMMADIR)/make/altsrc.make - --include $(HS_ALT_MAKE)/Makefile.make - -ifneq ($(ALT_OUTPUTDIR),) - ALT_OUT=ALT_OUTPUTDIR=$(ALT_OUTPUTDIR) -else - ALT_OUT= -endif - -# Typical C1/C2 targets made available with this Makefile -C1_VM_TARGETS=product1 fastdebug1 optimized1 debug1 -C2_VM_TARGETS=product fastdebug optimized debug -CORE_VM_TARGETS=productcore fastdebugcore optimizedcore debugcore -ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero debugzero -SHARK_VM_TARGETS=productshark fastdebugshark optimizedshark debugshark -MINIMAL1_VM_TARGETS=productminimal1 fastdebugminimal1 debugminimal1 - -COMMON_VM_PRODUCT_TARGETS=product product1 docs export_product -COMMON_VM_FASTDEBUG_TARGETS=fastdebug fastdebug1 docs export_fastdebug -COMMON_VM_DEBUG_TARGETS=debug debug1 docs export_debug -COMMON_VM_OPTIMIZED_TARGETS=optimized optimized1 docs export_optimized - -# JDK directory list -JDK_DIRS=bin include lib demo - -all: all_product all_fastdebug - -ifeq ($(JVM_VARIANT_MINIMAL1),true) -all_product: productminimal1 -all_fastdebug: fastdebugminimal1 -all_debug: debugminimal1 -endif - -ifdef BUILD_CLIENT_ONLY -all_product: product1 docs export_product -all_fastdebug: fastdebug1 docs export_fastdebug -all_debug: debug1 docs export_debug -all_optimized: optimized1 docs export_optimized -else -ifeq ($(MACOSX_UNIVERSAL),true) -all_product: universal_product -all_fastdebug: universal_fastdebug -all_debug: universal_debug -all_optimized: universal_optimized -else -all_product: $(COMMON_VM_PRODUCT_TARGETS) -all_fastdebug: $(COMMON_VM_FASTDEBUG_TARGETS) -all_debug: $(COMMON_VM_DEBUG_TARGETS) -all_optimized: $(COMMON_VM_OPTIMIZED_TARGETS) -endif -endif - -allzero: all_productzero all_fastdebugzero -all_productzero: productzero docs export_product -all_fastdebugzero: fastdebugzero docs export_fastdebug -all_debugzero: debugzero docs export_debug -all_optimizedzero: optimizedzero docs export_optimized - -allshark: all_productshark all_fastdebugshark -all_productshark: productshark docs export_product -all_fastdebugshark: fastdebugshark docs export_fastdebug -all_debugshark: debugshark docs export_debug -all_optimizedshark: optimizedshark docs export_optimized - -allcore: all_productcore all_fastdebugcore -all_productcore: productcore docs export_product -all_fastdebugcore: fastdebugcore docs export_fastdebug -all_debugcore: debugcore docs export_debug -all_optimizedcore: optimizedcore docs export_optimized - -# Do everything -world: all create_jdk - -# Build or export docs -docs: -ifeq ($(OSNAME),windows) - @$(ECHO) "No docs ($(VM_TARGET)) for windows" -else -# We specify 'BUILD_FLAVOR=product' so that the proper -# ENABLE_FULL_DEBUG_SYMBOLS value is used. - $(CD) $(OUTPUTDIR); \ - $(MAKE) -f $(ABS_OS_MAKEFILE) \ - $(MAKE_ARGS) BUILD_FLAVOR=product docs -endif - -# Output directories -C1_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler1 -C2_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_compiler2 -CORE_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_core -MINIMAL1_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_minimal1 -ZERO_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_zero -SHARK_DIR =$(OUTPUTDIR)/$(VM_PLATFORM)_shark - -# Build variation of hotspot -$(C1_VM_TARGETS): - $(CD) $(GAMMADIR)/make; \ - $(MAKE) BUILD_DIR=$(C1_DIR) BUILD_FLAVOR=$(@:%1=%) VM_TARGET=$@ generic_build1 $(ALT_OUT) - -$(C2_VM_TARGETS): - $(CD) $(GAMMADIR)/make; \ - $(MAKE) BUILD_DIR=$(C2_DIR) BUILD_FLAVOR=$@ VM_TARGET=$@ generic_build2 $(ALT_OUT) - -$(CORE_VM_TARGETS): - $(CD) $(GAMMADIR)/make; \ - $(MAKE) BUILD_DIR=$(CORE_DIR) BUILD_FLAVOR=$(@:%core=%) VM_TARGET=$@ generic_buildcore $(ALT_OUT) - -$(ZERO_VM_TARGETS): - $(CD) $(GAMMADIR)/make; \ - $(MAKE) BUILD_DIR=$(ZERO_DIR) BUILD_FLAVOR=$(@:%zero=%) VM_TARGET=$@ generic_buildzero $(ALT_OUT) - -$(SHARK_VM_TARGETS): - $(CD) $(GAMMADIR)/make; \ - $(MAKE) BUILD_DIR=$(SHARK_DIR) BUILD_FLAVOR=$(@:%shark=%) VM_TARGET=$@ generic_buildshark $(ALT_OUT) - -$(MINIMAL1_VM_TARGETS): - $(CD) $(GAMMADIR)/make; \ - $(MAKE) BUILD_DIR=$(MINIMAL1_DIR) BUILD_FLAVOR=$(@:%minimal1=%) VM_TARGET=$@ generic_buildminimal1 $(ALT_OUT) - -# Install hotspot script in build directory -HOTSPOT_SCRIPT=$(BUILD_DIR)/$(BUILD_FLAVOR)/hotspot -$(HOTSPOT_SCRIPT): $(GAMMADIR)/make/hotspot.script - $(QUIETLY) $(MKDIR) -p $(BUILD_DIR)/$(BUILD_FLAVOR) - $(QUIETLY) cat $< | sed -e 's|@@LIBARCH@@|$(LIBARCH)|g' | sed -e 's|@@JDK_IMPORT_PATH@@|$(JDK_IMPORT_PATH)|g' > $@ - $(QUIETLY) chmod +x $@ - -# Build compiler1 (client) rule, different for platforms -generic_build1: $(HOTSPOT_SCRIPT) - $(MKDIR) -p $(OUTPUTDIR) -ifeq ($(OSNAME),windows) - ifeq ($(ARCH_DATA_MODEL), 32) - $(CD) $(OUTPUTDIR); \ - $(NMAKE) -f $(ABS_OS_MAKEFILE) \ - Variant=compiler1 \ - WorkSpace=$(ABS_GAMMADIR) \ - BootStrapDir=$(ABS_BOOTDIR) \ - BuildUser=$(USERNAME) \ - $(MAKE_ARGS) $(VM_TARGET:%1=%) - else - @$(ECHO) "No compiler1 ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" - endif -else - ifeq ($(ARCH_DATA_MODEL), 32) - $(CD) $(OUTPUTDIR); \ - $(MAKE) -f $(ABS_OS_MAKEFILE) \ - $(MAKE_ARGS) $(VM_TARGET) - else - @$(ECHO) "No compiler1 ($(VM_TARGET)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" - endif -endif - -# Build compiler2 (server) rule, different for platforms -generic_build2: $(HOTSPOT_SCRIPT) - $(MKDIR) -p $(OUTPUTDIR) -ifeq ($(OSNAME),windows) - $(CD) $(OUTPUTDIR); \ - $(NMAKE) -f $(ABS_OS_MAKEFILE) \ - Variant=compiler2 \ - WorkSpace=$(ABS_GAMMADIR) \ - BootStrapDir=$(ABS_BOOTDIR) \ - BuildUser=$(USERNAME) \ - $(MAKE_ARGS) $(VM_TARGET) -else - $(CD) $(OUTPUTDIR); \ - $(MAKE) -f $(ABS_OS_MAKEFILE) \ - $(MAKE_ARGS) $(VM_TARGET) -endif - -# NOTE: Changes in this file was just to facilitate comparison when -# developing the new build, and should not be integrated. -generic_buildcore: $(HOTSPOT_SCRIPT) -#ifeq ($(HS_ARCH),ppc) -# ifeq ($(ARCH_DATA_MODEL),64) - $(MKDIR) -p $(OUTPUTDIR) - $(CD) $(OUTPUTDIR); \ - $(MAKE) -f $(ABS_OS_MAKEFILE) \ - $(MAKE_ARGS) $(VM_TARGET) -# else -# @$(ECHO) "No ($(VM_TARGET)) for ppc ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" -# endif -#else -# @$(ECHO) "No ($(VM_TARGET)) for $(HS_ARCH)" -#endif - -generic_buildzero: $(HOTSPOT_SCRIPT) - $(MKDIR) -p $(OUTPUTDIR) - $(CD) $(OUTPUTDIR); \ - $(MAKE) -f $(ABS_OS_MAKEFILE) \ - $(MAKE_ARGS) $(VM_TARGET) - -generic_buildshark: $(HOTSPOT_SCRIPT) - $(MKDIR) -p $(OUTPUTDIR) - $(CD) $(OUTPUTDIR); \ - $(MAKE) -f $(ABS_OS_MAKEFILE) \ - $(MAKE_ARGS) $(VM_TARGET) - -generic_buildminimal1: $(HOTSPOT_SCRIPT) -ifeq ($(JVM_VARIANT_MINIMAL1),true) - $(MKDIR) -p $(OUTPUTDIR) - ifeq ($(ARCH_DATA_MODEL), 32) - ifeq ($(OSNAME),windows) - $(ECHO) "No ($(VM_TARGET)) for $(OSNAME) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" ; - else - ifeq ($(OSNAME),solaris) - $(ECHO) "No ($(VM_TARGET)) for $(OSNAME) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" ; - else - $(CD) $(OUTPUTDIR); \ - $(MAKE) -f $(ABS_OS_MAKEFILE) $(MAKE_ARGS) $(VM_TARGET) ; - endif - endif - else - @$(ECHO) "No ($(VM_TARGET)) for $(OSNAME) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" - endif -else - @$(ECHO) "Error: trying to build a minimal target but JVM_VARIANT_MINIMAL1 is not true." -endif - -remove_old_debuginfo: -ifeq ($(JVM_VARIANT_CLIENT), true) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - ifeq ($(OSNAME), windows) - $(RM) -f $(EXPORT_CLIENT_DIR)/jvm.map $(EXPORT_CLIENT_DIR)/jvm.pdb - else - $(RM) -f $(EXPORT_CLIENT_DIR)/libjvm.debuginfo - endif - else - $(RM) -f $(EXPORT_CLIENT_DIR)/libjvm.diz - endif -endif -ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - ifeq ($(OSNAME), windows) - $(RM) -f $(EXPORT_SERVER_DIR)/jvm.map $(EXPORT_SERVER_DIR)/jvm.pdb - else - ifeq ($(OS_VENDOR), Darwin) - $(RM) -rf $(EXPORT_SERVER_DIR)/libjvm.dylib.dSYM - else - $(RM) -f $(EXPORT_SERVER_DIR)/libjvm.debuginfo - endif - endif - else - $(RM) -f $(EXPORT_SERVER_DIR)/libjvm.diz - endif -endif -ifeq ($(JVM_VARIANT_MINIMAL1),true) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(RM) -f $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo - else - $(RM) -f $(EXPORT_MINIMAL_DIR)/libjvm.diz - endif -endif - -# Export file rule -generic_export: $(EXPORT_LIST) remove_old_debuginfo - -export_product: - $(MAKE) BUILD_FLAVOR=$(@:export_%=%) generic_export -export_fastdebug: - $(MAKE) BUILD_FLAVOR=$(@:export_%=%) EXPORT_SUBDIR=/$(@:export_%=%) generic_export -export_debug: - $(MAKE) BUILD_FLAVOR=$(@:export_%=%) EXPORT_SUBDIR=/$(@:export_%=%) generic_export -export_optimized: - $(MAKE) BUILD_FLAVOR=$(@:export_%=%) EXPORT_SUBDIR=/$(@:export_%=%) generic_export - -export_product_jdk:: - $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR) generic_export -export_optimized_jdk:: - $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/$(@:export_%_jdk=%) generic_export -export_fastdebug_jdk:: - $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/$(@:export_%_jdk=%) generic_export -export_debug_jdk:: - $(MAKE) BUILD_FLAVOR=$(@:export_%_jdk=%) ALT_EXPORT_PATH=$(JDK_IMAGE_DIR)/$(@:export_%_jdk=%) generic_export - -# Export file copy rules -XUSAGE=$(HS_SRC_DIR)/share/vm/Xusage.txt -DOCS_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_docs -C1_BUILD_DIR =$(C1_DIR)/$(BUILD_FLAVOR) -C2_BUILD_DIR =$(C2_DIR)/$(BUILD_FLAVOR) -CORE_BUILD_DIR =$(CORE_DIR)/$(BUILD_FLAVOR) -MINIMAL1_BUILD_DIR=$(MINIMAL1_DIR)/$(BUILD_FLAVOR) -ZERO_BUILD_DIR =$(ZERO_DIR)/$(BUILD_FLAVOR) -SHARK_BUILD_DIR =$(SHARK_DIR)/$(BUILD_FLAVOR) - -# Server (C2) -ifeq ($(JVM_VARIANT_SERVER), true) -# Common -$(EXPORT_SERVER_DIR)/%.diz: $(C2_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_LIB_DIR)/%.jar: $(C2_BUILD_DIR)/../generated/%.jar - $(install-file) -$(EXPORT_INCLUDE_DIR)/%: $(C2_BUILD_DIR)/../generated/jvmtifiles/% - $(install-file) -# Windows -$(EXPORT_SERVER_DIR)/%.dll: $(C2_BUILD_DIR)/%.dll - $(install-file) -$(EXPORT_SERVER_DIR)/%.pdb: $(C2_BUILD_DIR)/%.pdb - $(install-file) -$(EXPORT_SERVER_DIR)/%.map: $(C2_BUILD_DIR)/%.map - $(install-file) -$(EXPORT_LIB_DIR)/%.lib: $(C2_BUILD_DIR)/%.lib - $(install-file) -$(EXPORT_BIN_DIR)/%.diz: $(C2_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_BIN_DIR)/%.dll: $(C2_BUILD_DIR)/%.dll - $(install-file) -$(EXPORT_BIN_DIR)/%.pdb: $(C2_BUILD_DIR)/%.pdb - $(install-file) -$(EXPORT_BIN_DIR)/%.map: $(C2_BUILD_DIR)/%.map - $(install-file) -# Unix -$(EXPORT_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(C2_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.debuginfo: $(C2_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_SERVER_DIR)/%.debuginfo: $(C2_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_SERVER_DIR)/64/%.debuginfo: $(C2_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.diz: $(C2_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_SERVER_DIR)/64/%.diz: $(C2_BUILD_DIR)/%.diz - $(install-file) -# MacOS X -$(EXPORT_LIB_ARCH_DIR)/%.dSYM: $(C2_BUILD_DIR)/%.dSYM - $(install-dir) -$(EXPORT_SERVER_DIR)/%.dSYM: $(C2_BUILD_DIR)/%.dSYM - $(install-dir) -$(EXPORT_SERVER_DIR)/%.symbols: $(C2_BUILD_DIR)/%.symbols - $(install-file) -endif - -# Client (C1) -ifeq ($(JVM_VARIANT_CLIENT), true) -# Common -$(EXPORT_CLIENT_DIR)/%.diz: $(C1_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_LIB_DIR)/%.jar: $(C1_BUILD_DIR)/../generated/%.jar - $(install-file) -$(EXPORT_INCLUDE_DIR)/%: $(C1_BUILD_DIR)/../generated/jvmtifiles/% - $(install-file) -# Windows -$(EXPORT_CLIENT_DIR)/%.dll: $(C1_BUILD_DIR)/%.dll - $(install-file) -$(EXPORT_CLIENT_DIR)/%.pdb: $(C1_BUILD_DIR)/%.pdb - $(install-file) -$(EXPORT_CLIENT_DIR)/%.map: $(C1_BUILD_DIR)/%.map - $(install-file) -$(EXPORT_LIB_DIR)/%.lib: $(C1_BUILD_DIR)/%.lib - $(install-file) -$(EXPORT_BIN_DIR)/%.diz: $(C1_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_BIN_DIR)/%.dll: $(C1_BUILD_DIR)/%.dll - $(install-file) -$(EXPORT_BIN_DIR)/%.pdb: $(C1_BUILD_DIR)/%.pdb - $(install-file) -$(EXPORT_BIN_DIR)/%.map: $(C1_BUILD_DIR)/%.map - $(install-file) -# Unix -$(EXPORT_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C1_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX): $(C1_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX): $(C1_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.debuginfo: $(C1_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_CLIENT_DIR)/%.debuginfo: $(C1_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_CLIENT_DIR)/64/%.debuginfo: $(C1_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.diz: $(C1_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_CLIENT_DIR)/64/%.diz: $(C1_BUILD_DIR)/%.diz - $(install-file) -# MacOS X -$(EXPORT_LIB_ARCH_DIR)/%.dSYM: $(C1_BUILD_DIR)/%.dSYM - $(install-dir) -$(EXPORT_CLIENT_DIR)/%.dSYM: $(C1_BUILD_DIR)/%.dSYM - $(install-dir) -endif - -# Minimal1 -ifeq ($(JVM_VARIANT_MINIMAL1), true) -# Common -$(EXPORT_MINIMAL_DIR)/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_LIB_DIR)/%.jar: $(MINIMAL1_BUILD_DIR)/../generated/%.jar - $(install-file) -$(EXPORT_INCLUDE_DIR)/%: $(MINIMAL1_BUILD_DIR)/../generated/jvmtifiles/% - $(install-file) -# Windows -$(EXPORT_MINIMAL_DIR)/%.dll: $(MINIMAL1_BUILD_DIR)/%.dll - $(install-file) -$(EXPORT_MINIMAL_DIR)/%.pdb: $(MINIMAL1_BUILD_DIR)/%.pdb - $(install-file) -$(EXPORT_MINIMAL_DIR)/%.map: $(MINIMAL1_BUILD_DIR)/%.map - $(install-file) -$(EXPORT_LIB_DIR)/%.lib: $(MINIMAL1_BUILD_DIR)/%.lib - $(install-file) -$(EXPORT_BIN_DIR)/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_BIN_DIR)/%.dll: $(MINIMAL1_BUILD_DIR)/%.dll - $(install-file) -$(EXPORT_BIN_DIR)/%.pdb: $(MINIMAL1_BUILD_DIR)/%.pdb - $(install-file) -$(EXPORT_BIN_DIR)/%.map: $(MINIMAL1_BUILD_DIR)/%.map - $(install-file) -# Unix -$(EXPORT_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(MINIMAL1_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_MINIMAL_DIR)/%.$(LIBRARY_SUFFIX): $(MINIMAL1_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_MINIMAL_DIR)/64/%.$(LIBRARY_SUFFIX): $(MINIMAL1_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.debuginfo: $(MINIMAL1_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_MINIMAL_DIR)/%.debuginfo: $(MINIMAL1_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_MINIMAL_DIR)/64/%.debuginfo: $(MINIMAL1_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_MINIMAL_DIR)/64/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz - $(install-file) -# MacOS X does not support Minimal1 config -endif - -# Zero -ifeq ($(JVM_VARIANT_ZERO), true) -# Common -$(EXPORT_LIB_DIR)/%.jar: $(ZERO_BUILD_DIR)/../generated/%.jar - $(install-file) -$(EXPORT_INCLUDE_DIR)/%: $(ZERO_BUILD_DIR)/../generated/jvmtifiles/% - $(install-file) -# Unix -$(EXPORT_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.debuginfo: $(ZERO_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.diz: $(ZERO_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(ZERO_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_SERVER_DIR)/%.debuginfo: $(ZERO_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_SERVER_DIR)/%.diz: $(ZERO_BUILD_DIR)/%.diz - $(install-file) -# MacOS X -$(EXPORT_LIB_ARCH_DIR)/%.dSYM: $(ZERO_BUILD_DIR)/%.dSYM - $(install-dir) -$(EXPORT_SERVER_DIR)/%.dSYM: $(ZERO_BUILD_DIR)/%.dSYM - $(install-dir) -endif - -# Core -ifeq ($(JVM_VARIANT_CORE), true) -# Common -$(EXPORT_LIB_DIR)/%.jar: $(CORE_BUILD_DIR)/../generated/%.jar - $(install-file) -$(EXPORT_INCLUDE_DIR)/%: $(CORE_BUILD_DIR)/../generated/jvmtifiles/% - $(install-file) -# Unix -$(EXPORT_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(CORE_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.debuginfo: $(CORE_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.diz: $(CORE_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(CORE_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_SERVER_DIR)/%.debuginfo: $(CORE_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_SERVER_DIR)/%.diz: $(CORE_BUILD_DIR)/%.diz - $(install-file) -endif - -# Shark -ifeq ($(JVM_VARIANT_ZEROSHARK), true) -# Common -$(EXPORT_LIB_DIR)/%.jar: $(SHARK_BUILD_DIR)/../generated/%.jar - $(install-file) -$(EXPORT_INCLUDE_DIR)/%: $(SHARK_BUILD_DIR)/../generated/jvmtifiles/% - $(install-file) -# Unix -$(EXPORT_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.debuginfo): $(SHARK_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_LIB_ARCH_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz - $(install-file) -$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(SHARK_BUILD_DIR)/%.$(LIBRARY_SUFFIX) - $(install-file) -$(EXPORT_SERVER_DIR)/%.debuginfo: $(SHARK_BUILD_DIR)/%.debuginfo - $(install-file) -$(EXPORT_SERVER_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz - $(install-file) -# MacOS X -$(EXPORT_LIB_ARCH_DIR)/%.dSYM: $(SHARK_BUILD_DIR)/%.dSYM - $(install-dir) -$(EXPORT_SERVER_DIR)/%.dSYM: $(SHARK_BUILD_DIR)/%.dSYM - $(install-dir) -endif - -$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/code/% - $(install-file) - -$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/prims/% - $(install-file) - -HS_JNI_ARCH_SRC=$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h) -$(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h: $(HS_JNI_ARCH_SRC) - $(install-file) - -$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/% - $(install-file) - -JFR_EXISTS=$(shell if [ -d $(HS_ALT_SRC) ]; then echo 1; else echo 0; fi) -# export jfr.h -ifeq ($JFR_EXISTS,1) -$(EXPORT_INCLUDE_DIR)/%: $(HS_ALT_SRC)/share/vm/jfr/% - $(install-file) -else -$(EXPORT_INCLUDE_DIR)/jfr.h: -endif - -# Doc files (jvmti.html) -$(EXPORT_DOCS_DIR)/platform/jvmti/%: $(DOCS_DIR)/% - $(install-file) - -# Xusage file -$(EXPORT_SERVER_DIR)/Xusage.txt $(EXPORT_CLIENT_DIR)/Xusage.txt $(EXPORT_MINIMAL_DIR)/Xusage.txt: $(XUSAGE) - $(prep-target) - $(RM) $@.temp - $(SED) 's/\(separated by \)[;:]/\1$(PATH_SEP)/g' $< > $@.temp - $(MV) $@.temp $@ - -# -# Clean rules -# -clobber clean: clean_build clean_export clean_jdk -clean_build: - $(RM) -r $(C1_DIR) - $(RM) -r $(C2_DIR) - $(RM) -r $(CORE_DIR) - $(RM) -r $(ZERO_DIR) - $(RM) -r $(SHARK_DIR) - $(RM) -r $(MINIMAL1_DIR) -clean_export: - $(RM) -r $(EXPORT_PATH) -clean_jdk: - $(RM) -r $(JDK_IMAGE_DIR) - -# -# Create JDK and place this build into it -# -create_jdk: copy_jdk update_jdk - -update_jdk: export_product_jdk export_fastdebug_jdk test_jdk - -copy_jdk: $(JDK_IMAGE_DIR)/bin/java - -$(JDK_IMAGE_DIR)/bin/java: - $(RM) -r $(JDK_IMAGE_DIR) - $(MKDIR) -p $(JDK_IMAGE_DIR) - ($(CD) $(JDK_IMPORT_PATH) && \ - $(TAR) -cf - *) | \ - ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -) - - -# Testing the built JVM -RUN_JVM=JAVA_HOME=$(JDK_IMPORT_PATH) $(JDK_IMPORT_PATH)/bin/java -d$(ARCH_DATA_MODEL) -XXaltjvm=$(ALTJVM_DIR) -Dsun.java.launcher.is_altjvm=true -generic_test: - @$(ECHO) "Running with: $(ALTJVM_DIR)" - @$(RUN_JVM) -Xinternalversion - @$(RUN_JVM) -showversion -help - -# C2 test targets -test_product test_optimized test_fastdebug test_debug: - @$(MAKE) generic_test ALTJVM_DIR="$(C2_DIR)/$(@:test_%=%)" - -# C1 test targets -test_product1 test_optimized1 test_fastdebug1 test_debug1: - ifeq ($(ARCH_DATA_MODEL), 32) - @$(MAKE) generic_test ALTJVM_DIR="$(C1_DIR)/$(@:test_%1=%)" - else - @$(ECHO) "No compiler1 ($(@:test_%=%)) for ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" - endif - -# Zero test targets -test_productzero test_optimizedzero test_fastdebugzero test_debugzero: - @$(MAKE) generic_test ALTJVM_DIR="$(ZERO_DIR)/$(@:test_%zero=%)" - -# Shark test targets -test_productshark test_optimizedshark test_fastdebugshark test_debugshark: - @$(MAKE) generic_test ALTJVM_DIR="$(SHARK_DIR)/$(@:test_%shark=%)" - -# Minimal1 test targets -test_productminimal1 test_optimizedminimal1 test_fastdebugminimal1 test_debugminimal1: - @$(MAKE) generic_test ALTJVM_DIR="$(MINIMAL1_DIR)/$(@:test_%minimal1=%)" - - -test_jdk: - ifeq ($(JVM_VARIANT_CLIENT), true) - $(JDK_IMAGE_DIR)/bin/java -d$(ARCH_DATA_MODEL) -client -Xinternalversion - $(JDK_IMAGE_DIR)/bin/java -d$(ARCH_DATA_MODEL) -client -version - endif - ifeq ($(findstring true, $(JVM_VARIANT_SERVER)\ - $(JVM_VARIANT_ZERO)$(JVM_VARIANT_ZEROSHARK)), true) - $(JDK_IMAGE_DIR)/bin/java -d$(ARCH_DATA_MODEL) -server -Xinternalversion - $(JDK_IMAGE_DIR)/bin/java -d$(ARCH_DATA_MODEL) -server -version - endif - -copy_product_jdk:: - $(RM) -r $(JDK_IMAGE_DIR) - $(MKDIR) -p $(JDK_IMAGE_DIR) - ($(CD) $(JDK_IMPORT_PATH) && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xf -) - -copy_fastdebug_jdk:: - $(RM) -r $(JDK_IMAGE_DIR)/fastdebug - $(MKDIR) -p $(JDK_IMAGE_DIR)/fastdebug - if [ -d $(JDK_IMPORT_PATH)/fastdebug ] ; then \ - ($(CD) $(JDK_IMPORT_PATH)/fastdebug && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR)/fastdebug && $(TAR) -xf -) ; \ - else \ - ($(CD) $(JDK_IMPORT_PATH) && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR)/fastdebug && $(TAR) -xf -) ; \ - fi - -copy_debug_jdk:: - $(RM) -r $(JDK_IMAGE_DIR)/debug - $(MKDIR) -p $(JDK_IMAGE_DIR)/debug - if [ -d $(JDK_IMPORT_PATH)/debug ] ; then \ - ($(CD) $(JDK_IMPORT_PATH)/debug && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \ - elif [ -d $(JDK_IMPORT_PATH)/fastdebug ] ; then \ - ($(CD) $(JDK_IMPORT_PATH)/fastdebug && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \ - else \ - ($(CD) $(JDK_IMPORT_PATH) && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR)/debug && $(TAR) -xf -) ; \ - fi - -copy_optimized_jdk:: - $(RM) -r $(JDK_IMAGE_DIR)/optimized - $(MKDIR) -p $(JDK_IMAGE_DIR)/optimized - if [ -d $(JDK_IMPORT_PATH)/optimized ] ; then \ - ($(CD) $(JDK_IMPORT_PATH)/optimized && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR)/optimized && $(TAR) -xf -) ; \ - else \ - ($(CD) $(JDK_IMPORT_PATH) && \ - $(TAR) -cf - $(JDK_DIRS)) | \ - ($(CD) $(JDK_IMAGE_DIR)/optimized && $(TAR) -xf -) ; \ - fi - -# -# Check target -# -check: variable_check - -# -# Help target -# -help: intro_help target_help variable_help notes_help examples_help - -# Intro help message -intro_help: - @$(ECHO) \ -"Makefile for the Hotspot workspace." - @$(ECHO) \ -"Default behavior is to build and create an export area for the j2se builds." - -# Target help -target_help: - @$(ECHO) "help: This help message" - @$(ECHO) "all: Same as: all_product all_fastdebug" - @$(ECHO) "world: Same as: all create_jdk" - @$(ECHO) "all_product: Same as: product product1 export_product" - @$(ECHO) "all_fastdebug: Same as: fastdebug fastdebug1 export_fastdebug" - @$(ECHO) "all_debug: Same as: debug debug1 export_debug" - @$(ECHO) "all_optimized: Same as: optimized optimized1 export_optimized" - @$(ECHO) "clean: Clean all areas" - @$(ECHO) "export_product: Export product files to EXPORT_PATH" - @$(ECHO) "export_fastdebug: Export fastdebug files to EXPORT_PATH" - @$(ECHO) "export_debug: Export debug files to EXPORT_PATH" - @$(ECHO) "export_optimized: Export optimized files to EXPORT_PATH" - @$(ECHO) "create_jdk: Create JDK image, export all files into it" - @$(ECHO) "update_jdk: Update JDK image with fresh exported files" - @$(ECHO) " " - @$(ECHO) "Other targets are:" - @$(ECHO) " $(C1_VM_TARGETS)" - @$(ECHO) " $(C2_VM_TARGETS)" - @$(ECHO) " $(MINIMAL1_VM_TARGETS)" - -# Variable help (only common ones used by this workspace) -variable_help: variable_help_intro variable_list variable_help_end -variable_help_intro: - @$(ECHO) "--- Common Variables ---" -variable_help_end: - @$(ECHO) " " - @$(ECHO) "--- Make Arguments ---" - @$(ECHO) "MAKE_ARGS=$(MAKE_ARGS)" - -# One line descriptions for the variables -SLASH_JAVA.desc = Root of all build tools, e.g. /java or J: -OUTPUTDIR.desc = Output directory, default is build/ -BOOTDIR.desc = JDK used to compile agent java source and test with -JDK_IMPORT_PATH.desc = Promoted JDK to copy for 'create_jdk' -JDK_IMAGE_DIR.desc = Directory to place JDK to copy -EXPORT_PATH.desc = Directory to place files to export for JDK build - -# Make variables to print out (description and value) -VARIABLE_PRINTVAL_LIST += \ - SLASH_JAVA \ - OUTPUTDIR \ - BOOTDIR \ - JDK_IMPORT_PATH \ - JDK_IMAGE_DIR \ - EXPORT_PATH - -# Make variables that should refer to directories that exist -VARIABLE_CHECKDIR_LIST += \ - SLASH_JAVA \ - BOOTDIR \ - JDK_IMPORT_PATH - -# For pattern rules below, so all are treated the same -DO_PRINTVAL_LIST=$(VARIABLE_PRINTVAL_LIST:%=%.printval) -DO_CHECKDIR_LIST=$(VARIABLE_CHECKDIR_LIST:%=%.checkdir) - -# Complete variable check -variable_check: $(DO_CHECKDIR_LIST) -variable_list: $(DO_PRINTVAL_LIST) variable_check - -# Pattern rule for printing out a variable -%.printval: - @$(ECHO) " ALT_$* - $($*.desc)" - @$(ECHO) " $*=$($*)" - -# Pattern rule for checking to see if a variable with a directory exists -%.checkdir: - @if [ ! -d $($*) ] ; then \ - $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ - fi - -# Pattern rule for checking to see if a variable with a file exists -%.checkfil: - @if [ ! -f $($*) ] ; then \ - $(ECHO) "WARNING: $* does not exist, try $(MAKE) sanity"; \ - fi - -# Misc notes on help -notes_help: - @$(ECHO) \ -"--- Notes --- " - @$(ECHO) \ -"- JDK_IMPORT_PATH must refer to a compatible build, not all past promoted" - @$(ECHO) \ -" builds or previous release JDK builds will work." - @$(ECHO) \ -"- The fastest builds have been when the workspace and the BOOTDIR are on" - @$(ECHO) \ -" local disk." - -examples_help: - @$(ECHO) \ -"--- Examples --- " - @$(ECHO) \ -" $(MAKE) all" - @$(ECHO) \ -" $(MAKE) world" - @$(ECHO) \ -" $(MAKE) ALT_BOOTDIR=/opt/java/jdk$(JDK_PREVIOUS_VERSION)" - @$(ECHO) \ -" $(MAKE) ALT_JDK_IMPORT_PATH=/opt/java/jdk$(VERSION_STRING)" - -# Universal build support -ifeq ($(OS_VENDOR), Darwin) -ifeq ($(MACOSX_UNIVERSAL),true) -include $(GAMMADIR)/make/$(OSNAME)/makefiles/universal.gmk -endif -endif - -# Compatibility for transition to new naming -warn_jvmg_deprecated: - echo "Warning: The jvmg target has been replaced with debug" - echo "Warning: Please update your usage" - -jvmg: warn_jvmg_deprecated debug - -jvmg1: warn_jvmg_deprecated debug1 - -jvmgminimal1: warn_jvmg_deprecated debugminimal1 - -jvmgcore: warn_jvmg_deprecated debugcore - -jvmgzero: warn_jvmg_deprecated debugzero - -jvmgshark: warn_jvmg_deprecated debugshark - -# JPRT rule to build this workspace -include $(GAMMADIR)/make/jprt.gmk - -.PHONY: all world clobber clean help $(C1_VM_TARGETS) $(C2_VM_TARGETS) \ - $(MINIMAL1_VM_TARGETS) \ - generic_build1 generic_build2 generic_buildminimal1 generic_export \ - export_product export_fastdebug export_debug export_optimized \ - export_jdk_product export_jdk_fastdebug export_jdk_debug \ - create_jdk copy_jdk update_jdk test_jdk \ - copy_product_jdk copy_fastdebug_jdk copy_debug_jdk \ - $(HS_ALT_MAKE)/Makefile.make remove_old_debuginfo - -.NOTPARALLEL: diff --git a/hotspot/make/aix/Makefile b/hotspot/make/aix/Makefile deleted file mode 100644 index 951a98502fa..00000000000 --- a/hotspot/make/aix/Makefile +++ /dev/null @@ -1,369 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2015 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile creates a build tree and lights off a build. -# You can go back into the build tree and perform rebuilds or -# incremental builds as desired. Be sure to reestablish -# environment variable settings for LD_LIBRARY_PATH and JAVA_HOME. - -# The make process now relies on java and javac. These can be -# specified either implicitly on the PATH, by setting the -# (JDK-inherited) ALT_BOOTDIR environment variable to full path to a -# JDK in which bin/java and bin/javac are present and working (e.g., -# /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited) -# default BOOTDIR path value. Note that one of ALT_BOOTDIR -# or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc. -# from the PATH. -# -# One can set ALT_BOOTDIR or BOOTDIR to point to a jdk that runs on -# an architecture that differs from the target architecture, as long -# as the bootstrap jdk runs under the same flavor of OS as the target -# (i.e., if the target is linux, point to a jdk that runs on a linux -# box). In order to use such a bootstrap jdk, set the make variable -# REMOTE to the desired remote command mechanism, e.g., -# -# make REMOTE="rsh -l me myotherlinuxbox" - -# No tests on Aix. -TEST_IN_BUILD=false - -ifeq ($(GAMMADIR),) -include ../../make/defs.make -else -include $(GAMMADIR)/make/defs.make -endif -include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make - -ifndef CC_INTERP - ifndef FORCE_TIERED - FORCE_TIERED=1 - endif -endif - -ifdef LP64 - ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") - _JUNK_ := $(shell echo >&2 \ - $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!") - @exit 1 - endif -endif - -# we need to set up LP64 correctly to satisfy sanity checks in adlc -ifneq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") - MFLAGS += " LP64=1 " -endif - -# pass USE_SUNCC further, through MFLAGS -ifdef USE_SUNCC - MFLAGS += " USE_SUNCC=1 " -endif - -# The following renders pathnames in generated Makefiles valid on -# machines other than the machine containing the build tree. -# -# For example, let's say my build tree lives on /files12 on -# exact.east.sun.com. This logic will cause GAMMADIR to begin with -# /net/exact/files12/... -# -# We only do this on SunOS variants, for a couple of reasons: -# * It is extremely rare that source trees exist on other systems -# * It has been claimed that the Linux automounter is flakey, so -# changing GAMMADIR in a way that exercises the automounter could -# prove to be a source of unreliability in the build process. -# Obviously, this Makefile is only relevant on SunOS boxes to begin -# with, but the SunOS conditionalization will make it easier to -# combine Makefiles in the future (assuming we ever do that). - -ifeq ($(OSNAME),solaris) - - # prepend current directory to relative pathnames. - NEW_GAMMADIR := \ - $(shell echo $(GAMMADIR) | \ - sed -e "s=^\([^/].*\)=$(shell pwd)/\1=" \ - ) - unexport NEW_GAMMADIR - - # If NEW_GAMMADIR doesn't already start with "/net/": - ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),) - # prepend /net/$(HOST) - # remove /net/$(HOST) if name already began with /home/ - # remove /net/$(HOST) if name already began with /java/ - # remove /net/$(HOST) if name already began with /lab/ - NEW_GAMMADIR := \ - $(shell echo $(NEW_GAMMADIR) | \ - sed -e "s=^\(.*\)=/net/$(HOST)\1=" \ - -e "s=^/net/$(HOST)/home/=/home/=" \ - -e "s=^/net/$(HOST)/java/=/java/=" \ - -e "s=^/net/$(HOST)/lab/=/lab/=" \ - ) - # Don't use the new value for GAMMADIR unless a file with the new - # name actually exists. - ifneq ($(wildcard $(NEW_GAMMADIR)),) - GAMMADIR := $(NEW_GAMMADIR) - endif - endif - -endif - -# BUILDARCH is set to "zero" for Zero builds. VARIANTARCH -# is used to give the build directories meaningful names. -VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH)) - -# There is a (semi-) regular correspondence between make targets and actions: -# -# Target Tree Type Build Dir -# -# debug compiler2 __compiler2/debug -# fastdebug compiler2 __compiler2/fastdebug -# optimized compiler2 __compiler2/optimized -# product compiler2 __compiler2/product -# -# debug1 compiler1 __compiler1/debug -# fastdebug1 compiler1 __compiler1/fastdebug -# optimized1 compiler1 __compiler1/optimized -# product1 compiler1 __compiler1/product -# -# debugcore core __core/debug -# fastdebugcore core __core/fastdebug -# optimizedcore core __core/optimized -# productcore core __core/product -# -# debugzero zero __zero/debug -# fastdebugzero zero __zero/fastdebug -# optimizedzero zero __zero/optimized -# productzero zero __zero/product -# -# debugshark shark __shark/debug -# fastdebugshark shark __shark/fastdebug -# optimizedshark shark __shark/optimized -# productshark shark __shark/product -# -# fastdebugminimal1 minimal1 __minimal1/fastdebug -# productminimal1 minimal1 __minimal1/product -# -# What you get with each target: -# -# debug* - debug compile with asserts enabled -# fastdebug* - optimized compile, but with asserts enabled -# optimized* - optimized compile, no asserts -# product* - the shippable thing: optimized compile, no asserts, -DPRODUCT - -# This target list needs to be coordinated with the usage message -# in the build.sh script: -TARGETS = debug fastdebug optimized product - -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - SUBDIR_DOCS = $(OSNAME)_$(VARIANTARCH)_docs -else - SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs -endif -SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) -SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) -SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) -SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) -SUBDIRS_ZERO = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS)) -SUBDIRS_SHARK = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS)) -SUBDIRS_MINIMAL1 = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS)) - -TARGETS_C2 = $(TARGETS) -TARGETS_C1 = $(addsuffix 1,$(TARGETS)) -TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) -TARGETS_CORE = $(addsuffix core,$(TARGETS)) -TARGETS_ZERO = $(addsuffix zero,$(TARGETS)) -TARGETS_SHARK = $(addsuffix shark,$(TARGETS)) -TARGETS_MINIMAL1 = $(addsuffix minimal1,$(TARGETS)) - -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) -BUILDTREE_VARS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE) - -BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS) - -#------------------------------------------------------------------------------- - -# Could make everything by default, but that would take a while. -all: - @echo "Try '$(MAKE) ...' where is one or more of" - @echo " $(TARGETS_C2)" - @echo " $(TARGETS_C1)" - @echo " $(TARGETS_CORE)" - @echo " $(TARGETS_ZERO)" - @echo " $(TARGETS_SHARK)" - @echo " $(TARGETS_MINIMAL1)" - -checks: check_os_version check_j2se_version - -# We do not want people accidentally building on old systems (e.g. Linux 2.2.x, -# Solaris 2.5.1, 2.6). -# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. - -SUPPORTED_OS_VERSION = AIX -OS_VERSION := $(shell uname -a) -EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) - -check_os_version: -ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),) - $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1; -endif - -# jvmti.make requires XSLT (J2SE 1.4.x or newer): -XSLT_CHECK = $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory -# If not found then fail fast. -check_j2se_version: - $(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \ - $(REMOTE) $(RUN.JAVA) -version; \ - echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \ - "to bootstrap this build" 1>&2; \ - exit 1; \ - fi - -$(SUBDIRS_TIERED): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered - -$(SUBDIRS_C2): $(BUILDTREE_MAKE) -ifeq ($(FORCE_TIERED),1) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered FORCE_TIERED=1 -else - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler2 -endif - -$(SUBDIRS_C1): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler1 - -$(SUBDIRS_CORE): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=core - -$(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH) - -$(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH) - -$(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=minimal1 - - -platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in - $(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@ - -# Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME - -$(TARGETS_C2): $(SUBDIRS_C2) - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_TIERED): $(SUBDIRS_TIERED) - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_C1): $(SUBDIRS_C1) - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_CORE): $(SUBDIRS_CORE) - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_ZERO): $(SUBDIRS_ZERO) - cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_SHARK): $(SUBDIRS_SHARK) - cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_MINIMAL1): $(SUBDIRS_MINIMAL1) - cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install -endif - -# Just build the tree, and nothing else: -tree: $(SUBDIRS_C2) -tree1: $(SUBDIRS_C1) -treecore: $(SUBDIRS_CORE) -treezero: $(SUBDIRS_ZERO) -treeshark: $(SUBDIRS_SHARK) -treeminimal1: $(SUBDIRS_MINIMAL1) - -# Doc target. This is the same for all build options. -# Hence create a docs directory beside ...$(ARCH)_[...] -# We specify 'BUILD_FLAVOR=product' so that the proper -# ENABLE_FULL_DEBUG_SYMBOLS value is used. -docs: checks - $(QUIETLY) mkdir -p $(SUBDIR_DOCS) - $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs - -# Synonyms for win32-like targets. -compiler2: debug product - -compiler1: debug1 product1 - -core: debugcore productcore - -zero: debugzero productzero - -shark: debugshark productshark - -clean_docs: - rm -rf $(SUBDIR_DOCS) - -clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1: - rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) - -clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs - -include $(GAMMADIR)/make/cscope.make - -#------------------------------------------------------------------------------- - -.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) -.PHONY: tree tree1 treecore treezero treeshark -.PHONY: all compiler1 compiler2 core zero shark -.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs -.PHONY: checks check_os_version check_j2se_version - -.NOTPARALLEL: diff --git a/hotspot/make/aix/adlc_updater b/hotspot/make/aix/adlc_updater deleted file mode 100644 index 99e04e333f2..00000000000 --- a/hotspot/make/aix/adlc_updater +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -# -# This file is used by adlc.make to selectively update generated -# adlc files. Because source and target diretories are relative -# paths, this file is copied to the target build directory before -# use. -# -# adlc-updater -# -fix_lines() { - # repair bare #line directives in $1 to refer to $2 - # and add an override of __FILE__ with just the basename on the - # first line of the file. - awk < $1 > $1+ -v F2=$2 ' - BEGIN { print "#line 1 \"" F2 "\""; } - /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next} - {print} - ' - mv $1+ $1 -} -fix_lines $2/$1 $1 -[ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \ -( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) diff --git a/hotspot/make/aix/makefiles/adjust-mflags.sh b/hotspot/make/aix/makefiles/adjust-mflags.sh deleted file mode 100644 index 6c06819fb74..00000000000 --- a/hotspot/make/aix/makefiles/adjust-mflags.sh +++ /dev/null @@ -1,87 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 1999, 2014, 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. -# -# - -# This script is used only from top.make. -# The macro $(MFLAGS-adjusted) calls this script to -# adjust the "-j" arguments to take into account -# the HOTSPOT_BUILD_JOBS variable. The default -# handling of the "-j" argument by gnumake does -# not meet our needs, so we must adjust it ourselves. - -# This argument adjustment applies to two recursive -# calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make. -# One invokes adlc.make, and the other invokes vm.make. -# The adjustment propagates the desired concurrency -# level down to the sub-make (of the adlc or vm). -# The default behavior of gnumake is to run all -# sub-makes without concurrency ("-j1"). - -# Also, we use a make variable rather than an explicit -# "-j" argument to control this setting, so that -# the concurrency setting (which must be tuned separately -# for each MP system) can be set via an environment variable. -# The recommended setting is 1.5x to 2x the number of available -# CPUs on the MP system, which is large enough to keep the CPUs -# busy (even though some jobs may be I/O bound) but not too large, -# we may presume, to overflow the system's swap space. - -set -eu - -default_build_jobs=4 - -case $# in -[12]) true;; -*) >&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;; -esac - -MFLAGS=$1 -HOTSPOT_BUILD_JOBS=${2-} - -# Normalize any -jN argument to the form " -j${HBJ}" -MFLAGS=` - echo "$MFLAGS" \ - | sed ' - s/^-/ -/ - s/ -\([^ I][^ I]*\)j/ -\1 -j/ - s/ -j[0-9][0-9]*/ -j/ - s/ -j\([^ ]\)/ -j -\1/ - s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ - ' ` - -case ${HOTSPOT_BUILD_JOBS} in \ - -'') case ${MFLAGS} in - *\ -j*) - >&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile." - >&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment." - esac;; - -?*) case ${MFLAGS} in - *\ -j*) true;; - *) MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";; - esac;; -esac - -echo "${MFLAGS}" diff --git a/hotspot/make/aix/makefiles/adlc.make b/hotspot/make/aix/makefiles/adlc.make deleted file mode 100644 index 63dc981410f..00000000000 --- a/hotspot/make/aix/makefiles/adlc.make +++ /dev/null @@ -1,225 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile (adlc.make) is included from the adlc.make in the -# build directories. -# It knows how to compile, link, and run the adlc. - -include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make - -# ######################################################################### - -# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make: -GENERATED = ../generated -OUTDIR = $(GENERATED)/adfiles - -ARCH = $(Platform_arch) -OS = $(Platform_os_family) - -SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad - -ifeq ("${Platform_arch_model}", "${Platform_arch}") - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) -else - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) -endif - -EXEC = $(OUTDIR)/adlc - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor -Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED) -INCLUDES += $(Src_Dirs_I:%=-I%) - -# set flags for adlc compilation -CXXFLAGS = $(SYSDEFS) $(INCLUDES) - -# Force assertions on. -CXXFLAGS += -DASSERT - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -# Suppress warnings (for now) -CFLAGS_WARN = -w -CFLAGS += $(CFLAGS_WARN) - -OBJECTNAMES = \ - adlparse.o \ - archDesc.o \ - arena.o \ - dfa.o \ - dict2.o \ - filebuff.o \ - forms.o \ - formsopt.o \ - formssel.o \ - main.o \ - adlc-opcodes.o \ - output_c.o \ - output_h.o \ - -OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%) - -GENERATEDNAMES = \ - ad_$(Platform_arch_model).cpp \ - ad_$(Platform_arch_model).hpp \ - ad_$(Platform_arch_model)_clone.cpp \ - ad_$(Platform_arch_model)_expand.cpp \ - ad_$(Platform_arch_model)_format.cpp \ - ad_$(Platform_arch_model)_gen.cpp \ - ad_$(Platform_arch_model)_misc.cpp \ - ad_$(Platform_arch_model)_peephole.cpp \ - ad_$(Platform_arch_model)_pipeline.cpp \ - adGlobals_$(Platform_arch_model).hpp \ - dfa_$(Platform_arch_model).cpp \ - -GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) - -# ######################################################################### - -all: $(EXEC) - -$(EXEC) : $(OBJECTS) - @echo $(LOG_INFO) Making adlc - $(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) - -# Random dependencies: -$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp - -# The source files refer to ostream.h, which sparcworks calls iostream.h -$(OBJECTS): ostream.h - -ostream.h : - @echo >$@ '#include ' - -dump: - : OUTDIR=$(OUTDIR) - : OBJECTS=$(OBJECTS) - : products = $(GENERATEDFILES) - -all: $(GENERATEDFILES) - -$(GENERATEDFILES): refresh_adfiles - -# Get a unique temporary directory name, so multiple makes can run in parallel. -# Note that product files are updated via "mv", which is atomic. -TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) - -# Debuggable by default -CFLAGS += -g - -# Pass -D flags into ADLC. -ADLCFLAGS += $(SYSDEFS) - -# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO. -ADLCFLAGS += -q -T - -ADLCFLAGS += -g - -ifdef LP64 -ADLCFLAGS += -D_LP64 -else -ADLCFLAGS += -U_LP64 -endif - -# -# adlc_updater is a simple sh script, under sccs control. It is -# used to selectively update generated adlc files. This should -# provide a nice compilation speed improvement. -# -ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) -ADLC_UPDATER = adlc_updater -$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) - $(QUIETLY) cp $< $@; chmod +x $@ - -# This action refreshes all generated adlc files simultaneously. -# The way it works is this: -# 1) create a scratch directory to work in. -# 2) if the current working directory does not have $(ADLC_UPDATER), copy it. -# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory. -# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. -# 5) If we actually updated any files, echo a notice. -# -refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) - @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) - $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ - -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ - || { rm -rf $(TEMPDIR); exit 1; } - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." - $(QUIETLY) rm -rf $(TEMPDIR) - - -# ######################################################################### - -$(SOURCE.AD): $(SOURCES.AD) - $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD) - -#PROCESS_AD_FILES = cat -# Pass through #line directives, in case user enables -g option above: -PROCESS_AD_FILES = awk '{ \ - if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ - if (need_lineno && $$0 !~ /\/\//) \ - { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ - print }' - -$(OUTDIR)/%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) - -# Some object files are given a prefix, to disambiguate -# them from objects of the same name built for the VM. -$(OUTDIR)/adlc-%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) - -# ######################################################################### - -clean: - rm $(OBJECTS) - -cleanall: - rm $(OBJECTS) $(EXEC) - -# ######################################################################### - -.PHONY: all dump refresh_adfiles clean cleanall diff --git a/hotspot/make/aix/makefiles/build_vm_def.sh b/hotspot/make/aix/makefiles/build_vm_def.sh deleted file mode 100644 index 8d8e8fd2955..00000000000 --- a/hotspot/make/aix/makefiles/build_vm_def.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# If we're cross compiling use that path for nm -if [ "$CROSS_COMPILE_ARCH" != "" ]; then -NM=$ALT_COMPILER_PATH/nm -else -# On AIX we have to prevent that we pick up the 'nm' version from the GNU binutils -# which may be installed under /opt/freeware/bin. So better use an absolute path here! -NM=/usr/bin/nm -fi - -$NM -X64 -B -C $* \ - | awk '{ - if (($2="d" || $2="D") && ($3 ~ /^__vft/ || $3 ~ /^gHotSpotVM/)) print "\t" $3 ";" - if ($3 ~ /^UseSharedSpaces$/) print "\t" $3 ";" - if ($3 ~ /^SharedArchivePath__9Arguments$/) print "\t" $3 ";" - }' \ - | sort -u diff --git a/hotspot/make/aix/makefiles/buildtree.make b/hotspot/make/aix/makefiles/buildtree.make deleted file mode 100644 index 94b71eb760f..00000000000 --- a/hotspot/make/aix/makefiles/buildtree.make +++ /dev/null @@ -1,351 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Usage: -# -# $(MAKE) -f buildtree.make SRCARCH=srcarch BUILDARCH=buildarch LIBARCH=libarch -# GAMMADIR=dir OS_FAMILY=os VARIANT=variant -# -# The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the -# environment or on the command-line: -# -# ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory -# BUILDARCH - build directory -# LIBARCH - the corresponding directory in JDK/JRE -# GAMMADIR - top of workspace -# OS_FAMILY - operating system -# VARIANT - core, compiler1, compiler2, or tiered -# VERSION_STRING - the JDK version string as specified by JEP-223 -# HOTSPOT_VERSION_STRING - the same as VERSION_STRING, unless overridden by a standalone build -# -# Builds the directory trees with makefiles plus some convenience files in -# each directory: -# -# Makefile - for "make foo" -# flags.make - with macro settings -# vm.make - to support making "$(MAKE) -v vm.make" in makefiles -# adlc.make - -# trace.make - generate tracing event and type definitions -# jvmti.make - generate JVMTI bindings from the spec (JSR-163) -# -# The makefiles are split this way so that "make foo" will run faster by not -# having to read the dependency files for the vm. - --include $(SPEC) -include $(GAMMADIR)/make/scm.make -include $(GAMMADIR)/make/defs.make -include $(GAMMADIR)/make/altsrc.make - - -# 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ - -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero -else - ifdef USE_SUNCC - PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc - else - PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) - endif -endif - -# Allow overriding of the arch part of the directory but default -# to BUILDARCH if nothing is specified -ifeq ($(VARIANTARCH),) - VARIANTARCH=$(BUILDARCH) -endif - -ifdef FORCE_TIERED -ifeq ($(VARIANT),tiered) -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_compiler2 -else -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) -endif -else -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) -endif - -# -# We do two levels of exclusion in the shared directory. -# TOPLEVEL excludes are pruned, they are not recursively searched, -# but lower level directories can be named without fear of collision. -# ALWAYS excludes are excluded at any level in the directory tree. -# - -ALWAYS_EXCLUDE_DIRS = $(SCM_DIRS) - -ifeq ($(VARIANT),tiered) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent -else -ifeq ($(VARIANT),compiler2) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent -else -# compiler1 and core use the same exclude list -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent -endif -endif - -# Get things from the platform file. -COMPILER = $(shell sed -n 's/^compiler[ ]*=[ ]*//p' $(PLATFORM_FILE)) - -SIMPLE_DIRS = \ - $(PLATFORM_DIR)/generated/dependencies \ - $(PLATFORM_DIR)/generated/adfiles \ - $(PLATFORM_DIR)/generated/jvmtifiles \ - $(PLATFORM_DIR)/generated/tracefiles - -TARGETS = debug fastdebug optimized product -SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) - -# For dependencies and recursive makes. -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make - -BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make - -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ - SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) - -# Define variables to be set in flags.make. -# Default values are set in make/defs.make. - -# Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami) -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME) -endif -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell whoami) -endif -# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro -# or make/hotspot_distro. -ifndef HOTSPOT_VM_DISTRO - ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - include $(GAMMADIR)/make/hotspot_distro - else - include $(GAMMADIR)/make/openjdk_distro - endif -endif - -# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK -ifndef OPENJDK - ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - OPENJDK=true - endif -endif - -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) - -BUILDTREE = \ - $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS) - -BUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)" - -all: $(SUBMAKE_DIRS) - -# Run make in each subdirectory recursively. -$(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE - $(QUIETLY) [ -d $@ ] || { mkdir -p $@; } - +$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F) - $(QUIETLY) touch $@ - -$(SIMPLE_DIRS): - $(QUIETLY) mkdir -p $@ - -# Convenience macro which takes a source relative path, applies $(1) to the -# absolute path, and then replaces $(GAMMADIR) in the result with a -# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. -gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2))) - -# This bit is needed to enable local rebuilds. -# Unless the makefile itself sets LP64, any environmental -# setting of LP64 will interfere with the build. -LP64_SETTING/32 = LP64 = \#empty -LP64_SETTING/64 = LP64 = 1 - -DATA_MODE/ppc64 = 64 - -DATA_MODE = $(DATA_MODE/$(BUILDARCH)) - -flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \ - sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \ - echo; \ - echo "GAMMADIR = $(GAMMADIR)"; \ - echo "HS_ALT_MAKE = $(HS_ALT_MAKE)"; \ - echo "OSNAME = $(OSNAME)"; \ - echo "SYSDEFS = \$$(Platform_sysdefs)"; \ - echo "SRCARCH = $(SRCARCH)"; \ - echo "BUILDARCH = $(BUILDARCH)"; \ - echo "LIBARCH = $(LIBARCH)"; \ - echo "TARGET = $(TARGET)"; \ - echo "HOTSPOT_VERSION_STRING = $(HOTSPOT_VERSION_STRING)"; \ - echo "VERSION_STRING = $(VERSION_STRING)"; \ - echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ - echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ - echo "OPENJDK = $(OPENJDK)"; \ - echo "$(LP64_SETTING/$(DATA_MODE))"; \ - echo; \ - echo "# Used for platform dispatching"; \ - echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \ - echo "CFLAGS += \$$(TARGET_DEFINES)"; \ - echo; \ - echo "Src_Dirs_V = \\"; \ - sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ - echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - echo; \ - echo "Src_Dirs_I = \\"; \ - echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,altsrc,share/vm) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm) \\"; \ - echo "$(call gamma-path,altsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - [ -n "$(CFLAGS_BROWSE)" ] && \ - echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ - [ -n "$(ENABLE_FULL_DEBUG_SYMBOLS)" ] && \ - echo && echo "ENABLE_FULL_DEBUG_SYMBOLS = $(ENABLE_FULL_DEBUG_SYMBOLS)"; \ - [ -n "$(OBJCOPY)" ] && \ - echo && echo "OBJCOPY = $(OBJCOPY)"; \ - [ -n "$(STRIP_POLICY)" ] && \ - echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \ - [ -n "$(ZIP_DEBUGINFO_FILES)" ] && \ - echo && echo "ZIP_DEBUGINFO_FILES = $(ZIP_DEBUGINFO_FILES)"; \ - [ -n "$(ZIPEXE)" ] && \ - echo && echo "ZIPEXE = $(ZIPEXE)"; \ - [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ - echo && \ - echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ - echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ - [ -n "$(INCLUDE_TRACE)" ] && \ - echo && echo "INCLUDE_TRACE = $(INCLUDE_TRACE)"; \ - echo; \ - [ -n "$(SPEC)" ] && \ - echo "include $(SPEC)"; \ - echo "CP ?= cp"; \ - echo "MV ?= mv"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ - echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ - ) > $@ - -flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \ - ) > $@ - -../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo $(LOG_INFO) Creating directory list $@ - $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ - find $(HS_ALT_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \ - fi; - $(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ - -Makefile: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/top.make"; \ - ) > $@ - -vm.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo include flags_vm.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -adlc.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -jvmti.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -trace.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -FORCE: - -.PHONY: all FORCE - -.NOTPARALLEL: diff --git a/hotspot/make/aix/makefiles/compiler2.make b/hotspot/make/aix/makefiles/compiler2.make deleted file mode 100644 index 13986308edf..00000000000 --- a/hotspot/make/aix/makefiles/compiler2.make +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making server version of VM - -TYPE=COMPILER2 - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 diff --git a/hotspot/make/aix/makefiles/core.make b/hotspot/make/aix/makefiles/core.make deleted file mode 100644 index 56d85c8fc16..00000000000 --- a/hotspot/make/aix/makefiles/core.make +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making core version of VM - -# Select which files to use (in top.make) -TYPE=CORE - -# There is no "core" directory in JDK. Install core build in server directory. -VM_SUBDIR = server - -# Note: macros.hpp defines CORE diff --git a/hotspot/make/aix/makefiles/debug.make b/hotspot/make/aix/makefiles/debug.make deleted file mode 100644 index 1a1c4ebbd7d..00000000000 --- a/hotspot/make/aix/makefiles/debug.make +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -DEBUG_CFLAGS/DEFAULT= $(DEBUG_CFLAGS) -DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)) -CFLAGS += $(DEBUG_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/aix/makefiles/mapfile-vers-debug - -VERSION = debug -SYSDEFS += -DASSERT -DDEBUG -PICFLAGS = DEFAULT diff --git a/hotspot/make/aix/makefiles/defs.make b/hotspot/make/aix/makefiles/defs.make deleted file mode 100644 index b9c54e36149..00000000000 --- a/hotspot/make/aix/makefiles/defs.make +++ /dev/null @@ -1,204 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# The common definitions for hotspot AIX builds. -# Include the top level defs.make under make directory instead of this one. -# This file is included into make/defs.make. - -SLASH_JAVA ?= /java - -define print_info - ifneq ($$(LOG_LEVEL), warn) - $$(shell echo >&2 "INFO: $1") - endif -endef - -# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name -#ARCH:=$(shell uname -m) -PATH_SEP = : -ifeq ($(LP64), 1) - ARCH_DATA_MODEL ?= 64 -else - ARCH_DATA_MODEL ?= 32 -endif - -ifeq ($(ARCH_DATA_MODEL), 64) - ARCH = ppc64 -else - ARCH = ppc -endif - -# PPC -ifeq ($(ARCH), ppc) - #ARCH_DATA_MODEL = 32 - PLATFORM = aix-ppc - VM_PLATFORM = aix_ppc - HS_ARCH = ppc -endif - -# PPC64 -ifeq ($(ARCH), ppc64) - #ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = aix-ppc64 - VM_PLATFORM = aix_ppc64 - HS_ARCH = ppc -endif - -# On 32 bit aix we build server and client, on 64 bit just server. -ifeq ($(JVM_VARIANTS),) - ifeq ($(ARCH_DATA_MODEL), 32) - JVM_VARIANTS:=client,server - JVM_VARIANT_CLIENT:=true - JVM_VARIANT_SERVER:=true - else - JVM_VARIANTS:=server - JVM_VARIANT_SERVER:=true - endif -endif - -# The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product -# builds is enabled with debug info files ZIP'ed to save space. For -# BUILD_FLAVOR != product builds, FDS is always enabled, after all a -# debug build without debug info isn't very useful. -# The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. -# -# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be -# disabled for a BUILD_FLAVOR == product build. -# -# Note: Use of a different variable name for the FDS override option -# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS -# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass -# in options via environment variables, use of distinct variables -# prevents strange behaviours. For example, in a BUILD_FLAVOR != -# product build, the FULL_DEBUG_SYMBOLS environment variable will be -# 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If -# the same variable name is used, then different values can be picked -# up by different parts of the build. Just to be clear, we only need -# two variable names because the incoming option value can be -# overridden in some situations, e.g., a BUILD_FLAVOR != product -# build. - -# Due to the multiple sub-make processes that occur this logic gets -# executed multiple times. We reduce the noise by at least checking that -# BUILD_FLAVOR has been set. -ifneq ($(BUILD_FLAVOR),) - ifeq ($(BUILD_FLAVOR), product) - FULL_DEBUG_SYMBOLS ?= 1 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) - else - # debug variants always get Full Debug Symbols (if available) - ENABLE_FULL_DEBUG_SYMBOLS = 1 - endif - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # Default OBJCOPY comes from GNU Binutils on Linux - ifeq ($(CROSS_COMPILE_ARCH),) - DEF_OBJCOPY=/usr/bin/objcopy - else - # Assume objcopy is part of the cross-compilation toolset - ifneq ($(ALT_COMPILER_PATH),) - DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy - endif - endif - OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) - ifneq ($(ALT_OBJCOPY),) - $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) - OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) - endif - - ifeq ($(OBJCOPY),) - $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")) - ENABLE_FULL_DEBUG_SYMBOLS=0 - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - else - $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) - - # Library stripping policies for .debuginfo configs: - # all_strip - strips everything from the library - # min_strip - strips most stuff from the library; leaves minimum symbols - # no_strip - does not strip the library at all - # - # Oracle security policy requires "all_strip". A waiver was granted on - # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. - # - # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. - # - STRIP_POLICY ?= min_strip - - $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) - - ZIP_DEBUGINFO_FILES ?= 1 - - $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) - endif - endif # ENABLE_FULL_DEBUG_SYMBOLS=1 -endif # BUILD_FLAVOR - -# unused JDK_INCLUDE_SUBDIR=aix - -# Library suffix -LIBRARY_SUFFIX=so - -EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html - -# client and server subdirectories have symbolic links to ../libjsig.so -EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz -# else -# EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo -# endif -#endif -EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server -EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client -EXPORT_MINIMAL_DIR = $(EXPORT_LIB_ARCH_DIR)/minimal - -ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) -# ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz -# else -# EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo -# endif -# endif -endif - -ifeq ($(JVM_VARIANT_CLIENT),true) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) -# ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz -# else -# EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo -# endif -# endif -endif diff --git a/hotspot/make/aix/makefiles/dtrace.make b/hotspot/make/aix/makefiles/dtrace.make deleted file mode 100644 index 749877d4aee..00000000000 --- a/hotspot/make/aix/makefiles/dtrace.make +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Linux does not build jvm_db -LIBJVM_DB = - diff --git a/hotspot/make/aix/makefiles/fastdebug.make b/hotspot/make/aix/makefiles/fastdebug.make deleted file mode 100644 index c0d50079d16..00000000000 --- a/hotspot/make/aix/makefiles/fastdebug.make +++ /dev/null @@ -1,72 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -# Pare down optimization to -O2 if xlCV10.1 is in use. -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) $(QV10_OPT_CONSERVATIVE) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -ifeq ($(BUILDARCH), ia64) - # Bug in GCC, causes hang. -O1 will override the -O3 specified earlier - OPT_CFLAGS/callGenerator.o += -O1 - OPT_CFLAGS/ciTypeFlow.o += -O1 - OPT_CFLAGS/compile.o += -O1 - OPT_CFLAGS/concurrentMarkSweepGeneration.o += -O1 - OPT_CFLAGS/doCall.o += -O1 - OPT_CFLAGS/generateOopMap.o += -O1 - OPT_CFLAGS/generateOptoStub.o += -O1 - OPT_CFLAGS/graphKit.o += -O1 - OPT_CFLAGS/instanceKlass.o += -O1 - OPT_CFLAGS/interpreterRT_ia64.o += -O1 - OPT_CFLAGS/output.o += -O1 - OPT_CFLAGS/parse1.o += -O1 - OPT_CFLAGS/runtime.o += -O1 - OPT_CFLAGS/synchronizer.o += -O1 -endif - - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/aix/makefiles/mapfile-vers-debug - -# xlc 10.1 parameters for ipa linkage. -# - remove ipa linkage altogether. Does not seem to benefit performance, -# but increases code footprint. -# - this is a debug build in the end. Extra effort for ipa linkage is thus -# not justified. -LFLAGS_QIPA= - -VERSION = optimized -SYSDEFS += -DASSERT -PICFLAGS = DEFAULT diff --git a/hotspot/make/aix/makefiles/jsig.make b/hotspot/make/aix/makefiles/jsig.make deleted file mode 100644 index 86c4bea5ae1..00000000000 --- a/hotspot/make/aix/makefiles/jsig.make +++ /dev/null @@ -1,87 +0,0 @@ -# -# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Rules to build signal interposition library, used by vm.make - -# libjsig.so: signal interposition library -JSIG = jsig -LIBJSIG = lib$(JSIG).so - -LIBJSIG_DEBUGINFO = lib$(JSIG).debuginfo -LIBJSIG_DIZ = lib$(JSIG).diz - -JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm - -DEST_JSIG = $(JDK_LIBDIR)/$(LIBJSIG) -DEST_JSIG_DEBUGINFO = $(JDK_LIBDIR)/$(LIBJSIG_DEBUGINFO) -DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ) - -LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig - -# On Linux we really dont want a mapfile, as this library is small -# and preloaded using LD_PRELOAD, making functions private will -# cause problems with interposing. See CR: 6466665 -# LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) - -LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT $(LDFLAGS_HASH_STYLE) - -LFLAGS_JSIG += $(BIN_UTILS) - -# DEBUG_BINARIES overrides everything, use full -g debug information -ifeq ($(DEBUG_BINARIES), true) - JSIG_DEBUG_CFLAGS = -g -endif - -$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo $(LOG_INFO) Making signal interposition lib... - $(QUIETLY) $(CXX) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ - $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl - -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ -# ifeq ($(STRIP_POLICY),all_strip) -# $(QUIETLY) $(STRIP) $@ -# else -# ifeq ($(STRIP_POLICY),min_strip) -# $(QUIETLY) $(STRIP) -g $@ -# # implied else here is no stripping at all -# endif -# endif -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) -# $(RM) $(LIBJSIG_DEBUGINFO) -# endif -#endif - -install_jsig: $(LIBJSIG) - @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" - $(QUIETLY) test -f $(LIBJSIG_DEBUGINFO) && \ - $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) - $(QUIETLY) test -f $(LIBJSIG_DIZ) && \ - $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" - -.PHONY: install_jsig diff --git a/hotspot/make/aix/makefiles/jvmti.make b/hotspot/make/aix/makefiles/jvmti.make deleted file mode 100644 index cff6a741da6..00000000000 --- a/hotspot/make/aix/makefiles/jvmti.make +++ /dev/null @@ -1,117 +0,0 @@ -# -# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile (jvmti.make) is included from the jvmti.make in the -# build directories. -# -# It knows how to build and run the tools to generate jvmti. - -include $(GAMMADIR)/make/aix/makefiles/rules.make - -# ######################################################################### - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles - -JvmtiSrcDir = $(GAMMADIR)/src/share/vm/prims -InterpreterSrcDir = $(GAMMADIR)/src/share/vm/interpreter - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(JvmtiSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -JvmtiGeneratedNames = \ - jvmtiEnv.hpp \ - jvmtiEnter.cpp \ - jvmtiEnterTrace.cpp \ - jvmtiEnvRecommended.cpp \ - bytecodeInterpreterWithChecks.cpp \ - jvmti.h \ - -JvmtiEnvFillSource = $(JvmtiSrcDir)/jvmtiEnvFill.java -JvmtiEnvFillClass = $(JvmtiOutDir)/jvmtiEnvFill.class - -JvmtiGenSource = $(JvmtiSrcDir)/jvmtiGen.java -JvmtiGenClass = $(JvmtiOutDir)/jvmtiGen.class - -JvmtiGeneratedFiles = $(JvmtiGeneratedNames:%=$(JvmtiOutDir)/%) - -XSLT = $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -.PHONY: all jvmtidocs clean cleanall - -# ######################################################################### - -all: $(JvmtiGeneratedFiles) - -both = $(JvmtiGenClass) $(JvmtiSrcDir)/jvmti.xml $(JvmtiSrcDir)/jvmtiLib.xsl - -$(JvmtiGenClass): $(JvmtiGenSource) - $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiGenSource) - -$(JvmtiEnvFillClass): $(JvmtiEnvFillSource) - $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) - -$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti - -$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp - -$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace - -$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp - $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp - -$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp - -$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h - -jvmtidocs: $(JvmtiOutDir)/jvmti.html - -$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html - -# ######################################################################### - -clean : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -cleanall : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -# ######################################################################### diff --git a/hotspot/make/aix/makefiles/mapfile-vers-debug b/hotspot/make/aix/makefiles/mapfile-vers-debug deleted file mode 100644 index fb75f3dfcea..00000000000 --- a/hotspot/make/aix/makefiles/mapfile-vers-debug +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - JVM_handle_linux_signal; - - # debug JVM - JVM_AccessVMBooleanFlag; - JVM_AccessVMIntFlag; - JVM_VMBreakPoint; - - # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; - - # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE - - local: - *; -}; - diff --git a/hotspot/make/aix/makefiles/mapfile-vers-jsig b/hotspot/make/aix/makefiles/mapfile-vers-jsig deleted file mode 100644 index ddb46c050ec..00000000000 --- a/hotspot/make/aix/makefiles/mapfile-vers-jsig +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - JVM_begin_signal_setting; - JVM_end_signal_setting; - JVM_get_libjsig_version; - JVM_get_signal_action; - sigaction; - signal; - sigset; - local: - *; -}; diff --git a/hotspot/make/aix/makefiles/mapfile-vers-product b/hotspot/make/aix/makefiles/mapfile-vers-product deleted file mode 100644 index ec0f06d8f65..00000000000 --- a/hotspot/make/aix/makefiles/mapfile-vers-product +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - JVM_handle_linux_signal; - - # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; - - # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE - - local: - *; -}; - diff --git a/hotspot/make/aix/makefiles/ppc64.make b/hotspot/make/aix/makefiles/ppc64.make deleted file mode 100644 index d7ad9510e11..00000000000 --- a/hotspot/make/aix/makefiles/ppc64.make +++ /dev/null @@ -1,93 +0,0 @@ -# -# Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2015 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Produce 64 bits object files. -CFLAGS += -q64 - -# Balanced tuning for recent versions of the POWER architecture (if supported by xlc). -QTUNE=$(if $(CXX_SUPPORTS_BALANCED_TUNING),balanced,pwr5) - -# Try to speed up the interpreter: use ppc64 instructions and inline -# glue code for external functions. -OPT_CFLAGS += -qarch=ppc64 -qtune=$(QTUNE) -qinlglue - -# We need variable length arrays -CFLAGS += -qlanglvl=c99vla -# Just to check for unwanted macro redefinitions -CFLAGS += -qlanglvl=noredefmac - -# Suppress those "implicit private" warnings xlc gives. -# - The omitted keyword "private" is assumed for base class "...". -CFLAGS += -qsuppress=1540-0198 - -# Suppress the following numerous warning: -# - 1540-1090 (I) The destructor of "..." might not be called. -# - 1500-010: (W) WARNING in ...: Infinite loop. Program may not stop. -# There are several infinite loops in the vm, suppress. -# - 1540-1639 (I) The behavior of long type bit fields has changed ... -# ... long type bit fields now default to long, not int. -CFLAGS += -qsuppress=1540-1090 -qsuppress=1500-010 -qsuppress=1540-1639 - -# Suppress -# - 540-1088 (W) The exception specification is being ignored. -# caused by throw() in declaration of new() in nmethod.hpp. -CFLAGS += -qsuppress=1540-1088 - -# Turn off floating-point optimizations that may alter program semantics -OPT_CFLAGS += -qstrict - -# Disable aggressive optimizations for functions in sharedRuntimeTrig.cpp -# and sharedRuntimeTrans.cpp on ppc64. -# -qstrict turns off the following optimizations: -# * Performing code motion and scheduling on computations such as loads -# and floating-point computations that may trigger an exception. -# * Relaxing conformance to IEEE rules. -# * Reassociating floating-point expressions. -# When using '-qstrict' there still remains one problem -# in javasoft.sqe.tests.api.java.lang.Math.sin5Tests when run in compile-all -# mode, so don't optimize sharedRuntimeTrig.cpp at all. -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) - -# Xlc 10.1 parameters for aggressive optimization: -# - qhot=level=1: Most aggressive loop optimizations. -# - qignerrno: Assume errno is not modified by system calls. -# - qinline: Inline method calls. No suboptions for c++ compiles. -# - qxflag=ASMMIDCOALFIX: Activate fix for -O3 problem in interpreter loop. -# - qxflag=asmfastsync: Activate fix for performance problem with inline assembler with memory clobber. -QV10_OPT=$(if $(CXX_IS_V10),-qxflag=ASMMIDCOALFIX -qxflag=asmfastsync) -QV10_OPT_AGGRESSIVE=$(if $(CXX_IS_V10),-qhot=level=1 -qignerrno -qinline) -QV10_OPT_CONSERVATIVE=$(if $(CXX_IS_V10),-qhot=level=1 -qignerrno -qinline) - -# Disallow inlining for synchronizer.cpp, but perform O3 optimizations. -OPT_CFLAGS/synchronizer.o = $(OPT_CFLAGS) -qnoinline - -# Set all the xlC V10.1 options here. -OPT_CFLAGS += $(QV10_OPT) $(QV10_OPT_AGGRESSIVE) - -export OBJECT_MODE=64 - -# Also build launcher as 64 bit executable. -LAUNCHERFLAGS += -q64 diff --git a/hotspot/make/aix/makefiles/product.make b/hotspot/make/aix/makefiles/product.make deleted file mode 100644 index f36ef69b32e..00000000000 --- a/hotspot/make/aix/makefiles/product.make +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making optimized version of Gamma VM -# (This is the "product", not the "release" version.) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/aix/makefiles/mapfile-vers-product - -# Remove ipa linkage altogether. Does not seem to benfit performance, but increases code footprint. -LFLAGS_QIPA= - -SYSDEFS += -DPRODUCT -VERSION = optimized - -# use -g to strip library as -x will discard its symbol table; -x is fine for -# executables. -# Note: these macros are not used in .debuginfo configs -STRIP_LIBJVM = $(STRIP) -g $@ || exit 1; -STRIP_AOUT = $(STRIP) -x $@ || exit 1; - -# If we can create .debuginfo files, then the VM is stripped in vm.make -# and this macro is not used. -# LINK_LIB.CXX/POST_HOOK += $(STRIP_$(LINK_INTO)) diff --git a/hotspot/make/aix/makefiles/rules.make b/hotspot/make/aix/makefiles/rules.make deleted file mode 100644 index effca45effa..00000000000 --- a/hotspot/make/aix/makefiles/rules.make +++ /dev/null @@ -1,208 +0,0 @@ -# -# Copyright (c) 2003, 2014, 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. -# -# - -# Common rules/macros for the vm, adlc. - -# Tell make that .cpp is important -.SUFFIXES: .cpp $(SUFFIXES) - -DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ - -# $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). -CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS) -CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS) - -AS.S = $(AS) $(ASFLAGS) - -COMPILE.CC = $(CC_COMPILE) -c -GENASM.CC = $(CC_COMPILE) -S -LINK.CC = $(CC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -LINK_LIB.CC = $(CC) $(LFLAGS) $(SHARED_FLAG) -PREPROCESS.CC = $(CC_COMPILE) -E - -COMPILE.CXX = $(CXX_COMPILE) -c -GENASM.CXX = $(CXX_COMPILE) -S -LINK.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -LINK_NOPROF.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) -LINK_LIB.CXX = $(CXX) $(LFLAGS) $(SHARED_FLAG) -PREPROCESS.CXX = $(CXX_COMPILE) -E - -# cross compiling the jvm with c2 requires host compilers to build -# adlc tool - -HOST.CXX_COMPILE = $(HOSTCXX) $(CXXFLAGS) $(CFLAGS) -HOST.COMPILE.CXX = $(HOST.CXX_COMPILE) -c -HOST.LINK_NOPROF.CXX = $(HOSTCXX) $(LFLAGS) $(AOUT_FLAGS) - - -# Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k". -REMOVE_TARGET = rm -f $@ - -# Note use of ALT_BOOTDIR to explicitly specify location of java and -# javac; this is the same environment variable used in the J2SE build -# process for overriding the default spec, which is BOOTDIR. -# Note also that we fall back to using JAVA_HOME if neither of these is -# specified. - -ifdef ALT_BOOTDIR - -RUN.JAVA = $(ALT_BOOTDIR)/bin/java -RUN.JAVAP = $(ALT_BOOTDIR)/bin/javap -RUN.JAVAH = $(ALT_BOOTDIR)/bin/javah -RUN.JAR = $(ALT_BOOTDIR)/bin/jar -COMPILE.JAVAC = $(ALT_BOOTDIR)/bin/javac -COMPILE.RMIC = $(ALT_BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(ALT_BOOTDIR) - -else - -ifdef BOOTDIR - -RUN.JAVA = $(BOOTDIR)/bin/java -RUN.JAVAP = $(BOOTDIR)/bin/javap -RUN.JAVAH = $(BOOTDIR)/bin/javah -RUN.JAR = $(BOOTDIR)/bin/jar -COMPILE.JAVAC = $(BOOTDIR)/bin/javac -COMPILE.RMIC = $(BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(BOOTDIR) - -else - -ifdef JAVA_HOME - -RUN.JAVA = $(JAVA_HOME)/bin/java -RUN.JAVAP = $(JAVA_HOME)/bin/javap -RUN.JAVAH = $(JAVA_HOME)/bin/javah -RUN.JAR = $(JAVA_HOME)/bin/jar -COMPILE.JAVAC = $(JAVA_HOME)/bin/javac -COMPILE.RMIC = $(JAVA_HOME)/bin/rmic -BOOT_JAVA_HOME = $(JAVA_HOME) - -else - -# take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined - -RUN.JAVA = java -RUN.JAVAP = javap -RUN.JAVAH = javah -RUN.JAR = jar -COMPILE.JAVAC = javac -COMPILE.RMIC = rmic - -endif -endif -endif - -COMPILE.JAVAC += $(BOOTSTRAP_JAVAC_FLAGS) - -SUM = /usr/bin/sum - -# 'gmake MAKE_VERBOSE=y' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ -RUN.JAR$(MAKE_VERBOSE) += >/dev/null - -# Settings for javac -JAVAC_FLAGS = -g -encoding ascii - -# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system) -# Fall back to the values here if it's not set (hotspot only builds) -ifeq ($(BOOT_JDK_SOURCETARGET),) -BOOTSTRAP_SOURCETARGET := -source 8 -target 8 -else -BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET) -endif - -BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET) - -# With parallel makes, print a message at the end of compilation. -ifeq ($(findstring j,$(MFLAGS)),j) -COMPILE_DONE = && { echo Done with $<; } -endif - -# Include $(NONPIC_OBJ_FILES) definition -ifndef LP64 -include $(GAMMADIR)/make/pic.make -endif - -include $(GAMMADIR)/make/altsrc.make - -# The non-PIC object files are only generated for 32 bit platforms. -ifdef LP64 -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) -else -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ - $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ - $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)) -endif - -%.o: %.s - @echo $(LOG_INFO) Assembling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) - -%.s: %.cpp - @echo $(LOG_INFO) Generating assembly for $< - $(QUIETLY) $(GENASM.CXX) -o $@ $< - $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) - -# Intermediate files (for debugging macros) -%.i: %.cpp - @echo $(LOG_INFO) Preprocessing $< to $@ - $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) - -# Override gnumake built-in rules which do sccs get operations badly. -# (They put the checked out code in the current directory, not in the -# directory of the original file.) Since this is a symptom of a teamware -# failure, and since not all problems can be detected by gnumake due -# to incomplete dependency checking... just complain and stop. -%:: s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -%:: SCCS/s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -.PHONY: default diff --git a/hotspot/make/aix/makefiles/tiered.make b/hotspot/make/aix/makefiles/tiered.make deleted file mode 100644 index f04496bdb60..00000000000 --- a/hotspot/make/aix/makefiles/tiered.make +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2015 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making tiered version of VM - -TYPE=TIERED - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 -DCOMPILER1 diff --git a/hotspot/make/aix/makefiles/top.make b/hotspot/make/aix/makefiles/top.make deleted file mode 100644 index fa9107c039d..00000000000 --- a/hotspot/make/aix/makefiles/top.make +++ /dev/null @@ -1,147 +0,0 @@ -# -# Copyright (c) 1999, 2014, 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. -# -# - -# top.make is included in the Makefile in the build directories. -# It DOES NOT include the vm dependency info in order to be faster. -# Its main job is to implement the incremental form of make lists. -# It also: -# -builds and runs adlc via adlc.make -# -generates JVMTI source and docs via jvmti.make (JSR-163) - -# It assumes the following flags are set: -# CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Obj_Files - -# -- D. Ungar (5/97) from a file by Bill Bush - -# Don't override the built-in $(MAKE). -# Instead, use "gmake" (or "gnumake") from the command line. --Rose -#MAKE = gmake - -include $(GAMMADIR)/make/altsrc.make - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -VM = $(GAMMADIR)/src/share/vm -Plat_File = $(Platform_file) -CDG = cd $(GENERATED); - -ifneq ($(USE_PRECOMPILED_HEADER),0) -UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) -else -UpdatePCH = \# precompiled header is not used -endif - -Cached_plat = $(GENERATED)/platform.current - -AD_Dir = $(GENERATED)/adfiles -ADLC = $(AD_Dir)/adlc -AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad) -AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc) -AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp -AD_Files = $(AD_Names:%=$(AD_Dir)/%) - -# AD_Files_If_Required/COMPILER1 = ad_stuff -AD_Files_If_Required/COMPILER2 = ad_stuff -AD_Files_If_Required/TIERED = ad_stuff -AD_Files_If_Required = $(AD_Files_If_Required/$(TYPE)) - -# Wierd argument adjustment for "gnumake -j..." -adjust-mflags = $(GENERATED)/adjust-mflags -# If SPEC is set, it's from configure and it's already controlling concurrency -# for us. Skip setting -j with HOTSPOT_BUILD_JOBS. -ifeq ($(SPEC), ) - MFLAGS-adjusted = -r `$(adjust-mflags) "$(MFLAGS)" "$(HOTSPOT_BUILD_JOBS)"` -else - MFLAGS-adjusted = -r $(MFLAGS) -endif - - -# default target: update lists, make vm -# done in stages to force sequential order with parallel make -# - -default: vm_build_preliminaries the_vm - @echo All done. - -# This is an explicit dependency for the sake of parallel makes. -vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) trace_stuff jvmti_stuff - @# We need a null action here, so implicit rules don't get consulted. - -$(Cached_plat): $(Plat_File) - $(CDG) $(CP) $(Plat_File) $(Cached_plat) - -# make AD files as necessary -ad_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f adlc.make $(MFLAGS-adjusted) - -# generate JVMTI files from the spec -jvmti_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f jvmti.make $(MFLAGS-adjusted) - -# generate trace files -trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f trace.make $(MFLAGS-adjusted) - -# and the VM: must use other makefile with dependencies included - -# We have to go to great lengths to get control over the -jN argument -# to the recursive invocation of vm.make. The problem is that gnumake -# resets -jN to -j1 for recursive runs. (How helpful.) -# Note that the user must specify the desired parallelism level via a -# command-line or environment variable name HOTSPOT_BUILD_JOBS. -$(adjust-mflags): $(GAMMADIR)/make/$(Platform_os_family)/makefiles/adjust-mflags.sh - @+rm -f $@ $@+ - @+cat $< > $@+ - @+chmod +x $@+ - @+mv $@+ $@ - -the_vm: vm_build_preliminaries $(adjust-mflags) - +@$(UpdatePCH) - @$(MAKE) -f vm.make $(MFLAGS-adjusted) - -install gamma: the_vm - @$(MAKE) -f vm.make $@ - -# next rules support "make foo.[ois]" - -%.o %.i %.s: - +$(UpdatePCH) - $(MAKE) -f vm.make $(MFLAGS) $@ - #$(MAKE) -f vm.make $@ - -# this should force everything to be rebuilt -clean: - rm -f $(GENERATED)/*.class - $(MAKE) -f vm.make $(MFLAGS) clean - -# just in case it doesn't, this should do it -realclean: - $(MAKE) -f vm.make $(MFLAGS) clean - rm -fr $(GENERATED) - -.PHONY: default vm_build_preliminaries -.PHONY: lists ad_stuff jvmti_stuff the_vm clean realclean -.PHONY: checks check_os_version install - -.NOTPARALLEL: diff --git a/hotspot/make/aix/makefiles/trace.make b/hotspot/make/aix/makefiles/trace.make deleted file mode 100644 index f17e75e1f4f..00000000000 --- a/hotspot/make/aix/makefiles/trace.make +++ /dev/null @@ -1,119 +0,0 @@ -# -# Copyright (c) 2003, 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. -# -# - -# This makefile (trace.make) is included from the trace.make in the -# build directories. -# -# It knows how to build and run the tools to generate trace files. - -include $(GAMMADIR)/make/aix/makefiles/rules.make -include $(GAMMADIR)/make/altsrc.make - -# ######################################################################### - -HAS_ALT_SRC := false -ifndef OPENJDK - ifneq ($(wildcard $(HS_ALT_SRC)/share/vm/trace), ) - HAS_ALT_SRC := true - endif -endif - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles -TraceOutDir = $(GENERATED)/tracefiles - -TraceAltSrcDir = $(HS_ALT_SRC)/share/vm/trace -TraceSrcDir = $(HS_COMMON_SRC)/share/vm/trace - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(TraceSrcDir) $(TraceAltSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -TraceGeneratedNames = \ - traceEventClasses.hpp \ - traceEventIds.hpp \ - traceTypes.hpp - -ifeq ($(HAS_ALT_SRC), true) -TraceGeneratedNames += \ - traceRequestables.hpp \ - traceEventControl.hpp -endif - -TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) - -XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -TraceXml = $(TraceSrcDir)/trace.xml -ifeq ($(HAS_ALT_SRC), true) - TraceXml = $(TraceAltSrcDir)/trace.xml -endif - -XML_DEPS = $(TraceXml) $(TraceSrcDir)/tracetypes.xml \ - $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod \ - $(TraceSrcDir)/tracerelationdecls.xml $(TraceSrcDir)/traceevents.xml -ifeq ($(HAS_ALT_SRC), true) - XML_DEPS += $(TraceAltSrcDir)/traceeventscustom.xml \ - $(TraceAltSrcDir)/traceeventtypes.xml -endif - -.PHONY: all clean cleanall - -# ######################################################################### - -all: $(TraceGeneratedFiles) - -GENERATE_CODE= \ - $(QUIETLY) echo $(LOG_INFO) Generating $@; \ - $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@ - -$(TraceOutDir)/traceEventIds.hpp: $(TraceXml) $(TraceSrcDir)/traceEventIds.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceTypes.hpp: $(TraceXml) $(TraceSrcDir)/traceTypes.xsl $(XML_DEPS) - $(GENERATE_CODE) - -ifeq ($(HAS_ALT_SRC), false) - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -else - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceRequestables.hpp: $(TraceXml) $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceEventControl.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS) - $(GENERATE_CODE) - -endif - -# ######################################################################### - -clean cleanall: - rm $(TraceGeneratedFiles) diff --git a/hotspot/make/aix/makefiles/vm.make b/hotspot/make/aix/makefiles/vm.make deleted file mode 100644 index 808bb124892..00000000000 --- a/hotspot/make/aix/makefiles/vm.make +++ /dev/null @@ -1,370 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Rules to build JVM and related libraries, included from vm.make in the build -# directory. - -# Common build rules. -MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles -include $(MAKEFILES_DIR)/rules.make -include $(GAMMADIR)/make/altsrc.make - -default: build - -#---------------------------------------------------------------------- -# Defs - -GENERATED = ../generated -DEP_DIR = $(GENERATED)/dependencies - -# reads the generated files defining the set of .o's and the .o .h dependencies --include $(DEP_DIR)/*.d - -# read machine-specific adjustments (%%% should do this via buildtree.make?) -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - include $(MAKEFILES_DIR)/zeroshark.make -else - include $(MAKEFILES_DIR)/$(BUILDARCH).make -endif - -# set VPATH so make knows where to look for source files -# Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm -# The adfiles directory contains ad_.[ch]pp. -# The jvmtifiles directory contains jvmti*.[ch]pp -Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor. -Src_Dirs_I += $(GENERATED) -# The order is important for the precompiled headers to work. -INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%) - -# SYMFLAG is used by jsig.make -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # always build with debug info when we can create .debuginfo files - SYMFLAG = -g -else - ifeq (${VERSION}, debug) - SYMFLAG = -g - else - SYMFLAG = - endif -endif - -# The following variables are defined in the generated flags.make file. -JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \ - -DVERSION_MINOR=$(VERSION_MINOR) \ - -DVERSION_SECURITY=$(VERSION_SECURITY) \ - -DVERSION_PATCH=$(VERSION_PATCH) \ - -DVERSION_BUILD=$(VERSION_BUILD) -VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \ - -DVERSION_STRING="\"$(VERSION_STRING)\"" \ - -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \ - $(JDK_VER_DEFS) -HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" -BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" -VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\"" - -CXXFLAGS = \ - ${SYSDEFS} \ - ${INCLUDES} \ - ${BUILD_USER} \ - ${HS_LIB_ARCH} \ - ${VM_DISTRO} - -# This is VERY important! The version define must only be supplied to vm_version.o -# If not, ccache will not re-use the cache at all, since the version string might contain -# a time and date. -CXXFLAGS/vm_version.o += ${VM_VER_DEFS} - -CXXFLAGS/BYFILE = $(CXXFLAGS/$@) - -# File specific flags -CXXFLAGS += $(CXXFLAGS/BYFILE) - - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -CFLAGS += $(CFLAGS_WARN/BYFILE) - -# Do not use C++ exception handling -CFLAGS += $(CFLAGS/NOEX) - -# Extra flags from gnumake's invocation or environment -CFLAGS += $(EXTRA_CFLAGS) -LFLAGS += $(EXTRA_CFLAGS) - -# Don't set excutable bit on stack segment -# the same could be done by separate execstack command -#LFLAGS += -Xlinker -z -Xlinker noexecstack - -LIBS += -lm -ldl -lpthread - -# By default, link the *.o into the library, not the executable. -LINK_INTO$(LINK_INTO) = LIBJVM - -JDK_LIBDIR = $(JAVA_HOME)/lib/$(LIBARCH) - -#---------------------------------------------------------------------- -# jvm_db & dtrace -include $(MAKEFILES_DIR)/dtrace.make - -#---------------------------------------------------------------------- -# JVM - -JVM = jvm -LIBJVM = lib$(JVM).so - -LIBJVM_DEBUGINFO = lib$(JVM).debuginfo -LIBJVM_DIZ = lib$(JVM).diz - -SPECIAL_PATHS:=adlc c1 gc opto shark libadt - -SOURCE_PATHS=\ - $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \ - \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \)) -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(SRCARCH)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_family)_$(SRCARCH)/vm - -CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) -CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/tracefiles - -ifneq ($(INCLUDE_TRACE), false) -CORE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ - find $(HS_ALT_SRC)/share/vm/jfr -type d; \ - fi) -endif - -COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1) -COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1 - -COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto) -COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt) -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt -COMPILER2_PATHS += $(GENERATED)/adfiles - -SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark - -# Include dirs per type. -Src_Dirs/CORE := $(CORE_PATHS) -Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) -Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) -Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) -Src_Dirs/ZERO := $(CORE_PATHS) -Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS) -Src_Dirs := $(Src_Dirs/$(TYPE)) - -COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\* -COMPILER1_SPECIFIC_FILES := c1_\* -SHARK_SPECIFIC_FILES := shark -ZERO_SPECIFIC_FILES := zero - -# Always exclude these. -Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp - -# Exclude per type. -Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/TIERED := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/ZERO := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/SHARK := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) - -Src_Files_EXCLUDE += $(Src_Files_EXCLUDE/$(TYPE)) - -# Disable ELF decoder on AIX (AIX uses XCOFF). -Src_Files_EXCLUDE += decoder_elf.cpp elfFile.cpp elfStringTable.cpp elfSymbolTable.cpp elfFuncDescTable.cpp - -# Special handling of arch model. -ifeq ($(Platform_arch_model), x86_32) -Src_Files_EXCLUDE += \*x86_64\* -endif -ifeq ($(Platform_arch_model), x86_64) -Src_Files_EXCLUDE += \*x86_32\* -endif - -# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE. -define findsrc - $(notdir $(shell find $(1)/. ! -name . -prune \ - -a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \ - -a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \))) -endef - -Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e))) - -Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files)))) - -JVM_OBJ_FILES = $(Obj_Files) - -vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES)) - -MAPFILE_SHARE := $(GAMMADIR)/make/share/makefiles/mapfile-vers - -mapfile : $(MAPFILE) $(MAPFILE_SHARE) vm.def - rm -f $@ - awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") \ - { system ("cat ${MAPFILE_SHARE} vm.def"); } \ - else \ - { print $$0 } \ - }' > $@ < $(MAPFILE) - -mapfile_reorder : mapfile $(REORDERFILE) - rm -f $@ - cat $^ > $@ - -vm.def: $(Res_Files) $(Obj_Files) - sh $(GAMMADIR)/make/aix/makefiles/build_vm_def.sh *.o > $@ - -ifeq ($(JVM_VARIANT_ZEROSHARK), true) - STATIC_CXX = false -else - ifeq ($(ZERO_LIBARCH), ppc64) - STATIC_CXX = false - else - STATIC_CXX = true - endif -endif - -ifeq ($(LINK_INTO),AOUT) - LIBJVM.o = - LIBJVM_MAPFILE = - LIBS_VM = $(LIBS) -else - LIBJVM.o = $(JVM_OBJ_FILES) - LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder - LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE)) -# xlC_r ignores the -o= syntax -# LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM)) - - # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to - # get around library dependency and compatibility issues. Must use gcc not - # g++ to link. - LIBS_VM += $(STATIC_STDCXX) $(LIBS) -endif - -LINK_VM = $(LINK_LIB.CXX) - -# create loadmap for libjvm.so by default. Helps in diagnosing some problems. -LFLAGS_VM += -bloadmap:libjvm.loadmap - -# rule for building precompiled header -$(PRECOMPILED_HEADER): - $(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@ - $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR) - $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE) - -# making the library: - -ifneq ($(JVM_BASE_ADDR),) -# By default shared library is linked at base address == 0. Modify the -# linker script if JVM prefers a different base location. It can also be -# implemented with 'prelink -r'. But 'prelink' is not (yet) available on -# our build platform (AS-2.1). -LD_SCRIPT = libjvm.so.lds -$(LD_SCRIPT): $(LIBJVM_MAPFILE) - $(QUIETLY) { \ - rm -rf $@; \ - $(LINK_VM) -Wl,--verbose $(LFLAGS_VM) 2>&1 | \ - sed -e '/^======/,/^======/!d' \ - -e '/^======/d' \ - -e 's/0\( + SIZEOF_HEADERS\)/$(JVM_BASE_ADDR)\1/' \ - > $@; \ - } -LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT) -endif - -# With more recent Redhat releases (or the cutting edge version Fedora), if -# SELinux is configured to be enabled, the runtime linker will fail to apply -# the text relocation to libjvm.so considering that it is built as a non-PIC -# DSO. To workaround that, we run chcon to libjvm.so after it is built. See -# details in bug 6538311. -$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) - $(QUIETLY) { \ - echo $(LOG_INFO) Linking vm...; \ - $(LINK_LIB.CXX/PRE_HOOK) \ - $(LINK_VM) $(LD_SCRIPT_FLAG) \ - $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ - $(LINK_LIB.CXX/POST_HOOK) \ - rm -f $@.1; ln -s $@ $@.1; \ - } -# No security contexts on AIX -# if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then \ -# if [ -x /usr/sbin/selinuxenabled ] ; then \ -# /usr/sbin/selinuxenabled; \ -# if [ $$? = 0 ] ; then \ -# /usr/bin/chcon -t textrel_shlib_t $@; \ -# if [ $$? != 0 ]; then \ -# echo "ERROR: Cannot chcon $@"; \ -# fi \ -# fi \ -# fi \ -# fi \ -# } - -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ -# ifeq ($(STRIP_POLICY),all_strip) -# $(QUIETLY) $(STRIP) $@ -# else -# ifeq ($(STRIP_POLICY),min_strip) -# $(QUIETLY) $(STRIP) -g $@ -# # implied else here is no stripping at all -# endif -# endif -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) -# $(RM) $(LIBJVM_DEBUGINFO) -# endif -#endif - -DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR) -DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM) -DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO) -DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ) - -install_jvm: $(LIBJVM) - @echo "Copying $(LIBJVM) to $(DEST_JVM)" - $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \ - $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) - $(QUIETLY) test -f $(LIBJVM_DIZ) && \ - $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" - -#---------------------------------------------------------------------- -# Other files - -# Signal interposition library -include $(MAKEFILES_DIR)/jsig.make - -#---------------------------------------------------------------------- - -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) - -install: install_jvm install_jsig - -.PHONY: default build install install_jvm diff --git a/hotspot/make/aix/makefiles/xlc.make b/hotspot/make/aix/makefiles/xlc.make deleted file mode 100644 index c44d306359e..00000000000 --- a/hotspot/make/aix/makefiles/xlc.make +++ /dev/null @@ -1,172 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2015 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -#------------------------------------------------------------------------ -# CC, CXX & AS - -# Set compiler explicitly -CXX = $(COMPILER_PATH)xlC_r -CC = $(COMPILER_PATH)xlc_r -HOSTCXX = $(CXX) -HOSTCC = $(CC) - -AS = $(CC) -c - -# get xlc version which comes as VV.RR.MMMM.LLLL where 'VV' is the version, -# 'RR' is the release, 'MMMM' is the modification and 'LLLL' is the level. -# We only use 'VV.RR.LLLL' to avoid integer overflows in bash when comparing -# the version numbers (some shells only support 32-bit integer compares!). -CXX_VERSION := $(shell $(CXX) -qversion 2>&1 | \ - sed -n 's/.*Version: \([0-9]\{2\}\).\([0-9]\{2\}\).[0-9]\{4\}.\([0-9]\{4\}\)/\1\2\3/p') - -# xlc 08.00.0000.0023 and higher supports -qtune=balanced -CXX_SUPPORTS_BALANCED_TUNING := $(shell if [ $(CXX_VERSION) -ge 08000023 ] ; then echo "true" ; fi) -# xlc 10.01 is used with aggressive optimizations to boost performance -CXX_IS_V10 := $(shell if [ $(CXX_VERSION) -ge 10010000 ] ; then echo "true" ; fi) - -# check for precompiled headers support - -# Switch off the precompiled header support. Neither xlC 8.0 nor xlC 10.0 -# support precompiled headers. Both "understand" the command line switches "-qusepcomp" and -# "-qgenpcomp" but when we specify them the following message is printed: -# "1506-755 (W) The -qusepcomp option is not supported in this release." -USE_PRECOMPILED_HEADER = 0 -ifneq ($(USE_PRECOMPILED_HEADER),0) -PRECOMPILED_HEADER_DIR=. -PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp -PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch -endif - - -#------------------------------------------------------------------------ -# Compiler flags - -# position-independent code -PICFLAG = -qpic=large - -VM_PICFLAG/LIBJVM = $(PICFLAG) -VM_PICFLAG/AOUT = -VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) - -CFLAGS += $(VM_PICFLAG) -CFLAGS += -qnortti -CFLAGS += -qnoeh - -# for compiler-level tls -CFLAGS += -qtls=default - -CFLAGS += -D_REENTRANT -# no xlc counterpart for -fcheck-new -# CFLAGS += -fcheck-new - -# We need to define this on the command line if we want to use the the -# predefined format specifiers from "inttypes.h". Otherwise system headrs -# can indirectly include inttypes.h before we define __STDC_FORMAT_MACROS -# in globalDefinitions.hpp -CFLAGS += -D__STDC_FORMAT_MACROS - -ARCHFLAG = -q64 - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) -ASFLAGS += $(ARCHFLAG) - -# Use C++ Interpreter -ifdef CC_INTERP - CFLAGS += -DCC_INTERP -endif - -# Keep temporary files (.ii, .s) -# no counterpart on xlc for -save-temps, -pipe - -# Compiler warnings are treated as errors -# Do not treat warnings as errors -# WARNINGS_ARE_ERRORS = -Werror -# Except for a few acceptable ones -# ACCEPTABLE_WARNINGS = -Wpointer-arith -Wconversion -Wsign-compare -# CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(ACCEPTABLE_WARNINGS) -CFLAGS_WARN/COMMON = -CFLAGS_WARN/DEFAULT = $(CFLAGS_WARN/COMMON) $(EXTRA_WARNINGS) -# Special cases -CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) - -# The flags to use for an optimized build -OPT_CFLAGS += -O3 - -# Hotspot uses very unstrict aliasing turn this optimization off -OPT_CFLAGS += -qalias=noansi - -OPT_CFLAGS/NOOPT=-qnoopt - -DEPFLAGS = -qmakedep=gcc -MF $(DEP_DIR)/$(@:%=%.d) - -#------------------------------------------------------------------------ -# Linker flags - -# statically link libstdc++.so, work with gcc but ignored by g++ -STATIC_STDCXX = -Wl,-lC_r - -# Enable linker optimization -# no counterpart on xlc for this -# LFLAGS += -Xlinker -O1 - -# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. -# MAPFLAG = -Xlinker --version-script=FILENAME - -# Build shared library -SHARED_FLAG = -q64 -b64 -bexpall -G -bnoentry -qmkshrobj -brtl -bnolibpath -bernotok - -#------------------------------------------------------------------------ -# Debug flags - -# Always compile with '-g' to get symbols in the stacktraces in the hs_err file -DEBUG_CFLAGS += -g -FASTDEBUG_CFLAGS += -g -OPT_CFLAGS += -g - -# DEBUG_BINARIES overrides everything, use full -g debug information -ifeq ($(DEBUG_BINARIES), true) - DEBUG_CFLAGS = -g - CFLAGS += $(DEBUG_CFLAGS) -endif - -# If we are building HEADLESS, pass on to VM -# so it can set the java.awt.headless property -ifdef HEADLESS -CFLAGS += -DHEADLESS -endif - -# We are building Embedded for a small device -# favor code space over speed -ifdef MINIMIZE_RAM_USAGE -CFLAGS += -DMINIMIZE_RAM_USAGE -endif - -ifdef CROSS_COMPILE_ARCH - STRIP = $(ALT_COMPILER_PATH)/strip -else - STRIP = strip -endif diff --git a/hotspot/make/aix/platform_ppc64 b/hotspot/make/aix/platform_ppc64 deleted file mode 100644 index 5a21fb9c031..00000000000 --- a/hotspot/make/aix/platform_ppc64 +++ /dev/null @@ -1,17 +0,0 @@ -os_family = aix - -arch = ppc - -arch_model = ppc_64 - -os_arch = aix_ppc - -os_arch_model = aix_ppc_64 - -lib_arch = ppc64 - -compiler = xlc - -gnu_dis_arch = ppc64 - -sysdefs = -DAIX -DPPC64 diff --git a/hotspot/make/altsrc.make b/hotspot/make/altsrc.make deleted file mode 100644 index 027dc35d966..00000000000 --- a/hotspot/make/altsrc.make +++ /dev/null @@ -1,96 +0,0 @@ -# -# Copyright (c) 2011, 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. -# -# - -# This file defines variables and macros which are used in the makefiles to -# allow distributions to augment or replace common hotspot code with -# distribution-specific source files. This capability is disabled when -# an OPENJDK build is requested, unless HS_ALT_SRC_REL has been set externally. - -# Requires: GAMMADIR -# Provides: -# variables: HS_COMMON_SRC, HS_ALT_SRC, HS_COMMON_SRC_REL, and HS_ALT_SRC_REL -# functions: altsrc-equiv, if-has-altsrc, altsrc, altsrc-replace - -HS_COMMON_SRC_REL=src - -ifneq ($(OPENJDK),true) - # This needs to be changed to a more generic location, but we keep it - # as this for now for compatibility - HS_ALT_SRC_REL=src/closed -else - HS_ALT_SRC_REL=NO_SUCH_PATH -endif - -HS_COMMON_SRC=$(GAMMADIR)/$(HS_COMMON_SRC_REL) -HS_ALT_SRC=$(GAMMADIR)/$(HS_ALT_SRC_REL) - -## altsrc-equiv -# -# Convert a common source path to an alternative source path -# -# Parameter: An absolute path into the common sources -# Result: The matching path to the alternate-source location -# -altsrc-equiv=$(subst $(HS_COMMON_SRC)/,$(HS_ALT_SRC)/,$(1)) - - -## if-has-altsrc -# -# Conditional macro to test for the existence of an alternate source path -# -# Parameter: An absolute path into the common sources -# Parameter: Result if the alternative-source location exists -# Parameter: Result if the alternative-source location does not exist -# Result: expands to parameter 2 or 3 depending on existence of alternate source -# -if-has-altsrc=$(if $(wildcard $(call altsrc-equiv,$(1))),$(2),$(3)) - - -## altsrc -# -# Converts common source path to alternate source path if the alternate -# path exists, otherwise evaluates to nul (empty string) -# -# Parameter: An absolute path into the common sources -# Result: The equivalent path to the alternate-source location, if such a -# location exists on the filesystem. Otherwise it expands to empty. -# -altsrc=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1))) - -## commonsrc -# -# Returns parameter. -# -commonsrc=$(1) - - -## altsrc-replace -# -# Converts a common source path to an alternate source path if the alternate -# source path exists. Otherwise it evaluates to the input common source path. -# -# Parameter: An absolute path into the common sources -# Result: A path to either the common or alternate sources -# -altsrc-replace=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1)),$(1)) diff --git a/hotspot/make/bsd/Makefile b/hotspot/make/bsd/Makefile deleted file mode 100644 index d3e977f152b..00000000000 --- a/hotspot/make/bsd/Makefile +++ /dev/null @@ -1,386 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile creates a build tree and lights off a build. -# You can go back into the build tree and perform rebuilds or -# incremental builds as desired. Be sure to reestablish -# environment variable settings for LD_LIBRARY_PATH and JAVA_HOME. - -# The make process now relies on java and javac. These can be -# specified either implicitly on the PATH, by setting the -# (JDK-inherited) ALT_BOOTDIR environment variable to full path to a -# JDK in which bin/java and bin/javac are present and working (e.g., -# /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited) -# default BOOTDIR path value. Note that one of ALT_BOOTDIR -# or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc. -# from the PATH. -# -# One can set ALT_BOOTDIR or BOOTDIR to point to a jdk that runs on -# an architecture that differs from the target architecture, as long -# as the bootstrap jdk runs under the same flavor of OS as the target -# (i.e., if the target is linux, point to a jdk that runs on a linux -# box). In order to use such a bootstrap jdk, set the make variable -# REMOTE to the desired remote command mechanism, e.g., -# -# make REMOTE="rsh -l me myotherlinuxbox" - -ifeq ($(GAMMADIR),) -include ../../make/defs.make -else -include $(GAMMADIR)/make/defs.make -endif -include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make - -ifndef CC_INTERP - ifndef FORCE_TIERED - FORCE_TIERED=1 - endif -endif - -ifdef LP64 - ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") - _JUNK_ := $(shell echo >&2 \ - $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!") - @exit 1 - endif -endif - -# we need to set up LP64 correctly to satisfy sanity checks in adlc -ifneq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") - MFLAGS += " LP64=1 " -endif - -# pass USE_SUNCC further, through MFLAGS -ifdef USE_SUNCC - MFLAGS += " USE_SUNCC=1 " -endif - -# The following renders pathnames in generated Makefiles valid on -# machines other than the machine containing the build tree. -# -# For example, let's say my build tree lives on /files12 on -# exact.east.sun.com. This logic will cause GAMMADIR to begin with -# /net/exact/files12/... -# -# We only do this on SunOS variants, for a couple of reasons: -# * It is extremely rare that source trees exist on other systems -# * It has been claimed that the Linux automounter is flakey, so -# changing GAMMADIR in a way that exercises the automounter could -# prove to be a source of unreliability in the build process. -# Obviously, this Makefile is only relevant on SunOS boxes to begin -# with, but the SunOS conditionalization will make it easier to -# combine Makefiles in the future (assuming we ever do that). - -ifeq ($(OSNAME),solaris) - - # prepend current directory to relative pathnames. - NEW_GAMMADIR := \ - $(shell echo $(GAMMADIR) | \ - sed -e "s=^\([^/].*\)=$(shell pwd)/\1=" \ - ) - unexport NEW_GAMMADIR - - # If NEW_GAMMADIR doesn't already start with "/net/": - ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),) - # prepend /net/$(HOST) - # remove /net/$(HOST) if name already began with /home/ - # remove /net/$(HOST) if name already began with /java/ - # remove /net/$(HOST) if name already began with /lab/ - NEW_GAMMADIR := \ - $(shell echo $(NEW_GAMMADIR) | \ - sed -e "s=^\(.*\)=/net/$(HOST)\1=" \ - -e "s=^/net/$(HOST)/home/=/home/=" \ - -e "s=^/net/$(HOST)/java/=/java/=" \ - -e "s=^/net/$(HOST)/lab/=/lab/=" \ - ) - # Don't use the new value for GAMMADIR unless a file with the new - # name actually exists. - ifneq ($(wildcard $(NEW_GAMMADIR)),) - GAMMADIR := $(NEW_GAMMADIR) - endif - endif - -endif - -# BUILDARCH is set to "zero" for Zero builds. VARIANTARCH -# is used to give the build directories meaningful names. -VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH)) - -# There is a (semi-) regular correspondence between make targets and actions: -# -# Target Tree Type Build Dir -# -# debug compiler2 __compiler2/debug -# fastdebug compiler2 __compiler2/fastdebug -# optimized compiler2 __compiler2/optimized -# product compiler2 __compiler2/product -# -# debug1 compiler1 __compiler1/debug -# fastdebug1 compiler1 __compiler1/fastdebug -# optimized1 compiler1 __compiler1/optimized -# product1 compiler1 __compiler1/product -# -# debugcore core __core/debug -# fastdebugcore core __core/fastdebug -# optimizedcore core __core/optimized -# productcore core __core/product -# -# debugzero zero __zero/debug -# fastdebugzero zero __zero/fastdebug -# optimizedzero zero __zero/optimized -# productzero zero __zero/product -# -# debugshark shark __shark/debug -# fastdebugshark shark __shark/fastdebug -# optimizedshark shark __shark/optimized -# productshark shark __shark/product -# -# fastdebugminimal1 minimal1 __minimal1/fastdebug -# debugminimal1 minimal1 __minimal1/debug -# productminimal1 minimal1 __minimal1/product -# -# What you get with each target: -# -# debug* - debug compile with asserts enabled -# fastdebug* - optimized compile, but with asserts enabled -# optimized* - optimized compile, no asserts -# product* - the shippable thing: optimized compile, no asserts, -DPRODUCT - -# This target list needs to be coordinated with the usage message -# in the build.sh script: -TARGETS = debug fastdebug optimized product - -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - SUBDIR_DOCS = $(OSNAME)_$(VARIANTARCH)_docs -else - SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs -endif -SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) -SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) -SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) -SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) -SUBDIRS_ZERO = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS)) -SUBDIRS_SHARK = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS)) -SUBDIRS_MINIMAL1 = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS)) - -TARGETS_C2 = $(TARGETS) -TARGETS_C1 = $(addsuffix 1,$(TARGETS)) -TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) -TARGETS_CORE = $(addsuffix core,$(TARGETS)) -TARGETS_ZERO = $(addsuffix zero,$(TARGETS)) -TARGETS_SHARK = $(addsuffix shark,$(TARGETS)) -TARGETS_MINIMAL1 = $(addsuffix minimal1,$(TARGETS)) - -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) LIBRARY_SUFFIX=$(LIBRARY_SUFFIX) -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) -BUILDTREE_VARS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE) - -BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS) - -#------------------------------------------------------------------------------- - -# Could make everything by default, but that would take a while. -all: - @echo "Try '$(MAKE) ...' where is one or more of" - @echo " $(TARGETS_C2)" - @echo " $(TARGETS_C1)" - @echo " $(TARGETS_CORE)" - @echo " $(TARGETS_ZERO)" - @echo " $(TARGETS_SHARK)" - @echo " $(TARGETS_MINIMAL1)" - -checks: check_os_version check_j2se_version - -# We do not want people accidentally building on old systems (e.g. Linux 2.2.x, -# Solaris 2.5.1, 2.6). -# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. - -#SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 2.7% -DISABLE_HOTSPOT_OS_VERSION_CHECK = ok -OS_VERSION := $(shell uname -r) -EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) - -check_os_version: -ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),) - $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1; -endif - -# jvmti.make requires XSLT (J2SE 1.4.x or newer): -XSLT_CHECK = $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory -# If not found then fail fast. -check_j2se_version: - $(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \ - $(REMOTE) $(RUN.JAVA) -version; \ - echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \ - "to bootstrap this build" 1>&2; \ - exit 1; \ - fi - -$(SUBDIRS_TIERED): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered - -$(SUBDIRS_C2): $(BUILDTREE_MAKE) -ifeq ($(FORCE_TIERED),1) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered FORCE_TIERED=1 -else - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler2 -endif - -$(SUBDIRS_C1): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler1 - -$(SUBDIRS_CORE): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=core - -$(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH) - -$(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH) - -$(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=minimal1 - -platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in - $(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@ - -# Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME - -$(TARGETS_C2): $(SUBDIRS_C2) - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_TIERED): $(SUBDIRS_TIERED) - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_C1): $(SUBDIRS_C1) - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_CORE): $(SUBDIRS_CORE) - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_ZERO): $(SUBDIRS_ZERO) - cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_SHARK): $(SUBDIRS_SHARK) - cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_MINIMAL1): $(SUBDIRS_MINIMAL1) - cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install -endif - -# Just build the tree, and nothing else: -tree: $(SUBDIRS_C2) -tree1: $(SUBDIRS_C1) -treecore: $(SUBDIRS_CORE) -treezero: $(SUBDIRS_ZERO) -treeshark: $(SUBDIRS_SHARK) -treeminimal1: $(SUBDIRS_MINIMAL1) - -# Doc target. This is the same for all build options. -# Hence create a docs directory beside ...$(ARCH)_[...] -# We specify 'BUILD_FLAVOR=product' so that the proper -# ENABLE_FULL_DEBUG_SYMBOLS value is used. -docs: checks - $(QUIETLY) mkdir -p $(SUBDIR_DOCS) - $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs - -# Synonyms for win32-like targets. -compiler2: debug product - -compiler1: debug1 product1 - -core: debugcore productcore - -zero: debugzero productzero - -shark: debugshark productshark - -warn_jvmg_deprecated: - echo "Warning: The jvmg target has been replaced with debug" - echo "Warning: Please update your usage" - -jvmg: warn_jvmg_deprecated debug - -jvmg1: warn_jvmg_deprecated debug1 - -jvmgcore: warn_jvmg_deprecated debugcore - -jvmgzero: warn_jvmg_deprecated debugzero - -jvmgshark: warn_jvmg_deprecated debugshark - -clean_docs: - rm -rf $(SUBDIR_DOCS) - -clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1: - rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) - -clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs - -include $(GAMMADIR)/make/cscope.make - -# -# Include alternate Makefile if it exists. -# --include $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make - -#------------------------------------------------------------------------------- - -.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) -.PHONY: tree tree1 treecore treezero treeshark -.PHONY: all compiler1 compiler2 core zero shark -.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs -.PHONY: checks check_os_version check_j2se_version -.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make - -.NOTPARALLEL: diff --git a/hotspot/make/bsd/README b/hotspot/make/bsd/README deleted file mode 100644 index d3efaf8b610..00000000000 --- a/hotspot/make/bsd/README +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2007, 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. - -________________________________________________________________________ - -Please refer to the comments in the Makefile in this directory -for instructions how to build the Solaris versions. - diff --git a/hotspot/make/bsd/adlc_updater b/hotspot/make/bsd/adlc_updater deleted file mode 100644 index 99e04e333f2..00000000000 --- a/hotspot/make/bsd/adlc_updater +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -# -# This file is used by adlc.make to selectively update generated -# adlc files. Because source and target diretories are relative -# paths, this file is copied to the target build directory before -# use. -# -# adlc-updater -# -fix_lines() { - # repair bare #line directives in $1 to refer to $2 - # and add an override of __FILE__ with just the basename on the - # first line of the file. - awk < $1 > $1+ -v F2=$2 ' - BEGIN { print "#line 1 \"" F2 "\""; } - /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next} - {print} - ' - mv $1+ $1 -} -fix_lines $2/$1 $1 -[ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \ -( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) diff --git a/hotspot/make/bsd/makefiles/adjust-mflags.sh b/hotspot/make/bsd/makefiles/adjust-mflags.sh deleted file mode 100644 index 97bc02db7f1..00000000000 --- a/hotspot/make/bsd/makefiles/adjust-mflags.sh +++ /dev/null @@ -1,87 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 1999, 2008, 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. -# -# - -# This script is used only from top.make. -# The macro $(MFLAGS-adjusted) calls this script to -# adjust the "-j" arguments to take into account -# the HOTSPOT_BUILD_JOBS variable. The default -# handling of the "-j" argument by gnumake does -# not meet our needs, so we must adjust it ourselves. - -# This argument adjustment applies to two recursive -# calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make. -# One invokes adlc.make, and the other invokes vm.make. -# The adjustment propagates the desired concurrency -# level down to the sub-make (of the adlc or vm). -# The default behavior of gnumake is to run all -# sub-makes without concurrency ("-j1"). - -# Also, we use a make variable rather than an explicit -# "-j" argument to control this setting, so that -# the concurrency setting (which must be tuned separately -# for each MP system) can be set via an environment variable. -# The recommended setting is 1.5x to 2x the number of available -# CPUs on the MP system, which is large enough to keep the CPUs -# busy (even though some jobs may be I/O bound) but not too large, -# we may presume, to overflow the system's swap space. - -set -eu - -default_build_jobs=4 - -case $# in -[12]) true;; -*) >&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;; -esac - -MFLAGS=$1 -HOTSPOT_BUILD_JOBS=${2-} - -# Normalize any -jN argument to the form " -j${HBJ}" -MFLAGS=` - echo "$MFLAGS" \ - | sed ' - s/^-/ -/ - s/ -\([^ I][^ I]*\)j/ -\1 -j/ - s/ -j[0-9][0-9]*/ -j/ - s/ -j\([^ ]\)/ -j -\1/ - s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ - ' ` - -case ${HOTSPOT_BUILD_JOBS} in \ - -'') case ${MFLAGS} in - *\ -j*) - >&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile." - >&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment." - esac;; - -?*) case ${MFLAGS} in - *\ -j*) true;; - *) MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";; - esac;; -esac - -echo "${MFLAGS}" diff --git a/hotspot/make/bsd/makefiles/adlc.make b/hotspot/make/bsd/makefiles/adlc.make deleted file mode 100644 index dd3346efc66..00000000000 --- a/hotspot/make/bsd/makefiles/adlc.make +++ /dev/null @@ -1,233 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile (adlc.make) is included from the adlc.make in the -# build directories. -# It knows how to compile, link, and run the adlc. - -include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make - -# ######################################################################### - -# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make: -GENERATED = ../generated -OUTDIR = $(GENERATED)/adfiles - -ARCH = $(Platform_arch) -OS = $(Platform_os_family) - -SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad - -ifeq ("${Platform_arch_model}", "${Platform_arch}") - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) -else - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) -endif - -EXEC = $(OUTDIR)/adlc - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor -Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED) -INCLUDES += $(Src_Dirs_I:%=-I%) - -# set flags for adlc compilation -CXXFLAGS = $(SYSDEFS) $(INCLUDES) - -# Force assertions on. -CXXFLAGS += -DASSERT - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -# Compiler warnings are treated as errors -ifneq ($(COMPILER_WARNINGS_FATAL),false) - CFLAGS_WARN = $(WARNINGS_ARE_ERRORS) -endif -CFLAGS += $(CFLAGS_WARN) - -OBJECTNAMES = \ - adlparse.o \ - archDesc.o \ - arena.o \ - dfa.o \ - dict2.o \ - filebuff.o \ - forms.o \ - formsopt.o \ - formssel.o \ - main.o \ - adlc-opcodes.o \ - output_c.o \ - output_h.o \ - -OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%) - -GENERATEDNAMES = \ - ad_$(Platform_arch_model).cpp \ - ad_$(Platform_arch_model).hpp \ - ad_$(Platform_arch_model)_clone.cpp \ - ad_$(Platform_arch_model)_expand.cpp \ - ad_$(Platform_arch_model)_format.cpp \ - ad_$(Platform_arch_model)_gen.cpp \ - ad_$(Platform_arch_model)_misc.cpp \ - ad_$(Platform_arch_model)_peephole.cpp \ - ad_$(Platform_arch_model)_pipeline.cpp \ - adGlobals_$(Platform_arch_model).hpp \ - dfa_$(Platform_arch_model).cpp \ - -GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) - -# ######################################################################### - -all: $(EXEC) - -$(EXEC) : $(OBJECTS) - @echo $(LOG_INFO) Making adlc - $(QUIETLY) $(HOST.LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) - -# Random dependencies: -$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp - -# The source files refer to ostream.h, which sparcworks calls iostream.h -$(OBJECTS): ostream.h - -ostream.h : - @echo >$@ '#include ' - -dump: - : OUTDIR=$(OUTDIR) - : OBJECTS=$(OBJECTS) - : products = $(GENERATEDFILES) - -all: $(GENERATEDFILES) - -$(GENERATEDFILES): refresh_adfiles - -# Get a unique temporary directory name, so multiple makes can run in parallel. -# Note that product files are updated via "mv", which is atomic. -TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) - -# Debuggable by default -CFLAGS += -g - -# Pass -D flags into ADLC. -ADLCFLAGS += $(SYSDEFS) - -# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO. -ADLCFLAGS += -q -T - -# Normally, debugging is done directly on the ad_*.cpp files. -# But -g will put #line directives in those files pointing back to .ad. -# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives -# so skip it for 3.2 and ealier. -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" -ADLCFLAGS += -g -endif - -ifdef LP64 -ADLCFLAGS += -D_LP64 -else -ADLCFLAGS += -U_LP64 -endif - -# -# adlc_updater is a simple sh script, under sccs control. It is -# used to selectively update generated adlc files. This should -# provide a nice compilation speed improvement. -# -ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) -ADLC_UPDATER = adlc_updater -$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) - $(QUIETLY) cp $< $@; chmod +x $@ - -# This action refreshes all generated adlc files simultaneously. -# The way it works is this: -# 1) create a scratch directory to work in. -# 2) if the current working directory does not have $(ADLC_UPDATER), copy it. -# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory. -# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. -# 5) If we actually updated any files, echo a notice. -# -refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) - @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) - $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ - -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ - || { rm -rf $(TEMPDIR); exit 1; } - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." - $(QUIETLY) rm -rf $(TEMPDIR) - - -# ######################################################################### - -$(SOURCE.AD): $(SOURCES.AD) - $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD) - -#PROCESS_AD_FILES = cat -# Pass through #line directives, in case user enables -g option above: -PROCESS_AD_FILES = awk '{ \ - if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ - if (need_lineno && $$0 !~ /\/\//) \ - { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ - print }' - -$(OUTDIR)/%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) - -# Some object files are given a prefix, to disambiguate -# them from objects of the same name built for the VM. -$(OUTDIR)/adlc-%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(HOST.COMPILE.CXX) -o $@ $< $(COMPILE_DONE) - -# ######################################################################### - -clean : - rm $(OBJECTS) - -cleanall : - rm $(OBJECTS) $(EXEC) - -# ######################################################################### - -.PHONY: all dump refresh_adfiles clean cleanall diff --git a/hotspot/make/bsd/makefiles/amd64.make b/hotspot/make/bsd/makefiles/amd64.make deleted file mode 100644 index 6512375259e..00000000000 --- a/hotspot/make/bsd/makefiles/amd64.make +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (c) 2003, 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. -# -# - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) -# Must also specify if CPU is little endian -CFLAGS += -DVM_LITTLE_ENDIAN - -CFLAGS += -D_LP64=1 - -# The serviceability agent relies on frame pointer (%rbp) to walk thread stack -ifndef USE_SUNCC - CFLAGS += -fno-omit-frame-pointer -endif - -OPT_CFLAGS/compactingPermGenGen.o = -O1 - -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/sharedRuntimeTrig.o += -g - OPT_CFLAGS/sharedRuntimeTrans.o += -g - OPT_CFLAGS/compactingPermGenGen.o += -g -endif diff --git a/hotspot/make/bsd/makefiles/arm.make b/hotspot/make/bsd/makefiles/arm.make deleted file mode 100644 index 9e6fdd5abae..00000000000 --- a/hotspot/make/bsd/makefiles/arm.make +++ /dev/null @@ -1,27 +0,0 @@ -# -# 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 -# 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. -# -# - -Obj_Files += bsd_arm.o - -CFLAGS += -DVM_LITTLE_ENDIAN diff --git a/hotspot/make/bsd/makefiles/build_vm_def.sh b/hotspot/make/bsd/makefiles/build_vm_def.sh deleted file mode 100644 index 91918635b26..00000000000 --- a/hotspot/make/bsd/makefiles/build_vm_def.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# If we're cross compiling use that path for nm -if [ "$CROSS_COMPILE_ARCH" != "" ]; then -NM=$ALT_COMPILER_PATH/nm -else -NM=nm -fi - -$NM -Uj $* | awk ' - { if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 } - ' diff --git a/hotspot/make/bsd/makefiles/buildtree.make b/hotspot/make/bsd/makefiles/buildtree.make deleted file mode 100644 index 3ae09d3dd5b..00000000000 --- a/hotspot/make/bsd/makefiles/buildtree.make +++ /dev/null @@ -1,370 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Usage: -# -# $(MAKE) -f buildtree.make SRCARCH=srcarch BUILDARCH=buildarch LIBARCH=libarch -# GAMMADIR=dir OS_FAMILY=os VARIANT=variant -# -# The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the -# environment or on the command-line: -# -# ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory -# BUILDARCH - build directory -# LIBARCH - the corresponding directory in JDK/JRE -# GAMMADIR - top of workspace -# OS_FAMILY - operating system -# VARIANT - core, compiler1, compiler2, or tiered -# VERSION_STRING - the JDK version string as specified by JEP-223 -# HOTSPOT_VERSION_STRING - the same as VERSION_STRING, unless overridden by a standalone build -# -# Builds the directory trees with makefiles plus some convenience files in -# each directory: -# -# Makefile - for "make foo" -# flags.make - with macro settings -# vm.make - to support making "$(MAKE) -v vm.make" in makefiles -# adlc.make - -# trace.make - generate tracing event and type definitions -# jvmti.make - generate JVMTI bindings from the spec (JSR-163) -# -# The makefiles are split this way so that "make foo" will run faster by not -# having to read the dependency files for the vm. - -# needs to be set here since this Makefile doesn't include defs.make -OS_VENDOR:=$(shell uname -s) - --include $(SPEC) -include $(GAMMADIR)/make/scm.make -include $(GAMMADIR)/make/defs.make -include $(GAMMADIR)/make/altsrc.make - - -# 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ - -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero -else - ifdef USE_SUNCC - PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc - else - PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) - endif -endif - -# Allow overriding of the arch part of the directory but default -# to BUILDARCH if nothing is specified -ifeq ($(VARIANTARCH),) - VARIANTARCH=$(BUILDARCH) -endif - -ifdef FORCE_TIERED -ifeq ($(VARIANT),tiered) -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_compiler2 -else -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) -endif -else -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) -endif - -# -# We do two levels of exclusion in the shared directory. -# TOPLEVEL excludes are pruned, they are not recursively searched, -# but lower level directories can be named without fear of collision. -# ALWAYS excludes are excluded at any level in the directory tree. -# - -ALWAYS_EXCLUDE_DIRS = $(SCM_DIRS) - -ifeq ($(VARIANT),tiered) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent -else -ifeq ($(VARIANT),compiler2) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent -else -# compiler1 and core use the same exclude list -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent -endif -endif - -# Get things from the platform file. -COMPILER = $(shell sed -n 's/^compiler[ ]*=[ ]*//p' $(PLATFORM_FILE)) - -# dtracefiles is used on BSD versions that implement Dtrace (like MacOS X) -SIMPLE_DIRS = \ - $(PLATFORM_DIR)/generated/dependencies \ - $(PLATFORM_DIR)/generated/adfiles \ - $(PLATFORM_DIR)/generated/jvmtifiles \ - $(PLATFORM_DIR)/generated/tracefiles \ - $(PLATFORM_DIR)/generated/dtracefiles - -TARGETS = debug fastdebug optimized product -SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) - -# For dependencies and recursive makes. -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make - -# dtrace.make is used on BSD versions that implement Dtrace (like MacOS X) -BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make dtrace.make - -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ - SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) - -# Define variables to be set in flags.make. -# Default values are set in make/defs.make. - -# Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami) -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME) -endif -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell whoami) -endif -# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro -# or make/hotspot_distro. -ifndef HOTSPOT_VM_DISTRO - ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - include $(GAMMADIR)/make/hotspot_distro - else - include $(GAMMADIR)/make/openjdk_distro - endif -endif - -# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK -ifndef OPENJDK - ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - OPENJDK=true - endif -endif - -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) - -BUILDTREE = \ - $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS) - -BUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)" - -all: $(SUBMAKE_DIRS) - -# Run make in each subdirectory recursively. -$(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE - $(QUIETLY) [ -d $@ ] || { mkdir -p $@; } - +$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F) - $(QUIETLY) touch $@ - -$(SIMPLE_DIRS): - $(QUIETLY) mkdir -p $@ - -# Convenience macro which takes a source relative path, applies $(1) to the -# absolute path, and then replaces $(GAMMADIR) in the result with a -# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. -gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2))) - -# This bit is needed to enable local rebuilds. -# Unless the makefile itself sets LP64, any environmental -# setting of LP64 will interfere with the build. -LP64_SETTING/32 = LP64 = \#empty -LP64_SETTING/64 = LP64 = 1 - -DATA_MODE/i486 = 32 -DATA_MODE/amd64 = 64 - -DATA_MODE = $(DATA_MODE/$(BUILDARCH)) - -flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \ - sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \ - echo; \ - echo "GAMMADIR = $(GAMMADIR)"; \ - echo "HS_ALT_MAKE = $(HS_ALT_MAKE)"; \ - echo "OSNAME = $(OSNAME)"; \ - echo "SYSDEFS = \$$(Platform_sysdefs)"; \ - echo "SRCARCH = $(SRCARCH)"; \ - echo "BUILDARCH = $(BUILDARCH)"; \ - echo "LIBARCH = $(LIBARCH)"; \ - echo "TARGET = $(TARGET)"; \ - echo "HOTSPOT_VERSION_STRING = $(HOTSPOT_VERSION_STRING)"; \ - echo "VERSION_STRING = $(VERSION_STRING)"; \ - echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ - echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ - echo "OPENJDK = $(OPENJDK)"; \ - echo "$(LP64_SETTING/$(DATA_MODE))"; \ - echo; \ - echo "STATIC_BUILD = $(STATIC_BUILD)"; \ - echo "COMPILER_WARNINGS_FATAL = $(COMPILER_WARNINGS_FATAL)"; \ - echo "EXTRA_LDFLAGS = $(EXTRA_LDFLAGS)"; \ - echo "LIBRARY_SUFFIX = $(LIBRARY_SUFFIX)"; \ - echo; \ - echo "# Used for platform dispatching"; \ - echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \ - echo "CFLAGS += \$$(TARGET_DEFINES)"; \ - echo; \ - echo "Src_Dirs_V = \\"; \ - sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ - echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - echo; \ - echo "Src_Dirs_I = \\"; \ - echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,altsrc,share/vm) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm) \\"; \ - echo "$(call gamma-path,altsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - [ -n "$(CFLAGS_BROWSE)" ] && \ - echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ - [ -n "$(ENABLE_FULL_DEBUG_SYMBOLS)" ] && \ - echo && echo "ENABLE_FULL_DEBUG_SYMBOLS = $(ENABLE_FULL_DEBUG_SYMBOLS)"; \ - [ -n "$(OBJCOPY)" ] && \ - echo && echo "OBJCOPY = $(OBJCOPY)"; \ - [ -n "$(STRIP_POLICY)" ] && \ - echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \ - [ -n "$(ZIP_DEBUGINFO_FILES)" ] && \ - echo && echo "ZIP_DEBUGINFO_FILES = $(ZIP_DEBUGINFO_FILES)"; \ - [ -n "$(ZIPEXE)" ] && \ - echo && echo "ZIPEXE = $(ZIPEXE)"; \ - [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ - echo && \ - echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ - echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ - echo; \ - [ -n "$(SPEC)" ] && \ - echo "include $(SPEC)"; \ - echo "CP ?= cp"; \ - echo "MV ?= mv"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ - echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ - ) > $@ - -flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \ - ) > $@ - -../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo $(LOG_INFO) Creating directory list $@ - $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ - find $(HS_ALT_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \ - fi; - $(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ - -Makefile: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/top.make"; \ - ) > $@ - -vm.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo include flags_vm.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -adlc.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -jvmti.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -trace.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -dtrace.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -FORCE: - -.PHONY: all FORCE - -.NOTPARALLEL: diff --git a/hotspot/make/bsd/makefiles/compiler1.make b/hotspot/make/bsd/makefiles/compiler1.make deleted file mode 100644 index d303bfc1ca4..00000000000 --- a/hotspot/make/bsd/makefiles/compiler1.make +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making client version of VM - -TYPE=COMPILER1 - -VM_SUBDIR = client - -# We don't support the JVMCI in a client VM. -INCLUDE_JVMCI := false - -CFLAGS += -DCOMPILER1 diff --git a/hotspot/make/bsd/makefiles/compiler2.make b/hotspot/make/bsd/makefiles/compiler2.make deleted file mode 100644 index c881079882e..00000000000 --- a/hotspot/make/bsd/makefiles/compiler2.make +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making server version of VM - -TYPE=COMPILER2 - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 diff --git a/hotspot/make/bsd/makefiles/core.make b/hotspot/make/bsd/makefiles/core.make deleted file mode 100644 index e032d964f57..00000000000 --- a/hotspot/make/bsd/makefiles/core.make +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (c) 1999, 2010, 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. -# -# - -# Sets make macros for making core version of VM - -# Select which files to use (in top.make) -TYPE=CORE - -# There is no "core" directory in JDK. Install core build in server directory. -VM_SUBDIR = server - -# Note: macros.hpp defines CORE diff --git a/hotspot/make/bsd/makefiles/cscope.make b/hotspot/make/bsd/makefiles/cscope.make deleted file mode 100644 index 7a12b3bbcd1..00000000000 --- a/hotspot/make/bsd/makefiles/cscope.make +++ /dev/null @@ -1,160 +0,0 @@ -# -# Copyright (c) 2005, 2008, 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. -# -# - -# -# The cscope.out file is made in the current directory and spans the entire -# source tree. -# -# Things to note: -# 1. We use relative names for cscope. -# 2. We *don't* remove the old cscope.out file, because cscope is smart -# enough to only build what has changed. It can be confused, however, -# if files are renamed or removed, so it may be necessary to manually -# remove cscope.out if a lot of reorganization has occurred. -# - -include $(GAMMADIR)/make/scm.make - -NAWK = awk -RM = rm -f -HG = hg -CS_TOP = ../.. - -CSDIRS = $(CS_TOP)/src $(CS_TOP)/build -CSINCS = $(CSDIRS:%=-I%) - -CSCOPE = cscope -CSCOPE_FLAGS = -b - -# Allow .java files to be added from the environment (CSCLASSES=yes). -ifdef CSCLASSES -ADDCLASSES= -o -name '*.java' -endif - -# Adding CClassHeaders also pushes the file count of a full workspace up about -# 200 files (these files also don't exist in a new workspace, and thus will -# cause the recreation of the database as they get created, which might seem -# a little confusing). Thus allow these files to be added from the environment -# (CSHEADERS=yes). -ifndef CSHEADERS -RMCCHEADERS= -o -name CClassHeaders -endif - -# Use CS_GENERATED=x to include auto-generated files in the build directories. -ifdef CS_GENERATED -CS_ADD_GENERATED = -o -name '*.incl' -else -CS_PRUNE_GENERATED = -o -name '${OS}_*_core' -o -name '${OS}_*_compiler?' -endif - -# OS-specific files for other systems are excluded by default. Use CS_OS=yes -# to include platform-specific files for other platforms. -ifndef CS_OS -CS_OS = linux macos solaris win32 bsd -CS_PRUNE_OS = $(patsubst %,-o -name '*%*',$(filter-out ${OS},${CS_OS})) -endif - -# Processor-specific files for other processors are excluded by default. Use -# CS_CPU=x to include platform-specific files for other platforms. -ifndef CS_CPU -CS_CPU = i486 sparc amd64 ia64 -CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',$(filter-out ${SRCARCH},${CS_CPU})) -endif - -# What files should we include? A simple rule might be just those files under -# SCCS control, however this would miss files we create like the opcodes and -# CClassHeaders. The following attempts to find everything that is *useful*. -# (.del files are created by sccsrm, demo directories contain many .java files -# that probably aren't useful for development, and the pkgarchive may contain -# duplicates of files within the source hierarchy). - -# Directories to exclude. -CS_PRUNE_STD = $(SCM_DIRS) \ - -o -name '.del-*' \ - -o -name '*demo' \ - -o -name pkgarchive - -CS_PRUNE = $(CS_PRUNE_STD) \ - $(CS_PRUNE_OS) \ - $(CS_PRUNE_CPU) \ - $(CS_PRUNE_GENERATED) \ - $(RMCCHEADERS) - -# File names to include. -CSFILENAMES = -name '*.[ch]pp' \ - -o -name '*.[Ccshlxy]' \ - $(CS_ADD_GENERATED) \ - -o -name '*.il' \ - -o -name '*.cc' \ - -o -name '*[Mm]akefile*' \ - -o -name '*.gmk' \ - -o -name '*.make' \ - -o -name '*.ad' \ - $(ADDCLASSES) - -.PRECIOUS: cscope.out - -cscope cscope.out: cscope.files FORCE - $(CSCOPE) $(CSCOPE_FLAGS) - -# The .raw file is reordered here in an attempt to make cscope display the most -# relevant files first. -cscope.files: .cscope.files.raw - echo "$(CSINCS)" > $@ - -egrep -v "\.java|\/make\/" $< >> $@ - -fgrep ".java" $< >> $@ - -fgrep "/make/" $< >> $@ - -.cscope.files.raw: .nametable.files - -find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \ - -type f \( $(CSFILENAMES) \) -print > $@ - -cscope.clean: nametable.clean - -$(RM) cscope.out cscope.files .cscope.files.raw - -TAGS: cscope.files FORCE - egrep -v '^-|^$$' $< | etags --members - - -TAGS.clean: nametable.clean - -$(RM) TAGS - -# .nametable.files and .nametable.files.tmp are used to determine if any files -# were added to/deleted from/renamed in the workspace. If not, then there's -# normally no need to rebuild the cscope database. To force a rebuild of -# the cscope database: gmake nametable.clean. -.nametable.files: .nametable.files.tmp - ( cmp -s $@ $< ) || ( cp $< $@ ) - -$(RM) $< - -# `hg status' is slightly faster than `hg fstatus'. Both are -# quite a bit slower on an NFS mounted file system, so this is -# really geared towards repos on local file systems. -.nametable.files.tmp: - -$(HG) fstatus -acmn > $@ -nametable.clean: - -$(RM) .nametable.files .nametable.files.tmp - -FORCE: - -.PHONY: cscope cscope.clean TAGS.clean nametable.clean FORCE diff --git a/hotspot/make/bsd/makefiles/debug.make b/hotspot/make/bsd/makefiles/debug.make deleted file mode 100644 index 1c4ef1418b1..00000000000 --- a/hotspot/make/bsd/makefiles/debug.make +++ /dev/null @@ -1,45 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -DEBUG_CFLAGS/DEFAULT= $(DEBUG_CFLAGS) -DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)) - -# _NMT_NOINLINE_ informs NMT that no inlining by Compiler -CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_ - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug -ifeq ($(OS_VENDOR), Darwin) -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-debug -endif - -VERSION = debug -SYSDEFS += -DASSERT -PICFLAGS = DEFAULT diff --git a/hotspot/make/bsd/makefiles/defs.make b/hotspot/make/bsd/makefiles/defs.make deleted file mode 100644 index 795bf57db00..00000000000 --- a/hotspot/make/bsd/makefiles/defs.make +++ /dev/null @@ -1,382 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# The common definitions for hotspot bsd builds. -# Include the top level defs.make under make directory instead of this one. -# This file is included into make/defs.make. - -SLASH_JAVA ?= /java - -define print_info - ifneq ($$(LOG_LEVEL), warn) - $$(shell echo >&2 "INFO: $1") - endif -endef - -# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name -ARCH:=$(shell uname -m) -PATH_SEP = : -ifeq ($(LP64), 1) - ARCH_DATA_MODEL ?= 64 -else - ARCH_DATA_MODEL ?= 32 -endif - -# zero -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - ifeq ($(ARCH_DATA_MODEL), 64) - MAKE_ARGS += LP64=1 - endif - PLATFORM = bsd-zero - VM_PLATFORM = bsd_$(subst i386,i486,$(ZERO_LIBARCH)) - HS_ARCH = zero - ARCH = zero -endif - -# ia64 -ifeq ($(ARCH), ia64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = bsd-ia64 - VM_PLATFORM = bsd_ia64 - HS_ARCH = ia64 -endif - -# sparc -ifeq ($(ARCH), sparc64) - ifeq ($(ARCH_DATA_MODEL), 64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = bsd-sparcv9 - VM_PLATFORM = bsd_sparcv9 - else - ARCH_DATA_MODEL = 32 - PLATFORM = bsd-sparc - VM_PLATFORM = bsd_sparc - endif - HS_ARCH = sparc -endif - -# amd64 -ifneq (,$(findstring $(ARCH), amd64 x86_64)) - ifeq ($(ARCH_DATA_MODEL), 64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = bsd-amd64 - VM_PLATFORM = bsd_amd64 - HS_ARCH = x86 - else - ARCH_DATA_MODEL = 32 - PLATFORM = bsd-i586 - VM_PLATFORM = bsd_i486 - HS_ARCH = x86 - # We have to reset ARCH to i386 since SRCARCH relies on it - ARCH = i386 - endif -endif - -# i386 -ifeq ($(ARCH), i386) - ifeq ($(ARCH_DATA_MODEL), 64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = bsd-amd64 - VM_PLATFORM = bsd_amd64 - HS_ARCH = x86 - # We have to reset ARCH to amd64 since SRCARCH relies on it - ARCH = amd64 - else - ARCH_DATA_MODEL = 32 - PLATFORM = bsd-i586 - VM_PLATFORM = bsd_i486 - HS_ARCH = x86 - endif -endif - -# ARM -ifeq ($(ARCH), arm) - ARCH_DATA_MODEL = 32 - PLATFORM = bsd-arm - VM_PLATFORM = bsd_arm - HS_ARCH = arm -endif - -# PPC -ifeq ($(ARCH), ppc) - ARCH_DATA_MODEL = 32 - PLATFORM = bsd-ppc - VM_PLATFORM = bsd_ppc - HS_ARCH = ppc -endif - -# On 32 bit bsd we build server and client, on 64 bit just server. -ifeq ($(JVM_VARIANTS),) - ifeq ($(ARCH_DATA_MODEL), 32) - JVM_VARIANTS:=client,server - JVM_VARIANT_CLIENT:=true - JVM_VARIANT_SERVER:=true - else - JVM_VARIANTS:=server - JVM_VARIANT_SERVER:=true - endif -endif - -OS_VENDOR:=$(shell uname -s) - -# The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product -# builds is enabled with debug info files ZIP'ed to save space. For -# BUILD_FLAVOR != product builds, FDS is always enabled, after all a -# debug build without debug info isn't very useful. -# The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. -# -# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be -# disabled for a BUILD_FLAVOR == product build. -# -# Note: Use of a different variable name for the FDS override option -# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS -# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass -# in options via environment variables, use of distinct variables -# prevents strange behaviours. For example, in a BUILD_FLAVOR != -# product build, the FULL_DEBUG_SYMBOLS environment variable will be -# 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If -# the same variable name is used, then different values can be picked -# up by different parts of the build. Just to be clear, we only need -# two variable names because the incoming option value can be -# overridden in some situations, e.g., a BUILD_FLAVOR != product -# build. - -# Due to the multiple sub-make processes that occur this logic gets -# executed multiple times. We reduce the noise by at least checking that -# BUILD_FLAVOR has been set. -ifneq ($(BUILD_FLAVOR),) - # FULL_DEBUG_SYMBOLS not created for individual static libraries - ifeq ($(STATIC_BUILD),false) - ifeq ($(BUILD_FLAVOR), product) - FULL_DEBUG_SYMBOLS ?= 1 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) - else - # debug variants always get Full Debug Symbols (if available) - ENABLE_FULL_DEBUG_SYMBOLS = 1 - endif - endif - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(OS_VENDOR), Darwin) - # MacOS X doesn't use OBJCOPY or STRIP_POLICY - OBJCOPY= - STRIP_POLICY= - ZIP_DEBUGINFO_FILES ?= 1 - else - # Default OBJCOPY comes from GNU Binutils on BSD - ifeq ($(CROSS_COMPILE_ARCH),) - DEF_OBJCOPY=/usr/bin/objcopy - else - # Assume objcopy is part of the cross-compilation toolset - ifneq ($(ALT_COMPILER_PATH),) - DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy - endif - endif - OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) - ifneq ($(ALT_OBJCOPY),) - $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) - OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) - endif - - ifeq ($(OBJCOPY),) - $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo" \ - "files. You may need to set ALT_OBJCOPY.")) - ENABLE_FULL_DEBUG_SYMBOLS=0 - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - else - $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo" \ - "files.")) - - # Library stripping policies for .debuginfo configs: - # all_strip - strips everything from the library - # min_strip - strips most stuff from the library; leaves - # minimum symbols - # no_strip - does not strip the library at all - # - # Oracle security policy requires "all_strip". A waiver was - # granted on 2011.09.01 that permits using "min_strip" in the - # Java JDK and Java JRE. - # - # Currently, STRIP_POLICY is only used when Full Debug Symbols - # is enabled. - # - STRIP_POLICY ?= min_strip - - $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) - - ZIP_DEBUGINFO_FILES ?= 1 - endif - - $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) - endif - endif # ENABLE_FULL_DEBUG_SYMBOLS=1 -endif # BUILD_FLAVOR - -JDK_INCLUDE_SUBDIR=bsd - -# Library suffix -ifneq ($(STATIC_BUILD),true) -ifeq ($(OS_VENDOR),Darwin) - LIBRARY_SUFFIX=dylib -else - LIBRARY_SUFFIX=so -endif -else - LIBRARY_SUFFIX=a -endif - - -EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html - -# jsig library not needed for static builds -ifneq ($(STATIC_BUILD),true) - # client and server subdirectories have symbolic links to ../libjsig.so - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) -endif - -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz - else - ifeq ($(OS_VENDOR), Darwin) - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM - else - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo - endif - endif -endif - -EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server -EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client -EXPORT_MINIMAL_DIR = $(EXPORT_LIB_ARCH_DIR)/minimal - -ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) - ifeq ($(STATIC_BUILD),true) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.symbols - endif - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz - else - ifeq ($(OS_VENDOR), Darwin) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM - else - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo - endif - endif - endif -endif - -ifeq ($(JVM_VARIANT_CLIENT),true) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) - ifeq ($(STATIC_BUILD),true) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.symbols - endif - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz - else - ifeq ($(OS_VENDOR), Darwin) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM - else - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo - endif - endif - endif -endif - -ifeq ($(JVM_VARIANT_MINIMAL1),true) - EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX) - ifeq ($(STATIC_BUILD),true) - EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.symbols - endif -endif - -# Universal build settings -ifeq ($(OS_VENDOR), Darwin) - # Build universal binaries by default on Mac OS X - MACOSX_UNIVERSAL = true - ifneq ($(ALT_MACOSX_UNIVERSAL),) - MACOSX_UNIVERSAL = $(ALT_MACOSX_UNIVERSAL) - endif - MAKE_ARGS += MACOSX_UNIVERSAL=$(MACOSX_UNIVERSAL) - - # Universal settings - ifeq ($(MACOSX_UNIVERSAL), true) - - # Set universal export path but avoid using ARCH or PLATFORM subdirs - EXPORT_PATH=$(OUTPUTDIR)/export-universal$(EXPORT_SUBDIR) - ifneq ($(ALT_EXPORT_PATH),) - EXPORT_PATH=$(ALT_EXPORT_PATH) - endif - - # Set universal image dir - JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-universal$(EXPORT_SUBDIR) - ifneq ($(ALT_JDK_IMAGE_DIR),) - JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR) - endif - - # Binaries to 'universalize' if built - ifneq ($(STATIC_BUILD),true) - UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX) - endif - UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX) - UNIVERSAL_LIPO_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX) - - # Files to simply copy in place - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/Xusage.txt - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/Xusage.txt - - ifeq ($(STATIC_BUILD),true) - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.symbols - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.symbols - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/minimal/libjvm.symbols - endif - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.diz - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.diz - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.diz - else - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX).dSYM - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX).dSYM - UNIVERSAL_COPY_LIST += $(EXPORT_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM - endif - endif - - endif -endif diff --git a/hotspot/make/bsd/makefiles/dtrace.make b/hotspot/make/bsd/makefiles/dtrace.make deleted file mode 100644 index e2af31ea7a0..00000000000 --- a/hotspot/make/bsd/makefiles/dtrace.make +++ /dev/null @@ -1,333 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Rules to build jvm_db/dtrace, used by vm.make - -# We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2 -# but not for CORE configuration. - -ifneq ("${TYPE}", "CORE") - -ifeq ($(OS_VENDOR), Darwin) -# we build dtrace for macosx using USDT2 probes - -DtraceOutDir = $(GENERATED)/dtracefiles - -# Bsd does not build libjvm_db, does not compile on macosx -# disabled in build: rule in vm.make -JVM_DB = libjvm_db -LIBJVM_DB = libjvm_db.$(LIBRARY_SUFFIX) - -LIBJVM_DB_DEBUGINFO = libjvm_db.$(LIBRARY_SUFFIX).dSYM -LIBJVM_DB_DIZ = libjvm_db.diz - -JVM_DTRACE = jvm_dtrace -LIBJVM_DTRACE = libjvm_dtrace.$(LIBRARY_SUFFIX) - -LIBJVM_DTRACE_DEBUGINFO = libjvm_dtrace.$(LIBRARY_SUFFIX).dSYM -LIBJVM_DTRACE_DIZ = libjvm_dtrace.diz - -JVMOFFS = JvmOffsets -JVMOFFS.o = $(JVMOFFS).o -GENOFFS = generate$(JVMOFFS) - -DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace -DTRACE_COMMON_SRCDIR = $(GAMMADIR)/src/os/posix/dtrace -DTRACE = dtrace -DTRACE.o = $(DTRACE).o - -# to remove '-g' option which causes link problems -# also '-z nodefs' is used as workaround -GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';) - -ifdef LP64 -DTRACE_OPTS = -D_LP64 -endif - -# making libjvm_db - -# Use mapfile with libjvm_db.so -LIBJVM_DB_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_db - -# Use mapfile with libjvm_dtrace.so -LIBJVM_DTRACE_MAPFILE = # no mapfile for usdt2 # $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace - -LFLAGS_JVM_DB += $(PICFLAG) # -D_REENTRANT -LFLAGS_JVM_DTRACE += $(PICFLAG) # -D_REENTRANT - -ISA = $(subst i386,i486,$(BUILDARCH)) - -# Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so -ifneq ("${ISA}","${BUILDARCH}") - -XLIBJVM_DIR = 64 -XLIBJVM_DB = $(XLIBJVM_DIR)/$(LIBJVM_DB) -XLIBJVM_DTRACE = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE) -XARCH = $(subst sparcv9,v9,$(shell echo $(ISA))) - -XLIBJVM_DB_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DB_DEBUGINFO) -XLIBJVM_DB_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ) -XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO) -XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ) - -$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ - $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \ - $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(OS_VENDOR), Darwin) - $(DSYMUTIL) $@ - ifeq ($(ZIP_DEBUGINFO_FILES),1) - # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) - # is not in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -r -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) ) - $(RM) -r $(XLIBJVM_DB_DEBUGINFO) - endif - else - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO) - # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) - # is not in the link name: - $(QUIETLY) ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ) - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) - # is not in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) ) - $(RM) $(XLIBJVM_DB_DEBUGINFO) - endif - endif -endif - -$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ - $(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \ - $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(OS_VENDOR), Darwin) - $(DSYMUTIL) $@ - ifeq ($(ZIP_DEBUGINFO_FILES),1) - # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) - # is not in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -r -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) ) - $(RM) -r $(XLIBJVM_DTRACE_DEBUGINFO) - endif - else - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO) - # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) - # is not in the link name: - ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ) - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) - # is not in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) ) - $(RM) $(XLIBJVM_DTRACE_DEBUGINFO) - endif - endif -endif - -endif # ifneq ("${ISA}","${BUILDARCH}") - -LFLAGS_GENOFFS += -L. - -lib$(GENOFFS).$(LIBRARY_SUFFIX): $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \ - $(LIBJVM.o) - $(QUIETLY) $(CXX) $(CXXFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \ - $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -ljvm - -$(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).$(LIBRARY_SUFFIX) - $(QUIETLY) $(LINK.CXX) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ - ./lib$(GENOFFS).$(LIBRARY_SUFFIX) - -# $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. -$(JVMOFFS).h: $(GENOFFS) - $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp; touch $@; \ - if diff $@.tmp $@ > /dev/null 2>&1 ; \ - then rm -f $@.tmp; \ - else rm -f $@; mv $@.tmp $@; \ - fi - -$(JVMOFFS)Index.h: $(GENOFFS) - $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp; touch $@; \ - if diff $@.tmp $@ > /dev/null 2>&1 ; \ - then rm -f $@.tmp; \ - else rm -f $@; mv $@.tmp $@; \ - fi - -$(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h - $(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp; touch $@; \ - if diff $@.tmp $@ > /dev/null 2>&1; \ - then rm -f $@.tmp; \ - else rm -f $@; mv $@.tmp $@; \ - fi - -$(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp - $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp - -$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ - $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(OS_VENDOR), Darwin) - $(DSYMUTIL) $@ - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -r -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) - $(RM) -r $(LIBJVM_DB_DEBUGINFO) - endif - else - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) - $(RM) $(LIBJVM_DB_DEBUGINFO) - endif - endif -endif - -$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \ - $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(OS_VENDOR), Darwin) - $(DSYMUTIL) $@ - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -r -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) - $(RM) -r $(LIBJVM_DTRACE_DEBUGINFO) - endif - else - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) - $(RM) $(LIBJVM_DTRACE_DEBUGINFO) - endif - endif -endif - - -$(DtraceOutDir): - mkdir $(DtraceOutDir) - -# When building using a devkit, dtrace cannot find the correct preprocessor so -# we run it explicitly before runing dtrace. -$(DtraceOutDir)/hotspot.h: $(DTRACE_COMMON_SRCDIR)/hotspot.d | $(DtraceOutDir) - $(QUIETLY) $(CC) -E $(DTRACE_OPTS) -I. -x c $(DTRACE_COMMON_SRCDIR)/hotspot.d > $(DtraceOutDir)/hotspot.d - $(QUIETLY) $(DTRACE_PROG) -h -o $@ -s $(DtraceOutDir)/hotspot.d - -$(DtraceOutDir)/hotspot_jni.h: $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d | $(DtraceOutDir) - $(QUIETLY) $(CC) -E $(DTRACE_OPTS) -I. -x c $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d > $(DtraceOutDir)/hotspot_jni.d - $(QUIETLY) $(DTRACE_PROG) -h -o $@ -s $(DtraceOutDir)/hotspot_jni.d - -$(DtraceOutDir)/hs_private.h: $(DTRACE_COMMON_SRCDIR)/hs_private.d | $(DtraceOutDir) - $(QUIETLY) $(CC) -E $(DTRACE_OPTS) -I. -x c $(DTRACE_COMMON_SRCDIR)/hs_private.d > $(DtraceOutDir)/hs_private.d - $(QUIETLY) $(DTRACE_PROG) -h -o $@ -s $(DtraceOutDir)/hs_private.d - -dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h - - -.PHONY: dtraceCheck - -SYSTEM_DTRACE_PROG = /usr/sbin/dtrace -systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) - -ifneq ("$(systemDtraceFound)", "") -DTRACE_PROG=$(SYSTEM_DTRACE_PROG) -else - -endif - -ifneq ("${DTRACE_PROG}", "") -ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") - -DTRACE_OBJS = $(DTRACE.o) #$(JVMOFFS.o) -CFLAGS += -DDTRACE_ENABLED #$(DTRACE_INCL) - - -dtraceCheck: - -dtrace_stuff: dtrace_gen_headers - $(QUIETLY) echo $(LOG_INFO) "dtrace headers generated" - - -else # manually disabled - -dtraceCheck: - $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled via environment variable" - -dtrace_stuff: - -endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") - -else # No dtrace program found - -dtraceCheck: - $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled: not supported by system" - -dtrace_stuff: - -endif # ifneq ("${dtraceFound}", "") - -endif # ifeq ($(OS_VENDOR), Darwin) - - -else # CORE build - -dtraceCheck: - $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for CORE builds" - -endif # ifneq ("${TYPE}", "CORE") diff --git a/hotspot/make/bsd/makefiles/fastdebug.make b/hotspot/make/bsd/makefiles/fastdebug.make deleted file mode 100644 index d57e545b5b0..00000000000 --- a/hotspot/make/bsd/makefiles/fastdebug.make +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -# They may also specify FASTDEBUG_CFLAGS, but it defaults to DEBUG_CFLAGS. - -FASTDEBUG_CFLAGS$(FASTDEBUG_CFLAGS) = $(DEBUG_CFLAGS) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# The following lines are copied from debug.make, except that we -# consult FASTDEBUG_CFLAGS instead of DEBUG_CFLAGS. -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -DEBUG_CFLAGS/DEFAULT= $(FASTDEBUG_CFLAGS) -DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)) -CFLAGS += $(DEBUG_CFLAGS/BYFILE) - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug -ifeq ($(OS_VENDOR), Darwin) -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-debug -endif - -VERSION = fastdebug -SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS -PICFLAGS = DEFAULT diff --git a/hotspot/make/bsd/makefiles/gcc.make b/hotspot/make/bsd/makefiles/gcc.make deleted file mode 100644 index 1bf6521a892..00000000000 --- a/hotspot/make/bsd/makefiles/gcc.make +++ /dev/null @@ -1,543 +0,0 @@ -# -# 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 -# 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. -# -# - -OS_VENDOR = $(shell uname -s) - -#------------------------------------------------------------------------ -# CC, CXX & AS - -# If a SPEC is not set already, then use these defaults. -ifeq ($(SPEC),) - # When cross-compiling the ALT_COMPILER_PATH points - # to the cross-compilation toolset - ifdef CROSS_COMPILE_ARCH - CXX = $(ALT_COMPILER_PATH)/g++ - CC = $(ALT_COMPILER_PATH)/gcc - HOSTCXX = g++ - HOSTCC = gcc - else ifneq ($(OS_VENDOR), Darwin) - CXX = g++ - CC = gcc - HOSTCXX = $(CXX) - HOSTCC = $(CC) - endif - - # i486 hotspot requires -mstackrealign on Darwin. - # llvm-gcc supports this in Xcode 3.2.6 and 4.0. - # gcc-4.0 supports this on earlier versions. - # Prefer llvm-gcc where available. - ifeq ($(OS_VENDOR), Darwin) - ifeq ($(origin CXX), default) - CXX = llvm-g++ - endif - ifeq ($(origin CC), default) - CC = llvm-gcc - endif - - ifeq ($(ARCH), i486) - LLVM_SUPPORTS_STACKREALIGN := $(shell \ - [ "0"`llvm-gcc -v 2>&1 | grep LLVM | sed -E "s/.*LLVM build ([0-9]+).*/\1/"` -gt "2333" ] \ - && echo true || echo false) - - ifeq ($(LLVM_SUPPORTS_STACKREALIGN), true) - CXX32 ?= llvm-g++ - CC32 ?= llvm-gcc - else - CXX32 ?= g++-4.0 - CC32 ?= gcc-4.0 - endif - CXX = $(CXX32) - CC = $(CC32) - endif - - ifeq ($(USE_CLANG), true) - CXX = clang++ - CC = clang - endif - - HOSTCXX = $(CXX) - HOSTCC = $(CC) - endif - - AS = $(CC) -c -endif - -ifeq ($(OS_VENDOR), Darwin) - ifeq ($(DSYMUTIL),) - DSYMUTIL=dsymutil - endif -endif - -ifeq ($(USE_CLANG), true) - CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1) - CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2) -else - # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only - # prints the numbers (e.g. "2.95", "3.2.1") - CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) - CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) - CC_VER_MICRO := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f3) -endif - -ifeq ($(USE_CLANG), true) - # Clang has precompiled headers support by default, but the user can switch - # it off by using 'USE_PRECOMPILED_HEADER=0'. - ifdef LP64 - ifeq ($(USE_PRECOMPILED_HEADER),) - USE_PRECOMPILED_HEADER=1 - endif - else - # We don't support precompiled headers on 32-bit builds because there some files are - # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make) - # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit. - USE_PRECOMPILED_HEADER=0 - endif - - ifeq ($(USE_PRECOMPILED_HEADER),1) - - ifndef LP64 - $(error " Precompiled Headers only supported on 64-bit platforms!") - endif - - PRECOMPILED_HEADER_DIR=. - PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp - PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch - - PCH_FLAG = -include precompiled.hpp - PCH_FLAG/DEFAULT = $(PCH_FLAG) - PCH_FLAG/NO_PCH = -DNO_PCH - PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@)) - - VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE) - VM_PCH_FLAG/AOUT = - VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO)) - - # We only use precompiled headers for the JVM build - CFLAGS += $(VM_PCH_FLAG) - - # The following files are compiled at various optimization - # levels due to optimization issues encountered at the - # 'OPT_CFLAGS_DEFAULT' level. The Clang compiler issues a compile - # time error if there is an optimization level specification - # skew between the PCH file and the C++ file. Especially if the - # PCH file is compiled at a higher optimization level than - # the C++ file. One solution might be to prepare extra optimization - # level specific PCH files for the opt build and use them here, but - # it's probably not worth the effort as long as only a few files - # need this special handling. - PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH) - PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH) - PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH) - PCH_FLAG/unsafe.o = $(PCH_FLAG/NO_PCH) - PCH_FLAG/jvmciCompilerToVM.o = $(PCH_FLAG/NO_PCH) - - endif -else # ($(USE_CLANG), true) - # check for precompiled headers support - ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" - # Allow the user to turn off precompiled headers from the command line. - ifneq ($(USE_PRECOMPILED_HEADER),0) - PRECOMPILED_HEADER_DIR=. - PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp - PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch - endif - endif -endif - -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -ifeq ($(USE_PRECOMPILED_HEADER),0) - CFLAGS += -DDONT_USE_PRECOMPILED_HEADER -endif - -#------------------------------------------------------------------------ -# Compiler flags - -# position-independent code -PICFLAG = -fPIC - -VM_PICFLAG/LIBJVM = $(PICFLAG) -VM_PICFLAG/AOUT = -VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) - -ifeq ($(JVM_VARIANT_ZERO), true) - CFLAGS += $(LIBFFI_CFLAGS) -endif -ifeq ($(JVM_VARIANT_ZEROSHARK), true) - CFLAGS += $(LIBFFI_CFLAGS) - CFLAGS += $(LLVM_CFLAGS) -endif - -ifeq ($(STATIC_BUILD),true) -CXXFLAGS += -DSTATIC_BUILD -CFLAGS += -DSTATIC_BUILD -else -CFLAGS += $(VM_PICFLAG) -endif - -CFLAGS += -fno-rtti -CFLAGS += -fno-exceptions -ifeq ($(USE_CLANG),) - CFLAGS += -pthread - CFLAGS += -fcheck-new - # version 4 and above support fvisibility=hidden (matches jni_x86.h file) - # except 4.1.2 gives pointless warnings that can't be disabled (afaik) - ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" - CFLAGS += -fvisibility=hidden - endif -else - CFLAGS += -fvisibility=hidden -endif - -ifeq ($(USE_CLANG), true) - # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm' - # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment') - ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0" - STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16 - else - STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16 - endif -endif - -ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) -ARCHFLAG/i486 = -m32 -march=i586 -ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT) -ARCHFLAG/ia64 = -ARCHFLAG/sparc = -m32 -mcpu=v9 -ARCHFLAG/sparcv9 = -m64 -mcpu=v9 -ARCHFLAG/zero = $(ZERO_ARCHFLAG) - -# Darwin-specific build flags -ifeq ($(OS_VENDOR), Darwin) - # Ineffecient 16-byte stack re-alignment on Darwin/IA32 - ARCHFLAG/i486 += -mstackrealign -endif - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) -ASFLAGS += $(ARCHFLAG) - -ifdef E500V2 -CFLAGS += -DE500V2 -endif - -# Use C++ Interpreter -ifdef CC_INTERP - CFLAGS += -DCC_INTERP -endif - -# Keep temporary files (.ii, .s) -ifdef NEED_ASM - CFLAGS += -save-temps -else - CFLAGS += -pipe -endif - -# Compiler warnings are treated as errors -ifneq ($(COMPILER_WARNINGS_FATAL),false) - WARNINGS_ARE_ERRORS ?= -Werror -endif - -ifeq ($(USE_CLANG), true) - # However we need to clean the code up before we can unrestrictedly enable this option with Clang - WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses - WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare -# Not yet supported by clang in Xcode 4.6.2 -# WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare - WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess - WARNINGS_ARE_ERRORS += -Wno-empty-body -endif - -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wformat=2 - -ifeq ($(USE_CLANG),) - # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit - # conversions which might affect the values. Only enable it in earlier versions. - ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" - WARNINGS_FLAGS += -Wconversion - endif -endif - -CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) -# Special cases -CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) -# XXXDARWIN: for _dyld_bind_fully_image_containing_address -ifeq ($(OS_VENDOR), Darwin) - CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations -endif - -# optimization control flags (Used by fastdebug and release variants) -OPT_CFLAGS/NOOPT=-O0 -OPT_CFLAGS/DEBUG=-O0 -OPT_CFLAGS/SIZE=-Os -OPT_CFLAGS/SPEED=-O3 - -ifeq ($(OS_VENDOR), Darwin) - # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy - # - OPT_CFLAGS_DEFAULT ?= SIZE -else - OPT_CFLAGS_DEFAULT ?= SPEED -endif - -# Hotspot uses very unstrict aliasing turn this optimization off -# This option is added to CFLAGS rather than OPT_CFLAGS -# so that OPT_CFLAGS overrides get this option too. -CFLAGS += -fno-strict-aliasing - -ifdef OPT_CFLAGS - ifneq ("$(origin OPT_CFLAGS)", "command line") - $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") - endif -endif - -OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) - -# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp -# if we use expensive-optimizations -ifeq ($(BUILDARCH), ia64) -OPT_CFLAGS += -fno-expensive-optimizations -endif - -# Work around some compiler bugs. -ifeq ($(USE_CLANG), true) - # Clang < 6 | <= 6.1 | <= 7.0 - ifeq ($(shell expr \ - $(CC_VER_MAJOR) \< 6 \| \ - \( $(CC_VER_MAJOR) = 6 \& $(CC_VER_MINOR) \<= 1 \) \| \ - \( $(CC_VER_MAJOR) = 7 \& $(CC_VER_MINOR) \<= 0 \) \ - ), 1) - OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) - OPT_CFLAGS/unsafe.o += -O1 - - # The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides - # of OPT_CFLAGS. Restore it here. - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/loopTransform.o += -g - OPT_CFLAGS/unsafe.o += -g - endif - else - $(error "Update compiler workarounds for Clang $(CC_VER_MAJOR).$(CC_VER_MINOR)") - endif -else - # Do not allow GCC 4.1.1 - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 1 \& $(CC_VER_MICRO) = 1), 1) - $(error "GCC $(CC_VER_MAJOR).$(CC_VER_MINOR).$(CC_VER_MICRO) not supported because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27724") - endif - # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) - OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) - endif -endif - -# Flags for generating make dependency flags. -DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) -ifeq ($(USE_CLANG),) - ifneq ($(CC_VER_MAJOR), 2) - DEPFLAGS += -fpch-deps - endif -endif - -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -ifeq ($(USE_PRECOMPILED_HEADER),0) -CFLAGS += -DDONT_USE_PRECOMPILED_HEADER -endif - -ifeq ($(OS_VENDOR), Darwin) - # Setting these parameters makes it an error to link to macosx APIs that are - # newer than the given OS version and makes the linked binaries compatible even - # if built on a newer version of the OS. - # The expected format is X.Y.Z - ifeq ($(MACOSX_VERSION_MIN),) - MACOSX_VERSION_MIN=10.7.0 - endif - # The macro takes the version with no dots, ex: 1070 - CFLAGS += -DMAC_OS_X_VERSION_MAX_ALLOWED=$(subst .,,$(MACOSX_VERSION_MIN)) \ - -mmacosx-version-min=$(MACOSX_VERSION_MIN) - LDFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) -endif - - -#------------------------------------------------------------------------ -# Assembler flags - -# Enforce prerpocessing of .s files -ASFLAGS += -x assembler-with-cpp - -#------------------------------------------------------------------------ -# Linker flags - -# statically link libstdc++.so, work with gcc but ignored by g++ -STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic - -# Ensure use libstdc++ on clang, not libc++ -ifeq ($(USE_CLANG), true) - LFLAGS += -stdlib=libstdc++ -endif - -ifeq ($(USE_CLANG),) - # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. - ifneq ($(CC_VER_MAJOR), 2) - STATIC_LIBGCC += -static-libgcc - endif - - ifneq ($(OS_VENDOR), Darwin) - ifneq (, findstring(debug,$(BUILD_FLAVOR))) - # for relocations read-only - LFLAGS += -Xlinker -z -Xlinker relro - - ifeq ($(BUILD_FLAVOR), debug) - # disable incremental relocations linking - LFLAGS += -Xlinker -z -Xlinker now - endif - endif - endif - - ifeq ($(BUILDARCH), ia64) - LFLAGS += -Wl,-relax - endif -endif - -# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. -MAPFLAG = -Xlinker --version-script=FILENAME - -# -# Shared Library -# -ifeq ($(OS_VENDOR), Darwin) - # Standard linker flags - LFLAGS += - - # The apple linker has its own variant of mapfiles/version-scripts - MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME - - # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj - SONAMEFLAG = - - # Build shared library - SHARED_FLAG = -Wl,-install_name,@rpath/$(@F) -dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0 $(VM_PICFLAG) - - # Keep symbols even they are not used - #AOUT_FLAGS += -Xlinker -export-dynamic -else - # Enable linker optimization - LFLAGS += -Xlinker -O1 - - # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj - SONAMEFLAG = -Xlinker -soname=SONAME - - # Build shared library - SHARED_FLAG = -shared $(VM_PICFLAG) - - # Keep symbols even they are not used - AOUT_FLAGS += -Xlinker -export-dynamic -endif - -#------------------------------------------------------------------------ -# Debug flags - -ifeq ($(USE_CLANG), true) - # Restrict the debug information created by Clang to avoid - # too big object files and speed the build up a little bit - # (see http://llvm.org/bugs/show_bug.cgi?id=7554) - CFLAGS += -flimit-debug-info -endif - -# Allow no optimizations. -DEBUG_CFLAGS=-O0 - -# DEBUG_BINARIES uses full -g debug information for all configs -ifeq ($(DEBUG_BINARIES), true) - CFLAGS += -g -else - # Use the stabs format for debugging information (this is the default - # on gcc-2.91). It's good enough, has all the information about line - # numbers and local variables, and libjvm.so is only about 16M. - # Change this back to "-g" if you want the most expressive format. - # (warning: that could easily inflate libjvm.so to 150M!) - # Note: The Itanium gcc compiler crashes when using -gstabs. - DEBUG_CFLAGS/ia64 = -g - DEBUG_CFLAGS/amd64 = -g - DEBUG_CFLAGS/arm = -g - DEBUG_CFLAGS/ppc = -g - DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) - ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) - ifeq ($(USE_CLANG), true) - # Clang doesn't understand -gstabs - DEBUG_CFLAGS += -g - else - DEBUG_CFLAGS += -gstabs - endif - endif - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - FASTDEBUG_CFLAGS/ia64 = -g - FASTDEBUG_CFLAGS/amd64 = -g - FASTDEBUG_CFLAGS/arm = -g - FASTDEBUG_CFLAGS/ppc = -g - FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH)) - ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),) - ifeq ($(USE_CLANG), true) - # Clang doesn't understand -gstabs - FASTDEBUG_CFLAGS += -g - else - FASTDEBUG_CFLAGS += -gstabs - endif - endif - - OPT_CFLAGS/ia64 = -g - OPT_CFLAGS/amd64 = -g - OPT_CFLAGS/arm = -g - OPT_CFLAGS/ppc = -g - OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH)) - ifeq ($(OPT_CFLAGS/$(BUILDARCH)),) - ifeq ($(USE_CLANG), true) - # Clang doesn't understand -gstabs - OPT_CFLAGS += -g - else - OPT_CFLAGS += -gstabs - endif - endif - endif -endif - -ifeq ($(USE_CLANG),) - # Enable bounds checking. - ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1" - # stack smashing checks. - DEBUG_CFLAGS += -fstack-protector-all --param ssp-buffer-size=1 - endif -endif - -# If we are building HEADLESS, pass on to VM -# so it can set the java.awt.headless property -ifdef HEADLESS -CFLAGS += -DHEADLESS -endif - -# We are building Embedded for a small device -# favor code space over speed -ifdef MINIMIZE_RAM_USAGE -CFLAGS += -DMINIMIZE_RAM_USAGE -endif diff --git a/hotspot/make/bsd/makefiles/hp.make b/hotspot/make/bsd/makefiles/hp.make deleted file mode 100644 index e0b262a8fa2..00000000000 --- a/hotspot/make/bsd/makefiles/hp.make +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making premium version of VM - -TYPE=HP - -CFLAGS += -DCOMPILER2 diff --git a/hotspot/make/bsd/makefiles/hp1.make b/hotspot/make/bsd/makefiles/hp1.make deleted file mode 100644 index 2e37a6ead33..00000000000 --- a/hotspot/make/bsd/makefiles/hp1.make +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making premium version of VM - -TYPE=HP1 - -CFLAGS += -DCOMPILER1 diff --git a/hotspot/make/bsd/makefiles/i486.make b/hotspot/make/bsd/makefiles/i486.make deleted file mode 100644 index 86e825d3e9d..00000000000 --- a/hotspot/make/bsd/makefiles/i486.make +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 1999, 2010, 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. -# -# - -# TLS helper, assembled from .s file - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) -# Must also specify if CPU is little endian -CFLAGS += -DVM_LITTLE_ENDIAN - -OPT_CFLAGS/compactingPermGenGen.o = -O1 diff --git a/hotspot/make/bsd/makefiles/ia64.make b/hotspot/make/bsd/makefiles/ia64.make deleted file mode 100644 index 8535807a787..00000000000 --- a/hotspot/make/bsd/makefiles/ia64.make +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# -# IA64 only uses c++ based interpreter -CFLAGS += -DCC_INTERP -D_LP64=1 -DVM_LITTLE_ENDIAN -ifeq ($(VERSION),debug) -ASM_FLAGS= -DDEBUG -else -ASM_FLAGS= -endif -# workaround gcc bug in compiling varargs -OPT_CFLAGS/jni.o = -O0 - -# gcc/ia64 has a bug that internal gcc functions linked with libjvm.so -# are made public. Hiding those symbols will cause undefined symbol error -# when VM is dropped into older JDK. We probably will need an IA64 -# mapfile to include those symbols as a workaround. Disable linker mapfile -# for now. -LDNOMAP=true diff --git a/hotspot/make/bsd/makefiles/jsig.make b/hotspot/make/bsd/makefiles/jsig.make deleted file mode 100644 index 585a0f45ba9..00000000000 --- a/hotspot/make/bsd/makefiles/jsig.make +++ /dev/null @@ -1,110 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Rules to build signal interposition library, used by vm.make - -# libjsig.so: signal interposition library -JSIG = jsig - -ifeq ($(OS_VENDOR), Darwin) - LIBJSIG = lib$(JSIG).$(LIBRARY_SUFFIX) - - LIBJSIG_DEBUGINFO = lib$(JSIG).$(LIBRARY_SUFFIX).dSYM - LIBJSIG_DIZ = lib$(JSIG).diz -else - LIBJSIG = lib$(JSIG).so - - LIBJSIG_DEBUGINFO = lib$(JSIG).debuginfo - LIBJSIG_DIZ = lib$(JSIG).diz -endif - -JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm - -DEST_JSIG = $(JDK_LIBDIR)/$(LIBJSIG) -DEST_JSIG_DEBUGINFO = $(JDK_LIBDIR)/$(LIBJSIG_DEBUGINFO) -DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ) - -LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig - -# On Bsd we really dont want a mapfile, as this library is small -# and preloaded using LD_PRELOAD, making functions private will -# cause problems with interposing. See CR: 6466665 -# LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) - -LFLAGS_JSIG += -D_GNU_SOURCE -pthread $(LDFLAGS_HASH_STYLE) - -# DEBUG_BINARIES overrides everything, use full -g debug information -ifeq ($(DEBUG_BINARIES), true) - JSIG_DEBUG_CFLAGS = -g -endif - -$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo $(LOG_INFO) Making signal interposition lib... -ifeq ($(STATIC_BUILD),true) - $(QUIETLY) $(CC) -c $(SYMFLAG) $(EXTRA_CFLAGS) $(ARCHFLAG) $(PICFLAG) \ - $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $(JSIG).o $< - $(QUIETLY) $(AR) $(ARFLAGS) $@ $(JSIG).o -else - $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ - $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(EXTRA_CFLAGS) -o $@ $< -endif -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(OS_VENDOR), Darwin) - $(DSYMUTIL) $@ - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -r -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) - $(RM) -r $(LIBJSIG_DEBUGINFO) - endif - else - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -g $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) - $(RM) $(LIBJSIG_DEBUGINFO) - endif - endif -endif - -install_jsig: $(LIBJSIG) - @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" -ifeq ($(OS_VENDOR), Darwin) - $(QUIETLY) test ! -d $(LIBJSIG_DEBUGINFO) || \ - $(CP) -f -r $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) -else - $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ - $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) -endif - $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ - $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" - -.PHONY: install_jsig diff --git a/hotspot/make/bsd/makefiles/jvmti.make b/hotspot/make/bsd/makefiles/jvmti.make deleted file mode 100644 index cb22c2b0f4d..00000000000 --- a/hotspot/make/bsd/makefiles/jvmti.make +++ /dev/null @@ -1,116 +0,0 @@ -# -# Copyright (c) 2003, 2010, 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. -# -# - -# This makefile (jvmti.make) is included from the jvmti.make in the -# build directories. -# -# It knows how to build and run the tools to generate jvmti. - -include $(GAMMADIR)/make/bsd/makefiles/rules.make - -# ######################################################################### - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles - -JvmtiSrcDir = $(GAMMADIR)/src/share/vm/prims -InterpreterSrcDir = $(GAMMADIR)/src/share/vm/interpreter - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(JvmtiSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -JvmtiGeneratedNames = \ - jvmtiEnv.hpp \ - jvmtiEnter.cpp \ - jvmtiEnterTrace.cpp \ - jvmtiEnvRecommended.cpp \ - bytecodeInterpreterWithChecks.cpp \ - jvmti.h \ - -JvmtiEnvFillSource = $(JvmtiSrcDir)/jvmtiEnvFill.java -JvmtiEnvFillClass = $(JvmtiOutDir)/jvmtiEnvFill.class - -JvmtiGenSource = $(JvmtiSrcDir)/jvmtiGen.java -JvmtiGenClass = $(JvmtiOutDir)/jvmtiGen.class - -JvmtiGeneratedFiles = $(JvmtiGeneratedNames:%=$(JvmtiOutDir)/%) - -XSLT = $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -.PHONY: all jvmtidocs clean cleanall - -# ######################################################################### - -all: $(JvmtiGeneratedFiles) - -both = $(JvmtiGenClass) $(JvmtiSrcDir)/jvmti.xml $(JvmtiSrcDir)/jvmtiLib.xsl - -$(JvmtiGenClass): $(JvmtiGenSource) - $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiGenSource) - -$(JvmtiEnvFillClass): $(JvmtiEnvFillSource) - $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) - -$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti - -$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp - -$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace - -$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp - $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp - -$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp - -$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h - -jvmtidocs: $(JvmtiOutDir)/jvmti.html - -$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html - -# ######################################################################### - -clean : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -cleanall : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -# ######################################################################### diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug deleted file mode 100644 index f92fe181903..00000000000 --- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-debug +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# -# Only used for OSX/Darwin builds - -# Define public interface. - _JVM_handle_bsd_signal - - # miscellaneous functions - _jio_fprintf - _jio_printf - _jio_snprintf - _jio_vfprintf - _jio_vsnprintf - - # This is for Forte Analyzer profiling support. - _AsyncGetCallTrace - - # INSERT VTABLE SYMBOLS HERE - diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product b/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product deleted file mode 100644 index 47b8549c2ba..00000000000 --- a/hotspot/make/bsd/makefiles/mapfile-vers-darwin-product +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# -# Only used for OSX/Darwin builds - -# Define public interface. - _JVM_handle_bsd_signal - - # miscellaneous functions - _jio_fprintf - _jio_printf - _jio_snprintf - _jio_vfprintf - _jio_vsnprintf - - # This is for Forte Analyzer profiling support. - _AsyncGetCallTrace - - # INSERT VTABLE SYMBOLS HERE - diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-debug b/hotspot/make/bsd/makefiles/mapfile-vers-debug deleted file mode 100644 index ec0f06d8f65..00000000000 --- a/hotspot/make/bsd/makefiles/mapfile-vers-debug +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - JVM_handle_linux_signal; - - # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; - - # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE - - local: - *; -}; - diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-jsig b/hotspot/make/bsd/makefiles/mapfile-vers-jsig deleted file mode 100644 index 8a675046b6e..00000000000 --- a/hotspot/make/bsd/makefiles/mapfile-vers-jsig +++ /dev/null @@ -1,40 +0,0 @@ -# - -# -# Copyright (c) 2005, 2008, 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. -# -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - JVM_begin_signal_setting; - JVM_end_signal_setting; - JVM_get_libjsig_version; - JVM_get_signal_action; - sigaction; - signal; - sigset; - local: - *; -}; diff --git a/hotspot/make/bsd/makefiles/mapfile-vers-product b/hotspot/make/bsd/makefiles/mapfile-vers-product deleted file mode 100644 index ec0f06d8f65..00000000000 --- a/hotspot/make/bsd/makefiles/mapfile-vers-product +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - JVM_handle_linux_signal; - - # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; - - # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE - - local: - *; -}; - diff --git a/hotspot/make/bsd/makefiles/minimal1.make b/hotspot/make/bsd/makefiles/minimal1.make deleted file mode 100644 index d453e789877..00000000000 --- a/hotspot/make/bsd/makefiles/minimal1.make +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -TYPE=MINIMAL1 - -# Force all variables to false, overriding any other -# setting that may have occurred in the makefiles. These -# can still be overridden by passing the variable as an -# argument to 'make' -INCLUDE_JVMTI := false -INCLUDE_FPROF := false -INCLUDE_VM_STRUCTS := false -INCLUDE_JNI_CHECK := false -INCLUDE_SERVICES := false -INCLUDE_MANAGEMENT := false -INCLUDE_ALL_GCS := false -INCLUDE_NMT := false -INCLUDE_TRACE := false -INCLUDE_CDS := false -INCLUDE_JVMCI := false - -CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" -CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" - -Src_Dirs/MINIMAL1 = $(CORE_PATHS) $(COMPILER1_PATHS) - -Src_Files_EXCLUDE/MINIMAL1 += $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp - --include $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make - -.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make diff --git a/hotspot/make/bsd/makefiles/optimized.make b/hotspot/make/bsd/makefiles/optimized.make deleted file mode 100644 index f098efdbd82..00000000000 --- a/hotspot/make/bsd/makefiles/optimized.make +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making optimized version of HotSpot VM -# (This is the "product", not the "release" version.) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug -ifeq ($(OS_VENDOR), Darwin) -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-debug -endif - -VERSION = optimized diff --git a/hotspot/make/bsd/makefiles/ppc.make b/hotspot/make/bsd/makefiles/ppc.make deleted file mode 100644 index 92957f963f9..00000000000 --- a/hotspot/make/bsd/makefiles/ppc.make +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (c) 2004, 2011, 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. -# -# - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) - -# Must also specify if CPU is big endian -CFLAGS += -DVM_BIG_ENDIAN - diff --git a/hotspot/make/bsd/makefiles/product.make b/hotspot/make/bsd/makefiles/product.make deleted file mode 100644 index 7d3c345d38c..00000000000 --- a/hotspot/make/bsd/makefiles/product.make +++ /dev/null @@ -1,62 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making optimized version of HotSpot VM -# (This is the "product", not the "release" version.) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-product -ifeq ($(OS_VENDOR), Darwin) -MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-darwin-product -endif - -SYSDEFS += -DPRODUCT -VERSION = optimized - -ifneq ($(OS_VENDOR), Darwin) - # use -g to strip library as -x will discard its symbol table; -x is fine for - # executables. - ifdef CROSS_COMPILE_ARCH - STRIP = $(ALT_COMPILER_PATH)/strip - else - STRIP = strip - endif - STRIP_LIBJVM = $(STRIP) -g $@ || exit 1; - STRIP_AOUT = $(STRIP) -x $@ || exit 1; - - # Don't strip in VM build; JDK build will strip libraries later - # LINK_LIB.CXX/POST_HOOK += $(STRIP_$(LINK_INTO)) -endif diff --git a/hotspot/make/bsd/makefiles/rules.make b/hotspot/make/bsd/makefiles/rules.make deleted file mode 100644 index bb36f19a473..00000000000 --- a/hotspot/make/bsd/makefiles/rules.make +++ /dev/null @@ -1,212 +0,0 @@ -# -# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Common rules/macros for the vm, adlc. - -# Tell make that .cpp is important -.SUFFIXES: .cpp $(SUFFIXES) - -DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ - -# $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). -CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS) -CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS) - -AS.S = $(AS) $(ASFLAGS) - -COMPILE.CC = $(CC_COMPILE) -c -GENASM.CC = $(CC_COMPILE) -S -LINK.CC = $(CC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -ifeq ($(STATIC_BUILD),true) -LINK_LIB.CC = $(AR) $(ARFLAGS) -else -LINK_LIB.CC = $(CC) $(LFLAGS) $(SHARED_FLAG) -endif -PREPROCESS.CC = $(CC_COMPILE) -E - -COMPILE.CXX = $(CXX_COMPILE) -c -GENASM.CXX = $(CXX_COMPILE) -S -LINK.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -LINK_NOPROF.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) -LINK_LIB.CXX = $(CXX) $(LFLAGS) $(SHARED_FLAG) -PREPROCESS.CXX = $(CXX_COMPILE) -E - -# cross compiling the jvm with c2 requires host compilers to build -# adlc tool - -HOST.CXX_COMPILE = $(HOSTCXX) $(CXXFLAGS) $(CFLAGS) -HOST.COMPILE.CXX = $(HOST.CXX_COMPILE) -c -HOST.LINK_NOPROF.CXX = $(HOSTCXX) $(LFLAGS) $(AOUT_FLAGS) - - -# Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k". -REMOVE_TARGET = rm -f $@ - -# Note use of ALT_BOOTDIR to explicitly specify location of java and -# javac; this is the same environment variable used in the J2SE build -# process for overriding the default spec, which is BOOTDIR. -# Note also that we fall back to using JAVA_HOME if neither of these is -# specified. - -ifdef ALT_BOOTDIR - -RUN.JAVA = $(ALT_BOOTDIR)/bin/java -RUN.JAVAP = $(ALT_BOOTDIR)/bin/javap -RUN.JAVAH = $(ALT_BOOTDIR)/bin/javah -RUN.JAR = $(ALT_BOOTDIR)/bin/jar -COMPILE.JAVAC = $(ALT_BOOTDIR)/bin/javac -COMPILE.RMIC = $(ALT_BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(ALT_BOOTDIR) - -else - -ifdef BOOTDIR - -RUN.JAVA = $(BOOTDIR)/bin/java -RUN.JAVAP = $(BOOTDIR)/bin/javap -RUN.JAVAH = $(BOOTDIR)/bin/javah -RUN.JAR = $(BOOTDIR)/bin/jar -COMPILE.JAVAC = $(BOOTDIR)/bin/javac -COMPILE.RMIC = $(BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(BOOTDIR) - -else - -ifdef JAVA_HOME - -RUN.JAVA = $(JAVA_HOME)/bin/java -RUN.JAVAP = $(JAVA_HOME)/bin/javap -RUN.JAVAH = $(JAVA_HOME)/bin/javah -RUN.JAR = $(JAVA_HOME)/bin/jar -COMPILE.JAVAC = $(JAVA_HOME)/bin/javac -COMPILE.RMIC = $(JAVA_HOME)/bin/rmic -BOOT_JAVA_HOME = $(JAVA_HOME) - -else - -# take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined - -RUN.JAVA = java -RUN.JAVAP = javap -RUN.JAVAH = javah -RUN.JAR = jar -COMPILE.JAVAC = javac -COMPILE.RMIC = rmic - -endif -endif -endif - -COMPILE.JAVAC += $(BOOTSTRAP_JAVAC_FLAGS) - -SUM = /usr/bin/sum - -# 'gmake MAKE_VERBOSE=y' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ -RUN.JAR$(MAKE_VERBOSE) += >/dev/null - -# Settings for javac -JAVAC_FLAGS = -g -encoding ascii - -# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system) -# Fall back to the values here if it's not set (hotspot only builds) -ifeq ($(BOOT_JDK_SOURCETARGET),) -BOOTSTRAP_SOURCETARGET := -source 8 -target 8 -else -BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET) -endif - -BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET) - -# With parallel makes, print a message at the end of compilation. -ifeq ($(findstring j,$(MFLAGS)),j) -COMPILE_DONE = && { echo Done with $<; } -endif - -# Include $(NONPIC_OBJ_FILES) definition -ifndef LP64 -include $(GAMMADIR)/make/pic.make -endif - -include $(GAMMADIR)/make/altsrc.make - -# The non-PIC object files are only generated for 32 bit platforms. -ifdef LP64 -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) -else -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ - $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ - $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)) -endif - -%.o: %.s - @echo $(LOG_INFO) Assembling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) - -%.s: %.cpp - @echo $(LOG_INFO) Generating assembly for $< - $(QUIETLY) $(GENASM.CXX) -o $@ $< - $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) - -# Intermediate files (for debugging macros) -%.i: %.cpp - @echo $(LOG_INFO) Preprocessing $< to $@ - $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) - -# Override gnumake built-in rules which do sccs get operations badly. -# (They put the checked out code in the current directory, not in the -# directory of the original file.) Since this is a symptom of a teamware -# failure, and since not all problems can be detected by gnumake due -# to incomplete dependency checking... just complain and stop. -%:: s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -%:: SCCS/s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -.PHONY: default diff --git a/hotspot/make/bsd/makefiles/shark.make b/hotspot/make/bsd/makefiles/shark.make deleted file mode 100644 index ca702ee6616..00000000000 --- a/hotspot/make/bsd/makefiles/shark.make +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2008, 2010 Red Hat, Inc. -# 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. -# -# - -# Sets make macros for making Shark version of VM - -TYPE = SHARK - -VM_SUBDIR = server - -CFLAGS += -DSHARK diff --git a/hotspot/make/bsd/makefiles/sparc.make b/hotspot/make/bsd/makefiles/sparc.make deleted file mode 100644 index ddb05132fab..00000000000 --- a/hotspot/make/bsd/makefiles/sparc.make +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2005, 2010, 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. -# -# - diff --git a/hotspot/make/bsd/makefiles/sparcWorks.make b/hotspot/make/bsd/makefiles/sparcWorks.make deleted file mode 100644 index e39116023c5..00000000000 --- a/hotspot/make/bsd/makefiles/sparcWorks.make +++ /dev/null @@ -1,107 +0,0 @@ -# -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -#------------------------------------------------------------------------ -# CC, CXX & AS - -# If a SPEC is not set already, then use these defaults. -ifeq ($(SPEC),) - CXX = CC - CC = cc - AS = $(CC) -c - - HOSTCXX = $(CXX) - HOSTCC = $(CC) -endif - -ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) -ARCHFLAG/i486 = -m32 -ARCHFLAG/amd64 = -m64 - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) -ASFLAGS += $(ARCHFLAG) - -#------------------------------------------------------------------------ -# Compiler flags - -# position-independent code -PICFLAG = -KPIC - -CFLAGS += $(PICFLAG) -# no more exceptions -CFLAGS += -features=no%except -# Reduce code bloat by reverting back to 5.0 behavior for static initializers -CFLAGS += -features=no%split_init -# allow zero sized arrays -CFLAGS += -features=zla - -# Use C++ Interpreter -ifdef CC_INTERP - CFLAGS += -DCC_INTERP -endif - -# We don't need libCstd.so and librwtools7.so, only libCrun.so -CFLAGS += -library=Crun -LIBS += -lCrun - -CFLAGS += -mt -LFLAGS += -mt - -# Compiler warnings are treated as errors -#WARNINGS_ARE_ERRORS = -errwarn=%all -CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) -# Special cases -CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) - -# The flags to use for an Optimized build -OPT_CFLAGS+=-xO4 -OPT_CFLAGS/NOOPT=-xO0 - -# Flags for creating the dependency files. -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) -DEPFLAGS = -xMMD -xMF $(DEP_DIR)/$(@:%=%.d) -endif - -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -CFLAGS += -DDONT_USE_PRECOMPILED_HEADER - -#------------------------------------------------------------------------ -# Linker flags - -# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. -MAPFLAG = -Wl,--version-script=FILENAME - -# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj -SONAMEFLAG = -h SONAME - -# Build shared library -SHARED_FLAG = -G - -#------------------------------------------------------------------------ -# Debug flags -DEBUG_CFLAGS += -g -FASTDEBUG_CFLAGS = -g0 - diff --git a/hotspot/make/bsd/makefiles/sparcv9.make b/hotspot/make/bsd/makefiles/sparcv9.make deleted file mode 100644 index b9e4e525d76..00000000000 --- a/hotspot/make/bsd/makefiles/sparcv9.make +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2005, 2010, 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. -# - -# gcc 4.0 miscompiles this code in -m64 -OPT_CFLAGS/macro.o = -O0 - -CFLAGS += -D_LP64=1 diff --git a/hotspot/make/bsd/makefiles/tiered.make b/hotspot/make/bsd/makefiles/tiered.make deleted file mode 100644 index da79ade9fdc..00000000000 --- a/hotspot/make/bsd/makefiles/tiered.make +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2006, 2008, 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. -# -# - -# Sets make macros for making tiered version of VM - -TYPE=TIERED - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 -DCOMPILER1 diff --git a/hotspot/make/bsd/makefiles/top.make b/hotspot/make/bsd/makefiles/top.make deleted file mode 100644 index 47394d64a95..00000000000 --- a/hotspot/make/bsd/makefiles/top.make +++ /dev/null @@ -1,156 +0,0 @@ -# -# Copyright (c) 1999, 2014, 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. -# -# - -# top.make is included in the Makefile in the build directories. -# It DOES NOT include the vm dependency info in order to be faster. -# Its main job is to implement the incremental form of make lists. -# It also: -# -builds and runs adlc via adlc.make -# -generates JVMTI source and docs via jvmti.make (JSR-163) - -# It assumes the following flags are set: -# CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Obj_Files - -# -- D. Ungar (5/97) from a file by Bill Bush - -# Don't override the built-in $(MAKE). -# Instead, use "gmake" (or "gnumake") from the command line. --Rose -#MAKE = gmake - -include $(GAMMADIR)/make/altsrc.make - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -VM = $(GAMMADIR)/src/share/vm -Plat_File = $(Platform_file) -CDG = cd $(GENERATED); - -ifneq ($(USE_PRECOMPILED_HEADER),0) -UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) -else -UpdatePCH = \# precompiled header is not used -endif - -Cached_plat = $(GENERATED)/platform.current - -AD_Dir = $(GENERATED)/adfiles -ADLC = $(AD_Dir)/adlc -AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad) -AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc) -AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp -AD_Files = $(AD_Names:%=$(AD_Dir)/%) - -# AD_Files_If_Required/COMPILER1 = ad_stuff -AD_Files_If_Required/COMPILER2 = ad_stuff -AD_Files_If_Required/TIERED = ad_stuff -AD_Files_If_Required = $(AD_Files_If_Required/$(TYPE)) - -# Wierd argument adjustment for "gnumake -j..." -adjust-mflags = $(GENERATED)/adjust-mflags -# If SPEC is set, it's from configure and it's already controlling concurrency -# for us. Skip setting -j with HOTSPOT_BUILD_JOBS. -ifeq ($(SPEC), ) - MFLAGS-adjusted = -r `$(adjust-mflags) "$(MFLAGS)" "$(HOTSPOT_BUILD_JOBS)"` -else - MFLAGS-adjusted = -r $(MFLAGS) -endif - - -# default target: update lists, make vm -# done in stages to force sequential order with parallel make -# - -default: vm_build_preliminaries the_vm - @echo All done. - -# This is an explicit dependency for the sake of parallel makes. -vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stuff trace_stuff dtrace_stuff - @# We need a null action here, so implicit rules don't get consulted. - -$(Cached_plat): $(Plat_File) - $(CDG) $(CP) $(Plat_File) $(Cached_plat) - -# make AD files as necessary -ad_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f adlc.make $(MFLAGS-adjusted) - -# generate JVMTI files from the spec -jvmti_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f jvmti.make $(MFLAGS-adjusted) - -# generate trace files -trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f trace.make $(MFLAGS-adjusted) - -ifeq ($(OS_VENDOR), Darwin) -# generate dtrace header files -dtrace_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f dtrace.make dtrace_stuff $(MFLAGS-adjusted) GENERATED=$(GENERATED) -else -dtrace_stuff: - @# We need a null action here, so implicit rules don't get consulted. -endif - -# and the VM: must use other makefile with dependencies included - -# We have to go to great lengths to get control over the -jN argument -# to the recursive invocation of vm.make. The problem is that gnumake -# resets -jN to -j1 for recursive runs. (How helpful.) -# Note that the user must specify the desired parallelism level via a -# command-line or environment variable name HOTSPOT_BUILD_JOBS. -$(adjust-mflags): $(GAMMADIR)/make/$(Platform_os_family)/makefiles/adjust-mflags.sh - @+rm -f $@ $@+ - @+cat $< > $@+ - @+chmod +x $@+ - @+mv $@+ $@ - -the_vm: vm_build_preliminaries $(adjust-mflags) - +@$(UpdatePCH) - @$(MAKE) -f vm.make $(MFLAGS-adjusted) - -install : the_vm - @$(MAKE) -f vm.make $@ - -# next rules support "make foo.[ois]" - -%.o %.i %.s: - +$(UpdatePCH) - $(MAKE) -f vm.make $(MFLAGS) $@ - #$(MAKE) -f vm.make $@ - -# this should force everything to be rebuilt -clean: - rm -f $(GENERATED)/*.class - $(MAKE) -f vm.make $(MFLAGS) clean - -# just in case it doesn't, this should do it -realclean: - $(MAKE) -f vm.make $(MFLAGS) clean - rm -fr $(GENERATED) - -.PHONY: default vm_build_preliminaries -.PHONY: lists ad_stuff jvmti_stuff the_vm clean realclean -.PHONY: checks check_os_version install - -.NOTPARALLEL: diff --git a/hotspot/make/bsd/makefiles/trace.make b/hotspot/make/bsd/makefiles/trace.make deleted file mode 100644 index 37df4425f50..00000000000 --- a/hotspot/make/bsd/makefiles/trace.make +++ /dev/null @@ -1,119 +0,0 @@ -# -# Copyright (c) 2003, 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. -# -# - -# This makefile (trace.make) is included from the trace.make in the -# build directories. -# -# It knows how to build and run the tools to generate trace files. - -include $(GAMMADIR)/make/bsd/makefiles/rules.make -include $(GAMMADIR)/make/altsrc.make - -# ######################################################################### - -HAS_ALT_SRC := false -ifndef OPENJDK - ifneq ($(wildcard $(HS_ALT_SRC)/share/vm/trace), ) - HAS_ALT_SRC := true - endif -endif - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles -TraceOutDir = $(GENERATED)/tracefiles - -TraceAltSrcDir = $(HS_ALT_SRC)/share/vm/trace -TraceSrcDir = $(HS_COMMON_SRC)/share/vm/trace - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(TraceSrcDir) $(TraceAltSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -TraceGeneratedNames = \ - traceEventClasses.hpp \ - traceEventIds.hpp \ - traceTypes.hpp - -ifeq ($(HAS_ALT_SRC), true) -TraceGeneratedNames += \ - traceRequestables.hpp \ - traceEventControl.hpp -endif - -TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) - -XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -TraceXml = $(TraceSrcDir)/trace.xml -ifeq ($(HAS_ALT_SRC), true) - TraceXml = $(TraceAltSrcDir)/trace.xml -endif - -XML_DEPS = $(TraceXml) $(TraceSrcDir)/tracetypes.xml \ - $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod \ - $(TraceSrcDir)/tracerelationdecls.xml $(TraceSrcDir)/traceevents.xml -ifeq ($(HAS_ALT_SRC), true) - XML_DEPS += $(TraceAltSrcDir)/traceeventscustom.xml \ - $(TraceAltSrcDir)/traceeventtypes.xml -endif - -.PHONY: all clean cleanall - -# ######################################################################### - -all: $(TraceGeneratedFiles) - -GENERATE_CODE= \ - $(QUIETLY) echo $(LOG_INFO) Generating $@; \ - $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@ - -$(TraceOutDir)/traceEventIds.hpp: $(TraceXml) $(TraceSrcDir)/traceEventIds.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceTypes.hpp: $(TraceXml) $(TraceSrcDir)/traceTypes.xsl $(XML_DEPS) - $(GENERATE_CODE) - -ifeq ($(HAS_ALT_SRC), false) - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -else - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceRequestables.hpp: $(TraceXml) $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceEventControl.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS) - $(GENERATE_CODE) - -endif - -# ######################################################################### - -clean cleanall: - rm $(TraceGeneratedFiles) diff --git a/hotspot/make/bsd/makefiles/universal.gmk b/hotspot/make/bsd/makefiles/universal.gmk deleted file mode 100644 index 128d21b46d6..00000000000 --- a/hotspot/make/bsd/makefiles/universal.gmk +++ /dev/null @@ -1,126 +0,0 @@ -# -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# macosx universal builds -universal_product: - $(MAKE) MACOSX_UNIVERSAL=true all_product_universal -universal_optimized: - $(MAKE) MACOSX_UNIVERSAL=true all_optimized_universal -universal_fastdebug: - $(MAKE) MACOSX_UNIVERSAL=true all_fastdebug_universal -universal_debug: - $(MAKE) MACOSX_UNIVERSAL=true all_debug_universal - - -# Universal builds include 1 or more architectures in a single binary -all_product_universal: -# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_PRODUCT_TARGETS) - $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_PRODUCT_TARGETS) - $(QUIETLY) $(MAKE) BUILD_FLAVOR=product EXPORT_SUBDIR= universalize -all_optimized_universal: -# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_OPTIMIZED_TARGETS) - $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_OPTIMIZED_TARGETS) - $(QUIETLY) $(MAKE) BUILD_FLAVOR=optimized EXPORT_SUBDIR=/optimized universalize -all_fastdebug_universal: -# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_FASTDEBUG_TARGETS) - $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_FASTDEBUG_TARGETS) - $(QUIETLY) $(MAKE) BUILD_FLAVOR=fastdebug EXPORT_SUBDIR=/fastdebug universalize -all_debug_universal: -# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_DEBUG_TARGETS) - $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_DEBUG_TARGETS) - $(QUIETLY) $(MAKE) BUILD_FLAVOR=debug EXPORT_SUBDIR=/debug universalize - - -# Consolidate architecture builds into a single Universal binary -universalize: $(UNIVERSAL_LIPO_LIST) $(UNIVERSAL_COPY_LIST) - $(RM) -r $(EXPORT_PATH)/lib/{i386,amd64} - -LIPO ?= lipo - -# Package built libraries in a universal binary -$(UNIVERSAL_LIPO_LIST): - BUILT_LIPO_FILES="`find $(EXPORT_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_LIB_DIR)/,,$@) 2>/dev/null`" || test $$? = "1"; \ - if [ -n "$${BUILT_LIPO_FILES}" ]; then \ - $(MKDIR) -p $(shell dirname $@); \ - $(LIPO) -create -output $@ $${BUILT_LIPO_FILES}; \ - fi - - -# Copy built non-universal binaries in place -# - copies directories; including empty dirs -# - copies files, symlinks, other non-directory files -$(UNIVERSAL_COPY_LIST): - BUILT_COPY_FILES="`find $(EXPORT_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_LIB_DIR)/,,$@) -prune 2>/dev/null`" || test $$? = "1"; \ - if [ -n "$${BUILT_COPY_FILES}" ]; then \ - for i in $${BUILT_COPY_FILES}; do \ - $(MKDIR) -p $(shell dirname $@); \ - $(CP) -R $${i} $@; \ - done; \ - fi - - -# Replace arch specific binaries with universal binaries -# Do not touch lib/{client,server}/libjsig.$(LIBRARY_SUFFIX) -# That symbolic link belongs to the 'jdk' build. -export_universal: - $(RM) -r $(EXPORT_PATH)/lib/{i386,amd64} - $(RM) -r $(JDK_IMAGE_DIR)/lib/{i386,amd64} - ($(CD) $(EXPORT_PATH) && \ - $(TAR) -cf - *) | \ - ($(CD) $(JDK_IMAGE_DIR) && $(TAR) -xpf -) - - -# Overlay universal binaries -# Do not touch lib/{client,server}/libjsig.$(LIBRARY_SUFFIX) -# That symbolic link belongs to the 'jdk' build. -copy_universal: - $(RM) -r $(JDK_IMAGE_DIR)$(COPY_SUBDIR)/lib/{i386,amd64} - ($(CD) $(EXPORT_PATH)$(COPY_SUBDIR) && \ - $(TAR) -cf - *) | \ - ($(CD) $(JDK_IMAGE_DIR)$(COPY_SUBDIR) && $(TAR) -xpf -) - - -# Additional processing for universal builds -export_product_jdk:: - $(MAKE) EXPORT_SUBDIR= export_universal -export_optimized_jdk:: - $(MAKE) EXPORT_SUBDIR=/optimized export_universal -export_fastdebug_jdk:: - $(MAKE) EXPORT_SUBDIR=/fastdebug export_universal -export_debug_jdk:: - $(MAKE) EXPORT_SUBDIR=/debug export_universal -copy_product_jdk:: - $(MAKE) COPY_SUBDIR= copy_universal -copy_optimized_jdk:: - $(MAKE) COPY_SUBDIR=/optimized copy_universal -copy_fastdebug_jdk:: - $(MAKE) COPY_SUBDIR=/fastdebug copy_universal -copy_debug_jdk:: - $(MAKE) COPY_SUBDIR=/debug copy_universal - -.PHONY: universal_product universal_fastdebug universal_debug \ - all_product_universal all_fastdebug_universal all_debug_universal \ - universal_optimized all_optimized_universal \ - universalize export_universal copy_universal \ - $(UNIVERSAL_LIPO_LIST) $(UNIVERSAL_COPY_LIST) diff --git a/hotspot/make/bsd/makefiles/vm.make b/hotspot/make/bsd/makefiles/vm.make deleted file mode 100644 index a3c1ce6c267..00000000000 --- a/hotspot/make/bsd/makefiles/vm.make +++ /dev/null @@ -1,438 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Rules to build JVM and related libraries, included from vm.make in the build -# directory. - -# Common build rules. -MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles -include $(MAKEFILES_DIR)/rules.make -include $(GAMMADIR)/make/altsrc.make - -default: build - -#---------------------------------------------------------------------- -# Defs - -GENERATED = ../generated -DEP_DIR = $(GENERATED)/dependencies - -# reads the generated files defining the set of .o's and the .o .h dependencies --include $(DEP_DIR)/*.d - -# read machine-specific adjustments (%%% should do this via buildtree.make?) -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - include $(MAKEFILES_DIR)/zeroshark.make -else - include $(MAKEFILES_DIR)/$(BUILDARCH).make -endif - -# set VPATH so make knows where to look for source files -# Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm -# The adfiles directory contains ad_.[ch]pp. -# The jvmtifiles directory contains jvmti*.[ch]pp -Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor. -Src_Dirs_I += $(GENERATED) -# The order is important for the precompiled headers to work. -INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%) - -# SYMFLAG is used by jsig.make -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # always build with debug info when we can create .dSYM/.debuginfo files - SYMFLAG = -g -else - ifeq (${VERSION}, debug) - SYMFLAG = -g - else - SYMFLAG = - endif -endif - -# The following variables are defined in the generated flags.make file. -JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \ - -DVERSION_MINOR=$(VERSION_MINOR) \ - -DVERSION_SECURITY=$(VERSION_SECURITY) \ - -DVERSION_PATCH=$(VERSION_PATCH) \ - -DVERSION_BUILD=$(VERSION_BUILD) -VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \ - -DVERSION_STRING="\"$(VERSION_STRING)\"" \ - -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \ - $(JDK_VER_DEFS) -HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" -BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" -VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\"" - -CXXFLAGS = \ - ${SYSDEFS} \ - ${INCLUDES} \ - ${BUILD_USER} \ - ${HS_LIB_ARCH} \ - ${VM_DISTRO} - -# This is VERY important! The version define must only be supplied to vm_version.o -# If not, ccache will not re-use the cache at all, since the version string might contain -# a time and date. -CXXFLAGS/vm_version.o += ${VM_VER_DEFS} - -CXXFLAGS/BYFILE = $(CXXFLAGS/$@) - -# File specific flags -CXXFLAGS += $(CXXFLAGS/BYFILE) - -ifdef DEFAULT_LIBPATH -CXXFLAGS += -DDEFAULT_LIBPATH="\"$(DEFAULT_LIBPATH)\"" -endif - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -CFLAGS += $(CFLAGS_WARN/BYFILE) - -# Do not use C++ exception handling -CFLAGS += $(CFLAGS/NOEX) - -# Extra flags from gnumake's invocation or environment -CFLAGS += $(EXTRA_CFLAGS) -LFLAGS += $(EXTRA_CFLAGS) - -# Don't set excutable bit on stack segment -# the same could be done by separate execstack command -# Darwin is non-executable-stack by default -ifneq ($(OS_VENDOR), Darwin) -LFLAGS += -Xlinker -z -Xlinker noexecstack -endif - -LIBS += -lm - -ifeq ($(USE_CLANG),) - LIBS += -pthread -endif - -# By default, link the *.o into the library, not the executable. -LINK_INTO$(LINK_INTO) = LIBJVM - -JDK_LIBDIR = $(JAVA_HOME)/lib/$(LIBARCH) - -#---------------------------------------------------------------------- -# jvm_db & dtrace -include $(MAKEFILES_DIR)/dtrace.make - -#---------------------------------------------------------------------- -# JVM - -JVM = jvm -ifeq ($(OS_VENDOR), Darwin) - LIBJVM = lib$(JVM).$(LIBRARY_SUFFIX) - CFLAGS += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE - - LIBJVM_DEBUGINFO = lib$(JVM).$(LIBRARY_SUFFIX).dSYM - LIBJVM_DIZ = lib$(JVM).diz -else - LIBJVM = lib$(JVM).so - - LIBJVM_DEBUGINFO = lib$(JVM).debuginfo - LIBJVM_DIZ = lib$(JVM).diz -endif - -SPECIAL_PATHS:=adlc c1 gc opto shark libadt - -SOURCE_PATHS=\ - $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \ - \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \)) -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm - -CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) -CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/tracefiles - -ifneq ($(INCLUDE_TRACE), false) -CORE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ - find $(HS_ALT_SRC)/share/vm/jfr -type d; \ - fi) -endif - -COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1) -COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1 - -COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto) -COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt) -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt -COMPILER2_PATHS += $(GENERATED)/adfiles - -SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark - -# Include dirs per type. -Src_Dirs/CORE := $(CORE_PATHS) -Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) -Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) -Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) -Src_Dirs/ZERO := $(CORE_PATHS) -Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS) -Src_Dirs := $(Src_Dirs/$(TYPE)) - -COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\* -COMPILER1_SPECIFIC_FILES := c1_\* -SHARK_SPECIFIC_FILES := shark -ZERO_SPECIFIC_FILES := zero - -# Always exclude these. -Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp - -# Exclude per type. -Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/TIERED := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/ZERO := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/SHARK := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) - -Src_Files_EXCLUDE += $(Src_Files_EXCLUDE/$(TYPE)) - -# Special handling of arch model. -ifeq ($(Platform_arch_model), x86_32) -Src_Files_EXCLUDE += \*x86_64\* -endif -ifeq ($(Platform_arch_model), x86_64) -Src_Files_EXCLUDE += \*x86_32\* -endif - -# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE. -define findsrc - $(notdir $(shell find $(1)/. ! -name . -prune \ - -a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \ - -a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \))) -endef - -Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e))) - -Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files)))) - -JVM_OBJ_FILES = $(Obj_Files) - -vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES)) - -MAPFILE_SHARE := $(GAMMADIR)/make/share/makefiles/mapfile-vers - -MAPFILE_EXT_SRC := $(HS_ALT_MAKE)/share/makefiles/mapfile-ext -ifneq ("$(wildcard $(MAPFILE_EXT_SRC))","") -MAPFILE_EXT := $(MAPFILE_EXT_SRC) -endif - -# For Darwin: add _ prefix and remove trailing ; -mapfile_extra: $(MAPFILE_SHARE) $(MAPFILE_EXT) - rm -f $@ -ifeq ($(OS_VENDOR), Darwin) - cat $(MAPFILE_SHARE) $(MAPFILE_EXT) | \ - sed -e 's/#.*//g' -e 's/[ ]*//g' -e 's/;//g' | \ - awk '{ if ($$0 ~ ".") { print "\t\t_" $$0 } }' \ - > $@ -else - cat $(MAPFILE_SHARE) $(MAPFILE_EXT) > $@ -endif - -mapfile : $(MAPFILE) mapfile_extra vm.def - rm -f $@ - awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") \ - { system ("cat mapfile_extra vm.def"); } \ - else \ - { print $$0 } \ - }' > $@ < $(MAPFILE) - -ifeq ($(STATIC_BUILD),true) -EXPORTED_SYMBOLS = libjvm.symbols - -libjvm.symbols : mapfile - $(CP) mapfile libjvm.symbols - -else -EXPORTED_SYMBOLS = -endif - -mapfile_reorder : mapfile $(REORDERFILE) - rm -f $@ - cat $^ > $@ - -vm.def: $(Res_Files) $(Obj_Files) - sh $(GAMMADIR)/make/bsd/makefiles/build_vm_def.sh *.o > $@ - -mapfile_ext: - rm -f $@ - touch $@ - if [ -f $(HS_ALT_MAKE)/bsd/makefiles/mapfile-ext ]; then \ - cat $(HS_ALT_MAKE)/bsd/makefiles/mapfile-ext > $@; \ - fi - -STATIC_CXX = false - -ifeq ($(LINK_INTO),AOUT) - LIBJVM.o = - LIBJVM_MAPFILE = - LIBS_VM = $(LIBS) -else - LIBJVM.o = $(JVM_OBJ_FILES) - LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder - LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE)) - LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM)) - - ifeq ($(OS_VENDOR), Darwin) - ifneq ($(STATIC_BUILD),true) - LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/. - LFLAGS_VM += -Xlinker -rpath -Xlinker @loader_path/.. - LFLAGS_VM += -Xlinker -install_name -Xlinker @rpath/$(@F) - endif - else - LFLAGS_VM += -Wl,-z,defs - endif - - # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to - # get around library dependency and compatibility issues. Must use gcc not - # g++ to link. - ifeq ($(STATIC_CXX), true) - LFLAGS_VM += $(STATIC_LIBGCC) - LIBS_VM += $(STATIC_STDCXX) - LINK_VM = $(LINK_LIB.CC) - else - LINK_VM = $(LINK_LIB.CXX) - endif - - LIBS_VM += $(LIBS) -endif -ifeq ($(JVM_VARIANT_ZERO), true) - LIBS_VM += $(LIBFFI_LIBS) -endif -ifeq ($(JVM_VARIANT_ZEROSHARK), true) - LIBS_VM += $(LIBFFI_LIBS) $(LLVM_LIBS) - LFLAGS_VM += $(LLVM_LDFLAGS) -endif - - -# rule for building precompiled header -$(PRECOMPILED_HEADER): - $(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@ - $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR) - $(QUIETLY) rm -f $@ - $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE) - -# making the library: - -ifneq ($(JVM_BASE_ADDR),) -# By default shared library is linked at base address == 0. Modify the -# linker script if JVM prefers a different base location. It can also be -# implemented with 'prelink -r'. But 'prelink' is not (yet) available on -# our build platform (AS-2.1). -LD_SCRIPT = libjvm.so.lds -$(LD_SCRIPT): $(LIBJVM_MAPFILE) - $(QUIETLY) { \ - rm -rf $@; \ - $(LINK_VM) -Wl,--verbose $(LFLAGS_VM) 2>&1 | \ - sed -e '/^======/,/^======/!d' \ - -e '/^======/d' \ - -e 's/0\( + SIZEOF_HEADERS\)/$(JVM_BASE_ADDR)\1/' \ - > $@; \ - } -LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT) -endif - -$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) -ifeq ($(STATIC_BUILD),true) - echo Linking static vm...; - $(LINK_LIB.CC) $@ $(LIBJVM.o) -else - $(QUIETLY) { \ - echo $(LOG_INFO) Linking vm...; \ - $(LINK_LIB.CXX/PRE_HOOK) \ - $(LINK_VM) $(LD_SCRIPT_FLAG) \ - $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ - $(LINK_LIB.CXX/POST_HOOK) \ - rm -f $@.1; ln -s $@ $@.1; \ - } - -endif - -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(OS_VENDOR), Darwin) - $(DSYMUTIL) $@ - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -r -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) - $(RM) -r $(LIBJVM_DEBUGINFO) - endif - else - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -g $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) - $(RM) $(LIBJVM_DEBUGINFO) - endif - endif -endif - -DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR) -DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM) -DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO) -DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ) - -install_jvm: $(LIBJVM) - @echo "Copying $(LIBJVM) to $(DEST_JVM)" -ifeq ($(OS_VENDOR), Darwin) - $(QUIETLY) test ! -d $(LIBJVM_DEBUGINFO) || \ - $(CP) -f -r $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) -else - $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ - $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) -endif - $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ - $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" - -#---------------------------------------------------------------------- -# Other files - -# Signal interposition library -include $(MAKEFILES_DIR)/jsig.make - -#---------------------------------------------------------------------- - -ifeq ($(OS_VENDOR), Darwin) -# no libjvm_db for macosx -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) dtraceCheck $(EXPORTED_SYMBOLS) - echo "Doing vm.make build:" -else -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(EXPORTED_SYMBOLS) -endif - -install: install_jvm install_jsigs - -.PHONY: default build install install_jvm diff --git a/hotspot/make/bsd/makefiles/zero.make b/hotspot/make/bsd/makefiles/zero.make deleted file mode 100644 index 0270711f5cb..00000000000 --- a/hotspot/make/bsd/makefiles/zero.make +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2009 Red Hat, Inc. -# 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. -# -# - -# Setup for Zero (non-Shark) version of VM - -# Select which files to use (in top.make) -TYPE = ZERO - -# Install libjvm.so, etc in in server directory. -VM_SUBDIR = server diff --git a/hotspot/make/bsd/makefiles/zeroshark.make b/hotspot/make/bsd/makefiles/zeroshark.make deleted file mode 100644 index 12c41981904..00000000000 --- a/hotspot/make/bsd/makefiles/zeroshark.make +++ /dev/null @@ -1,62 +0,0 @@ -# -# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. -# Copyright 2007, 2008 Red Hat, Inc. -# 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. -# -# - -# Setup common to Zero (non-Shark) and Shark versions of VM - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) - -# Specify that the CPU is little endian, if necessary -ifeq ($(ZERO_ENDIANNESS), little) - CFLAGS += -DVM_LITTLE_ENDIAN -endif - -# Specify that the CPU is 64 bit, if necessary -ifeq ($(ARCH_DATA_MODEL), 64) - CFLAGS += -D_LP64=1 -endif - -# Specify the path to the FFI headers -ifdef ALT_PACKAGE_PATH - PACKAGE_PATH = $(ALT_PACKAGE_PATH) -else - ifeq ($(OS_VENDOR),Apple) - PACKAGE_PATH = /opt/local - else - ifeq ($(OS_VENDOR),NetBSD) - PACKAGE_PATH = /usr/pkg - LIBS += -Wl,-R${PACKAGE_PATH}/lib - else - PACKAGE_PATH = /usr/local - endif - endif -endif - -CFLAGS += -I$(PACKAGE_PATH)/include -LIBS += -L$(PACKAGE_PATH)/lib -lffi - -OPT_CFLAGS/compactingPermGenGen.o = -O1 diff --git a/hotspot/make/bsd/platform_amd64 b/hotspot/make/bsd/platform_amd64 deleted file mode 100644 index 51b2b1cd325..00000000000 --- a/hotspot/make/bsd/platform_amd64 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = bsd - -arch = x86 - -arch_model = x86_64 - -os_arch = bsd_x86 - -os_arch_model = bsd_x86_64 - -lib_arch = amd64 - -compiler = gcc - -sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DAMD64 diff --git a/hotspot/make/bsd/platform_amd64.suncc b/hotspot/make/bsd/platform_amd64.suncc deleted file mode 100644 index 68e0cc37489..00000000000 --- a/hotspot/make/bsd/platform_amd64.suncc +++ /dev/null @@ -1,17 +0,0 @@ -os_family = bsd - -arch = x86 - -arch_model = x86_64 - -os_arch = bsd_x86 - -os_arch_model = bsd_x86_64 - -lib_arch = amd64 - -compiler = sparcWorks - -gnu_dis_arch = amd64 - -sysdefs = -D_ALLBSD_SOURCE -DSPARC_WORKS -D_GNU_SOURCE -DAMD64 diff --git a/hotspot/make/bsd/platform_i486 b/hotspot/make/bsd/platform_i486 deleted file mode 100644 index 2f77e79ff56..00000000000 --- a/hotspot/make/bsd/platform_i486 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = bsd - -arch = x86 - -arch_model = x86_32 - -os_arch = bsd_x86 - -os_arch_model = bsd_x86_32 - -lib_arch = i386 - -compiler = gcc - -sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DIA32 diff --git a/hotspot/make/bsd/platform_i486.suncc b/hotspot/make/bsd/platform_i486.suncc deleted file mode 100644 index 5b203cd5c5b..00000000000 --- a/hotspot/make/bsd/platform_i486.suncc +++ /dev/null @@ -1,17 +0,0 @@ -os_family = bsd - -arch = x86 - -arch_model = x86_32 - -os_arch = bsd_x86 - -os_arch_model = bsd_x86_32 - -lib_arch = i386 - -compiler = sparcWorks - -gnu_dis_arch = i386 - -sysdefs = -D_ALLBSD_SOURCE -DSPARC_WORKS -D_GNU_SOURCE -DIA32 diff --git a/hotspot/make/bsd/platform_ia64 b/hotspot/make/bsd/platform_ia64 deleted file mode 100644 index 00b9f3380b7..00000000000 --- a/hotspot/make/bsd/platform_ia64 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = bsd - -arch = ia64 - -os_arch = bsd_ia64 - -lib_arch = ia64 - -compiler = gcc - -gnu_dis_arch = ia64 - -sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DIA64 -DCC_INTERP - -mark_style = alignment diff --git a/hotspot/make/bsd/platform_sparc b/hotspot/make/bsd/platform_sparc deleted file mode 100644 index 04772ad4f2a..00000000000 --- a/hotspot/make/bsd/platform_sparc +++ /dev/null @@ -1,15 +0,0 @@ -os_family = bsd - -arch = sparc - -arch_model = sparc - -os_arch = bsd_sparc - -os_arch_model = bsd_sparc - -lib_arch = sparc - -compiler = gcc - -sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DSPARC diff --git a/hotspot/make/bsd/platform_sparcv9 b/hotspot/make/bsd/platform_sparcv9 deleted file mode 100644 index 89e51c5b209..00000000000 --- a/hotspot/make/bsd/platform_sparcv9 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = bsd - -arch = sparc - -arch_model = sparc - -os_arch = bsd_sparc - -os_arch_model = bsd_sparc - -lib_arch = sparcv9 - -compiler = gcc - -sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DSPARC diff --git a/hotspot/make/bsd/platform_zero.in b/hotspot/make/bsd/platform_zero.in deleted file mode 100644 index f6729c2c08c..00000000000 --- a/hotspot/make/bsd/platform_zero.in +++ /dev/null @@ -1,17 +0,0 @@ -os_family = bsd - -arch = zero - -arch_model = zero - -os_arch = bsd_zero - -os_arch_model = bsd_zero - -lib_arch = zero - -compiler = gcc - -gnu_dis_arch = zero - -sysdefs = -D_ALLBSD_SOURCE -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\" diff --git a/hotspot/make/build.sh b/hotspot/make/build.sh deleted file mode 100644 index 27c78433046..00000000000 --- a/hotspot/make/build.sh +++ /dev/null @@ -1,92 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# 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. -# -# - -# Make sure the variable JAVA_HOME is set before running this script. - -set -u - - -if [ $# -lt 1 ]; then - echo "Usage : $0 BuildTarget [LP64=1] [BuildOptions]" - echo " Server VM | Client VM" - echo "BuildTarget : debug | debug1" - echo " fastdebug | fastdebug1" - echo " jvmg | jvmg1" - echo " optimized | optimized1" - echo " profiled | profiled1" - echo " product | product1" - exit 1 -fi - -if [ "${JAVA_HOME-}" = "" -o ! -d "${JAVA_HOME-}" ]; then - echo "JAVA_HOME needs to be set to a valid JDK path" - echo "JAVA_HOME: ${JAVA_HOME-}" - exit 1 -fi - -# Just in case: -JAVA_HOME=`( cd $JAVA_HOME; pwd )` - -if [ "${ALT_BOOTDIR-}" = "" -o ! -d "${ALT_BOOTDIR-}" -o ! -d ${ALT_BOOTDIR-}/lib/ ]; then - ALT_BOOTDIR=${JAVA_HOME} -fi - -# build in current directory by default -if [ "${ALT_OUTPUTDIR-}" = "" -o ! -d "${ALT_OUTPUTDIR-}" ]; then - ALT_OUTPUTDIR=`(pwd)` -fi - -HOTSPOT_SRC=`(dirname $0)`/.. -HOTSPOT_SRC=`(cd ${HOTSPOT_SRC}; pwd)` - -for gm in gmake gnumake -do - if [ "${GNUMAKE-}" != "" ]; then break; fi - ($gm --version >/dev/null) 2>/dev/null && GNUMAKE=$gm -done -: ${GNUMAKE:?'Cannot locate the gnumake program. Stop.'} - -# quiet build by default -Quiet="MAKE_VERBOSE=" - -# no debug info by default -NoDebugInfo="ENABLE_FULL_DEBUG_SYMBOLS=" - -LANG=C - -echo "### ENVIRONMENT SETTINGS:" -export HOTSPOT_SRC ; echo "HOTSPOT_SRC=$HOTSPOT_SRC" -export JAVA_HOME ; echo "JAVA_HOME=$JAVA_HOME" -export ALT_BOOTDIR ; echo "ALT_BOOTDIR=$ALT_BOOTDIR" -export ALT_OUTPUTDIR ; echo "ALT_OUTPUTDIR=$ALT_OUTPUTDIR" -export GNUMAKE ; echo "GNUMAKE=$GNUMAKE" -export LANG ; echo "LANG=$LANG" -echo "###" - -BuildOptions="$Quiet $NoDebugInfo $*" - -echo \ -${GNUMAKE} -f ${HOTSPOT_SRC}/make/Makefile $BuildOptions GAMMADIR=${HOTSPOT_SRC} -${GNUMAKE} -f ${HOTSPOT_SRC}/make/Makefile $BuildOptions GAMMADIR=${HOTSPOT_SRC} diff --git a/hotspot/make/cscope.make b/hotspot/make/cscope.make deleted file mode 100644 index c38b7a5c784..00000000000 --- a/hotspot/make/cscope.make +++ /dev/null @@ -1,141 +0,0 @@ -# -# Copyright (c) 2000, 2008, 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. -# -# - -# The cscope.out file is generated in the current directory. The old cscope.out -# file is *not* removed because cscope is smart enough to only build what has -# changed. cscope can be confused if files are renamed or removed, so it may be -# necessary to remove cscope.out (gmake cscope.clean) if a lot of reorganization -# has occurred. - -include $(GAMMADIR)/make/scm.make - -RM = rm -f -HG = hg -CS_TOP = $(GAMMADIR) - -CSDIRS = $(CS_TOP)/src $(CS_TOP)/make -CSINCS = $(CSDIRS:%=-I%) - -CSCOPE = cscope -CSCOPE_OUT = cscope.out -CSCOPE_FLAGS = -b - -# Allow .java files to be added from the environment (CSCLASSES=yes). -ifdef CSCLASSES -ADDCLASSES= -o -name '*.java' -endif - -# Adding CClassHeaders also pushes the file count of a full workspace up about -# 200 files (these files also don't exist in a new workspace, and thus will -# cause the recreation of the database as they get created, which might seem -# a little confusing). Thus allow these files to be added from the environment -# (CSHEADERS=yes). -ifndef CSHEADERS -RMCCHEADERS= -o -name CClassHeaders -endif - -# Ignore build products. -CS_PRUNE_GENERATED = -o -name '${OSNAME}_*_core' -o \ - -name '${OSNAME}_*_compiler?' - -# O/S-specific files for all systems are included by default. Set CS_OS to a -# space-separated list of identifiers to include only those systems. -ifdef CS_OS -CS_PRUNE_OS = $(patsubst %,-o -name '*%*',\ - $(filter-out ${CS_OS},bsd linux macos solaris windows)) -endif - -# CPU-specific files for all processors are included by default. Set CS_CPU -# space-separated list identifiers to include only those CPUs. -ifdef CS_CPU -CS_PRUNE_CPU = $(patsubst %,-o -name '*%*',\ - $(filter-out ${CS_CPU},arm ppc sparc x86 zero)) -endif - -# What files should we include? A simple rule might be just those files under -# SCCS control, however this would miss files we create like the opcodes and -# CClassHeaders. The following attempts to find everything that is *useful*. -# (.del files are created by sccsrm, demo directories contain many .java files -# that probably aren't useful for development, and the pkgarchive may contain -# duplicates of files within the source hierarchy). - -# Directories to exclude. -CS_PRUNE_STD = $(SCM_DIRS) \ - -o -name '.del-*' \ - -o -name '*demo' \ - -o -name pkgarchive - -# Placeholder for user-defined excludes. -CS_PRUNE_EX = - -CS_PRUNE = $(CS_PRUNE_STD) \ - $(CS_PRUNE_OS) \ - $(CS_PRUNE_CPU) \ - $(CS_PRUNE_GENERATED) \ - $(CS_PRUNE_EX) \ - $(RMCCHEADERS) - -# File names to include. -CSFILENAMES = -name '*.[ch]pp' \ - -o -name '*.[Ccshlxy]' \ - $(CS_ADD_GENERATED) \ - -o -name '*.d' \ - -o -name '*.il' \ - -o -name '*.cc' \ - -o -name '*[Mm]akefile*' \ - -o -name '*.gmk' \ - -o -name '*.make' \ - -o -name '*.ad' \ - $(ADDCLASSES) - -.PHONY: cscope cscope.clean cscope.scratch TAGS.clean FORCE -.PRECIOUS: cscope.out - -cscope $(CSCOPE_OUT): cscope.files FORCE - $(CSCOPE) -f $(CSCOPE_OUT) $(CSCOPE_FLAGS) - -cscope.clean: - $(QUIETLY) $(RM) $(CSCOPE_OUT) cscope.files - -cscope.scratch: cscope.clean cscope - -# The raw list is reordered so cscope displays the most relevant files first. -cscope.files: - $(QUIETLY) \ - raw=cscope.$$$$; \ - find $(CSDIRS) -type d \( $(CS_PRUNE) \) -prune -o \ - -type f \( $(CSFILENAMES) \) -print > $$raw; \ - { \ - echo "$(CSINCS)"; \ - egrep -v "\.java|/make/" $$raw; \ - fgrep ".java" $$raw; \ - fgrep "/make/" $$raw; \ - } > $@; \ - rm -f $$raw - -TAGS: cscope.files FORCE - egrep -v '^-|^$$' $< | etags --members - - -TAGS.clean: - $(RM) TAGS diff --git a/hotspot/make/defs.make b/hotspot/make/defs.make deleted file mode 100644 index e02d660f349..00000000000 --- a/hotspot/make/defs.make +++ /dev/null @@ -1,362 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# The common definitions for hotspot builds. - -# Optionally include SPEC file generated by configure. -ifneq ($(SPEC),) - include $(SPEC) -endif - -ifeq ($(LOG_LEVEL),warn) - LOG_INFO := > /dev/null -else - LOG_INFO := -endif - -# Directory paths and user name -# Unless GAMMADIR is set on the command line, search upward from -# the current directory for a parent directory containing "src/share/vm". -# If that fails, look for $GAMMADIR in the environment. -# When the tree of subdirs is built, this setting is stored in each flags.make. -GAMMADIR := $(shell until ([ -d dev ]&&echo $${GAMMADIR:-/GAMMADIR/}) || ([ -d src/share/vm ]&&pwd); do cd ..; done) -HS_SRC_DIR=$(GAMMADIR)/src -HS_MAKE_DIR=$(GAMMADIR)/make -HS_BUILD_DIR=$(GAMMADIR)/build - -ifeq ($(USER),) - USER=$(USERNAME) -endif - -ifeq ($(HS_ALT_MAKE),) - ifneq ($(OPENJDK),true) - HS_ALT_MAKE=$(GAMMADIR)/make/closed - else - HS_ALT_MAKE=NO_SUCH_PATH - endif -endif - -# -# Include alternate defs.make if it exists -# --include $(HS_ALT_MAKE)/defs.make - -# Default to verbose build logs (show all compile lines): -MAKE_VERBOSE=y - -# Make macros for install files or preparing targets -CD=cd -CP=cp -ECHO=echo -GREP=grep -MKDIR=mkdir -MV=mv -PWD=pwd -RM=rm -f -SED=sed -TAR=tar -ZIPEXE=zip - -define install-file -@$(MKDIR) -p $(@D) -@$(RM) $@ -$(CP) $< $@ -endef - -# MacOS X strongly discourages 'cp -r' and provides 'cp -R' instead. -# May need to have a MacOS X specific definition of install-dir -# sometime in the future. -define install-dir -@$(MKDIR) -p $(@D) -@$(RM) -r $@ -$(CP) -r $< $@ -endef - -define prep-target -@$(MKDIR) -p $(@D) -@$(RM) $@ -endef - -# Default values for JVM_VARIANT* variables if configure hasn't set -# it already. -ifeq ($(JVM_VARIANTS),) - ifeq ($(ZERO_BUILD), true) - ifeq ($(SHARK_BUILD), true) - JVM_VARIANTS:=zeroshark - JVM_VARIANT_ZEROSHARK:=true - else - JVM_VARIANTS:=zero - JVM_VARIANT_ZERO:=true - endif - else - # A default is needed - ifeq ($(BUILD_CLIENT_ONLY), true) - JVM_VARIANTS:=client - JVM_VARIANT_CLIENT:=true - endif - # Further defaults are platform and arch specific - endif -endif - -# hotspot version definitions -include $(GAMMADIR)/make/jdk_version - -# JDK_PREVIOUS_VERSION is only needed to facilitate standalone builds -ifeq ($(JDK_PREVIOUS_VERSION),) - export JDK_PREVIOUS_VERSION=$(STANDALONE_JDK_PREVIOUS_VERSION) -endif -# Java versions needed -ifeq ($(VERSION_MAJOR),) - export VERSION_MAJOR=$(STANDALONE_JDK_MAJOR_VER) -endif -ifeq ($(VERSION_MINOR),) - export VERSION_MINOR=$(STANDALONE_JDK_MINOR_VER) -endif -ifeq ($(VERSION_SECURITY),) - export VERSION_SECURITY=$(STANDALONE_JDK_SECURITY_VER) -endif -ifeq ($(VERSION_PATCH),) - export VERSION_PATCH=$(STANDALONE_JDK_PATCH_VER) -endif -ifeq ($(VERSION_BUILD),) - export VERSION_BUILD=0 -endif -ifeq ($(VERSION_SHORT),) - export VERSION_SHORT=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_SECURITY) -endif -ifeq ($(VERSION_STRING),) - # Note that this is an extremely rough and incorrect approximation of a correct version string. - export VERSION_STRING=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_SECURITY)-internal -endif - -ifneq ($(HOTSPOT_RELEASE_VERSION),) - # Allow old command-line overrides - HOTSPOT_VERSION_STRING := $(HOTSPOT_RELEASE_VERSION) -else - # Normally get from surrounding JDK build - HOTSPOT_VERSION_STRING := $(VERSION_STRING) -endif - -ifneq ($(HOTSPOT_BUILD_VERSION),) - # If old command-lines variable exists, append to version string - HOTSPOT_VERSION_STRING := $(HOTSPOT_VERSION_STRING)-$(HOTSPOT_BUILD_VERSION) -else - ifeq ($(SPEC),) - # If building standalone, add -internal. - HOTSPOT_VERSION_STRING := $(HOTSPOT_VERSION_STRING)-internal - endif -endif - -# Windows should have OS predefined -ifeq ($(OS),) - OS := $(shell uname -s) - ifneq ($(findstring BSD,$(OS)),) - OS=bsd - endif - ifeq ($(OS), Darwin) - OS=bsd - endif - HOST := $(shell uname -n) -endif - -# If not SunOS, not Linux not BSD and not AIX, assume Windows -ifneq ($(OS), Linux) - ifneq ($(OS), SunOS) - ifneq ($(OS), bsd) - ifneq ($(OS), AIX) - OSNAME=windows - else - OSNAME=aix - endif - else - OSNAME=bsd - endif - else - OSNAME=solaris - endif -else - OSNAME=linux -endif - -# Determinations of default make arguments and platform specific settings -MAKE_ARGS= - -# ARCH_DATA_MODEL==64 is equivalent to LP64=1 -ifeq ($(ARCH_DATA_MODEL), 64) - ifndef LP64 - LP64 := 1 - endif -endif - -# Defaults set for product build -EXPORT_SUBDIR= - -# Change default /java path if requested -ifneq ($(ALT_SLASH_JAVA),) - SLASH_JAVA=$(ALT_SLASH_JAVA) -endif - -# Default OUTPUTDIR -OUTPUTDIR=$(HS_BUILD_DIR)/$(OSNAME) -ifneq ($(ALT_OUTPUTDIR),) - OUTPUTDIR=$(ALT_OUTPUTDIR) -endif - -# Find latest promoted JDK area -JDK_IMPORT_PATH=$(SLASH_JAVA)/re/j2se/$(VERSION_STRING)/promoted/latest/binaries/$(PLATFORM) -ifneq ($(ALT_JDK_IMPORT_PATH),) - JDK_IMPORT_PATH=$(ALT_JDK_IMPORT_PATH) -endif - -# Other parts of JDK build may require an import JDK that can be executed -# on the build host. For cross-compile builds we also need an import JDK -# that matches the target arch, so for that we set ALT_JDK_TARGET_IMPORT_PATH -ifneq ($(ALT_JDK_TARGET_IMPORT_PATH),) - JDK_IMPORT_PATH=$(ALT_JDK_TARGET_IMPORT_PATH) -endif - -# Find JDK used for javac compiles -BOOTDIR=$(SLASH_JAVA)/re/j2se/$(JDK_PREVIOUS_VERSION)/latest/binaries/$(PLATFORM) -ifneq ($(ALT_BOOTDIR),) - BOOTDIR=$(ALT_BOOTDIR) -endif - -# Select name of the export directory and honor ALT overrides -EXPORT_PATH=$(OUTPUTDIR)/export-$(PLATFORM)$(EXPORT_SUBDIR) -ifneq ($(ALT_EXPORT_PATH),) - EXPORT_PATH=$(ALT_EXPORT_PATH) -endif - -# Default jdk image if one is created for you with create_jdk -JDK_IMAGE_DIR=$(OUTPUTDIR)/jdk-$(PLATFORM) -ifneq ($(ALT_JDK_IMAGE_DIR),) - JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR) -endif - -# The platform dependent defs.make defines platform specific variable such -# as ARCH, EXPORT_LIST etc. We must place the include here after BOOTDIR is defined. -include $(GAMMADIR)/make/$(OSNAME)/makefiles/defs.make - -# We are trying to put platform specific defintions -# files to make/$(OSNAME)/makefiles dictory. However -# some definitions are common for both linux and solaris, -# so we put them here. -ifneq ($(OSNAME),windows) - ABS_OUTPUTDIR := $(shell mkdir -p $(OUTPUTDIR); $(CD) $(OUTPUTDIR); $(PWD)) - ABS_BOOTDIR := $(shell $(CD) $(BOOTDIR); $(PWD)) - ABS_GAMMADIR := $(shell $(CD) $(GAMMADIR); $(PWD)) - ABS_OS_MAKEFILE := $(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME); $(PWD))/Makefile - - # uname, HotSpot source directory, build directory and JDK use different names - # for CPU architectures. - # ARCH - uname output - # SRCARCH - where to find HotSpot cpu and os_cpu source files - # BUILDARCH - build directory - # LIBARCH - directory name in JDK/JRE - - # Use uname output for SRCARCH, but deal with platform differences. If ARCH - # is not explicitly listed below, it is treated as x86. - SRCARCH ?= $(ARCH/$(filter sparc sparc64 ia64 amd64 x86_64 ppc ppc64 ppc64le aarch64 zero,$(ARCH))) - ARCH/ = x86 - ARCH/sparc = sparc - ARCH/sparc64= sparc - ARCH/ia64 = ia64 - ARCH/amd64 = x86 - ARCH/x86_64 = x86 - ARCH/ppc64 = ppc - ARCH/ppc64le= ppc - ARCH/ppc = ppc - ARCH/aarch64= aarch64 - ARCH/zero = zero - - # BUILDARCH is usually the same as SRCARCH, except for sparcv9 - BUILDARCH ?= $(SRCARCH) - ifeq ($(BUILDARCH), x86) - ifdef LP64 - BUILDARCH = amd64 - else - BUILDARCH = i486 - endif - endif - ifeq ($(BUILDARCH), sparc) - ifdef LP64 - BUILDARCH = sparcv9 - endif - endif - ifeq ($(BUILDARCH), ppc) - ifdef LP64 - BUILDARCH = ppc64 - endif - endif - - # LIBARCH is 1:1 mapping from BUILDARCH, except for ARCH=ppc64le - ifeq ($(ARCH),ppc64le) - LIBARCH ?= ppc64le - else - LIBARCH ?= $(LIBARCH/$(BUILDARCH)) - endif - - LIBARCH/i486 = i386 - LIBARCH/amd64 = amd64 - LIBARCH/sparc = sparc - LIBARCH/sparcv9 = sparcv9 - LIBARCH/ia64 = ia64 - LIBARCH/ppc64 = ppc64 - LIBARCH/aarch64 = aarch64 - LIBARCH/zero = $(ZERO_LIBARCH) - - LP64_ARCH = sparcv9 amd64 ia64 ppc64 aarch64 zero -endif - -# Required make macro settings for all platforms -MAKE_ARGS += BOOTDIR=$(ABS_BOOTDIR) -MAKE_ARGS += OUTPUTDIR=$(ABS_OUTPUTDIR) -MAKE_ARGS += GAMMADIR=$(ABS_GAMMADIR) -MAKE_ARGS += MAKE_VERBOSE=$(MAKE_VERBOSE) -MAKE_ARGS += VERSION_STRING=$(VERSION_STRING) - -MAKE_ARGS += BOOT_JDK_SOURCETARGET="$(BOOT_JDK_SOURCETARGET)" - -# Various export sub directories -EXPORT_INCLUDE_DIR = $(EXPORT_PATH)/include -EXPORT_DOCS_DIR = $(EXPORT_PATH)/docs -EXPORT_LIB_DIR = $(EXPORT_PATH)/lib -EXPORT_BIN_DIR = $(EXPORT_PATH)/bin -EXPORT_LIB_ARCH_DIR = $(EXPORT_LIB_DIR)/$(LIBARCH) - -# non-universal macosx builds need to appear universal -ifeq ($(OS_VENDOR), Darwin) - ifneq ($(MACOSX_UNIVERSAL), true) - EXPORT_LIB_ARCH_DIR = $(EXPORT_LIB_DIR) - endif -endif - -# Common export list of files -EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmti.h -EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jvmticmlr.h -EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h -EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h -EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h - -.PHONY: $(HS_ALT_MAKE)/defs.make diff --git a/hotspot/make/excludeSrc.make b/hotspot/make/excludeSrc.make deleted file mode 100644 index cab00edf842..00000000000 --- a/hotspot/make/excludeSrc.make +++ /dev/null @@ -1,131 +0,0 @@ -# -# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -include $(GAMMADIR)/make/altsrc.make - -ifeq ($(INCLUDE_JVMTI), false) - CXXFLAGS += -DINCLUDE_JVMTI=0 - CFLAGS += -DINCLUDE_JVMTI=0 - - Src_Files_EXCLUDE += jvmtiGetLoadedClasses.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \ - jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \ - jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \ - jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \ - jvmtiClassFileReconstituter.cpp -endif - -ifeq ($(INCLUDE_FPROF), false) - CXXFLAGS += -DINCLUDE_FPROF=0 - CFLAGS += -DINCLUDE_FPROF=0 - - Src_Files_EXCLUDE += fprofiler.cpp -endif - -ifeq ($(INCLUDE_VM_STRUCTS), false) - CXXFLAGS += -DINCLUDE_VM_STRUCTS=0 - CFLAGS += -DINCLUDE_VM_STRUCTS=0 - - Src_Files_EXCLUDE += vmStructs.cpp -endif - -ifeq ($(INCLUDE_JNI_CHECK), false) - CXXFLAGS += -DINCLUDE_JNI_CHECK=0 - CFLAGS += -DINCLUDE_JNI_CHECK=0 - - Src_Files_EXCLUDE += jniCheck.cpp -endif - -ifeq ($(INCLUDE_SERVICES), false) - CXXFLAGS += -DINCLUDE_SERVICES=0 - CFLAGS += -DINCLUDE_SERVICES=0 - - Src_Files_EXCLUDE += heapDumper.cpp heapInspection.cpp \ - attachListener_linux.cpp attachListener.cpp -endif - -ifeq ($(INCLUDE_MANAGEMENT), false) - CXXFLAGS += -DINCLUDE_MANAGEMENT=0 - CFLAGS += -DINCLUDE_MANAGEMENT=0 -endif - -ifeq ($(INCLUDE_CDS), false) - CXXFLAGS += -DINCLUDE_CDS=0 - CFLAGS += -DINCLUDE_CDS=0 - - Src_Files_EXCLUDE += classListParser.cpp classLoaderExt.cpp \ - filemap.cpp metaspaceShared*.cpp sharedClassUtil.cpp sharedPathsMiscInfo.cpp \ - systemDictionaryShared.cpp -endif - -ifeq ($(INCLUDE_ALL_GCS), false) - CXXFLAGS += -DINCLUDE_ALL_GCS=0 - CFLAGS += -DINCLUDE_ALL_GCS=0 - - gc_dir := $(HS_COMMON_SRC)/share/vm/gc - gc_dir_alt := $(HS_ALT_SRC)/share/vm/gc - gc_subdirs := cms g1 parallel - gc_exclude := $(foreach gc,$(gc_subdirs), \ - $(notdir $(wildcard $(gc_dir)/$(gc)/*.cpp)) \ - $(notdir $(wildcard $(gc_dir_alt)/$(gc)/*.cpp))) - Src_Files_EXCLUDE += $(gc_exclude) \ - concurrentGCThread.cpp \ - plab.cpp - - # src/share/vm/services - Src_Files_EXCLUDE += \ - g1MemoryPool.cpp \ - psMemoryPool.cpp -endif - -ifeq ($(INCLUDE_NMT), false) - CXXFLAGS += -DINCLUDE_NMT=0 - CFLAGS += -DINCLUDE_NMT=0 - - Src_Files_EXCLUDE += \ - memBaseline.cpp memReporter.cpp mallocTracker.cpp virtualMemoryTracker.cpp nmtCommon.cpp \ - memTracker.cpp nmtDCmd.cpp mallocSiteTable.cpp -endif - -ifneq (,$(findstring $(Platform_arch_model), aarch64, arm_64, sparc, x86_64)) - # JVMCI is supported -else - INCLUDE_JVMCI := false -endif - -ifeq ($(INCLUDE_JVMCI), false) - CXXFLAGS += -DINCLUDE_JVMCI=0 - CFLAGS += -DINCLUDE_JVMCI=0 - - jvmci_dir := $(HS_COMMON_SRC)/share/vm/jvmci - jvmci_dir_alt := $(HS_ALT_SRC)/share/vm/jvmci - jvmci_exclude := $(notdir $(wildcard $(jvmci_dir)/*.cpp)) \ - $(notdir $(wildcard $(jvmci_dir_alt)/*.cpp)) - Src_Files_EXCLUDE += $(jvmci_exclude) \ - jvmciCodeInstaller_aarch64.cpp jvmciCodeInstaller_ppc.cpp jvmciCodeInstaller_sparc.cpp \ - jvmciCodeInstaller_x86.cpp -endif - --include $(HS_ALT_MAKE)/excludeSrc.make - -.PHONY: $(HS_ALT_MAKE)/excludeSrc.make diff --git a/hotspot/makefiles/gensrc/GenerateSources.gmk b/hotspot/make/gensrc/GenerateSources.gmk similarity index 100% rename from hotspot/makefiles/gensrc/GenerateSources.gmk rename to hotspot/make/gensrc/GenerateSources.gmk diff --git a/hotspot/makefiles/gensrc/GensrcAdlc.gmk b/hotspot/make/gensrc/GensrcAdlc.gmk similarity index 100% rename from hotspot/makefiles/gensrc/GensrcAdlc.gmk rename to hotspot/make/gensrc/GensrcAdlc.gmk diff --git a/hotspot/makefiles/gensrc/GensrcDtrace.gmk b/hotspot/make/gensrc/GensrcDtrace.gmk similarity index 100% rename from hotspot/makefiles/gensrc/GensrcDtrace.gmk rename to hotspot/make/gensrc/GensrcDtrace.gmk diff --git a/hotspot/makefiles/gensrc/GensrcJvmti.gmk b/hotspot/make/gensrc/GensrcJvmti.gmk similarity index 100% rename from hotspot/makefiles/gensrc/GensrcJvmti.gmk rename to hotspot/make/gensrc/GensrcJvmti.gmk diff --git a/hotspot/make/hotspot_distro b/hotspot/make/hotspot_distro deleted file mode 100644 index 059f4d1f547..00000000000 --- a/hotspot/make/hotspot_distro +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 2006, 2010, 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. -# - -# -# This file format must remain compatible with both -# GNU Makefile and Microsoft nmake formats. -# - -# Don't put quotes (fail windows build). -HOTSPOT_VM_DISTRO=Java HotSpot(TM) -COMPANY_NAME=Oracle Corporation -PRODUCT_NAME=Java(TM) Platform SE diff --git a/hotspot/makefiles/ide/CreateVSProject.gmk b/hotspot/make/ide/CreateVSProject.gmk similarity index 98% rename from hotspot/makefiles/ide/CreateVSProject.gmk rename to hotspot/make/ide/CreateVSProject.gmk index d804dcce9a8..d6f5324adb8 100644 --- a/hotspot/makefiles/ide/CreateVSProject.gmk +++ b/hotspot/make/ide/CreateVSProject.gmk @@ -90,7 +90,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows) $(eval $(call SetupJavaCompilation, BUILD_PROJECT_CREATOR, \ SETUP := GENERATE_OLDBYTECODE, \ ADD_JAVAC_FLAGS := -Xlint:-auxiliaryclass, \ - SRC := $(HOTSPOT_TOPDIR)/makefiles/src/classes, \ + SRC := $(HOTSPOT_TOPDIR)/make/src/classes, \ BIN := $(TOOLS_OUTPUTDIR), \ )) diff --git a/hotspot/make/jdk_version b/hotspot/make/jdk_version deleted file mode 100644 index 90b509ed4c2..00000000000 --- a/hotspot/make/jdk_version +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# Master JDK version file. These values may be overridden by a control -# workspace build. This file format must remain compatible with both -# GNU Makefile and Microsoft nmake formats. -# - -# Don't put quotes (fail windows build). -HOTSPOT_VM_COPYRIGHT=Copyright 2015 - -STANDALONE_JDK_MAJOR_VER=9 -STANDALONE_JDK_MINOR_VER=0 -STANDALONE_JDK_SECURITY_VER=0 -STANDALONE_JDK_PATCH_VER=0 - -# Previous (bootdir) JDK version -STANDALONE_JDK_PREVIOUS_VERSION=1.8.0 diff --git a/hotspot/make/jprt.gmk b/hotspot/make/jprt.gmk deleted file mode 100644 index 41db0685c93..00000000000 --- a/hotspot/make/jprt.gmk +++ /dev/null @@ -1,77 +0,0 @@ -# -# Copyright (c) 2006, 2011, 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. -# -# - -# JPRT rule to build this workspace - -JPRT_ARCHIVE_BUNDLE=$(ABS_OUTPUTDIR)/$(JPRT_BUILD_FLAVOR)-bundle.zip - -ifeq ($(OSNAME),windows) - ZIPFLAGS=-q -else - # store symbolic links as the link - ZIPFLAGS=-q -y -endif - -jprt_build_productEmb: - $(MAKE) JAVASE_EMBEDDED=true MINIMIZE_RAM_USAGE=true jprt_build_product - -jprt_build_debugEmb: - $(MAKE) JAVASE_EMBEDDED=true MINIMIZE_RAM_USAGE=true jprt_build_debug - -jprt_build_fastdebugEmb: - $(MAKE) JAVASE_EMBEDDED=true MINIMIZE_RAM_USAGE=true jprt_build_fastdebug - -jprt_build_optimizedEmb: - $(MAKE) JAVASE_EMBEDDED=true MINIMIZE_RAM_USAGE=true jprt_build_optimized - -jprt_build_productOpen: - $(MAKE) OPENJDK=true jprt_build_product - -jprt_build_debugOpen: - $(MAKE) OPENJDK=true jprt_build_debug - -jprt_build_fastdebugOpen: - $(MAKE) OPENJDK=true jprt_build_fastdebug - -jprt_build_optimizedOpen: - $(MAKE) OPENJDK=true jprt_build_optimized - -jprt_build_product: all_product copy_product_jdk export_product_jdk - ( $(CD) $(JDK_IMAGE_DIR) && \ - $(ZIPEXE) $(ZIPFLAGS) -r $(JPRT_ARCHIVE_BUNDLE) . ) - -jprt_build_fastdebug: all_fastdebug copy_fastdebug_jdk export_fastdebug_jdk - ( $(CD) $(JDK_IMAGE_DIR)/fastdebug && \ - $(ZIPEXE) $(ZIPFLAGS) -r $(JPRT_ARCHIVE_BUNDLE) . ) - -jprt_build_debug: all_debug copy_debug_jdk export_debug_jdk - ( $(CD) $(JDK_IMAGE_DIR)/debug && \ - $(ZIPEXE) $(ZIPFLAGS) -r $(JPRT_ARCHIVE_BUNDLE) . ) - -jprt_build_optimized: all_optimized copy_optimized_jdk export_optimized_jdk - ( $(CD) $(JDK_IMAGE_DIR)/optimized && \ - $(ZIPEXE) $(ZIPFLAGS) -r $(JPRT_ARCHIVE_BUNDLE) . ) - -.PHONY: jprt_build_product jprt_build_fastdebug jprt_build_debug jprt_build_optimized - diff --git a/hotspot/makefiles/lib/CompileDtracePostJvm.gmk b/hotspot/make/lib/CompileDtracePostJvm.gmk similarity index 98% rename from hotspot/makefiles/lib/CompileDtracePostJvm.gmk rename to hotspot/make/lib/CompileDtracePostJvm.gmk index 127460a562e..50a7f10d67d 100644 --- a/hotspot/makefiles/lib/CompileDtracePostJvm.gmk +++ b/hotspot/make/lib/CompileDtracePostJvm.gmk @@ -186,7 +186,7 @@ ifeq ($(call check-jvm-feature, dtrace), true) CFLAGS := -m64 -G -mt -KPIC, \ LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \ LIBS := $(LIBDL) -lc -lthread -ldoor, \ - MAPFILE := $(HOTSPOT_TOPDIR)/makefiles/mapfiles/libjvm_dtrace/mapfile-vers, \ + MAPFILE := $(HOTSPOT_TOPDIR)/make/mapfiles/libjvm_dtrace/mapfile-vers, \ OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \ STRIP_SYMBOLS := true, \ )) @@ -204,7 +204,7 @@ ifeq ($(call check-jvm-feature, dtrace), true) -m64 -G -mt -KPIC, \ LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \ LIBS := -lc, \ - MAPFILE := $(HOTSPOT_TOPDIR)/makefiles/mapfiles/libjvm_db/mapfile-vers, \ + MAPFILE := $(HOTSPOT_TOPDIR)/make/mapfiles/libjvm_db/mapfile-vers, \ OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \ STRIP_SYMBOLS := true, \ )) diff --git a/hotspot/makefiles/lib/CompileDtracePreJvm.gmk b/hotspot/make/lib/CompileDtracePreJvm.gmk similarity index 100% rename from hotspot/makefiles/lib/CompileDtracePreJvm.gmk rename to hotspot/make/lib/CompileDtracePreJvm.gmk diff --git a/hotspot/make/lib/CompileGtest.gmk b/hotspot/make/lib/CompileGtest.gmk new file mode 100644 index 00000000000..9cf1d891255 --- /dev/null +++ b/hotspot/make/lib/CompileGtest.gmk @@ -0,0 +1,116 @@ +# +# 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. 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. +# + +GTEST_TEST_SRC := $(HOTSPOT_TOPDIR)/test/native +GTEST_FRAMEWORK_SRC := $(SRC_ROOT)/test/fmw/gtest + +# On Windows, there are no internal debug symbols so must set copying to true +# to get any at all. +ifeq ($(OPENJDK_TARGET_OS), windows) + GTEST_COPY_DEBUG_SYMBOLS := true +else + GTEST_COPY_DEBUG_SYMBOLS := false +endif + +################################################################################ + +GTEST_TEST_SRC_FILES := $(shell $(FIND) $(HOTSPOT_TOPDIR)/test/native -name \ + "test*.cpp" -type f) + +ifeq ($(OPENJDK_TARGET_OS), windows) + GTEST_JVM_MAPFILE := $(JVM_MAPFILE) +else + GTEST_JVM_MAPFILE := $(JVM_OUTPUTDIR)/gtest/mapfile + + $(JVM_OUTPUTDIR)/gtest/symbols: $(JVM_OUTPUTDIR)/symbols + $(call MakeDir, $(@D)) + ( $(CAT) $< ; echo "runUnitTests" ) > $@ + + $(GTEST_JVM_MAPFILE): $(JVM_OUTPUTDIR)/gtest/symbols + $(call create-mapfile) +endif + +# Disabling switch warning for clang because of test source. + +$(eval $(call SetupNativeCompilation, BUILD_GTEST_LIBJVM, \ + TOOLCHAIN := $(JVM_TOOLCHAIN), \ + LIBRARY := jvm, \ + OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ + EXTRA_FILES := $(GTEST_TEST_SRC_FILES) \ + $(GTEST_FRAMEWORK_SRC)/src/gtest-all.cc \ + $(GTEST_TEST_SRC)/gtestMain.cpp, \ + OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/objs, \ + EXTRA_OBJECT_FILES := $(filter-out %/operator_new$(OBJ_SUFFIX), \ + $(BUILD_LIBJVM_ALL_OBJS)), \ + CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \ + -I$(GTEST_FRAMEWORK_SRC)/include \ + -I$(GTEST_TEST_SRC), \ + CFLAGS_windows := /EHsc, \ + CFLAGS_solaris := -DGTEST_HAS_EXCEPTIONS=0 -library=stlport4, \ + CFLAGS_macosx := -DGTEST_OS_MAC=1, \ + CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ + CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ + DISABLED_WARNINGS_gcc := undef, \ + DISABLED_WARNINGS_clang := undef switch format-nonliteral \ + tautological-undefined-compare, \ + DISABLED_WARNINGS_solstudio := identexpected, \ + LDFLAGS := $(JVM_LDFLAGS), \ + LDFLAGS_solaris := -library=stlport4 $(call SET_SHARED_LIBRARY_ORIGIN), \ + LIBS := $(JVM_LIBS), \ + OPTIMIZATION := $(JVM_OPTIMIZATION), \ + MAPFILE := $(GTEST_JVM_MAPFILE), \ + USE_MAPFILE_FOR_SYMBOLS := true, \ + COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ + ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \ +)) + +TARGETS += $(BUILD_GTEST_LIBJVM) + +################################################################################ + +$(eval $(call SetupNativeCompilation, BUILD_GTEST_LAUNCHER, \ + TOOLCHAIN := $(JVM_TOOLCHAIN), \ + PROGRAM := gtestLauncher, \ + OUTPUT_DIR := $(JVM_OUTPUTDIR)/gtest, \ + EXTRA_FILES := $(GTEST_TEST_SRC)/gtestLauncher.cpp, \ + OBJECT_DIR := $(JVM_OUTPUTDIR)/gtest/launcher-objs, \ + CFLAGS := $(JVM_CFLAGS) -I$(GTEST_FRAMEWORK_SRC) \ + -I$(GTEST_FRAMEWORK_SRC)/include, \ + CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ + CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \ + LDFLAGS := $(LDFLAGS_TESTEXE), \ + LDFLAGS_unix := -L$(JVM_OUTPUTDIR)/gtest $(call SET_SHARED_LIBRARY_ORIGIN), \ + LDFLAGS_solaris := -library=stlport4, \ + LIBS_unix := -ljvm, \ + LIBS_windows := $(JVM_OUTPUTDIR)/gtest/objs/jvm.lib, \ + COPY_DEBUG_SYMBOLS := $(GTEST_COPY_DEBUG_SYMBOLS), \ + ZIP_EXTERNAL_DEBUG_SYMBOLS := false, \ +)) + +$(BUILD_GTEST_LAUNCHER): $(BUILD_GTEST_LIBJVM) + +TARGETS += $(BUILD_GTEST_LAUNCHER) + +################################################################################ diff --git a/hotspot/makefiles/lib/CompileJvm.gmk b/hotspot/make/lib/CompileJvm.gmk similarity index 100% rename from hotspot/makefiles/lib/CompileJvm.gmk rename to hotspot/make/lib/CompileJvm.gmk diff --git a/hotspot/makefiles/lib/CompileLibjsig.gmk b/hotspot/make/lib/CompileLibjsig.gmk similarity index 97% rename from hotspot/makefiles/lib/CompileLibjsig.gmk rename to hotspot/make/lib/CompileLibjsig.gmk index ba9791cdef8..1c9a10fbf5c 100644 --- a/hotspot/makefiles/lib/CompileLibjsig.gmk +++ b/hotspot/make/lib/CompileLibjsig.gmk @@ -79,7 +79,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows) endif LIBJSIG_SRC_FILE := $(HOTSPOT_TOPDIR)/src/os/$(HOTSPOT_TARGET_OS)/vm/jsig.c - LIBJSIG_MAPFILE := $(wildcard $(HOTSPOT_TOPDIR)/makefiles/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS)) + LIBJSIG_MAPFILE := $(wildcard $(HOTSPOT_TOPDIR)/make/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS)) LIBJSIG_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/libjsig LIBJSIG_LDFLAGS += $(SHARED_LIBRARY_FLAGS) diff --git a/hotspot/makefiles/lib/CompileLibraries.gmk b/hotspot/make/lib/CompileLibraries.gmk similarity index 95% rename from hotspot/makefiles/lib/CompileLibraries.gmk rename to hotspot/make/lib/CompileLibraries.gmk index 7a7a1651194..d7e39e7f7b0 100644 --- a/hotspot/makefiles/lib/CompileLibraries.gmk +++ b/hotspot/make/lib/CompileLibraries.gmk @@ -37,6 +37,10 @@ include lib/CompileDtracePreJvm.gmk include lib/CompileJvm.gmk include lib/CompileDtracePostJvm.gmk +ifeq ($(BUILD_GTEST), true) + include lib/CompileGtest.gmk +endif + all: $(TARGETS) .PHONY: all diff --git a/hotspot/makefiles/lib/JvmFeatures.gmk b/hotspot/make/lib/JvmFeatures.gmk similarity index 100% rename from hotspot/makefiles/lib/JvmFeatures.gmk rename to hotspot/make/lib/JvmFeatures.gmk diff --git a/hotspot/makefiles/lib/JvmMapfile.gmk b/hotspot/make/lib/JvmMapfile.gmk similarity index 85% rename from hotspot/makefiles/lib/JvmMapfile.gmk rename to hotspot/make/lib/JvmMapfile.gmk index 9d7655b26ee..9f9c928d8f5 100644 --- a/hotspot/makefiles/lib/JvmMapfile.gmk +++ b/hotspot/make/lib/JvmMapfile.gmk @@ -31,20 +31,20 @@ $(eval $(call IncludeCustomExtension, hotspot, lib/JvmMapfile.gmk)) ifneq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), windows-x86_64) # On Windows x86_64, we should not have any symbols at all, since that # results in duplicate warnings from the linker (JDK-8043491). - SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-shared + SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-shared endif ifeq ($(OPENJDK_TARGET_OS_TYPE), unix) - SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-unix + SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-unix endif -ifneq ($(wildcard $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS)), ) - SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS) +ifneq ($(wildcard $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS)), ) + SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS) endif ifneq ($(findstring debug, $(DEBUG_LEVEL)), ) - ifneq ($(wildcard $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS)-debug), ) - SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-$(OPENJDK_TARGET_OS)-debug + ifneq ($(wildcard $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS)-debug), ) + SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-$(OPENJDK_TARGET_OS)-debug endif endif @@ -53,9 +53,9 @@ ifeq ($(OPENJDK_TARGET_OS), solaris) # Additional mapfiles that are only used when dtrace is enabled ifeq ($(call check-jvm-feature, compiler2), true) # This also covers the case of compiler1+compiler2. - SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-solaris-dtrace-compiler2 + SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-solaris-dtrace-compiler2 else ifeq ($(call check-jvm-feature, compiler1), true) - SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/makefiles/symbols/symbols-solaris-dtrace-compiler1 + SYMBOLS_SRC += $(HOTSPOT_TOPDIR)/make/symbols/symbols-solaris-dtrace-compiler1 endif endif endif @@ -153,20 +153,33 @@ $(JVM_OUTPUTDIR)/symbols: $(SYMBOLS_SRC) ################################################################################ # Finally convert the symbol list into a platform-specific mapfile -$(JVM_MAPFILE): $(JVM_OUTPUTDIR)/symbols - $(call LogInfo, Creating mapfile) - $(RM) $@ - ifeq ($(OPENJDK_TARGET_OS), macosx) - # On macosx, we need to add a leading underscore +ifeq ($(OPENJDK_TARGET_OS), macosx) + # On macosx, we need to add a leading underscore + define create-mapfile-work $(AWK) '{ if ($$0 ~ ".") { print " _" $$0 } }' < $^ > $@.tmp - else ifeq ($(OPENJDK_TARGET_OS), windows) - # On windows, add an 'EXPORTS' header + endef +else ifeq ($(OPENJDK_TARGET_OS), windows) + # On windows, add an 'EXPORTS' header + define create-mapfile-work $(ECHO) "EXPORTS" > $@.tmp $(AWK) '{ if ($$0 ~ ".") { print " " $$0 } }' < $^ >> $@.tmp - else - # Assume standard linker script + endef +else + # Assume standard linker script + define create-mapfile-work $(PRINTF) "SUNWprivate_1.1 { \n global: \n" > $@.tmp $(AWK) '{ if ($$0 ~ ".") { print " " $$0 ";" } }' < $^ >> $@.tmp $(PRINTF) " local: \n *; \n }; \n" >> $@.tmp - endif + endef +endif + +define create-mapfile + $(call LogInfo, Creating mapfile) + $(call MakeDir, $(@D)) + $(call create-mapfile-work) + $(RM) $@ $(MV) $@.tmp $@ +endef + +$(JVM_MAPFILE): $(JVM_OUTPUTDIR)/symbols + $(call create-mapfile) diff --git a/hotspot/makefiles/lib/JvmOverrideFiles.gmk b/hotspot/make/lib/JvmOverrideFiles.gmk similarity index 100% rename from hotspot/makefiles/lib/JvmOverrideFiles.gmk rename to hotspot/make/lib/JvmOverrideFiles.gmk diff --git a/hotspot/make/linux/Makefile b/hotspot/make/linux/Makefile deleted file mode 100644 index dba28625eec..00000000000 --- a/hotspot/make/linux/Makefile +++ /dev/null @@ -1,385 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile creates a build tree and lights off a build. -# You can go back into the build tree and perform rebuilds or -# incremental builds as desired. Be sure to reestablish -# environment variable settings for LD_LIBRARY_PATH and JAVA_HOME. - -# The make process now relies on java and javac. These can be -# specified either implicitly on the PATH, by setting the -# (JDK-inherited) ALT_BOOTDIR environment variable to full path to a -# JDK in which bin/java and bin/javac are present and working (e.g., -# /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited) -# default BOOTDIR path value. Note that one of ALT_BOOTDIR -# or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc. -# from the PATH. -# -# One can set ALT_BOOTDIR or BOOTDIR to point to a jdk that runs on -# an architecture that differs from the target architecture, as long -# as the bootstrap jdk runs under the same flavor of OS as the target -# (i.e., if the target is linux, point to a jdk that runs on a linux -# box). In order to use such a bootstrap jdk, set the make variable -# REMOTE to the desired remote command mechanism, e.g., -# -# make REMOTE="rsh -l me myotherlinuxbox" - -ifeq ($(GAMMADIR),) -include ../../make/defs.make -else -include $(GAMMADIR)/make/defs.make -endif -include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make - -ifndef CC_INTERP - ifndef FORCE_TIERED - FORCE_TIERED=1 - endif -endif - -ifdef LP64 - ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") - _JUNK_ := $(shell echo >&2 \ - $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!") - @exit 1 - endif -endif - -# we need to set up LP64 correctly to satisfy sanity checks in adlc -ifneq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") - MFLAGS += " LP64=1 " -endif - -# pass USE_SUNCC further, through MFLAGS -ifdef USE_SUNCC - MFLAGS += " USE_SUNCC=1 " -endif - -# The following renders pathnames in generated Makefiles valid on -# machines other than the machine containing the build tree. -# -# For example, let's say my build tree lives on /files12 on -# exact.east.sun.com. This logic will cause GAMMADIR to begin with -# /net/exact/files12/... -# -# We only do this on SunOS variants, for a couple of reasons: -# * It is extremely rare that source trees exist on other systems -# * It has been claimed that the Linux automounter is flakey, so -# changing GAMMADIR in a way that exercises the automounter could -# prove to be a source of unreliability in the build process. -# Obviously, this Makefile is only relevant on SunOS boxes to begin -# with, but the SunOS conditionalization will make it easier to -# combine Makefiles in the future (assuming we ever do that). - -ifeq ($(OSNAME),solaris) - - # prepend current directory to relative pathnames. - NEW_GAMMADIR := \ - $(shell echo $(GAMMADIR) | \ - sed -e "s=^\([^/].*\)=$(shell pwd)/\1=" \ - ) - unexport NEW_GAMMADIR - - # If NEW_GAMMADIR doesn't already start with "/net/": - ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),) - # prepend /net/$(HOST) - # remove /net/$(HOST) if name already began with /home/ - # remove /net/$(HOST) if name already began with /java/ - # remove /net/$(HOST) if name already began with /lab/ - NEW_GAMMADIR := \ - $(shell echo $(NEW_GAMMADIR) | \ - sed -e "s=^\(.*\)=/net/$(HOST)\1=" \ - -e "s=^/net/$(HOST)/home/=/home/=" \ - -e "s=^/net/$(HOST)/java/=/java/=" \ - -e "s=^/net/$(HOST)/lab/=/lab/=" \ - ) - # Don't use the new value for GAMMADIR unless a file with the new - # name actually exists. - ifneq ($(wildcard $(NEW_GAMMADIR)),) - GAMMADIR := $(NEW_GAMMADIR) - endif - endif - -endif - -# BUILDARCH is set to "zero" for Zero builds. VARIANTARCH -# is used to give the build directories meaningful names. -VARIANTARCH = $(subst i386,i486,$(ZERO_LIBARCH)) - -# There is a (semi-) regular correspondence between make targets and actions: -# -# Target Tree Type Build Dir -# -# debug compiler2 __compiler2/debug -# fastdebug compiler2 __compiler2/fastdebug -# optimized compiler2 __compiler2/optimized -# product compiler2 __compiler2/product -# -# debug1 compiler1 __compiler1/debug -# fastdebug1 compiler1 __compiler1/fastdebug -# optimized1 compiler1 __compiler1/optimized -# product1 compiler1 __compiler1/product -# -# debugcore core __core/debug -# fastdebugcore core __core/fastdebug -# optimizedcore core __core/optimized -# productcore core __core/product -# -# debugzero zero __zero/debug -# fastdebugzero zero __zero/fastdebug -# optimizedzero zero __zero/optimized -# productzero zero __zero/product -# -# debugshark shark __shark/debug -# fastdebugshark shark __shark/fastdebug -# optimizedshark shark __shark/optimized -# productshark shark __shark/product -# -# fastdebugminimal1 minimal1 __minimal1/fastdebug -# productminimal1 minimal1 __minimal1/product -# -# What you get with each target: -# -# debug* - debug compile with asserts enabled -# fastdebug* - optimized compile, but with asserts enabled -# optimized* - optimized compile, no asserts -# product* - the shippable thing: optimized compile, no asserts, -DPRODUCT - -# This target list needs to be coordinated with the usage message -# in the build.sh script: -TARGETS = debug fastdebug optimized product - -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - SUBDIR_DOCS = $(OSNAME)_$(VARIANTARCH)_docs -else - SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs -endif -SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) -SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) -SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) -SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) -SUBDIRS_ZERO = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS)) -SUBDIRS_SHARK = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS)) -SUBDIRS_MINIMAL1 = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS)) - -TARGETS_C2 = $(TARGETS) -TARGETS_C1 = $(addsuffix 1,$(TARGETS)) -TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) -TARGETS_CORE = $(addsuffix core,$(TARGETS)) -TARGETS_ZERO = $(addsuffix zero,$(TARGETS)) -TARGETS_SHARK = $(addsuffix shark,$(TARGETS)) -TARGETS_MINIMAL1 = $(addsuffix minimal1,$(TARGETS)) - -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) -BUILDTREE_VARS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE) - -BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS) - -#------------------------------------------------------------------------------- - -# Could make everything by default, but that would take a while. -all: - @echo "Try '$(MAKE) ...' where is one or more of" - @echo " $(TARGETS_C2)" - @echo " $(TARGETS_C1)" - @echo " $(TARGETS_CORE)" - @echo " $(TARGETS_ZERO)" - @echo " $(TARGETS_SHARK)" - @echo " $(TARGETS_MINIMAL1)" - -checks: check_os_version check_j2se_version - -# We do not want people accidentally building on old systems (e.g. Linux 2.2.x, -# Solaris 2.5.1, 2.6). -# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. - -SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4% -OS_VERSION := $(shell uname -r) -EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) - -check_os_version: -ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),) - $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1; -endif - -# jvmti.make requires XSLT (J2SE 1.4.x or newer): -XSLT_CHECK = $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory -# If not found then fail fast. -check_j2se_version: - $(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \ - $(REMOTE) $(RUN.JAVA) -version; \ - echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \ - "to bootstrap this build" 1>&2; \ - exit 1; \ - fi - -$(SUBDIRS_TIERED): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered - -$(SUBDIRS_C2): $(BUILDTREE_MAKE) -ifeq ($(FORCE_TIERED),1) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered FORCE_TIERED=1 -else - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler2 -endif - -$(SUBDIRS_C1): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler1 - -$(SUBDIRS_CORE): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=core - -$(SUBDIRS_ZERO): $(BUILDTREE_MAKE) platform_zero - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=zero VARIANTARCH=$(VARIANTARCH) - -$(SUBDIRS_SHARK): $(BUILDTREE_MAKE) platform_zero - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH) - -$(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=minimal1 - - -platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in - $(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@ - -# Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME - -$(TARGETS_C2): $(SUBDIRS_C2) - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_TIERED): $(SUBDIRS_TIERED) - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_C1): $(SUBDIRS_C1) - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_CORE): $(SUBDIRS_CORE) - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_ZERO): $(SUBDIRS_ZERO) - cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(VARIANTARCH)_zero/$(patsubst %zero,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_SHARK): $(SUBDIRS_SHARK) - cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_MINIMAL1): $(SUBDIRS_MINIMAL1) - cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install -endif - -# Just build the tree, and nothing else: -tree: $(SUBDIRS_C2) -tree1: $(SUBDIRS_C1) -treecore: $(SUBDIRS_CORE) -treezero: $(SUBDIRS_ZERO) -treeshark: $(SUBDIRS_SHARK) -treeminimal1: $(SUBDIRS_MINIMAL1) - -# Doc target. This is the same for all build options. -# Hence create a docs directory beside ...$(ARCH)_[...] -# We specify 'BUILD_FLAVOR=product' so that the proper -# ENABLE_FULL_DEBUG_SYMBOLS value is used. -docs: checks - $(QUIETLY) mkdir -p $(SUBDIR_DOCS) - $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs - -# Synonyms for win32-like targets. -compiler2: debug product - -compiler1: debug1 product1 - -core: debugcore productcore - -zero: debugzero productzero - -shark: debugshark productshark - -warn_jvmg_deprecated: - echo "Warning: The jvmg target has been replaced with debug" - echo "Warning: Please update your usage" - -jvmg: warn_jvmg_deprecated debug - -jvmg1: warn_jvmg_deprecated debug1 - -jvmgcore: warn_jvmg_deprecated debugcore - -jvmgzero: warn_jvmg_deprecated debugzero - -jvmgshark: warn_jvmg_deprecated debugshark - -clean_docs: - rm -rf $(SUBDIR_DOCS) - -clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1: - rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) - -clean: clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs - -include $(GAMMADIR)/make/cscope.make - -# -# Include alternate Makefile if it exists. -# --include $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make - -#------------------------------------------------------------------------------- - -.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1) -.PHONY: tree tree1 treecore treezero treeshark -.PHONY: all compiler1 compiler2 core zero shark -.PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs -.PHONY: checks check_os_version check_j2se_version -.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make - -.NOTPARALLEL: diff --git a/hotspot/make/linux/README b/hotspot/make/linux/README deleted file mode 100644 index d3efaf8b610..00000000000 --- a/hotspot/make/linux/README +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2007, 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. - -________________________________________________________________________ - -Please refer to the comments in the Makefile in this directory -for instructions how to build the Solaris versions. - diff --git a/hotspot/make/linux/adlc_updater b/hotspot/make/linux/adlc_updater deleted file mode 100644 index 99e04e333f2..00000000000 --- a/hotspot/make/linux/adlc_updater +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -# -# This file is used by adlc.make to selectively update generated -# adlc files. Because source and target diretories are relative -# paths, this file is copied to the target build directory before -# use. -# -# adlc-updater -# -fix_lines() { - # repair bare #line directives in $1 to refer to $2 - # and add an override of __FILE__ with just the basename on the - # first line of the file. - awk < $1 > $1+ -v F2=$2 ' - BEGIN { print "#line 1 \"" F2 "\""; } - /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next} - {print} - ' - mv $1+ $1 -} -fix_lines $2/$1 $1 -[ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \ -( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) diff --git a/hotspot/make/linux/makefiles/aarch64.make b/hotspot/make/linux/makefiles/aarch64.make deleted file mode 100644 index 9dedb3e29c1..00000000000 --- a/hotspot/make/linux/makefiles/aarch64.make +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) -# Must also specify if CPU is little endian -CFLAGS += -DVM_LITTLE_ENDIAN - -CFLAGS += -D_LP64=1 diff --git a/hotspot/make/linux/makefiles/adjust-mflags.sh b/hotspot/make/linux/makefiles/adjust-mflags.sh deleted file mode 100644 index 97bc02db7f1..00000000000 --- a/hotspot/make/linux/makefiles/adjust-mflags.sh +++ /dev/null @@ -1,87 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 1999, 2008, 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. -# -# - -# This script is used only from top.make. -# The macro $(MFLAGS-adjusted) calls this script to -# adjust the "-j" arguments to take into account -# the HOTSPOT_BUILD_JOBS variable. The default -# handling of the "-j" argument by gnumake does -# not meet our needs, so we must adjust it ourselves. - -# This argument adjustment applies to two recursive -# calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make. -# One invokes adlc.make, and the other invokes vm.make. -# The adjustment propagates the desired concurrency -# level down to the sub-make (of the adlc or vm). -# The default behavior of gnumake is to run all -# sub-makes without concurrency ("-j1"). - -# Also, we use a make variable rather than an explicit -# "-j" argument to control this setting, so that -# the concurrency setting (which must be tuned separately -# for each MP system) can be set via an environment variable. -# The recommended setting is 1.5x to 2x the number of available -# CPUs on the MP system, which is large enough to keep the CPUs -# busy (even though some jobs may be I/O bound) but not too large, -# we may presume, to overflow the system's swap space. - -set -eu - -default_build_jobs=4 - -case $# in -[12]) true;; -*) >&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;; -esac - -MFLAGS=$1 -HOTSPOT_BUILD_JOBS=${2-} - -# Normalize any -jN argument to the form " -j${HBJ}" -MFLAGS=` - echo "$MFLAGS" \ - | sed ' - s/^-/ -/ - s/ -\([^ I][^ I]*\)j/ -\1 -j/ - s/ -j[0-9][0-9]*/ -j/ - s/ -j\([^ ]\)/ -j -\1/ - s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ - ' ` - -case ${HOTSPOT_BUILD_JOBS} in \ - -'') case ${MFLAGS} in - *\ -j*) - >&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile." - >&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment." - esac;; - -?*) case ${MFLAGS} in - *\ -j*) true;; - *) MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";; - esac;; -esac - -echo "${MFLAGS}" diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make deleted file mode 100644 index 287923151d2..00000000000 --- a/hotspot/make/linux/makefiles/adlc.make +++ /dev/null @@ -1,233 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile (adlc.make) is included from the adlc.make in the -# build directories. -# It knows how to compile, link, and run the adlc. - -include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make - -# ######################################################################### - -# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make: -GENERATED = ../generated -OUTDIR = $(GENERATED)/adfiles - -ARCH = $(Platform_arch) -OS = $(Platform_os_family) - -SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad - -ifeq ("${Platform_arch_model}", "${Platform_arch}") - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) -else - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) -endif - -EXEC = $(OUTDIR)/adlc - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor -Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED) -INCLUDES += $(Src_Dirs_I:%=-I%) - -# set flags for adlc compilation -CXXFLAGS = $(SYSDEFS) $(INCLUDES) - -# Force assertions on. -CXXFLAGS += -DASSERT - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -# Compiler warnings are treated as errors -CFLAGS_WARN = $(WARNINGS_ARE_ERRORS) -CFLAGS += $(CFLAGS_WARN) - -OBJECTNAMES = \ - adlparse.o \ - archDesc.o \ - arena.o \ - dfa.o \ - dict2.o \ - filebuff.o \ - forms.o \ - formsopt.o \ - formssel.o \ - main.o \ - adlc-opcodes.o \ - output_c.o \ - output_h.o \ - -OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%) - -GENERATEDNAMES = \ - ad_$(Platform_arch_model).cpp \ - ad_$(Platform_arch_model).hpp \ - ad_$(Platform_arch_model)_clone.cpp \ - ad_$(Platform_arch_model)_expand.cpp \ - ad_$(Platform_arch_model)_format.cpp \ - ad_$(Platform_arch_model)_gen.cpp \ - ad_$(Platform_arch_model)_misc.cpp \ - ad_$(Platform_arch_model)_peephole.cpp \ - ad_$(Platform_arch_model)_pipeline.cpp \ - adGlobals_$(Platform_arch_model).hpp \ - dfa_$(Platform_arch_model).cpp \ - -GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) - -# ######################################################################### - -all: $(EXEC) - -$(EXEC) : $(OBJECTS) - @echo $(LOG_INFO) Making adlc - $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.LINK_NOPROF.CXX)) -o $(EXEC) $(OBJECTS) - -# Random dependencies: -$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp - -# The source files refer to ostream.h, which sparcworks calls iostream.h -$(OBJECTS): ostream.h - -ostream.h : - @echo >$@ '#include ' - -dump: - : OUTDIR=$(OUTDIR) - : OBJECTS=$(OBJECTS) - : products = $(GENERATEDFILES) - -all: $(GENERATEDFILES) - -$(GENERATEDFILES): refresh_adfiles - -# Get a unique temporary directory name, so multiple makes can run in parallel. -# Note that product files are updated via "mv", which is atomic. -TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) - -ifneq ($(DEBUG_BINARIES), true) - # Debuggable by default (unless already done by DEBUG_BINARIES) - CFLAGS += -g -endif - -# Pass -D flags into ADLC. -ADLCFLAGS += $(SYSDEFS) - -# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO. -ADLCFLAGS += -q -T - -# Normally, debugging is done directly on the ad_*.cpp files. -# But -g will put #line directives in those files pointing back to .ad. -# Some builds of gcc 3.2 have a bug that gets tickled by the extra #line directives -# so skip it for 3.2 and ealier. -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" -ADLCFLAGS += -g -endif - -ifdef LP64 -ADLCFLAGS += -D_LP64 -else -ADLCFLAGS += -U_LP64 -endif - -# -# adlc_updater is a simple sh script, under sccs control. It is -# used to selectively update generated adlc files. This should -# provide a nice compilation speed improvement. -# -ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) -ADLC_UPDATER = adlc_updater -$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) - $(QUIETLY) cp $< $@; chmod +x $@ - -# This action refreshes all generated adlc files simultaneously. -# The way it works is this: -# 1) create a scratch directory to work in. -# 2) if the current working directory does not have $(ADLC_UPDATER), copy it. -# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory. -# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. -# 5) If we actually updated any files, echo a notice. -# -refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) - @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) - $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ - -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ - || { rm -rf $(TEMPDIR); exit 1; } - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." - $(QUIETLY) rm -rf $(TEMPDIR) - - -# ######################################################################### - -$(SOURCE.AD): $(SOURCES.AD) - $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD) - -#PROCESS_AD_FILES = cat -# Pass through #line directives, in case user enables -g option above: -PROCESS_AD_FILES = awk '{ \ - if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ - if (need_lineno && $$0 !~ /\/\//) \ - { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ - print }' - -$(OUTDIR)/%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE) - -# Some object files are given a prefix, to disambiguate -# them from objects of the same name built for the VM. -$(OUTDIR)/adlc-%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(filter-out $(ARCHFLAG),$(HOST.COMPILE.CXX)) -o $@ $< $(COMPILE_DONE) - -# ######################################################################### - -clean : - rm $(OBJECTS) - -cleanall : - rm $(OBJECTS) $(EXEC) - -# ######################################################################### - -.PHONY: all dump refresh_adfiles clean cleanall diff --git a/hotspot/make/linux/makefiles/amd64.make b/hotspot/make/linux/makefiles/amd64.make deleted file mode 100644 index c98a5827820..00000000000 --- a/hotspot/make/linux/makefiles/amd64.make +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (c) 2003, 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. -# -# - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) -# Must also specify if CPU is little endian -CFLAGS += -DVM_LITTLE_ENDIAN - -CFLAGS += -D_LP64=1 - -OPT_CFLAGS/compactingPermGenGen.o = -O1 - -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/sharedRuntimeTrig.o += -g - OPT_CFLAGS/sharedRuntimeTrans.o += -g - OPT_CFLAGS/compactingPermGenGen.o += -g -endif diff --git a/hotspot/make/linux/makefiles/buildtree.make b/hotspot/make/linux/makefiles/buildtree.make deleted file mode 100644 index b5eb37e01f7..00000000000 --- a/hotspot/make/linux/makefiles/buildtree.make +++ /dev/null @@ -1,368 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Usage: -# -# $(MAKE) -f buildtree.make SRCARCH=srcarch BUILDARCH=buildarch LIBARCH=libarch -# GAMMADIR=dir OS_FAMILY=os VARIANT=variant -# -# The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the -# environment or on the command-line: -# -# ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory -# BUILDARCH - build directory -# LIBARCH - the corresponding directory in JDK/JRE -# GAMMADIR - top of workspace -# OS_FAMILY - operating system -# VARIANT - core, compiler1, compiler2, or tiered -# VERSION_STRING - the JDK version string as specified by JEP-223 -# HOTSPOT_VERSION_STRING - the same as VERSION_STRING, unless overridden by a standalone build -# -# Builds the directory trees with makefiles plus some convenience files in -# each directory: -# -# Makefile - for "make foo" -# flags.make - with macro settings -# vm.make - to support making "$(MAKE) -v vm.make" in makefiles -# adlc.make - -# trace.make - generate tracing event and type definitions -# jvmti.make - generate JVMTI bindings from the spec (JSR-163) -# -# The makefiles are split this way so that "make foo" will run faster by not -# having to read the dependency files for the vm. - --include $(SPEC) -include $(GAMMADIR)/make/scm.make -include $(GAMMADIR)/make/defs.make -include $(GAMMADIR)/make/altsrc.make - - -# 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ - -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - PLATFORM_FILE = $(shell dirname $(shell dirname $(shell pwd)))/platform_zero -else - ifdef USE_SUNCC - PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).suncc - else - PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) - ALT_PLATFORM_FILE = $(HS_ALT_MAKE)/$(OS_FAMILY)/platform_$(BUILDARCH) - PLATFORM_FILE := $(if $(wildcard $(ALT_PLATFORM_FILE)),$(ALT_PLATFORM_FILE),$(PLATFORM_FILE)) - endif -endif - -# Allow overriding of the arch part of the directory but default -# to BUILDARCH if nothing is specified -ifeq ($(VARIANTARCH),) - VARIANTARCH=$(BUILDARCH) -endif - -ifdef FORCE_TIERED -ifeq ($(VARIANT),tiered) -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_compiler2 -else -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) -endif -else -PLATFORM_DIR = $(OS_FAMILY)_$(VARIANTARCH)_$(VARIANT) -endif - -# -# We do two levels of exclusion in the shared directory. -# TOPLEVEL excludes are pruned, they are not recursively searched, -# but lower level directories can be named without fear of collision. -# ALWAYS excludes are excluded at any level in the directory tree. -# - -ALWAYS_EXCLUDE_DIRS = $(SCM_DIRS) - -ifeq ($(VARIANT),tiered) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent -else -ifeq ($(VARIANT),compiler2) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent -else -# compiler1 and core use the same exclude list -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent -endif -endif - -# Get things from the platform file. -COMPILER = $(shell sed -n 's/^compiler[ ]*=[ ]*//p' $(PLATFORM_FILE)) - -SIMPLE_DIRS = \ - $(PLATFORM_DIR)/generated/dependencies \ - $(PLATFORM_DIR)/generated/adfiles \ - $(PLATFORM_DIR)/generated/jvmtifiles \ - $(PLATFORM_DIR)/generated/tracefiles \ - $(PLATFORM_DIR)/generated/extensions - -TARGETS = debug fastdebug optimized product -SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) - -# For dependencies and recursive makes. -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make - -BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make dtrace.make - -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ - SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) - -# Define variables to be set in flags.make. -# Default values are set in make/defs.make. - -# Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami) -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME) -endif -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell whoami) -endif -# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro -# or make/hotspot_distro. -ifndef HOTSPOT_VM_DISTRO - ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - include $(GAMMADIR)/make/hotspot_distro - else - include $(GAMMADIR)/make/openjdk_distro - endif -endif - -# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK -ifndef OPENJDK - ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - OPENJDK=true - endif -endif - -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) - -BUILDTREE = \ - $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS) - -BUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)" - -all: $(SUBMAKE_DIRS) - -# Run make in each subdirectory recursively. -$(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE - $(QUIETLY) [ -d $@ ] || { mkdir -p $@; } - +$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F) - $(QUIETLY) touch $@ - -$(SIMPLE_DIRS): - $(QUIETLY) mkdir -p $@ - -# Convenience macro which takes a source relative path, applies $(1) to the -# absolute path, and then replaces $(GAMMADIR) in the result with a -# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. -gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2))) - -# This bit is needed to enable local rebuilds. -# Unless the makefile itself sets LP64, any environmental -# setting of LP64 will interfere with the build. -LP64_SETTING/32 = LP64 = \#empty -LP64_SETTING/64 = LP64 = 1 - -DATA_MODE/i486 = 32 -DATA_MODE/sparc = 32 -DATA_MODE/sparcv9 = 64 -DATA_MODE/amd64 = 64 -DATA_MODE/ppc64 = 64 -DATA_MODE/aarch64 = 64 - -DATA_MODE = $(DATA_MODE/$(BUILDARCH)) - -flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "Platform_file = $(PLATFORM_FILE)" | sed -e 's|$(HS_ALT_MAKE)|$$(HS_ALT_MAKE)|' -e 's|$(GAMMADIR)|$$(GAMMADIR)|'; \ - sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \ - echo; \ - echo "GAMMADIR = $(GAMMADIR)"; \ - echo "HS_ALT_MAKE = $(HS_ALT_MAKE)"; \ - echo "OSNAME = $(OSNAME)"; \ - echo "SYSDEFS = \$$(Platform_sysdefs)"; \ - echo "SRCARCH = $(SRCARCH)"; \ - echo "BUILDARCH = $(BUILDARCH)"; \ - echo "LIBARCH = $(LIBARCH)"; \ - echo "TARGET = $(TARGET)"; \ - echo "HOTSPOT_VERSION_STRING = $(HOTSPOT_VERSION_STRING)"; \ - echo "VERSION_STRING = $(VERSION_STRING)"; \ - echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ - echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ - echo "OPENJDK = $(OPENJDK)"; \ - echo "$(LP64_SETTING/$(DATA_MODE))"; \ - echo; \ - echo "# Used for platform dispatching"; \ - echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \ - echo "CFLAGS += \$$(TARGET_DEFINES)"; \ - echo; \ - echo "Src_Dirs_V = \\"; \ - sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ - echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - echo; \ - echo "Src_Dirs_I = \\"; \ - echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,altsrc,share/vm) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm) \\"; \ - echo "$(call gamma-path,altsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - [ -n "$(CFLAGS_BROWSE)" ] && \ - echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ - [ -n "$(ENABLE_FULL_DEBUG_SYMBOLS)" ] && \ - echo && echo "ENABLE_FULL_DEBUG_SYMBOLS = $(ENABLE_FULL_DEBUG_SYMBOLS)"; \ - [ -n "$(OBJCOPY)" ] && \ - echo && echo "OBJCOPY = $(OBJCOPY)"; \ - [ -n "$(STRIP_POLICY)" ] && \ - echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \ - [ -n "$(ZIP_DEBUGINFO_FILES)" ] && \ - echo && echo "ZIP_DEBUGINFO_FILES = $(ZIP_DEBUGINFO_FILES)"; \ - [ -n "$(ZIPEXE)" ] && \ - echo && echo "ZIPEXE = $(ZIPEXE)"; \ - [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ - echo && \ - echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ - echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ - [ -n "$(INCLUDE_TRACE)" ] && \ - echo && echo "INCLUDE_TRACE = $(INCLUDE_TRACE)"; \ - echo; \ - [ -n "$(SPEC)" ] && \ - echo "include $(SPEC)"; \ - echo "CP ?= cp"; \ - echo "MV ?= mv"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ - echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ - ) > $@ - -flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \ - ) > $@ - -../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo $(LOG_INFO) Creating directory list $@ - $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ - find $(HS_ALT_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \ - fi; - $(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ - -Makefile: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/top.make"; \ - ) > $@ - -vm.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo include flags_vm.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -adlc.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -jvmti.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -trace.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -dtrace.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -FORCE: - -.PHONY: all FORCE - -.NOTPARALLEL: diff --git a/hotspot/make/linux/makefiles/compiler1.make b/hotspot/make/linux/makefiles/compiler1.make deleted file mode 100644 index d303bfc1ca4..00000000000 --- a/hotspot/make/linux/makefiles/compiler1.make +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making client version of VM - -TYPE=COMPILER1 - -VM_SUBDIR = client - -# We don't support the JVMCI in a client VM. -INCLUDE_JVMCI := false - -CFLAGS += -DCOMPILER1 diff --git a/hotspot/make/linux/makefiles/compiler2.make b/hotspot/make/linux/makefiles/compiler2.make deleted file mode 100644 index c881079882e..00000000000 --- a/hotspot/make/linux/makefiles/compiler2.make +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making server version of VM - -TYPE=COMPILER2 - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 diff --git a/hotspot/make/linux/makefiles/core.make b/hotspot/make/linux/makefiles/core.make deleted file mode 100644 index e032d964f57..00000000000 --- a/hotspot/make/linux/makefiles/core.make +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (c) 1999, 2010, 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. -# -# - -# Sets make macros for making core version of VM - -# Select which files to use (in top.make) -TYPE=CORE - -# There is no "core" directory in JDK. Install core build in server directory. -VM_SUBDIR = server - -# Note: macros.hpp defines CORE diff --git a/hotspot/make/linux/makefiles/debug.make b/hotspot/make/linux/makefiles/debug.make deleted file mode 100644 index 7c57280a12c..00000000000 --- a/hotspot/make/linux/makefiles/debug.make +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -DEBUG_CFLAGS/DEFAULT= $(DEBUG_CFLAGS) -DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)) - -# _NMT_NOINLINE_ informs NMT that no inlining by Compiler -CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_ - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug - -VERSION = debug -SYSDEFS += -DASSERT -PICFLAGS = DEFAULT diff --git a/hotspot/make/linux/makefiles/defs.make b/hotspot/make/linux/makefiles/defs.make deleted file mode 100644 index f61dacd44e2..00000000000 --- a/hotspot/make/linux/makefiles/defs.make +++ /dev/null @@ -1,279 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# The common definitions for hotspot linux builds. -# Include the top level defs.make under make directory instead of this one. -# This file is included into make/defs.make. - -SLASH_JAVA ?= /java - -define print_info - ifneq ($$(LOG_LEVEL), warn) - $$(shell echo >&2 "INFO: $1") - endif -endef - -# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name - -# ARCH can be set explicitly in spec.gmk -ifndef ARCH - ARCH := $(shell uname -m) - # Fold little endian PowerPC64 into big-endian (if ARCH is set in - # hotspot-spec.gmk, this will be done by the configure script). - ifeq ($(ARCH),ppc64le) - ARCH := ppc64 - endif -endif - -PATH_SEP ?= : - -ifeq ($(LP64), 1) - ARCH_DATA_MODEL ?= 64 -else - ARCH_DATA_MODEL ?= 32 -endif - -# zero -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - ifeq ($(ARCH_DATA_MODEL), 64) - MAKE_ARGS += LP64=1 - endif - PLATFORM = linux-zero - VM_PLATFORM = linux_$(subst i386,i486,$(ZERO_LIBARCH)) - HS_ARCH = zero - ARCH = zero -endif - -# ia64 -ifeq ($(ARCH), ia64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = linux-ia64 - VM_PLATFORM = linux_ia64 - HS_ARCH = ia64 -endif - -# sparc -ifneq (,$(findstring $(ARCH), sparc)) - ifeq ($(ARCH_DATA_MODEL), 64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = linux-sparcv9 - VM_PLATFORM = linux_sparcv9 - else - ARCH_DATA_MODEL = 32 - PLATFORM = linux-sparc - VM_PLATFORM = linux_sparc - endif - HS_ARCH = sparc -endif - -# i686/i586 and amd64/x86_64 -ifneq (,$(findstring $(ARCH), amd64 x86_64 i686 i586)) - ifeq ($(ARCH_DATA_MODEL), 64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = linux-amd64 - VM_PLATFORM = linux_amd64 - else - ARCH_DATA_MODEL = 32 - PLATFORM = linux-i586 - VM_PLATFORM = linux_i486 - endif - - HS_ARCH = x86 -endif - -# PPC -# Notice: after 8046471 ARCH will be 'ppc' for top-level ppc64 builds but -# 'ppc64' for HotSpot-only ppc64 builds. Need to detect both variants here! -ifneq (,$(findstring $(ARCH), ppc ppc64)) - ifeq ($(ARCH_DATA_MODEL), 64) - MAKE_ARGS += LP64=1 - PLATFORM = linux-ppc64 - VM_PLATFORM = linux_ppc64 - endif - - HS_ARCH = ppc -endif - -# AARCH64 -ifeq ($(ARCH), aarch64) - ARCH_DATA_MODEL = 64 - MAKE_ARGS += LP64=1 - PLATFORM = linux-aarch64 - VM_PLATFORM = linux_aarch64 - HS_ARCH = aarch64 -endif - -# On 32 bit linux we build server and client, on 64 bit just server. -ifeq ($(JVM_VARIANTS),) - ifeq ($(ARCH_DATA_MODEL), 32) - JVM_VARIANTS:=client,server - JVM_VARIANT_CLIENT:=true - JVM_VARIANT_SERVER:=true - else - JVM_VARIANTS:=server - JVM_VARIANT_SERVER:=true - endif -endif - -# The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product -# builds is enabled with debug info files ZIP'ed to save space. For -# BUILD_FLAVOR != product builds, FDS is always enabled, after all a -# debug build without debug info isn't very useful. -# The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. -# -# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be -# disabled for a BUILD_FLAVOR == product build. -# -# Note: Use of a different variable name for the FDS override option -# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS -# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass -# in options via environment variables, use of distinct variables -# prevents strange behaviours. For example, in a BUILD_FLAVOR != -# product build, the FULL_DEBUG_SYMBOLS environment variable will be -# 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If -# the same variable name is used, then different values can be picked -# up by different parts of the build. Just to be clear, we only need -# two variable names because the incoming option value can be -# overridden in some situations, e.g., a BUILD_FLAVOR != product -# build. - -# Due to the multiple sub-make processes that occur this logic gets -# executed multiple times. We reduce the noise by at least checking that -# BUILD_FLAVOR has been set. -ifneq ($(BUILD_FLAVOR),) - ifeq ($(BUILD_FLAVOR), product) - FULL_DEBUG_SYMBOLS ?= 1 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) - else - # debug variants always get Full Debug Symbols (if available) - ENABLE_FULL_DEBUG_SYMBOLS = 1 - endif - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # Default OBJCOPY comes from GNU Binutils on Linux - ifeq ($(CROSS_COMPILE_ARCH),) - DEF_OBJCOPY=/usr/bin/objcopy - else - # Assume objcopy is part of the cross-compilation toolset - ifneq ($(ALT_COMPILER_PATH),) - DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy - endif - endif - OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) - ifneq ($(ALT_OBJCOPY),) - $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) - OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) - endif - - ifeq ($(OBJCOPY),) - $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.")) - ENABLE_FULL_DEBUG_SYMBOLS=0 - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - else - $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) - - # Library stripping policies for .debuginfo configs: - # all_strip - strips everything from the library - # min_strip - strips most stuff from the library; leaves minimum symbols - # no_strip - does not strip the library at all - # - # Oracle security policy requires "all_strip". A waiver was granted on - # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. - # - # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. - # - STRIP_POLICY ?= min_strip - - $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) - - ZIP_DEBUGINFO_FILES ?= 1 - - $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) - endif - endif # ENABLE_FULL_DEBUG_SYMBOLS=1 -endif # BUILD_FLAVOR - -JDK_INCLUDE_SUBDIR=linux - -# Library suffix -LIBRARY_SUFFIX=so - -EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html - -# client and server subdirectories have symbolic links to ../libjsig.so -EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz - else - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo - endif -endif -EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server -EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client -EXPORT_MINIMAL_DIR = $(EXPORT_LIB_ARCH_DIR)/minimal - -ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz - else - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo - endif - endif -endif - -ifeq ($(JVM_VARIANT_CLIENT),true) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz - else - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo - endif - endif -endif - -ifeq ($(JVM_VARIANT_MINIMAL1),true) - EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX) - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz - else - EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo - endif - endif -endif - --include $(HS_ALT_MAKE)/linux/makefiles/defs.make diff --git a/hotspot/make/linux/makefiles/dtrace.make b/hotspot/make/linux/makefiles/dtrace.make deleted file mode 100644 index 2c898d0e778..00000000000 --- a/hotspot/make/linux/makefiles/dtrace.make +++ /dev/null @@ -1,95 +0,0 @@ -# -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012 Red Hat, Inc. -# 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. -# -# - -# Linux does not build jvm_db -LIBJVM_DB = - -# Only OPENJDK builds test and support SDT probes currently. -ifndef OPENJDK -REASON = "This JDK does not support SDT probes" -else - -# We need a recent GCC for the default (4.4 or later) -ifeq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) \) \| \( $(CC_VER_MAJOR) \>= 5 \) )" "0" -REASON = "gcc version is too old" -else - -# But it does have a SystemTap dtrace compatible sys/sdt.h -ifneq ($(ALT_SDT_H),) - SDT_H_FILE = $(ALT_SDT_H) -else - ifeq ($(USE_CLANG), true) - # Clang doesn't support the -print-sysroot option and there is no known equivalent - # option, so fall back to using / as sysroot - SDT_SYSROOT= - else - SDT_SYSROOT=$(shell $(CXX) -print-sysroot) - endif - SDT_H_FILE = $(SDT_SYSROOT)/usr/include/sys/sdt.h -endif - -DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE)) -REASON = "$(SDT_H_FILE) not found" - -endif # GCC version -endif # OPENJDK - - -DTRACE_COMMON_SRCDIR = $(GAMMADIR)/src/os/posix/dtrace -DTRACE_PROG = dtrace -DtraceOutDir = $(GENERATED)/dtracefiles - -$(DtraceOutDir): - mkdir $(DtraceOutDir) - -$(DtraceOutDir)/hotspot.h: $(DTRACE_COMMON_SRCDIR)/hotspot.d | $(DtraceOutDir) - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot.d - -$(DtraceOutDir)/hotspot_jni.h: $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d | $(DtraceOutDir) - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d - -$(DtraceOutDir)/hs_private.h: $(DTRACE_COMMON_SRCDIR)/hs_private.d | $(DtraceOutDir) - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hs_private.d - -ifneq ($(DTRACE_ENABLED),) -CFLAGS += -DDTRACE_ENABLED -dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h -else -dtrace_gen_headers: - $(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)" -endif - -# Phony target used in vm.make build target to check whether enabled. -ifeq ($(DTRACE_ENABLED),) -dtraceCheck: - $(QUIETLY) $(LOG_INFO) echo "**NOTICE** Dtrace support disabled: $(REASON)" -else -dtraceCheck: -endif - -.PHONY: dtrace_gen_headers dtraceCheck - -# It doesn't support HAVE_DTRACE_H though. - diff --git a/hotspot/make/linux/makefiles/fastdebug.make b/hotspot/make/linux/makefiles/fastdebug.make deleted file mode 100644 index ebadd1986b3..00000000000 --- a/hotspot/make/linux/makefiles/fastdebug.make +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -# They may also specify FASTDEBUG_CFLAGS, but it defaults to DEBUG_CFLAGS. - -FASTDEBUG_CFLAGS$(FASTDEBUG_CFLAGS) = $(DEBUG_CFLAGS) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -ifeq ($(BUILDARCH), ia64) - # Bug in GCC, causes hang. -O1 will override the -O3 specified earlier - OPT_CFLAGS/callGenerator.o += -O1 - OPT_CFLAGS/ciTypeFlow.o += -O1 - OPT_CFLAGS/compile.o += -O1 - OPT_CFLAGS/concurrentMarkSweepGeneration.o += -O1 - OPT_CFLAGS/doCall.o += -O1 - OPT_CFLAGS/generateOopMap.o += -O1 - OPT_CFLAGS/generateOptoStub.o += -O1 - OPT_CFLAGS/graphKit.o += -O1 - OPT_CFLAGS/instanceKlass.o += -O1 - OPT_CFLAGS/interpreterRT_ia64.o += -O1 - OPT_CFLAGS/output.o += -O1 - OPT_CFLAGS/parse1.o += -O1 - OPT_CFLAGS/runtime.o += -O1 - OPT_CFLAGS/synchronizer.o += -O1 -endif - - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. -# The following lines are copied from debug.make, except that we -# consult FASTDEBUG_CFLAGS instead of DEBUG_CFLAGS. -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -DEBUG_CFLAGS/DEFAULT= $(FASTDEBUG_CFLAGS) -DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)) -CFLAGS += $(DEBUG_CFLAGS/BYFILE) - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug - -VERSION = optimized -SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS -PICFLAGS = DEFAULT diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make deleted file mode 100644 index 75dcaeb2c34..00000000000 --- a/hotspot/make/linux/makefiles/gcc.make +++ /dev/null @@ -1,425 +0,0 @@ -# -# 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 -# 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. -# -# - -#------------------------------------------------------------------------ -# CC, CXX & AS - -# If a SPEC is not set already, then use these defaults. -ifeq ($(SPEC),) - # When cross-compiling the ALT_COMPILER_PATH points - # to the cross-compilation toolset - ifdef CROSS_COMPILE_ARCH - CXX = $(ALT_COMPILER_PATH)/g++ - CC = $(ALT_COMPILER_PATH)/gcc - HOSTCXX = g++ - HOSTCC = gcc - STRIP = $(ALT_COMPILER_PATH)/strip - else - ifeq ($(USE_CLANG), true) - CXX = clang++ - CC = clang - else - CXX = g++ - CC = gcc - endif - - HOSTCXX = $(CXX) - HOSTCC = $(CC) - STRIP = strip - endif - AS = $(CC) -c -endif - - -ifeq ($(USE_CLANG), true) - CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1) - CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2) -else - # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only - # prints the numbers (e.g. "2.95", "3.2.1") - CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) - CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) - CC_VER_MICRO := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f3) - # Workaround Ubuntu bug where -dumpversion doesn't print a micro version - # https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1360404 - ifeq ($(CC_VER_MICRO),) - CC_VER_MICRO := "0" - endif -endif - -ifeq ($(USE_CLANG), true) - # Clang has precompiled headers support by default, but the user can switch - # it off by using 'USE_PRECOMPILED_HEADER=0'. - ifdef LP64 - ifeq ($(USE_PRECOMPILED_HEADER),) - USE_PRECOMPILED_HEADER=1 - endif - else - # We don't support precompiled headers on 32-bit builds because there some files are - # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make) - # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit. - USE_PRECOMPILED_HEADER=0 - endif - - ifeq ($(USE_PRECOMPILED_HEADER),1) - - ifndef LP64 - $(error " Precompiled Headers only supported on 64-bit platforms!") - endif - - PRECOMPILED_HEADER_DIR=. - PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp - PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch - - PCH_FLAG = -include precompiled.hpp - PCH_FLAG/DEFAULT = $(PCH_FLAG) - PCH_FLAG/NO_PCH = -DNO_PCH - PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@)) - - VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE) - VM_PCH_FLAG/AOUT = - VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO)) - - # We only use precompiled headers for the JVM build - CFLAGS += $(VM_PCH_FLAG) - - # There are some files which don't like precompiled headers - # The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build. - # But Clang doesn't support a precompiled header which was compiled with -O3 - # to be used in a compilation unit which uses '-O0'. We could also prepare an - # extra '-O0' PCH file for the opt build and use it here, but it's probably - # not worth the effort as long as only two files need this special handling. - PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH) - PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH) - PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH) - - endif -else # ($(USE_CLANG), true) - # check for precompiled headers support - ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" - # Allow the user to turn off precompiled headers from the command line. - ifneq ($(USE_PRECOMPILED_HEADER),0) - PRECOMPILED_HEADER_DIR=. - PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp - PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch - endif - endif -endif - -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -ifeq ($(USE_PRECOMPILED_HEADER),0) - CFLAGS += -DDONT_USE_PRECOMPILED_HEADER -endif - - -#------------------------------------------------------------------------ -# Compiler flags - -# position-independent code -PICFLAG = -fPIC - -VM_PICFLAG/LIBJVM = $(PICFLAG) -VM_PICFLAG/AOUT = -VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) - -ifeq ($(JVM_VARIANT_ZERO), true) -CFLAGS += $(LIBFFI_CFLAGS) -endif -ifeq ($(JVM_VARIANT_ZEROSHARK), true) -CFLAGS += $(LIBFFI_CFLAGS) -CFLAGS += $(LLVM_CFLAGS) -endif -CFLAGS += $(VM_PICFLAG) -CFLAGS += -fno-rtti -CFLAGS += -fno-exceptions -CFLAGS += -D_REENTRANT -ifeq ($(USE_CLANG),) - CFLAGS += -fcheck-new - # version 4 and above support fvisibility=hidden (matches jni_x86.h file) - # except 4.1.2 gives pointless warnings that can't be disabled (afaik) - ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" - CFLAGS += -fvisibility=hidden - endif -else - CFLAGS += -fvisibility=hidden -endif - -ifeq ($(USE_CLANG), true) - # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm' - # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment') - ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0" - STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16 - else - STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16 - endif -endif - -ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) -ARCHFLAG/i486 = -m32 -march=i586 -ARCHFLAG/amd64 = -m64 $(STACK_ALIGNMENT_OPT) -ARCHFLAG/aarch64 = -ARCHFLAG/ia64 = -ARCHFLAG/sparc = -m32 -mcpu=v9 -ARCHFLAG/sparcv9 = -m64 -mcpu=v9 -ARCHFLAG/zero = $(ZERO_ARCHFLAG) -ARCHFLAG/ppc64 = -m64 - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) -ASFLAGS += $(ARCHFLAG) - -# Use C++ Interpreter -ifdef CC_INTERP - CFLAGS += -DCC_INTERP -endif - -# Keep temporary files (.ii, .s) -ifdef NEED_ASM - CFLAGS += -save-temps -else - CFLAGS += -pipe -endif - -# Compiler warnings are treated as errors -WARNINGS_ARE_ERRORS ?= -Werror - -ifeq ($(USE_CLANG), true) - # However we need to clean the code up before we can unrestrictedly enable this option with Clang - WARNINGS_ARE_ERRORS += -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses - WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare - WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess - WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body -endif - -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual - -ifeq ($(USE_CLANG),) - # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit - # conversions which might affect the values. Only enable it in earlier versions. - ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" - # GCC < 4.3 - WARNING_FLAGS += -Wconversion - endif - ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 8 \) \))" "1" - # GCC >= 4.8 - # This flag is only known since GCC 4.3. Gcc 4.8 contains a fix so that with templates no - # warnings are issued: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11856 - WARNING_FLAGS += -Wtype-limits - # GCC < 4.8 don't accept this flag for C++. - WARNING_FLAGS += -Wno-format-zero-length - # GCC 4.8 reports less false positives than the older compilers. - WARNING_FLAGS += -Wuninitialized - endif -endif - -CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) - -# Special cases -CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) - -# optimization control flags (Used by fastdebug and release variants) -OPT_CFLAGS/NOOPT=-O0 -OPT_CFLAGS/DEBUG=-O0 -OPT_CFLAGS/SIZE=-Os -OPT_CFLAGS/SPEED=-O3 - -OPT_CFLAGS_DEFAULT ?= SPEED - -# Hotspot uses very unstrict aliasing turn this optimization off -# This option is added to CFLAGS rather than OPT_CFLAGS -# so that OPT_CFLAGS overrides get this option too. -CFLAGS += -fno-strict-aliasing - -ifdef OPT_CFLAGS - ifneq ("$(origin OPT_CFLAGS)", "command line") - $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") - endif -endif - -OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) - -# Variable tracking size limit exceeded for VMStructs::init() -ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "1" - # GCC >= 4.3 - # Gcc 4.1.2 does not support this flag, nor does it have problems compiling the file. - OPT_CFLAGS/vmStructs.o += -fno-var-tracking-assignments - # The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides - # of OPT_CFLAGS. Restore it here. - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/vmStructs.o += -g - endif -endif - -# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp -# if we use expensive-optimizations -ifeq ($(BUILDARCH), ia64) -OPT_CFLAGS += -fno-expensive-optimizations -endif - -# Work around some compiler bugs. -ifeq ($(USE_CLANG), true) - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) - OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) - # The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides - # of OPT_CFLAGS. Restore it here. - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/loopTransform.o += -g - endif - endif -else - # Do not allow GCC 4.1.1 - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 1 \& $(CC_VER_MICRO) = 1), 1) - $(error "GCC $(CC_VER_MAJOR).$(CC_VER_MINOR).$(CC_VER_MICRO) not supported because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27724") - endif - # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) - OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) - endif -endif - -# Flags for generating make dependency flags. -DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) -ifeq ($(USE_CLANG),) - ifneq ($(CC_VER_MAJOR), 2) - DEPFLAGS += -fpch-deps - endif -endif - -#------------------------------------------------------------------------ -# Linker flags - -# statically link libstdc++.so, work with gcc but ignored by g++ -STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic - -# Enable linker optimization -LFLAGS += -Xlinker -O1 - -ifeq ($(USE_CLANG),) - STATIC_LIBGCC += -static-libgcc - - ifneq (, findstring(debug,$(BUILD_FLAVOR))) - # for relocations read-only - LFLAGS += -Xlinker -z -Xlinker relro - - ifeq ($(BUILD_FLAVOR), debug) - # disable incremental relocations linking - LFLAGS += -Xlinker -z -Xlinker now - endif - endif - - ifeq ($(BUILDARCH), ia64) - LFLAGS += -Wl,-relax - endif - - # If this is a --hash-style=gnu system, use --hash-style=both - # The gnu .hash section won't work on some Linux systems like SuSE 10. - _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu') - ifneq ($(_HAS_HASH_STYLE_GNU),) - LDFLAGS_HASH_STYLE = -Wl,--hash-style=both - endif -else - # Don't know how to find out the 'hash style' of a system as '-dumpspecs' - # doesn't work for Clang. So for now we'll alwys use --hash-style=both - LDFLAGS_HASH_STYLE = -Wl,--hash-style=both -endif - -LFLAGS += $(LDFLAGS_HASH_STYLE) - -# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. -MAPFLAG = -Xlinker --version-script=FILENAME - -# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj -SONAMEFLAG = -Xlinker -soname=SONAME - -# Build shared library -SHARED_FLAG = -shared - -# Keep symbols even they are not used -AOUT_FLAGS += -Xlinker -export-dynamic - -#------------------------------------------------------------------------ -# Debug flags - -ifeq ($(USE_CLANG), true) - # Restrict the debug information created by Clang to avoid - # too big object files and speed the build up a little bit - # (see http://llvm.org/bugs/show_bug.cgi?id=7554) - CFLAGS += -flimit-debug-info -endif - -# Allow no optimizations. -DEBUG_CFLAGS=-O0 - -# DEBUG_BINARIES uses full -g debug information for all configs -ifeq ($(DEBUG_BINARIES), true) - CFLAGS += -g -else - DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH)) - ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) - DEBUG_CFLAGS += -g - endif - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH)) - ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),) - FASTDEBUG_CFLAGS += -g - endif - - OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH)) - ifeq ($(OPT_CFLAGS/$(BUILDARCH)),) - OPT_CFLAGS += -g - endif - endif -endif - -ifeq ($(USE_CLANG),) - # Enable bounds checking. - ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1" - # stack smashing checks. - DEBUG_CFLAGS += -fstack-protector-all --param ssp-buffer-size=1 - endif -endif - - -# If we are building HEADLESS, pass on to VM -# so it can set the java.awt.headless property -ifdef HEADLESS -CFLAGS += -DHEADLESS -endif - -# We are building Embedded for a small device -# favor code space over speed -ifdef MINIMIZE_RAM_USAGE -CFLAGS += -DMINIMIZE_RAM_USAGE -endif - -# Stack walking in the JVM relies on frame pointer (%rbp) to walk thread stack. -# Explicitly specify -fno-omit-frame-pointer because it is off by default -# starting with gcc 4.6. -ifndef USE_SUNCC - CFLAGS += -fno-omit-frame-pointer -endif - --include $(HS_ALT_MAKE)/linux/makefiles/gcc.make diff --git a/hotspot/make/linux/makefiles/hp.make b/hotspot/make/linux/makefiles/hp.make deleted file mode 100644 index e0b262a8fa2..00000000000 --- a/hotspot/make/linux/makefiles/hp.make +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making premium version of VM - -TYPE=HP - -CFLAGS += -DCOMPILER2 diff --git a/hotspot/make/linux/makefiles/hp1.make b/hotspot/make/linux/makefiles/hp1.make deleted file mode 100644 index 2e37a6ead33..00000000000 --- a/hotspot/make/linux/makefiles/hp1.make +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making premium version of VM - -TYPE=HP1 - -CFLAGS += -DCOMPILER1 diff --git a/hotspot/make/linux/makefiles/i486.make b/hotspot/make/linux/makefiles/i486.make deleted file mode 100644 index a1adda6477c..00000000000 --- a/hotspot/make/linux/makefiles/i486.make +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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 -# 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. -# -# - -# TLS helper, assembled from .s file - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) -# Must also specify if CPU is little endian -CFLAGS += -DVM_LITTLE_ENDIAN - -OPT_CFLAGS/compactingPermGenGen.o = -O1 - -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/sharedRuntimeTrig.o += -g - OPT_CFLAGS/sharedRuntimeTrans.o += -g - OPT_CFLAGS/compactingPermGenGen.o += -g -endif diff --git a/hotspot/make/linux/makefiles/ia64.make b/hotspot/make/linux/makefiles/ia64.make deleted file mode 100644 index 8535807a787..00000000000 --- a/hotspot/make/linux/makefiles/ia64.make +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# -# IA64 only uses c++ based interpreter -CFLAGS += -DCC_INTERP -D_LP64=1 -DVM_LITTLE_ENDIAN -ifeq ($(VERSION),debug) -ASM_FLAGS= -DDEBUG -else -ASM_FLAGS= -endif -# workaround gcc bug in compiling varargs -OPT_CFLAGS/jni.o = -O0 - -# gcc/ia64 has a bug that internal gcc functions linked with libjvm.so -# are made public. Hiding those symbols will cause undefined symbol error -# when VM is dropped into older JDK. We probably will need an IA64 -# mapfile to include those symbols as a workaround. Disable linker mapfile -# for now. -LDNOMAP=true diff --git a/hotspot/make/linux/makefiles/jsig.make b/hotspot/make/linux/makefiles/jsig.make deleted file mode 100644 index 58c84930824..00000000000 --- a/hotspot/make/linux/makefiles/jsig.make +++ /dev/null @@ -1,83 +0,0 @@ -# -# Copyright (c) 2005, 2014, 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. -# -# - -# Rules to build signal interposition library, used by vm.make - -# libjsig.so: signal interposition library -JSIG = jsig -LIBJSIG = lib$(JSIG).so - -LIBJSIG_DEBUGINFO = lib$(JSIG).debuginfo -LIBJSIG_DIZ = lib$(JSIG).diz - -JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm - -DEST_JSIG = $(JDK_LIBDIR)/$(LIBJSIG) -DEST_JSIG_DEBUGINFO = $(JDK_LIBDIR)/$(LIBJSIG_DEBUGINFO) -DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ) - -LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig - -# On Linux we really dont want a mapfile, as this library is small -# and preloaded using LD_PRELOAD, making functions private will -# cause problems with interposing. See CR: 6466665 -# LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) - -LFLAGS_JSIG += -D_GNU_SOURCE -D_REENTRANT $(LDFLAGS_HASH_STYLE) - -# DEBUG_BINARIES overrides everything, use full -g debug information -ifeq ($(DEBUG_BINARIES), true) - JSIG_DEBUG_CFLAGS = -g -endif - -$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo $(LOG_INFO) Making signal interposition lib... - $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ - $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(EXTRA_CFLAGS) -o $@ $< -ldl -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -g $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) - $(RM) $(LIBJSIG_DEBUGINFO) - endif -endif - -install_jsig: $(LIBJSIG) - @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" - $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ - $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) - $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ - $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" - -.PHONY: install_jsig diff --git a/hotspot/make/linux/makefiles/jvmti.make b/hotspot/make/linux/makefiles/jvmti.make deleted file mode 100644 index 14220e9909f..00000000000 --- a/hotspot/make/linux/makefiles/jvmti.make +++ /dev/null @@ -1,117 +0,0 @@ -# -# Copyright (c) 2003, 2010, 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. -# -# - -# This makefile (jvmti.make) is included from the jvmti.make in the -# build directories. -# -# It knows how to build and run the tools to generate jvmti. - -include $(GAMMADIR)/make/linux/makefiles/rules.make - -# ######################################################################### - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles - -JvmtiSrcDir = $(GAMMADIR)/src/share/vm/prims -InterpreterSrcDir = $(GAMMADIR)/src/share/vm/interpreter - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(JvmtiSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -JvmtiGeneratedNames = \ - jvmtiEnv.hpp \ - jvmtiEnter.cpp \ - jvmtiEnterTrace.cpp \ - jvmtiEnvRecommended.cpp \ - bytecodeInterpreterWithChecks.cpp \ - jvmti.h \ - -JvmtiEnvFillSource = $(JvmtiSrcDir)/jvmtiEnvFill.java -JvmtiEnvFillClass = $(JvmtiOutDir)/jvmtiEnvFill.class - -JvmtiGenSource = $(JvmtiSrcDir)/jvmtiGen.java -JvmtiGenClass = $(JvmtiOutDir)/jvmtiGen.class - -JvmtiGeneratedFiles = $(JvmtiGeneratedNames:%=$(JvmtiOutDir)/%) - -XSLT = $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -.PHONY: all jvmtidocs clean cleanall - -# ######################################################################### - -all: $(JvmtiGeneratedFiles) - -both = $(JvmtiGenClass) $(JvmtiSrcDir)/jvmti.xml $(JvmtiSrcDir)/jvmtiLib.xsl - -$(JvmtiGenClass): $(JvmtiGenSource) - $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiGenSource) - -$(JvmtiEnvFillClass): $(JvmtiEnvFillSource) - $(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) - -$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti - -$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp - -$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace - -$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp - $(QUIETLY) $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp - -$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp - -$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h - -jvmtidocs: $(JvmtiOutDir)/jvmti.html - -$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html - -# ######################################################################### - -clean : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -cleanall : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -# ######################################################################### - diff --git a/hotspot/make/linux/makefiles/mapfile-vers-debug b/hotspot/make/linux/makefiles/mapfile-vers-debug deleted file mode 100644 index ec0f06d8f65..00000000000 --- a/hotspot/make/linux/makefiles/mapfile-vers-debug +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - JVM_handle_linux_signal; - - # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; - - # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE - - local: - *; -}; - diff --git a/hotspot/make/linux/makefiles/mapfile-vers-jsig b/hotspot/make/linux/makefiles/mapfile-vers-jsig deleted file mode 100644 index 8a675046b6e..00000000000 --- a/hotspot/make/linux/makefiles/mapfile-vers-jsig +++ /dev/null @@ -1,40 +0,0 @@ -# - -# -# Copyright (c) 2005, 2008, 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. -# -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - JVM_begin_signal_setting; - JVM_end_signal_setting; - JVM_get_libjsig_version; - JVM_get_signal_action; - sigaction; - signal; - sigset; - local: - *; -}; diff --git a/hotspot/make/linux/makefiles/mapfile-vers-product b/hotspot/make/linux/makefiles/mapfile-vers-product deleted file mode 100644 index ec0f06d8f65..00000000000 --- a/hotspot/make/linux/makefiles/mapfile-vers-product +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - JVM_handle_linux_signal; - - # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; - - # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE - - local: - *; -}; - diff --git a/hotspot/make/linux/makefiles/minimal1.make b/hotspot/make/linux/makefiles/minimal1.make deleted file mode 100644 index d453e789877..00000000000 --- a/hotspot/make/linux/makefiles/minimal1.make +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -TYPE=MINIMAL1 - -# Force all variables to false, overriding any other -# setting that may have occurred in the makefiles. These -# can still be overridden by passing the variable as an -# argument to 'make' -INCLUDE_JVMTI := false -INCLUDE_FPROF := false -INCLUDE_VM_STRUCTS := false -INCLUDE_JNI_CHECK := false -INCLUDE_SERVICES := false -INCLUDE_MANAGEMENT := false -INCLUDE_ALL_GCS := false -INCLUDE_NMT := false -INCLUDE_TRACE := false -INCLUDE_CDS := false -INCLUDE_JVMCI := false - -CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" -CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" - -Src_Dirs/MINIMAL1 = $(CORE_PATHS) $(COMPILER1_PATHS) - -Src_Files_EXCLUDE/MINIMAL1 += $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp - --include $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make - -.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make diff --git a/hotspot/make/linux/makefiles/optimized.make b/hotspot/make/linux/makefiles/optimized.make deleted file mode 100644 index 41d5e5d792e..00000000000 --- a/hotspot/make/linux/makefiles/optimized.make +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making optimized version of HotSpot VM -# (This is the "product", not the "release" version.) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug - -VERSION = optimized diff --git a/hotspot/make/linux/makefiles/ppc64.make b/hotspot/make/linux/makefiles/ppc64.make deleted file mode 100644 index acb51ab2b7a..00000000000 --- a/hotspot/make/linux/makefiles/ppc64.make +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2012, 2013 SAP SE. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# make c code know it is on a 64 bit platform. -CFLAGS += -D_LP64=1 - -ifeq ($(origin OPENJDK_TARGET_CPU_ENDIAN),undefined) - # This can happen during hotspot standalone build. Set endianness from - # uname. We assume build and target machines are the same. - OPENJDK_TARGET_CPU_ENDIAN:=$(if $(filter ppc64le,$(shell uname -m)),little,big) -endif - -ifeq ($(filter $(OPENJDK_TARGET_CPU_ENDIAN),big little),) - $(error OPENJDK_TARGET_CPU_ENDIAN value should be 'big' or 'little') -endif - -ifeq ($(OPENJDK_TARGET_CPU_ENDIAN),big) - # fixes `relocation truncated to fit' error for gcc 4.1. - CFLAGS += -mminimal-toc - - # finds use ppc64 instructions, but schedule for power5 - CFLAGS += -mcpu=powerpc64 -mtune=power5 -minsert-sched-nops=regroup_exact -mno-multiple -mno-string -else - # Little endian machine uses ELFv2 ABI. - CFLAGS += -DVM_LITTLE_ENDIAN -DABI_ELFv2 - - # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI. - CFLAGS += -mcpu=power7 -mtune=power8 -minsert-sched-nops=regroup_exact -mno-multiple -mno-string -endif diff --git a/hotspot/make/linux/makefiles/product.make b/hotspot/make/linux/makefiles/product.make deleted file mode 100644 index 70e23c6cb5e..00000000000 --- a/hotspot/make/linux/makefiles/product.make +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making optimized version of HotSpot VM -# (This is the "product", not the "release" version.) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfile -MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-product - -SYSDEFS += -DPRODUCT -VERSION = optimized - -# use -g to strip library as -x will discard its symbol table; -x is fine for -# executables. -# Note: these macros are not used in .debuginfo configs -STRIP_LIBJVM = $(STRIP) -g $@ || exit 1; -STRIP_AOUT = $(STRIP) -x $@ || exit 1; - -# If we can create .debuginfo files, then the VM is stripped in vm.make -# and this macro is not used. -# LINK_LIB.CXX/POST_HOOK += $(STRIP_$(LINK_INTO)) diff --git a/hotspot/make/linux/makefiles/rules.make b/hotspot/make/linux/makefiles/rules.make deleted file mode 100644 index 82b952d2988..00000000000 --- a/hotspot/make/linux/makefiles/rules.make +++ /dev/null @@ -1,214 +0,0 @@ -# -# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Common rules/macros for the vm, adlc. - -# Tell make that .cpp is important -.SUFFIXES: .cpp $(SUFFIXES) - -DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ - -# $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). -CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS) -CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS) - -AS.S = $(AS) $(ASFLAGS) - -COMPILE.CC = $(CC_COMPILE) -c -GENASM.CC = $(CC_COMPILE) -S -LINK.CC = $(CC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -LINK_LIB.CC = $(CC) $(LFLAGS) $(SHARED_FLAG) -PREPROCESS.CC = $(CC_COMPILE) -E - -COMPILE.CXX = $(CXX_COMPILE) -c -GENASM.CXX = $(CXX_COMPILE) -S -LINK.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -LINK_NOPROF.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) -LINK_LIB.CXX = $(CXX) $(LFLAGS) $(SHARED_FLAG) -PREPROCESS.CXX = $(CXX_COMPILE) -E - -# cross compiling the jvm with c2 requires host compilers to build -# adlc tool - -HOST.CXX_COMPILE = $(HOSTCXX) $(CXXFLAGS) $(CFLAGS) -HOST.COMPILE.CXX = $(HOST.CXX_COMPILE) -c -HOST.LINK_NOPROF.CXX = $(HOSTCXX) $(LFLAGS) $(AOUT_FLAGS) - - -# Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k". -REMOVE_TARGET = rm -f $@ - -# Note use of ALT_BOOTDIR to explicitly specify location of java and -# javac; this is the same environment variable used in the J2SE build -# process for overriding the default spec, which is BOOTDIR. -# Note also that we fall back to using JAVA_HOME if neither of these is -# specified. - -ifdef ALT_BOOTDIR - -RUN.JAVA = $(ALT_BOOTDIR)/bin/java -RUN.JAVAP = $(ALT_BOOTDIR)/bin/javap -RUN.JAVAH = $(ALT_BOOTDIR)/bin/javah -RUN.JAR = $(ALT_BOOTDIR)/bin/jar -COMPILE.JAVAC = $(ALT_BOOTDIR)/bin/javac -COMPILE.RMIC = $(ALT_BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(ALT_BOOTDIR) - -else - -ifdef BOOTDIR - -RUN.JAVA = $(BOOTDIR)/bin/java -RUN.JAVAP = $(BOOTDIR)/bin/javap -RUN.JAVAH = $(BOOTDIR)/bin/javah -RUN.JAR = $(BOOTDIR)/bin/jar -COMPILE.JAVAC = $(BOOTDIR)/bin/javac -COMPILE.RMIC = $(BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(BOOTDIR) - -else - -ifdef JAVA_HOME - -RUN.JAVA = $(JAVA_HOME)/bin/java -RUN.JAVAP = $(JAVA_HOME)/bin/javap -RUN.JAVAH = $(JAVA_HOME)/bin/javah -RUN.JAR = $(JAVA_HOME)/bin/jar -COMPILE.JAVAC = $(JAVA_HOME)/bin/javac -COMPILE.RMIC = $(JAVA_HOME)/bin/rmic -BOOT_JAVA_HOME = $(JAVA_HOME) - -else - -# take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined - -RUN.JAVA = java -RUN.JAVAP = javap -RUN.JAVAH = javah -RUN.JAR = jar -COMPILE.JAVAC = javac -COMPILE.RMIC = rmic - -endif -endif -endif - -COMPILE.JAVAC += $(BOOTSTRAP_JAVAC_FLAGS) - -SUM = /usr/bin/sum - -# 'gmake MAKE_VERBOSE=y' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ -RUN.JAR$(MAKE_VERBOSE) += >/dev/null - -# Settings for javac -JAVAC_FLAGS = -g -encoding ascii - -# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system) -# Fall back to the values here if it's not set (hotspot only builds) -ifeq ($(BOOT_JDK_SOURCETARGET),) -BOOTSTRAP_SOURCETARGET := -source 8 -target 8 -else -BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET) -endif - -BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET) - -# With parallel makes, print a message at the end of compilation. -ifeq ($(findstring j,$(MFLAGS)),j) -COMPILE_DONE = && { echo Done with $<; } -endif - -# Include $(NONPIC_OBJ_FILES) definition -ifndef LP64 -include $(GAMMADIR)/make/pic.make -endif - -include $(GAMMADIR)/make/altsrc.make - -# The non-PIC object files are only generated for 32 bit platforms. -ifdef LP64 -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) -else -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ - $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ - $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)) -endif - -%.o: %.s - @echo $(LOG_INFO) Assembling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) - -# gcc applies preprocessing if the file extension is .S instead of .s -%.o: %.S - @echo $(LOG_INFO) Preprocessing and assembling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(AS.S) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) - -%.s: %.cpp - @echo $(LOG_INFO) Generating assembly for $< - $(QUIETLY) $(GENASM.CXX) -o $@ $< - $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) - -# Intermediate files (for debugging macros) -%.i: %.cpp - @echo $(LOG_INFO) Preprocessing $< to $@ - $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) - -# Override gnumake built-in rules which do sccs get operations badly. -# (They put the checked out code in the current directory, not in the -# directory of the original file.) Since this is a symptom of a teamware -# failure, and since not all problems can be detected by gnumake due -# to incomplete dependency checking... just complain and stop. -%:: s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -%:: SCCS/s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -.PHONY: default diff --git a/hotspot/make/linux/makefiles/shark.make b/hotspot/make/linux/makefiles/shark.make deleted file mode 100644 index ca702ee6616..00000000000 --- a/hotspot/make/linux/makefiles/shark.make +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2008, 2010 Red Hat, Inc. -# 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. -# -# - -# Sets make macros for making Shark version of VM - -TYPE = SHARK - -VM_SUBDIR = server - -CFLAGS += -DSHARK diff --git a/hotspot/make/linux/makefiles/sparc.make b/hotspot/make/linux/makefiles/sparc.make deleted file mode 100644 index ddb05132fab..00000000000 --- a/hotspot/make/linux/makefiles/sparc.make +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (c) 2005, 2010, 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. -# -# - diff --git a/hotspot/make/linux/makefiles/sparcWorks.make b/hotspot/make/linux/makefiles/sparcWorks.make deleted file mode 100644 index e39116023c5..00000000000 --- a/hotspot/make/linux/makefiles/sparcWorks.make +++ /dev/null @@ -1,107 +0,0 @@ -# -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -#------------------------------------------------------------------------ -# CC, CXX & AS - -# If a SPEC is not set already, then use these defaults. -ifeq ($(SPEC),) - CXX = CC - CC = cc - AS = $(CC) -c - - HOSTCXX = $(CXX) - HOSTCC = $(CC) -endif - -ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) -ARCHFLAG/i486 = -m32 -ARCHFLAG/amd64 = -m64 - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) -ASFLAGS += $(ARCHFLAG) - -#------------------------------------------------------------------------ -# Compiler flags - -# position-independent code -PICFLAG = -KPIC - -CFLAGS += $(PICFLAG) -# no more exceptions -CFLAGS += -features=no%except -# Reduce code bloat by reverting back to 5.0 behavior for static initializers -CFLAGS += -features=no%split_init -# allow zero sized arrays -CFLAGS += -features=zla - -# Use C++ Interpreter -ifdef CC_INTERP - CFLAGS += -DCC_INTERP -endif - -# We don't need libCstd.so and librwtools7.so, only libCrun.so -CFLAGS += -library=Crun -LIBS += -lCrun - -CFLAGS += -mt -LFLAGS += -mt - -# Compiler warnings are treated as errors -#WARNINGS_ARE_ERRORS = -errwarn=%all -CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) -# Special cases -CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) - -# The flags to use for an Optimized build -OPT_CFLAGS+=-xO4 -OPT_CFLAGS/NOOPT=-xO0 - -# Flags for creating the dependency files. -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) -DEPFLAGS = -xMMD -xMF $(DEP_DIR)/$(@:%=%.d) -endif - -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -CFLAGS += -DDONT_USE_PRECOMPILED_HEADER - -#------------------------------------------------------------------------ -# Linker flags - -# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. -MAPFLAG = -Wl,--version-script=FILENAME - -# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj -SONAMEFLAG = -h SONAME - -# Build shared library -SHARED_FLAG = -G - -#------------------------------------------------------------------------ -# Debug flags -DEBUG_CFLAGS += -g -FASTDEBUG_CFLAGS = -g0 - diff --git a/hotspot/make/linux/makefiles/sparcv9.make b/hotspot/make/linux/makefiles/sparcv9.make deleted file mode 100644 index b9e4e525d76..00000000000 --- a/hotspot/make/linux/makefiles/sparcv9.make +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2005, 2010, 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. -# - -# gcc 4.0 miscompiles this code in -m64 -OPT_CFLAGS/macro.o = -O0 - -CFLAGS += -D_LP64=1 diff --git a/hotspot/make/linux/makefiles/tiered.make b/hotspot/make/linux/makefiles/tiered.make deleted file mode 100644 index da79ade9fdc..00000000000 --- a/hotspot/make/linux/makefiles/tiered.make +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2006, 2008, 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. -# -# - -# Sets make macros for making tiered version of VM - -TYPE=TIERED - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 -DCOMPILER1 diff --git a/hotspot/make/linux/makefiles/top.make b/hotspot/make/linux/makefiles/top.make deleted file mode 100644 index d798d42851e..00000000000 --- a/hotspot/make/linux/makefiles/top.make +++ /dev/null @@ -1,150 +0,0 @@ -# -# Copyright (c) 1999, 2014, 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. -# -# - -# top.make is included in the Makefile in the build directories. -# It DOES NOT include the vm dependency info in order to be faster. -# Its main job is to implement the incremental form of make lists. -# It also: -# -builds and runs adlc via adlc.make -# -generates JVMTI source and docs via jvmti.make (JSR-163) - -# It assumes the following flags are set: -# CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Obj_Files - -# -- D. Ungar (5/97) from a file by Bill Bush - -# Don't override the built-in $(MAKE). -# Instead, use "gmake" (or "gnumake") from the command line. --Rose -#MAKE = gmake - -include $(GAMMADIR)/make/altsrc.make - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -VM = $(GAMMADIR)/src/share/vm -Plat_File = $(Platform_file) -CDG = cd $(GENERATED); - -ifneq ($(USE_PRECOMPILED_HEADER),0) -UpdatePCH = $(MAKE) -f vm.make $(PRECOMPILED_HEADER) $(MFLAGS) -else -UpdatePCH = \# precompiled header is not used -endif - -Cached_plat = $(GENERATED)/platform.current - -AD_Dir = $(GENERATED)/adfiles -ADLC = $(AD_Dir)/adlc -AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad) -AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc) -AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp -AD_Files = $(AD_Names:%=$(AD_Dir)/%) - -# AD_Files_If_Required/COMPILER1 = ad_stuff -AD_Files_If_Required/COMPILER2 = ad_stuff -AD_Files_If_Required/TIERED = ad_stuff -AD_Files_If_Required = $(AD_Files_If_Required/$(TYPE)) - -# Wierd argument adjustment for "gnumake -j..." -adjust-mflags = $(GENERATED)/adjust-mflags -# If SPEC is set, it's from configure and it's already controlling concurrency -# for us. Skip setting -j with HOTSPOT_BUILD_JOBS. -ifeq ($(SPEC), ) - MFLAGS-adjusted = -r `$(adjust-mflags) "$(MFLAGS)" "$(HOTSPOT_BUILD_JOBS)"` -else - MFLAGS-adjusted = -r $(MFLAGS) -endif - - -# default target: update lists, make vm -# done in stages to force sequential order with parallel make -# - -default: vm_build_preliminaries the_vm - @echo All done. - -# This is an explicit dependency for the sake of parallel makes. -vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) trace_stuff jvmti_stuff dtrace_stuff - @# We need a null action here, so implicit rules don't get consulted. - -$(Cached_plat): $(Plat_File) - $(CDG) $(CP) $(Plat_File) $(Cached_plat) - -# make AD files as necessary -ad_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f adlc.make $(MFLAGS-adjusted) - -# generate JVMTI files from the spec -jvmti_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f jvmti.make $(MFLAGS-adjusted) - -# generate trace files -trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f trace.make $(MFLAGS-adjusted) - -dtrace_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f dtrace.make dtrace_gen_headers $(MFLAGS-adjusted) GENERATED=$(GENERATED) - -# and the VM: must use other makefile with dependencies included - -# We have to go to great lengths to get control over the -jN argument -# to the recursive invocation of vm.make. The problem is that gnumake -# resets -jN to -j1 for recursive runs. (How helpful.) -# Note that the user must specify the desired parallelism level via a -# command-line or environment variable name HOTSPOT_BUILD_JOBS. -$(adjust-mflags): $(GAMMADIR)/make/$(Platform_os_family)/makefiles/adjust-mflags.sh - @+rm -f $@ $@+ - @+cat $< > $@+ - @+chmod +x $@+ - @+mv $@+ $@ - -the_vm: vm_build_preliminaries $(adjust-mflags) - +@$(UpdatePCH) - @$(MAKE) -f vm.make $(MFLAGS-adjusted) - -install: the_vm - @$(MAKE) -f vm.make $@ - -# next rules support "make foo.[ois]" - -%.o %.i %.s: - +$(UpdatePCH) - $(MAKE) -f vm.make $(MFLAGS) $@ - #$(MAKE) -f vm.make $@ - -# this should force everything to be rebuilt -clean: - rm -f $(GENERATED)/*.class - $(MAKE) -f vm.make $(MFLAGS) clean - -# just in case it doesn't, this should do it -realclean: - $(MAKE) -f vm.make $(MFLAGS) clean - rm -fr $(GENERATED) - -.PHONY: default vm_build_preliminaries -.PHONY: lists ad_stuff jvmti_stuff the_vm clean realclean -.PHONY: checks check_os_version install - -.NOTPARALLEL: diff --git a/hotspot/make/linux/makefiles/trace.make b/hotspot/make/linux/makefiles/trace.make deleted file mode 100644 index 2209716d35b..00000000000 --- a/hotspot/make/linux/makefiles/trace.make +++ /dev/null @@ -1,119 +0,0 @@ -# -# Copyright (c) 2003, 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. -# -# - -# This makefile (trace.make) is included from the trace.make in the -# build directories. -# -# It knows how to build and run the tools to generate trace files. - -include $(GAMMADIR)/make/linux/makefiles/rules.make -include $(GAMMADIR)/make/altsrc.make - -# ######################################################################### - -HAS_ALT_SRC := false -ifndef OPENJDK - ifneq ($(wildcard $(HS_ALT_SRC)/share/vm/trace), ) - HAS_ALT_SRC := true - endif -endif - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles -TraceOutDir = $(GENERATED)/tracefiles - -TraceAltSrcDir = $(HS_ALT_SRC)/share/vm/trace -TraceSrcDir = $(HS_COMMON_SRC)/share/vm/trace - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(TraceSrcDir) $(TraceAltSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -TraceGeneratedNames = \ - traceEventClasses.hpp \ - traceEventIds.hpp \ - traceTypes.hpp - -ifeq ($(HAS_ALT_SRC), true) -TraceGeneratedNames += \ - traceRequestables.hpp \ - traceEventControl.hpp -endif - -TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) - -XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -TraceXml = $(TraceSrcDir)/trace.xml -ifeq ($(HAS_ALT_SRC), true) - TraceXml = $(TraceAltSrcDir)/trace.xml -endif - -XML_DEPS = $(TraceXml) $(TraceSrcDir)/tracetypes.xml \ - $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod \ - $(TraceSrcDir)/tracerelationdecls.xml $(TraceSrcDir)/traceevents.xml -ifeq ($(HAS_ALT_SRC), true) - XML_DEPS += $(TraceAltSrcDir)/traceeventscustom.xml \ - $(TraceAltSrcDir)/traceeventtypes.xml -endif - -.PHONY: all clean cleanall - -# ######################################################################### - -all: $(TraceGeneratedFiles) - -GENERATE_CODE= \ - $(QUIETLY) echo $(LOG_INFO) Generating $@; \ - $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@ - -$(TraceOutDir)/traceEventIds.hpp: $(TraceXml) $(TraceSrcDir)/traceEventIds.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceTypes.hpp: $(TraceXml) $(TraceSrcDir)/traceTypes.xsl $(XML_DEPS) - $(GENERATE_CODE) - -ifeq ($(HAS_ALT_SRC), false) - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -else - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceRequestables.hpp: $(TraceXml) $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceEventControl.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS) - $(GENERATE_CODE) - -endif - -# ######################################################################### - -clean cleanall: - rm $(TraceGeneratedFiles) diff --git a/hotspot/make/linux/makefiles/vm.make b/hotspot/make/linux/makefiles/vm.make deleted file mode 100644 index f97884af1da..00000000000 --- a/hotspot/make/linux/makefiles/vm.make +++ /dev/null @@ -1,407 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Rules to build JVM and related libraries, included from vm.make in the build -# directory. - -# Common build rules. -MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles -include $(MAKEFILES_DIR)/rules.make -include $(GAMMADIR)/make/altsrc.make - -default: build - -#---------------------------------------------------------------------- -# Defs - -GENERATED = ../generated -DEP_DIR = $(GENERATED)/dependencies - -# reads the generated files defining the set of .o's and the .o .h dependencies --include $(DEP_DIR)/*.d - -# read machine-specific adjustments (%%% should do this via buildtree.make?) -ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true) - include $(MAKEFILES_DIR)/zeroshark.make -else - BUILDARCH_MAKE = $(MAKEFILES_DIR)/$(BUILDARCH).make - ALT_BUILDARCH_MAKE = $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make - include $(if $(wildcard $(ALT_BUILDARCH_MAKE)),$(ALT_BUILDARCH_MAKE),$(BUILDARCH_MAKE)) -endif - -# set VPATH so make knows where to look for source files -# Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm -# The adfiles directory contains ad_.[ch]pp. -# The jvmtifiles directory contains jvmti*.[ch]pp -Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles $(GENERATED)/extensions -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor. -Src_Dirs_I += $(GENERATED) -# The order is important for the precompiled headers to work. -INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%) - -# SYMFLAG is used by jsig.make -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # always build with debug info when we can create .debuginfo files - SYMFLAG = -g -else - ifeq (${VERSION}, debug) - SYMFLAG = -g - else - SYMFLAG = - endif -endif - -# The following variables are defined in the generated flags.make file. -JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \ - -DVERSION_MINOR=$(VERSION_MINOR) \ - -DVERSION_SECURITY=$(VERSION_SECURITY) \ - -DVERSION_PATCH=$(VERSION_PATCH) \ - -DVERSION_BUILD=$(VERSION_BUILD) -VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \ - -DVERSION_STRING="\"$(VERSION_STRING)\"" \ - -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \ - $(JDK_VER_DEFS) -HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" -BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" -VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\"" - -CXXFLAGS = \ - ${SYSDEFS} \ - ${INCLUDES} \ - ${BUILD_USER} \ - ${HS_LIB_ARCH} \ - ${VM_DISTRO} - -# This is VERY important! The version define must only be supplied to vm_version.o -# If not, ccache will not re-use the cache at all, since the version string might contain -# a time and date. -CXXFLAGS/vm_version.o += ${VM_VER_DEFS} - -CXXFLAGS/BYFILE = $(CXXFLAGS/$@) - -# File specific flags -CXXFLAGS += $(CXXFLAGS/BYFILE) - -# Large File Support -ifneq ($(LP64), 1) -CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64 -endif # ifneq ($(LP64), 1) - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -CFLAGS += $(CFLAGS_WARN/BYFILE) - -# Do not use C++ exception handling -CFLAGS += $(CFLAGS/NOEX) - -# Extra flags from gnumake's invocation or environment -CFLAGS += $(EXTRA_CFLAGS) -LFLAGS += $(EXTRA_CFLAGS) - -# Don't set excutable bit on stack segment -# the same could be done by separate execstack command -LFLAGS += -Xlinker -z -Xlinker noexecstack - -LIBS += -lm -ldl -lpthread - -# By default, link the *.o into the library, not the executable. -LINK_INTO$(LINK_INTO) = LIBJVM - -JDK_LIBDIR = $(JAVA_HOME)/lib/$(LIBARCH) - -#---------------------------------------------------------------------- -# jvm_db & dtrace -include $(MAKEFILES_DIR)/dtrace.make - -#---------------------------------------------------------------------- -# JVM - -JVM = jvm -LIBJVM = lib$(JVM).so - -LIBJVM_DEBUGINFO = lib$(JVM).debuginfo -LIBJVM_DIZ = lib$(JVM).diz - -SPECIAL_PATHS:=adlc c1 gc opto shark libadt - -SOURCE_PATHS=\ - $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \ - \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \)) -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm - -CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) -CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/tracefiles - -ifneq ($(INCLUDE_TRACE), false) -CORE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ - find $(HS_ALT_SRC)/share/vm/jfr -type d; \ - fi) -endif - -CORE_PATHS+=$(GENERATED)/extensions - -COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1) -COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1 - -COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto) -COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt) -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt -COMPILER2_PATHS += $(GENERATED)/adfiles - -SHARK_PATHS := $(GAMMADIR)/src/share/vm/shark - -# Include dirs per type. -Src_Dirs/CORE := $(CORE_PATHS) -Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) -Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) -Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) -Src_Dirs/ZERO := $(CORE_PATHS) -Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS) -Src_Dirs := $(Src_Dirs/$(TYPE)) - -COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\* -COMPILER1_SPECIFIC_FILES := c1_\* -SHARK_SPECIFIC_FILES := shark -ZERO_SPECIFIC_FILES := zero - -# Always exclude these. -Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp - -# Exclude per type. -Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/TIERED := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/ZERO := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/SHARK := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) - -Src_Files_EXCLUDE += $(Src_Files_EXCLUDE/$(TYPE)) - -# Special handling of arch model. -ifeq ($(Platform_arch_model), x86_32) -Src_Files_EXCLUDE += \*x86_64\* -endif -ifeq ($(Platform_arch_model), x86_64) -Src_Files_EXCLUDE += \*x86_32\* -endif - -Src_Files_BASE += \*.c \*.cpp \*.s - -# Alternate vm.make -# This has to be included here to allow changes to the source -# directories and excluded files before they are expanded -# by the definition of Src_Files. --include $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make - -# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE. -define findsrc - $(notdir $(shell find $(1)/. ! -name . -prune \ - -a \( -name DUMMY $(addprefix -o -name ,$(Src_Files_BASE)) \) \ - -a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \))) -endef - -Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e))) - -Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files))) $(EXTENDED_JVM_OBJ_FILES)) - -JVM_OBJ_FILES = $(Obj_Files) - -vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES)) - -MAPFILE_SHARE := $(GAMMADIR)/make/share/makefiles/mapfile-vers - -MAPFILE_EXT_SRC := $(HS_ALT_MAKE)/share/makefiles/mapfile-ext -ifneq ("$(wildcard $(MAPFILE_EXT_SRC))","") -MAPFILE_EXT := $(MAPFILE_EXT_SRC) -endif - -mapfile : $(MAPFILE) $(MAPFILE_SHARE) vm.def $(MAPFILE_EXT) - rm -f $@ - awk '{ if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") \ - { system ("cat ${MAPFILE_SHARE} $(MAPFILE_EXT) vm.def"); } \ - else \ - { print $$0 } \ - }' > $@ < $(MAPFILE) - -mapfile_reorder : mapfile $(REORDERFILE) - rm -f $@ - cat $^ > $@ - -VMDEF_PAT = ^_ZTV -VMDEF_PAT := ^gHotSpotVM|$(VMDEF_PAT) -VMDEF_PAT := ^UseSharedSpaces$$|$(VMDEF_PAT) -VMDEF_PAT := ^_ZN9Arguments17SharedArchivePathE$$|$(VMDEF_PAT) -ifneq ($(VMDEF_PAT_EXT),) - VMDEF_PAT := $(VMDEF_PAT_EXT)|$(VMDEF_PAT) -endif - -vm.def: $(Res_Files) $(Obj_Files) $(VM_DEF_EXT) - $(QUIETLY) $(NM) --defined-only $(Obj_Files) | sort -k3 -u | \ - awk '$$3 ~ /$(VMDEF_PAT)/ { print "\t" $$3 ";" }' > $@ -ifneq ($(VM_DEF_EXT),) - cat $(VM_DEF_EXT) >> $@ -endif - -ifeq ($(JVM_VARIANT_ZEROSHARK), true) - STATIC_CXX = false -else - ifeq ($(ZERO_LIBARCH), ppc64) - STATIC_CXX = false - else - STATIC_CXX = true - endif -endif - -ifeq ($(LINK_INTO),AOUT) - LIBJVM.o = - LIBJVM_MAPFILE = - LIBS_VM = $(LIBS) -else - LIBJVM.o = $(JVM_OBJ_FILES) - LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder - LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE)) - LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM)) - LFLAGS_VM += -Wl,-z,defs - - # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to - # get around library dependency and compatibility issues. Must use gcc not - # g++ to link. - ifeq ($(STATIC_CXX), true) - LFLAGS_VM += $(STATIC_LIBGCC) - LIBS_VM += $(STATIC_STDCXX) - else - LIBS_VM += -lstdc++ - endif - - LIBS_VM += $(LIBS) -endif -ifeq ($(JVM_VARIANT_ZERO), true) - LIBS_VM += $(LIBFFI_LIBS) -endif -ifeq ($(JVM_VARIANT_ZEROSHARK), true) - LIBS_VM += $(LIBFFI_LIBS) $(LLVM_LIBS) - LFLAGS_VM += $(LLVM_LDFLAGS) -endif - -LINK_VM = $(LINK_LIB.CC) - -# rule for building precompiled header -$(PRECOMPILED_HEADER): - $(QUIETLY) echo $(LOG_INFO) Generating precompiled header $@ - $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR) - $(QUIETLY) rm -f $@ - $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -x c++-header $(PRECOMPILED_HEADER_SRC) -o $@ $(COMPILE_DONE) - -# making the library: - -ifneq ($(JVM_BASE_ADDR),) -# By default shared library is linked at base address == 0. Modify the -# linker script if JVM prefers a different base location. It can also be -# implemented with 'prelink -r'. But 'prelink' is not (yet) available on -# our build platform (AS-2.1). -LD_SCRIPT = libjvm.so.lds -$(LD_SCRIPT): $(LIBJVM_MAPFILE) - $(QUIETLY) { \ - rm -rf $@; \ - $(LINK_VM) -Wl,--verbose $(LFLAGS_VM) 2>&1 | \ - sed -e '/^======/,/^======/!d' \ - -e '/^======/d' \ - -e 's/0\( + SIZEOF_HEADERS\)/$(JVM_BASE_ADDR)\1/' \ - > $@; \ - } -LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT) -endif - -# With more recent Redhat releases (or the cutting edge version Fedora), if -# SELinux is configured to be enabled, the runtime linker will fail to apply -# the text relocation to libjvm.so considering that it is built as a non-PIC -# DSO. To workaround that, we run chcon to libjvm.so after it is built. See -# details in bug 6538311. -$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) - $(QUIETLY) { \ - echo $(LOG_INFO) Linking vm...; \ - $(LINK_LIB.CXX/PRE_HOOK) \ - $(LINK_VM) $(LD_SCRIPT_FLAG) \ - $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \ - $(LINK_LIB.CXX/POST_HOOK) \ - rm -f $@.1; ln -s $@ $@.1; \ - if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then \ - if [ -x /usr/sbin/selinuxenabled ] ; then \ - if /usr/sbin/selinuxenabled; then \ - if ! /usr/bin/chcon -t textrel_shlib_t $@; then \ - echo "ERROR: Cannot chcon $@"; \ - fi \ - fi \ - fi \ - fi \ - } - -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -g $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) - $(RM) $(LIBJVM_DEBUGINFO) - endif -endif - -DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR) -DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM) -DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO) -DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ) - -install_jvm: $(LIBJVM) - @echo "Copying $(LIBJVM) to $(DEST_JVM)" - $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ - $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) - $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ - $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" - -#---------------------------------------------------------------------- -# Other files - -# Signal interposition library -include $(MAKEFILES_DIR)/jsig.make - -#---------------------------------------------------------------------- - -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) dtraceCheck - -install: install_jvm install_jsig - -.PHONY: default build install install_jvm $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make diff --git a/hotspot/make/linux/makefiles/zero.make b/hotspot/make/linux/makefiles/zero.make deleted file mode 100644 index 622710f4dfa..00000000000 --- a/hotspot/make/linux/makefiles/zero.make +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. -# Copyright 2009 Red Hat, Inc. -# 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. -# -# - -# Setup for Zero (non-Shark) version of VM - -# Select which files to use (in top.make) -TYPE = ZERO - -# Install libjvm.so, etc in in server directory. -VM_SUBDIR = server - -# Disable trace for zero builds -# NOTE: This is used for simple comparison with the new build system, and -# should not be merged into mainline with build-infra. -INCLUDE_TRACE := false diff --git a/hotspot/make/linux/makefiles/zeroshark.make b/hotspot/make/linux/makefiles/zeroshark.make deleted file mode 100644 index 4f9a70c98fa..00000000000 --- a/hotspot/make/linux/makefiles/zeroshark.make +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. -# Copyright 2007, 2008 Red Hat, Inc. -# 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. -# -# - -# Setup common to Zero (non-Shark) and Shark versions of VM - -# Some versions of llvm do not like -Wundef -ifeq ($(USE_CLANG), true) - WARNING_FLAGS += -Wno-undef -endif - -# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT) -# The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized -OPT_CFLAGS/sharedRuntimeTrans.o = $(OPT_CFLAGS/NOOPT) - -# Specify that the CPU is little endian, if necessary -ifeq ($(ZERO_ENDIANNESS), little) - CFLAGS += -DVM_LITTLE_ENDIAN -endif - -# Specify that the CPU is 64 bit, if necessary -ifeq ($(ARCH_DATA_MODEL), 64) - CFLAGS += -D_LP64=1 -endif diff --git a/hotspot/make/linux/platform_aarch64 b/hotspot/make/linux/platform_aarch64 deleted file mode 100644 index f0bbf337c95..00000000000 --- a/hotspot/make/linux/platform_aarch64 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = linux - -arch = aarch64 - -arch_model = aarch64 - -os_arch = linux_aarch64 - -os_arch_model = linux_aarch64 - -lib_arch = aarch64 - -compiler = gcc - -sysdefs = -DLINUX -D_GNU_SOURCE -DAARCH64 diff --git a/hotspot/make/linux/platform_amd64 b/hotspot/make/linux/platform_amd64 deleted file mode 100644 index b612635958e..00000000000 --- a/hotspot/make/linux/platform_amd64 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = linux - -arch = x86 - -arch_model = x86_64 - -os_arch = linux_x86 - -os_arch_model = linux_x86_64 - -lib_arch = amd64 - -compiler = gcc - -sysdefs = -DLINUX -D_GNU_SOURCE -DAMD64 diff --git a/hotspot/make/linux/platform_amd64.suncc b/hotspot/make/linux/platform_amd64.suncc deleted file mode 100644 index 4366549571d..00000000000 --- a/hotspot/make/linux/platform_amd64.suncc +++ /dev/null @@ -1,17 +0,0 @@ -os_family = linux - -arch = x86 - -arch_model = x86_64 - -os_arch = linux_x86 - -os_arch_model = linux_x86_64 - -lib_arch = amd64 - -compiler = sparcWorks - -gnu_dis_arch = amd64 - -sysdefs = -DLINUX -DSPARC_WORKS -D_GNU_SOURCE -DAMD64 diff --git a/hotspot/make/linux/platform_i486 b/hotspot/make/linux/platform_i486 deleted file mode 100644 index 610ac91ce79..00000000000 --- a/hotspot/make/linux/platform_i486 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = linux - -arch = x86 - -arch_model = x86_32 - -os_arch = linux_x86 - -os_arch_model = linux_x86_32 - -lib_arch = i386 - -compiler = gcc - -sysdefs = -DLINUX -D_GNU_SOURCE -DIA32 diff --git a/hotspot/make/linux/platform_i486.suncc b/hotspot/make/linux/platform_i486.suncc deleted file mode 100644 index 325a3febd96..00000000000 --- a/hotspot/make/linux/platform_i486.suncc +++ /dev/null @@ -1,17 +0,0 @@ -os_family = linux - -arch = x86 - -arch_model = x86_32 - -os_arch = linux_x86 - -os_arch_model = linux_x86_32 - -lib_arch = i386 - -compiler = sparcWorks - -gnu_dis_arch = i386 - -sysdefs = -DLINUX -DSPARC_WORKS -D_GNU_SOURCE -DIA32 diff --git a/hotspot/make/linux/platform_ia64 b/hotspot/make/linux/platform_ia64 deleted file mode 100644 index 7474e5bf923..00000000000 --- a/hotspot/make/linux/platform_ia64 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = linux - -arch = ia64 - -os_arch = linux_ia64 - -lib_arch = ia64 - -compiler = gcc - -gnu_dis_arch = ia64 - -sysdefs = -DLINUX -D_GNU_SOURCE -DIA64 -DCC_INTERP - -mark_style = alignment diff --git a/hotspot/make/linux/platform_ppc64 b/hotspot/make/linux/platform_ppc64 deleted file mode 100644 index 2fd79c4dae9..00000000000 --- a/hotspot/make/linux/platform_ppc64 +++ /dev/null @@ -1,17 +0,0 @@ -os_family = linux - -arch = ppc - -arch_model = ppc_64 - -os_arch = linux_ppc - -os_arch_model = linux_ppc_64 - -lib_arch = ppc64 - -compiler = gcc - -gnu_dis_arch = ppc64 - -sysdefs = -DLINUX -D_GNU_SOURCE -DPPC64 diff --git a/hotspot/make/linux/platform_sparc b/hotspot/make/linux/platform_sparc deleted file mode 100644 index 8d9e3ee7201..00000000000 --- a/hotspot/make/linux/platform_sparc +++ /dev/null @@ -1,15 +0,0 @@ -os_family = linux - -arch = sparc - -arch_model = sparc - -os_arch = linux_sparc - -os_arch_model = linux_sparc - -lib_arch = sparc - -compiler = gcc - -sysdefs = -DLINUX -D_GNU_SOURCE -DSPARC diff --git a/hotspot/make/linux/platform_sparcv9 b/hotspot/make/linux/platform_sparcv9 deleted file mode 100644 index c9f8722c406..00000000000 --- a/hotspot/make/linux/platform_sparcv9 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = linux - -arch = sparc - -arch_model = sparc - -os_arch = linux_sparc - -os_arch_model = linux_sparc - -lib_arch = sparcv9 - -compiler = gcc - -sysdefs = -DLINUX -D_GNU_SOURCE -DSPARC diff --git a/hotspot/make/linux/platform_zero.in b/hotspot/make/linux/platform_zero.in deleted file mode 100644 index 404ad3f9b58..00000000000 --- a/hotspot/make/linux/platform_zero.in +++ /dev/null @@ -1,17 +0,0 @@ -os_family = linux - -arch = zero - -arch_model = zero - -os_arch = linux_zero - -os_arch_model = linux_zero - -lib_arch = zero - -compiler = gcc - -gnu_dis_arch = zero - -sysdefs = -DLINUX -D_GNU_SOURCE -DCC_INTERP -DZERO -D@ZERO_ARCHDEF@ -DZERO_LIBARCH=\"@ZERO_LIBARCH@\" diff --git a/hotspot/makefiles/mapfiles/libjsig/mapfile-vers-solaris b/hotspot/make/mapfiles/libjsig/mapfile-vers-solaris similarity index 100% rename from hotspot/makefiles/mapfiles/libjsig/mapfile-vers-solaris rename to hotspot/make/mapfiles/libjsig/mapfile-vers-solaris diff --git a/hotspot/makefiles/mapfiles/libjvm_db/mapfile-vers b/hotspot/make/mapfiles/libjvm_db/mapfile-vers similarity index 100% rename from hotspot/makefiles/mapfiles/libjvm_db/mapfile-vers rename to hotspot/make/mapfiles/libjvm_db/mapfile-vers diff --git a/hotspot/makefiles/mapfiles/libjvm_dtrace/mapfile-vers b/hotspot/make/mapfiles/libjvm_dtrace/mapfile-vers similarity index 100% rename from hotspot/makefiles/mapfiles/libjvm_dtrace/mapfile-vers rename to hotspot/make/mapfiles/libjvm_dtrace/mapfile-vers diff --git a/hotspot/make/openjdk_distro b/hotspot/make/openjdk_distro deleted file mode 100644 index 520b33d3457..00000000000 --- a/hotspot/make/openjdk_distro +++ /dev/null @@ -1,32 +0,0 @@ -# -# Copyright (c) 2007, 2008, 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. -# - -# -# This file format must remain compatible with both -# GNU Makefile and Microsoft nmake formats. -# - -# Don't put quotes (fail windows build). -HOTSPOT_VM_DISTRO=OpenJDK -COMPANY_NAME= -PRODUCT_NAME=OpenJDK diff --git a/hotspot/make/pic.make b/hotspot/make/pic.make deleted file mode 100644 index 9211b5b70d6..00000000000 --- a/hotspot/make/pic.make +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# A list of object files built without the platform specific PIC flags, e.g. -# -fPIC on linux. Performance measurements show that by compiling GC related -# code, we could significantly reduce the GC pause time on 32 bit Linux/Unix -# platforms. See 6454213 for more details. -include $(GAMMADIR)/make/scm.make - -ifneq ($(OSNAME), windows) - ifndef LP64 - PARTIAL_NONPIC=1 - endif - PIC_ARCH = ppc arm - ifneq ("$(filter $(PIC_ARCH),$(BUILDARCH))","") - PARTIAL_NONPIC=0 - endif - ifeq ($(PARTIAL_NONPIC),1) - NONPIC_DIRS = memory oops gc - NONPIC_DIRS := $(foreach dir,$(NONPIC_DIRS), $(GAMMADIR)/src/share/vm/$(dir)) - # Look for source files under NONPIC_DIRS - NONPIC_FILES := $(foreach dir,$(NONPIC_DIRS),\ - $(shell find $(dir) \( $(SCM_DIRS) \) -prune -o \ - -name '*.cpp' -print)) - NONPIC_OBJ_FILES := $(notdir $(subst .cpp,.o,$(NONPIC_FILES))) - endif -endif diff --git a/hotspot/make/scm.make b/hotspot/make/scm.make deleted file mode 100644 index 011492d0516..00000000000 --- a/hotspot/make/scm.make +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) 2007, 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. -# - -# Prune out all known SCM (Source Code Management) directories -# so they will not appear on -I PATHs, when copying directory trees, -# packaging up .jar files, etc. This applies to all workspaces. -# -SCM_DIRS = -name .hg -o -name .svn -o -name CVS -o -name RCS -o -name SCCS -o -name Codemgr_wsdata -o -name deleted_files diff --git a/hotspot/make/share/makefiles/mapfile-vers b/hotspot/make/share/makefiles/mapfile-vers deleted file mode 100644 index f7d08e50b98..00000000000 --- a/hotspot/make/share/makefiles/mapfile-vers +++ /dev/null @@ -1,180 +0,0 @@ - # JNI - JNI_CreateJavaVM; - JNI_GetCreatedJavaVMs; - JNI_GetDefaultJavaVMInitArgs; - - # JVM - JVM_ActiveProcessorCount; - JVM_ArrayCopy; - JVM_AssertionStatusDirectives; - JVM_CallStackWalk; - JVM_ClassDepth; - JVM_ClassLoaderDepth; - JVM_Clone; - JVM_ConstantPoolGetClassAt; - JVM_ConstantPoolGetClassAtIfLoaded; - JVM_ConstantPoolGetClassRefIndexAt; - JVM_ConstantPoolGetDoubleAt; - JVM_ConstantPoolGetFieldAt; - JVM_ConstantPoolGetFieldAtIfLoaded; - JVM_ConstantPoolGetFloatAt; - JVM_ConstantPoolGetIntAt; - JVM_ConstantPoolGetLongAt; - JVM_ConstantPoolGetMethodAt; - JVM_ConstantPoolGetMethodAtIfLoaded; - JVM_ConstantPoolGetMemberRefInfoAt; - JVM_ConstantPoolGetNameAndTypeRefInfoAt; - JVM_ConstantPoolGetNameAndTypeRefIndexAt; - JVM_ConstantPoolGetSize; - JVM_ConstantPoolGetStringAt; - JVM_ConstantPoolGetTagAt; - JVM_ConstantPoolGetUTF8At; - JVM_CountStackFrames; - JVM_CurrentClassLoader; - JVM_CurrentLoadedClass; - JVM_CurrentThread; - JVM_CurrentTimeMillis; - JVM_DefineClass; - JVM_DefineClassWithSource; - JVM_DesiredAssertionStatus; - JVM_DoPrivileged; - JVM_DumpAllStacks; - JVM_DumpThreads; - JVM_FillInStackTrace; - JVM_FindClassFromCaller; - JVM_FindClassFromClass; - JVM_FindClassFromBootLoader; - JVM_FindLibraryEntry; - JVM_FindLoadedClass; - JVM_FindPrimitiveClass; - JVM_FindSignal; - JVM_FreeMemory; - JVM_GC; - JVM_GetAllThreads; - JVM_GetArrayElement; - JVM_GetArrayLength; - JVM_GetCPClassNameUTF; - JVM_GetCPFieldClassNameUTF; - JVM_GetCPFieldModifiers; - JVM_GetCPFieldNameUTF; - JVM_GetCPFieldSignatureUTF; - JVM_GetCPMethodClassNameUTF; - JVM_GetCPMethodModifiers; - JVM_GetCPMethodNameUTF; - JVM_GetCPMethodSignatureUTF; - JVM_GetCallerClass; - JVM_GetClassAccessFlags; - JVM_GetClassAnnotations; - JVM_GetClassCPEntriesCount; - JVM_GetClassCPTypes; - JVM_GetClassConstantPool; - JVM_GetClassContext; - JVM_GetClassDeclaredConstructors; - JVM_GetClassDeclaredFields; - JVM_GetClassDeclaredMethods; - JVM_GetClassFieldsCount; - JVM_GetClassInterfaces; - JVM_GetClassMethodsCount; - JVM_GetClassModifiers; - JVM_GetClassName; - JVM_GetClassNameUTF; - JVM_GetClassSignature; - JVM_GetClassSigners; - JVM_GetClassTypeAnnotations; - JVM_GetDeclaredClasses; - JVM_GetDeclaringClass; - JVM_GetSimpleBinaryName; - JVM_GetEnclosingMethodInfo; - JVM_GetFieldIxModifiers; - JVM_GetFieldTypeAnnotations; - JVM_GetInheritedAccessControlContext; - JVM_GetInterfaceVersion; - JVM_GetManagement; - JVM_GetMethodIxArgsSize; - JVM_GetMethodIxByteCode; - JVM_GetMethodIxByteCodeLength; - JVM_GetMethodIxExceptionIndexes; - JVM_GetMethodIxExceptionTableEntry; - JVM_GetMethodIxExceptionTableLength; - JVM_GetMethodIxExceptionsCount; - JVM_GetMethodIxLocalsCount; - JVM_GetMethodIxMaxStack; - JVM_GetMethodIxModifiers; - JVM_GetMethodIxNameUTF; - JVM_GetMethodIxSignatureUTF; - JVM_GetMethodParameters; - JVM_GetMethodTypeAnnotations; - JVM_GetNanoTimeAdjustment; - JVM_GetPrimitiveArrayElement; - JVM_GetProtectionDomain; - JVM_GetStackAccessControlContext; - JVM_GetStackTraceElements; - JVM_GetSystemPackage; - JVM_GetSystemPackages; - JVM_GetTemporaryDirectory; - JVM_GetVersionInfo; - JVM_GetVmArguments; - JVM_Halt; - JVM_HoldsLock; - JVM_IHashCode; - JVM_InitAgentProperties; - JVM_InitProperties; - JVM_InternString; - JVM_Interrupt; - JVM_InvokeMethod; - JVM_IsArrayClass; - JVM_IsConstructorIx; - JVM_IsInterface; - JVM_IsInterrupted; - JVM_IsPrimitiveClass; - JVM_IsSameClassPackage; - JVM_IsSupportedJNIVersion; - JVM_IsThreadAlive; - JVM_IsVMGeneratedMethodIx; - JVM_LatestUserDefinedLoader; - JVM_LoadLibrary; - JVM_MaxObjectInspectionAge; - JVM_MaxMemory; - JVM_MonitorNotify; - JVM_MonitorNotifyAll; - JVM_MonitorWait; - JVM_MoreStackWalk; - JVM_NanoTime; - JVM_NativePath; - JVM_NewArray; - JVM_NewInstanceFromConstructor; - JVM_NewMultiArray; - JVM_RaiseSignal; - JVM_RawMonitorCreate; - JVM_RawMonitorDestroy; - JVM_RawMonitorEnter; - JVM_RawMonitorExit; - JVM_RegisterSignal; - JVM_ReleaseUTF; - JVM_ResumeThread; - JVM_SetArrayElement; - JVM_SetClassSigners; - JVM_SetNativeThreadName; - JVM_SetPrimitiveArrayElement; - JVM_SetThreadPriority; - JVM_Sleep; - JVM_StartThread; - JVM_StopThread; - JVM_SuspendThread; - JVM_SupportsCX8; - JVM_ToStackTraceElement; - JVM_TotalMemory; - JVM_UnloadLibrary; - JVM_Yield; - - # Module related API's - JVM_AddModuleExports; - JVM_AddModuleExportsToAll; - JVM_AddModuleExportsToAllUnnamed; - JVM_AddModulePackage; - JVM_AddReadsModule; - JVM_CanReadModule; - JVM_DefineModule; - JVM_IsExportedToModule; - JVM_SetBootLoaderUnnamedModule; - JVM_GetModuleByPackageName; diff --git a/hotspot/make/solaris/Makefile b/hotspot/make/solaris/Makefile deleted file mode 100644 index 4a89bb3fcf6..00000000000 --- a/hotspot/make/solaris/Makefile +++ /dev/null @@ -1,286 +0,0 @@ -# -# Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# This makefile creates a build tree and lights off a build. -# You can go back into the build tree and perform rebuilds or -# incremental builds as desired. Be sure to reestablish -# environment variable settings for LD_LIBRARY_PATH and JAVA_HOME. - -# The make process now relies on java and javac. These can be -# specified either implicitly on the PATH, by setting the -# (JDK-inherited) ALT_BOOTDIR environment variable to full path to a -# JDK in which bin/java and bin/javac are present and working (e.g., -# /usr/local/java/jdk1.3/solaris), or via the (JDK-inherited) -# default BOOTDIR path value. Note that one of ALT_BOOTDIR -# or BOOTDIR has to be set. We do *not* search javac, javah, rmic etc. -# from the PATH. - -ifeq ($(GAMMADIR),) -include ../../make/defs.make -else -include $(GAMMADIR)/make/defs.make -endif -include $(GAMMADIR)/make/$(OSNAME)/makefiles/rules.make - -ifndef CC_INTERP - ifndef FORCE_TIERED - FORCE_TIERED=1 - endif -endif - -ifdef LP64 - ifeq ("$(filter $(LP64_ARCH),$(BUILDARCH))","") - _JUNK_ := $(shell echo >&2 \ - $(OSNAME) $(ARCH) "*** ERROR: this platform does not support 64-bit compilers!") - @exit 1 - endif -endif - -# The following renders pathnames in generated Makefiles valid on -# machines other than the machine containing the build tree. -# -# For example, let's say my build tree lives on /files12 on -# exact.east.sun.com. This logic will cause GAMMADIR to begin with -# /net/exact/files12/... -# -# We only do this on SunOS variants, for a couple of reasons: -# * It is extremely rare that source trees exist on other systems -# * It has been claimed that the Linux automounter is flakey, so -# changing GAMMADIR in a way that exercises the automounter could -# prove to be a source of unreliability in the build process. -# Obviously, this Makefile is only relevant on SunOS boxes to begin -# with, but the SunOS conditionalization will make it easier to -# combine Makefiles in the future (assuming we ever do that). - -ifeq ($(OSNAME),solaris) - - # prepend current directory to relative pathnames. - NEW_GAMMADIR := \ - $(shell echo $(GAMMADIR) | \ - sed -e "s=^\([^/].*\)=$(shell pwd)/\1=" \ - ) - unexport NEW_GAMMADIR - - # If NEW_GAMMADIR doesn't already start with "/net/": - ifeq ($(strip $(filter /net/%,$(NEW_GAMMADIR))),) - # prepend /net/$(HOST) - # remove /net/$(HOST) if name already began with /home/ - # remove /net/$(HOST) if name already began with /java/ - # remove /net/$(HOST) if name already began with /lab/ - NEW_GAMMADIR := \ - $(shell echo $(NEW_GAMMADIR) | \ - sed -e "s=^\(.*\)=/net/$(HOST)\1=" \ - -e "s=^/net/$(HOST)/home/=/home/=" \ - -e "s=^/net/$(HOST)/java/=/java/=" \ - -e "s=^/net/$(HOST)/lab/=/lab/=" \ - ) - # Don't use the new value for GAMMADIR unless a file with the new - # name actually exists. - ifneq ($(wildcard $(NEW_GAMMADIR)),) - GAMMADIR := $(NEW_GAMMADIR) - endif - endif - -endif - - -# There is a (semi-) regular correspondence between make targets and actions: -# -# Target Tree Type Build Dir -# -# debug compiler2 __compiler2/debug -# fastdebug compiler2 __compiler2/fastdebug -# optimized compiler2 __compiler2/optimized -# product compiler2 __compiler2/product -# -# debug1 compiler1 __compiler1/debug -# fastdebug1 compiler1 __compiler1/fastdebug -# optimized1 compiler1 __compiler1/optimized -# product1 compiler1 __compiler1/product -# -# debugcore core __core/debug -# fastdebugcore core __core/fastdebug -# optimizedcore core __core/optimized -# productcore core __core/product -# -# What you get with each target: -# -# debug* - debug compile with asserts enabled -# fastdebug* - optimized compile, but with asserts enabled -# optimized* - optimized compile, no asserts -# product* - the shippable thing: optimized compile, no asserts, -DPRODUCT - -# This target list needs to be coordinated with the usage message -# in the build.sh script: -TARGETS = debug fastdebug optimized product - -SUBDIR_DOCS = $(OSNAME)_$(BUILDARCH)_docs -SUBDIRS_C1 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler1/,$(TARGETS)) -SUBDIRS_C2 = $(addprefix $(OSNAME)_$(BUILDARCH)_compiler2/,$(TARGETS)) -SUBDIRS_TIERED = $(addprefix $(OSNAME)_$(BUILDARCH)_tiered/,$(TARGETS)) -SUBDIRS_CORE = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS)) - -TARGETS_C2 = $(TARGETS) -TARGETS_C1 = $(addsuffix 1,$(TARGETS)) -TARGETS_TIERED = $(addsuffix tiered,$(TARGETS)) -TARGETS_CORE = $(addsuffix core,$(TARGETS)) - -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) -BUILDTREE_VARS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE) - -BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS) - -#------------------------------------------------------------------------------- - -# Could make everything by default, but that would take a while. -all: - @echo "Try '$(MAKE) ...' where is one or more of" - @echo " $(TARGETS_C2)" - @echo " $(TARGETS_C1)" - @echo " $(TARGETS_CORE)" - -checks: check_os_version check_j2se_version - -# We do not want people accidentally building on old systems (e.g. Linux 2.2.x, -# Solaris 2.5.1, 2.6). -# Disable this check by setting DISABLE_HOTSPOT_OS_VERSION_CHECK=ok. - -SUPPORTED_OS_VERSION = 5.7 5.8 5.9 5.10 5.11 -OS_VERSION := $(shell uname -r) -EMPTY_IF_NOT_SUPPORTED = $(filter $(SUPPORTED_OS_VERSION),$(OS_VERSION)) - -check_os_version: -ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),) - $(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1; -endif - -# jvmti.make requires XSLT (J2SE 1.4.x or newer): -XSLT_CHECK = $(RUN.JAVAP) javax.xml.transform.TransformerFactory -# If not found then fail fast. -check_j2se_version: - $(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \ - $(RUN.JAVA) -version; \ - echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \ - "to bootstrap this build" 1>&2; \ - exit 1; \ - fi - -$(SUBDIRS_TIERED): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered - -$(SUBDIRS_C2): $(BUILDTREE_MAKE) -ifeq ($(FORCE_TIERED),1) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=tiered FORCE_TIERED=1 -else - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler2 -endif - -$(SUBDIRS_C1): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=compiler1 - -$(SUBDIRS_CORE): $(BUILDTREE_MAKE) - $(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks - +$(BUILDTREE) VARIANT=core - -# Define INSTALL=y at command line to automatically copy JVM into JAVA_HOME - -$(TARGETS_C2): $(SUBDIRS_C2) - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_TIERED): $(SUBDIRS_TIERED) - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_C1): $(SUBDIRS_C1) - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install -endif - -$(TARGETS_CORE): $(SUBDIRS_CORE) - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) -ifdef INSTALL - cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install -endif - -# Just build the tree, and nothing else: -tree: $(SUBDIRS_C2) -tree1: $(SUBDIRS_C1) -treecore: $(SUBDIRS_CORE) - -# Doc target. This is the same for all build options. -# Hence create a docs directory beside ...$(ARCH)_[...] -# We specify 'BUILD_FLAVOR=product' so that the proper -# ENABLE_FULL_DEBUG_SYMBOLS value is used. -docs: checks - $(QUIETLY) mkdir -p $(SUBDIR_DOCS) - $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs - -# Synonyms for win32-like targets. -compiler2: debug product - -compiler1: debug1 product1 - -core: debugcore productcore - -warn_jvmg_deprecated: - echo "Warning: The jvmg target has been replaced with debug" - echo "Warning: Please update your usage" - -jvmg: warn_jvmg_deprecated debug - -jvmg1: warn_jvmg_deprecated debug1 - -jvmgcore: warn_jvmg_deprecated debugcore - -clean_docs: - rm -rf $(SUBDIR_DOCS) - -clean_compiler1 clean_compiler2 clean_core: - rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@) - -clean: clean_compiler2 clean_compiler1 clean_core clean_docs - -include $(GAMMADIR)/make/cscope.make - -#------------------------------------------------------------------------------- - -.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) -.PHONY: tree tree1 treecore -.PHONY: all compiler1 compiler2 core -.PHONY: clean clean_compiler1 clean_compiler2 clean_core docs clean_docs -.PHONY: checks check_os_version check_j2se_version - -.NOTPARALLEL: diff --git a/hotspot/make/solaris/adlc_updater b/hotspot/make/solaris/adlc_updater deleted file mode 100644 index 8b1df724e60..00000000000 --- a/hotspot/make/solaris/adlc_updater +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -# -# This file is used by adlc.make to selectively update generated -# adlc files. Because source and target diretories are relative -# paths, this file is copied to the target build directory before -# use. -# -# adlc-updater -# -fix_lines() { - # repair bare #line directives in $1 to refer to $2 - # and add an override of __FILE__ with just the basename on the - # first line of the file. - nawk < $1 > $1+ -v F2=$2 ' - BEGIN { print "#line 1 \"" F2 "\""; } - /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next} - {print} - ' - mv $1+ $1 -} -fix_lines $2/$1 $1 -[ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \ -( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) diff --git a/hotspot/make/solaris/makefiles/adjust-mflags.sh b/hotspot/make/solaris/makefiles/adjust-mflags.sh deleted file mode 100644 index 97bc02db7f1..00000000000 --- a/hotspot/make/solaris/makefiles/adjust-mflags.sh +++ /dev/null @@ -1,87 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 1999, 2008, 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. -# -# - -# This script is used only from top.make. -# The macro $(MFLAGS-adjusted) calls this script to -# adjust the "-j" arguments to take into account -# the HOTSPOT_BUILD_JOBS variable. The default -# handling of the "-j" argument by gnumake does -# not meet our needs, so we must adjust it ourselves. - -# This argument adjustment applies to two recursive -# calls to "$(MAKE) $(MFLAGS-adjusted)" in top.make. -# One invokes adlc.make, and the other invokes vm.make. -# The adjustment propagates the desired concurrency -# level down to the sub-make (of the adlc or vm). -# The default behavior of gnumake is to run all -# sub-makes without concurrency ("-j1"). - -# Also, we use a make variable rather than an explicit -# "-j" argument to control this setting, so that -# the concurrency setting (which must be tuned separately -# for each MP system) can be set via an environment variable. -# The recommended setting is 1.5x to 2x the number of available -# CPUs on the MP system, which is large enough to keep the CPUs -# busy (even though some jobs may be I/O bound) but not too large, -# we may presume, to overflow the system's swap space. - -set -eu - -default_build_jobs=4 - -case $# in -[12]) true;; -*) >&2 echo "Usage: $0 ${MFLAGS} ${HOTSPOT_BUILD_JOBS}"; exit 2;; -esac - -MFLAGS=$1 -HOTSPOT_BUILD_JOBS=${2-} - -# Normalize any -jN argument to the form " -j${HBJ}" -MFLAGS=` - echo "$MFLAGS" \ - | sed ' - s/^-/ -/ - s/ -\([^ I][^ I]*\)j/ -\1 -j/ - s/ -j[0-9][0-9]*/ -j/ - s/ -j\([^ ]\)/ -j -\1/ - s/ -j/ -j'${HOTSPOT_BUILD_JOBS:-${default_build_jobs}}'/ - ' ` - -case ${HOTSPOT_BUILD_JOBS} in \ - -'') case ${MFLAGS} in - *\ -j*) - >&2 echo "# Note: -jN is ineffective for setting parallelism in this makefile." - >&2 echo "# please set HOTSPOT_BUILD_JOBS=${default_build_jobs} in the command line or environment." - esac;; - -?*) case ${MFLAGS} in - *\ -j*) true;; - *) MFLAGS="-j${HOTSPOT_BUILD_JOBS} ${MFLAGS}";; - esac;; -esac - -echo "${MFLAGS}" diff --git a/hotspot/make/solaris/makefiles/adlc.make b/hotspot/make/solaris/makefiles/adlc.make deleted file mode 100644 index 730a5a36eca..00000000000 --- a/hotspot/make/solaris/makefiles/adlc.make +++ /dev/null @@ -1,257 +0,0 @@ -# -# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This makefile (adlc.make) is included from the adlc.make in the -# build directories. -# It knows how to compile, link, and run the adlc. - -include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make -include $(GAMMADIR)/make/altsrc.make - -# ######################################################################### - -# OUTDIR must be the same as AD_Dir = $(GENERATED)/adfiles in top.make: -GENERATED = ../generated -OUTDIR = $(GENERATED)/adfiles - -ARCH = $(Platform_arch) -OS = $(Platform_os_family) - -SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad - -ifeq ("${Platform_arch_model}", "${Platform_arch}") - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) -else - SOURCES.AD = \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ - $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) -endif - -EXEC = $(OUTDIR)/adlc - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(GAMMADIR)/src/share/vm/adlc -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor -Src_Dirs_I += $(GAMMADIR)/src/share/vm/adlc $(GENERATED) -INCLUDES += $(Src_Dirs_I:%=-I%) - -# set flags for adlc compilation -CXXFLAGS = $(SYSDEFS) $(INCLUDES) - -# Force assertions on. -CXXFLAGS += -DASSERT - -ifndef USE_GCC - # We need libCstd.so for adlc - CFLAGS += -library=Cstd -g - LFLAGS += -library=Cstd -g -endif - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -CFLAGS_WARN = +w -# Compiler warnings are treated as errors -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) - WARNINGS_ARE_ERRORS ?= -xwe -endif - -CFLAGS_WARN += $(WARNINGS_ARE_ERRORS) - -# When using compiler version 5.13 (Solaris Studio 12.4), calls to explicitly -# instantiated template functions trigger this warning when +w is active. -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 513), 1) - CFLAGS_WARN += -erroff=notemsource -endif -CFLAGS += $(CFLAGS_WARN) - -ifeq ("${Platform_compiler}", "sparcWorks") -# Enable the following CFLAGS addition if you need to compare the -# built ELF objects. -# -# The -g option makes static data global and the "-Qoption ccfe -# -xglobalstatic" option tells the compiler to not globalize static -# data using a unique globalization prefix. Instead force the use -# of a static globalization prefix based on the source filepath so -# the objects from two identical compilations are the same. -#CFLAGS += -Qoption ccfe -xglobalstatic -endif # Platform_compiler == sparcWorks - -OBJECTNAMES = \ - adlparse.o \ - archDesc.o \ - arena.o \ - dfa.o \ - dict2.o \ - filebuff.o \ - forms.o \ - formsopt.o \ - formssel.o \ - main.o \ - adlc-opcodes.o \ - output_c.o \ - output_h.o \ - -OBJECTS = $(OBJECTNAMES:%=$(OUTDIR)/%) - -GENERATEDNAMES = \ - ad_$(Platform_arch_model).cpp \ - ad_$(Platform_arch_model).hpp \ - ad_$(Platform_arch_model)_clone.cpp \ - ad_$(Platform_arch_model)_expand.cpp \ - ad_$(Platform_arch_model)_format.cpp \ - ad_$(Platform_arch_model)_gen.cpp \ - ad_$(Platform_arch_model)_misc.cpp \ - ad_$(Platform_arch_model)_peephole.cpp \ - ad_$(Platform_arch_model)_pipeline.cpp \ - adGlobals_$(Platform_arch_model).hpp \ - dfa_$(Platform_arch_model).cpp \ - -GENERATEDFILES = $(GENERATEDNAMES:%=$(OUTDIR)/%) - -# ######################################################################### - -all: $(EXEC) - -$(EXEC) : $(OBJECTS) - @echo $(LOG_INFO) Making adlc - $(QUIETLY) $(LINK_NOPROF.CXX) -o $(EXEC) $(OBJECTS) - -# Random dependencies: -$(OBJECTS): opcodes.hpp classes.hpp adlc.hpp adlcVMDeps.hpp adlparse.hpp archDesc.hpp arena.hpp dict2.hpp filebuff.hpp forms.hpp formsopt.hpp formssel.hpp - -# The source files refer to ostream.h, which sparcworks calls iostream.h -$(OBJECTS): ostream.h - -ostream.h : - @echo >$@ '#include ' - -dump: - : OUTDIR=$(OUTDIR) - : OBJECTS=$(OBJECTS) - : products = $(GENERATEDFILES) - -all: $(GENERATEDFILES) - -$(GENERATEDFILES): refresh_adfiles - -# Get a unique temporary directory name, so multiple makes can run in parallel. -# Note that product files are updated via "mv", which is atomic. -TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) - -# Debuggable by default -CFLAGS += -g - -# Pass -D flags into ADLC. -ADLCFLAGS += $(SYSDEFS) - -# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO. -ADLCFLAGS += -q -T - -# Normally, debugging is done directly on the ad_*.cpp files. -# But -g will put #line directives in those files pointing back to .ad. -ADLCFLAGS += -g - -ifdef LP64 -ADLCFLAGS += -D_LP64 -else -ADLCFLAGS += -U_LP64 -endif - -# -# adlc_updater is a simple sh script, under sccs control. It is -# used to selectively update generated adlc files. This should -# provide a nice compilation speed improvement. -# -ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) -ADLC_UPDATER = adlc_updater -$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) - $(QUIETLY) cp $< $@; chmod +x $@ - -# This action refreshes all generated adlc files simultaneously. -# The way it works is this: -# 1) create a scratch directory to work in. -# 2) if the current working directory does not have $(ADLC_UPDATER), copy it. -# 3) run the compiled adlc executable. This will create new adlc files in the scratch directory. -# 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. -# 5) If we actually updated any files, echo a notice. -# -refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) - @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) - $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ - -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ - || { rm -rf $(TEMPDIR); exit 1; } - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_clone.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_expand.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_format.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_gen.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_misc.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_peephole.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) ad_$(Platform_arch_model)_pipeline.cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) adGlobals_$(Platform_arch_model).hpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) ./$(ADLC_UPDATER) dfa_$(Platform_arch_model).cpp $(TEMPDIR) $(OUTDIR) - $(QUIETLY) [ -f $(TEMPDIR)/made-change ] \ - || echo $(LOG_INFO) "Rescanned $(SOURCE.AD) but encountered no changes." - $(QUIETLY) rm -rf $(TEMPDIR) - - -# ######################################################################### - -$(SOURCE.AD): $(SOURCES.AD) - $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD) - -#PROCESS_AD_FILES = cat -# Pass through #line directives, in case user enables -g option above: -PROCESS_AD_FILES = awk '{ \ - if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ - if (need_lineno && $$0 !~ /\/\//) \ - { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ - print }' - -$(OUTDIR)/%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE) - -# Some object files are given a prefix, to disambiguate -# them from objects of the same name built for the VM. -$(OUTDIR)/adlc-%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CXX) -o $@ $< $(COMPILE_DONE) - -# ######################################################################### - -clean : - rm $(OBJECTS) - -cleanall : - rm $(OBJECTS) $(EXEC) - -# ######################################################################### - -.PHONY: all dump refresh_adfiles clean cleanall diff --git a/hotspot/make/solaris/makefiles/amd64.make b/hotspot/make/solaris/makefiles/amd64.make deleted file mode 100644 index 3eb6dee9b92..00000000000 --- a/hotspot/make/solaris/makefiles/amd64.make +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (c) 2004, 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. -# -# - -# Must also specify if CPU is little endian -CFLAGS += -DVM_LITTLE_ENDIAN - -# -# Special case flags for compilers and compiler versions on amd64. -# -ifeq ("${Platform_compiler}", "sparcWorks") - -# Temporary until SS10 C++ compiler is fixed -OPT_CFLAGS/generateOptoStub.o = -xO2 -# Temporary util SS12u1 C++ compiler is fixed -OPT_CFLAGS/c1_LinearScan.o = -xO2 - -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/generateOptoStub.o += -g0 -xs - OPT_CFLAGS/c1_LinearScan.o += -g0 -xs -endif - -else - -ifeq ("${Platform_compiler}", "gcc") -# gcc -# The serviceability agent relies on frame pointer (%rbp) to walk thread stack -CFLAGS += -fno-omit-frame-pointer - -else -# error -_JUNK2_ := $(shell echo >&2 \ - "*** ERROR: this compiler is not yet supported by this code base!") - @exit 1 -endif -endif diff --git a/hotspot/make/solaris/makefiles/build_vm_def.sh b/hotspot/make/solaris/makefiles/build_vm_def.sh deleted file mode 100644 index 7f86953ddf3..00000000000 --- a/hotspot/make/solaris/makefiles/build_vm_def.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -/usr/ccs/bin/nm -p $* \ - | awk '{ - if ($2 == "U") next - if ($3 ~ /^__1c.*__vtbl_$/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";" - if ($3 ~ /^UseSharedSpaces$/) print "\t" $3 ";" - if ($3 ~ /^__1cJArgumentsRSharedArchivePath_$/) print "\t" $3 ";" - }' \ - | sort -u diff --git a/hotspot/make/solaris/makefiles/buildtree.make b/hotspot/make/solaris/makefiles/buildtree.make deleted file mode 100644 index 905eaa06ec5..00000000000 --- a/hotspot/make/solaris/makefiles/buildtree.make +++ /dev/null @@ -1,354 +0,0 @@ -# -# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Usage: -# -# $(MAKE) -f buildtree.make ARCH=arch BUILDARCH=buildarch LIBARCH=libarch -# GAMMADIR=dir OS_FAMILY=os VARIANT=variant -# -# The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the -# environment or on the command-line: -# -# ARCH - sparc, i486, ... HotSpot cpu and os_cpu source directory -# BUILDARCH - build directory -# LIBARCH - the corresponding directory in JDK/JRE -# GAMMADIR - top of workspace -# OS_FAMILY - operating system -# VARIANT - core, compiler1, compiler2, or tiered -# VERSION_STRING - the JDK version string as specified by JEP-223 -# HOTSPOT_VERSION_STRING - the same as VERSION_STRING, unless overridden by a standalone build -# -# Builds the directory trees with makefiles plus some convenience files in -# each directory: -# -# Makefile - for "make foo" -# flags.make - with macro settings -# vm.make - to support making "$(MAKE) -v vm.make" in makefiles -# adlc.make - -# trace.make - generate tracing event and type definitions -# jvmti.make - generate JVMTI bindings from the spec (JSR-163) -# -# The makefiles are split this way so that "make foo" will run faster by not -# having to read the dependency files for the vm. - --include $(SPEC) -include $(GAMMADIR)/make/scm.make -include $(GAMMADIR)/make/defs.make -include $(GAMMADIR)/make/altsrc.make - - -# 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ - -### maye ARCH_XXX instead? -ifdef USE_GCC -PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH).gcc -GCC_LIB = /usr/local/lib -else -PLATFORM_FILE = $(GAMMADIR)/make/$(OS_FAMILY)/platform_$(BUILDARCH) -GCC_LIB = -endif - -ifdef FORCE_TIERED -ifeq ($(VARIANT),tiered) -PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_compiler2 -else -PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) -endif -else -PLATFORM_DIR = $(OS_FAMILY)_$(BUILDARCH)_$(VARIANT) -endif - -# -# We do two levels of exclusion in the shared directory. -# TOPLEVEL excludes are pruned, they are not recursively searched, -# but lower level directories can be named without fear of collision. -# ALWAYS excludes are excluded at any level in the directory tree. -# - -ALWAYS_EXCLUDE_DIRS = $(SCM_DIRS) - -ifeq ($(VARIANT),tiered) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name agent -else -ifeq ($(VARIANT),compiler2) -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name c1 -o -name agent -else -# compiler1 and core use the same exclude list -TOPLEVEL_EXCLUDE_DIRS = $(ALWAYS_EXCLUDE_DIRS) -o -name adlc -o -name opto -o -name libadt -o -name agent -endif -endif - -# Get things from the platform file. -COMPILER = $(shell sed -n 's/^compiler[ ]*=[ ]*//p' $(PLATFORM_FILE)) - -SIMPLE_DIRS = \ - $(PLATFORM_DIR)/generated/dependencies \ - $(PLATFORM_DIR)/generated/adfiles \ - $(PLATFORM_DIR)/generated/jvmtifiles \ - $(PLATFORM_DIR)/generated/tracefiles - -TARGETS = debug fastdebug optimized product -SUBMAKE_DIRS = $(addprefix $(PLATFORM_DIR)/,$(TARGETS)) - -# For dependencies and recursive makes. -BUILDTREE_MAKE = $(GAMMADIR)/make/$(OS_FAMILY)/makefiles/buildtree.make - -BUILDTREE_TARGETS = Makefile flags.make flags_vm.make vm.make adlc.make jvmti.make trace.make dtrace.make - -BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \ - ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT) - -# Define variables to be set in flags.make. -# Default values are set in make/defs.make. - -# Set BUILD_USER from system-dependent hints: $LOGNAME, $(whoami) -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell echo $$LOGNAME) -endif -ifndef HOTSPOT_BUILD_USER - HOTSPOT_BUILD_USER := $(shell whoami) -endif -# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro -# or make/hotspot_distro. -ifndef HOTSPOT_VM_DISTRO - ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - include $(GAMMADIR)/make/hotspot_distro - else - include $(GAMMADIR)/make/openjdk_distro - endif -endif - -# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK -ifndef OPENJDK - ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true) - OPENJDK=true - endif -endif - -BUILDTREE_VARS += HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) VERSION_STRING=$(VERSION_STRING) - -BUILDTREE = \ - $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_TARGETS) $(BUILDTREE_VARS) - -BUILDTREE_COMMENT = echo "\# Generated by $(BUILDTREE_MAKE)" - -all: $(SUBMAKE_DIRS) - -# Run make in each subdirectory recursively. -$(SUBMAKE_DIRS): $(SIMPLE_DIRS) FORCE - $(QUIETLY) [ -d $@ ] || { mkdir -p $@; } - +$(QUIETLY) cd $@ && $(BUILDTREE) TARGET=$(@F) - $(QUIETLY) touch $@ - -$(SIMPLE_DIRS): - $(QUIETLY) mkdir -p $@ - -# Convenience macro which takes a source relative path, applies $(1) to the -# absolute path, and then replaces $(GAMMADIR) in the result with a -# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile. -gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2))) - -# This bit is needed to enable local rebuilds. -# Unless the makefile itself sets LP64, any environmental -# setting of LP64 will interfere with the build. -LP64_SETTING/32 = LP64 = \#empty -LP64_SETTING/64 = LP64 = 1 - -DATA_MODE/i486 = 32 -DATA_MODE/sparc = 32 -DATA_MODE/sparcv9 = 64 -DATA_MODE/amd64 = 64 - -DATA_MODE = $(DATA_MODE/$(BUILDARCH)) - -flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "Platform_file = $(PLATFORM_FILE)" | sed 's|$(GAMMADIR)|$$(GAMMADIR)|'; \ - sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \ - echo; \ - echo "GAMMADIR = $(GAMMADIR)"; \ - echo "SYSDEFS = \$$(Platform_sysdefs)"; \ - echo "SRCARCH = $(ARCH)"; \ - echo "BUILDARCH = $(BUILDARCH)"; \ - echo "LIBARCH = $(LIBARCH)"; \ - echo "TARGET = $(TARGET)"; \ - echo "HOTSPOT_VERSION_STRING = $(HOTSPOT_VERSION_STRING)"; \ - echo "VERSION_STRING = $(VERSION_STRING)"; \ - echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \ - echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \ - echo "OPENJDK = $(OPENJDK)"; \ - echo "$(LP64_SETTING/$(DATA_MODE))"; \ - echo; \ - echo "# Used for platform dispatching"; \ - echo "TARGET_DEFINES = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_\$$(Platform_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_ARCH_MODEL_\$$(Platform_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_\$$(Platform_os_arch)"; \ - echo "TARGET_DEFINES += -DTARGET_OS_ARCH_MODEL_\$$(Platform_os_arch_model)"; \ - echo "TARGET_DEFINES += -DTARGET_COMPILER_\$$(Platform_compiler)"; \ - echo "CFLAGS += \$$(TARGET_DEFINES)"; \ - echo; \ - echo "Src_Dirs_V = \\"; \ - sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \ - echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - echo; \ - echo "Src_Dirs_I = \\"; \ - echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \ - echo "$(call gamma-path,altsrc,share/vm) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm) \\"; \ - echo "$(call gamma-path,altsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,commonsrc,share/vm/precompiled) \\"; \ - echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \ - echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \ - echo "$(call gamma-path,commonsrc,os/posix/vm)"; \ - [ -n "$(CFLAGS_BROWSE)" ] && \ - echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \ - [ -n "$(ENABLE_FULL_DEBUG_SYMBOLS)" ] && \ - echo && echo "ENABLE_FULL_DEBUG_SYMBOLS = $(ENABLE_FULL_DEBUG_SYMBOLS)"; \ - [ -n "$(OBJCOPY)" ] && \ - echo && echo "OBJCOPY = $(OBJCOPY)"; \ - [ -n "$(STRIP_POLICY)" ] && \ - echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \ - [ -n "$(ZIP_DEBUGINFO_FILES)" ] && \ - echo && echo "ZIP_DEBUGINFO_FILES = $(ZIP_DEBUGINFO_FILES)"; \ - [ -n "$(ZIPEXE)" ] && \ - echo && echo "ZIPEXE = $(ZIPEXE)"; \ - [ -n "$(HS_ALT_MAKE)" ] && \ - echo && echo "HS_ALT_MAKE = $(HS_ALT_MAKE)"; \ - [ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \ - echo && \ - echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \ - echo "SYSDEFS += \$$(HOTSPOT_EXTRA_SYSDEFS)"; \ - echo; \ - [ -n "$(SPEC)" ] && \ - echo "include $(SPEC)"; \ - echo "CP ?= cp"; \ - echo "MV ?= mv"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \ - echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \ - ) > $@ - -flags_vm.make: $(BUILDTREE_MAKE) ../shared_dirs.lst - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(TARGET).make"; \ - ) > $@ - -../shared_dirs.lst: $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm - @echo $(LOG_INFO) Creating directory list $@ - $(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \ - find $(HS_ALT_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \ - fi; - $(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \ - -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \ - \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@ - -Makefile: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/top.make"; \ - ) > $@ - -vm.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo include flags_vm.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -adlc.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -jvmti.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -trace.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -dtrace.make: $(BUILDTREE_MAKE) - @echo $(LOG_INFO) Creating $@ ... - $(QUIETLY) ( \ - $(BUILDTREE_COMMENT); \ - echo; \ - echo include flags.make; \ - echo; \ - echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(@F)"; \ - ) > $@ - -FORCE: - -.PHONY: all FORCE - -.NOTPARALLEL: diff --git a/hotspot/make/solaris/makefiles/compiler1.make b/hotspot/make/solaris/makefiles/compiler1.make deleted file mode 100644 index d303bfc1ca4..00000000000 --- a/hotspot/make/solaris/makefiles/compiler1.make +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making client version of VM - -TYPE=COMPILER1 - -VM_SUBDIR = client - -# We don't support the JVMCI in a client VM. -INCLUDE_JVMCI := false - -CFLAGS += -DCOMPILER1 diff --git a/hotspot/make/solaris/makefiles/compiler2.make b/hotspot/make/solaris/makefiles/compiler2.make deleted file mode 100644 index c881079882e..00000000000 --- a/hotspot/make/solaris/makefiles/compiler2.make +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making server version of VM - -TYPE=COMPILER2 - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 diff --git a/hotspot/make/solaris/makefiles/core.make b/hotspot/make/solaris/makefiles/core.make deleted file mode 100644 index 64400556fcc..00000000000 --- a/hotspot/make/solaris/makefiles/core.make +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright (c) 1998, 2010, 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. -# -# - -# Sets make macros for making core version of VM - -# Select which files to use (in top.make) -TYPE=CORE - -# There is no "core" directory in JDK. Install core build in server directory. -VM_SUBDIR = server - -# Note: macros.hpp defines CORE diff --git a/hotspot/make/solaris/makefiles/debug.make b/hotspot/make/solaris/makefiles/debug.make deleted file mode 100644 index 3fba8e1239d..00000000000 --- a/hotspot/make/solaris/makefiles/debug.make +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -DEBUG_CFLAGS/DEFAULT= $(DEBUG_CFLAGS) -DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)) - -ifeq ("${Platform_compiler}", "sparcWorks") - -ifeq ($(COMPILER_REV_NUMERIC),508) - # SS11 SEGV when compiling with -g and -xarch=v8, using different backend - DEBUG_CFLAGS/compileBroker.o = $(DEBUG_CFLAGS) -xO0 - DEBUG_CFLAGS/jvmtiTagMap.o = $(DEBUG_CFLAGS) -xO0 -endif -endif - -# _NMT_NOINLINE_ informs NMT that no inlining by Compiler -CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_ - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfiles -MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers \ - $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-debug - -# This mapfile is only needed when compiling with dtrace support, -# and mustn't be otherwise. -MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE) - -VERSION = debug -SYSDEFS += -DASSERT -PICFLAGS = DEFAULT diff --git a/hotspot/make/solaris/makefiles/defs.make b/hotspot/make/solaris/makefiles/defs.make deleted file mode 100644 index f6b913ab460..00000000000 --- a/hotspot/make/solaris/makefiles/defs.make +++ /dev/null @@ -1,279 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# The common definitions for hotspot solaris builds. -# Include the top level defs.make under make directory instead of this one. -# This file is included into make/defs.make. - -define print_info - ifneq ($$(LOG_LEVEL), warn) - $$(shell echo >&2 "INFO: $1") - endif -endef - -# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name -SLASH_JAVA ?= /java -ARCH:=$(shell uname -p) -PATH_SEP = : -ifeq ($(LP64), 1) - ARCH_DATA_MODEL=64 -else - ARCH_DATA_MODEL=32 -endif - -ifeq ($(ARCH),sparc) - ifeq ($(ARCH_DATA_MODEL), 64) - MAKE_ARGS += LP64=1 - PLATFORM=solaris-sparcv9 - VM_PLATFORM=solaris_sparcv9 - else - PLATFORM=solaris-sparc - VM_PLATFORM=solaris_sparc - endif - HS_ARCH=sparc -else - ifeq ($(ARCH_DATA_MODEL), 64) - MAKE_ARGS += LP64=1 - PLATFORM=solaris-amd64 - VM_PLATFORM=solaris_amd64 - HS_ARCH=x86 - else - PLATFORM=solaris-i586 - VM_PLATFORM=solaris_i486 - HS_ARCH=x86 - endif -endif - -# On 32 bit solaris we build server and client, on 64 bit just server. -ifeq ($(JVM_VARIANTS),) - ifeq ($(ARCH_DATA_MODEL), 32) - JVM_VARIANTS:=client,server - JVM_VARIANT_CLIENT:=true - JVM_VARIANT_SERVER:=true - else - JVM_VARIANTS:=server - JVM_VARIANT_SERVER:=true - endif -endif - -# The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product -# builds is enabled with debug info files ZIP'ed to save space. For -# BUILD_FLAVOR != product builds, FDS is always enabled, after all a -# debug build without debug info isn't very useful. -# The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. -# -# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be -# disabled for a BUILD_FLAVOR == product build. -# -# Note: Use of a different variable name for the FDS override option -# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS -# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass -# in options via environment variables, use of distinct variables -# prevents strange behaviours. For example, in a BUILD_FLAVOR != -# product build, the FULL_DEBUG_SYMBOLS environment variable will be -# 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If -# the same variable name is used, then different values can be picked -# up by different parts of the build. Just to be clear, we only need -# two variable names because the incoming option value can be -# overridden in some situations, e.g., a BUILD_FLAVOR != product -# build. - -# Due to the multiple sub-make processes that occur this logic gets -# executed multiple times. We reduce the noise by at least checking that -# BUILD_FLAVOR has been set. -ifneq ($(BUILD_FLAVOR),) - ifeq ($(BUILD_FLAVOR), product) - FULL_DEBUG_SYMBOLS ?= 1 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) - else - # debug variants always get Full Debug Symbols (if available) - ENABLE_FULL_DEBUG_SYMBOLS = 1 - endif - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # Default OBJCOPY comes from the SUNWbinutils package: - DEF_OBJCOPY=/usr/sfw/bin/gobjcopy - OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY)) - ifneq ($(ALT_OBJCOPY),) - $(eval $(call print_info, "ALT_OBJCOPY=$(ALT_OBJCOPY)")) - OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) - endif - - ifneq ($(OBJCOPY),) - # OBJCOPY version check: - # - version number is last blank separate word on first line - # - version number formats that have been seen: - # - . - # - .. - # - # Full Debug Symbols on Solaris needs version 2.21.1 or newer. - # - OBJCOPY_VERS_CHK := $(shell \ - $(OBJCOPY) --version \ - | sed -n \ - -e 's/.* //' \ - -e '/^[01]\./b bad' \ - -e '/^2\./{' \ - -e ' s/^2\.//' \ - -e ' /^[0-9]$$/b bad' \ - -e ' /^[0-9]\./b bad' \ - -e ' /^1[0-9]$$/b bad' \ - -e ' /^1[0-9]\./b bad' \ - -e ' /^20\./b bad' \ - -e ' /^21\.0$$/b bad' \ - -e ' /^21\.0\./b bad' \ - -e '}' \ - -e ':good' \ - -e 's/.*/VALID_VERSION/p' \ - -e 'q' \ - -e ':bad' \ - -e 's/.*/BAD_VERSION/p' \ - -e 'q' \ - ) - ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION) - _JUNK_ := $(shell \ - echo >&2 "WARNING: $(OBJCOPY) --version info:"; \ - $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \ - echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \ - "is needed to create valid .debuginfo files."; \ - echo >&2 "WARNING: ignoring above objcopy command."; \ - echo >&2 "WARNING: patch 149063-01 or newer contains the" \ - "correct Solaris 10 SPARC version."; \ - echo >&2 "WARNING: patch 149064-01 or newer contains the" \ - "correct Solaris 10 X86 version."; \ - echo >&2 "WARNING: Solaris 11 Update 1 contains the" \ - "correct version."; \ - ) - OBJCOPY= - endif - endif - - ifeq ($(OBJCOPY),) - $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files.")) - ENABLE_FULL_DEBUG_SYMBOLS=0 - $(eval $(call print_info, "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")) - else - $(eval $(call print_info, "$(OBJCOPY) cmd found so will create .debuginfo files.")) - - # Library stripping policies for .debuginfo configs: - # all_strip - strips everything from the library - # min_strip - strips most stuff from the library; leaves minimum symbols - # no_strip - does not strip the library at all - # - # Oracle security policy requires "all_strip". A waiver was granted on - # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. - # - # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. - # - STRIP_POLICY ?= min_strip - - $(eval $(call print_info, "STRIP_POLICY=$(STRIP_POLICY)")) - - ZIP_DEBUGINFO_FILES ?= 1 - - $(eval $(call print_info, "ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")) - endif - endif # ENABLE_FULL_DEBUG_SYMBOLS=1 -endif # BUILD_FLAVOR - -JDK_INCLUDE_SUBDIR=solaris - -# Library suffix -LIBRARY_SUFFIX=so - -EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html - -# client and server subdirectories have symbolic links to ../libjsig.$(LIBRARY_SUFFIX) -EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.diz - else - EXPORT_LIST += $(EXPORT_LIB_ARCH_DIR)/libjsig.debuginfo - endif -endif - -EXPORT_SERVER_DIR = $(EXPORT_LIB_ARCH_DIR)/server -EXPORT_CLIENT_DIR = $(EXPORT_LIB_ARCH_DIR)/client - -ifeq ($(JVM_VARIANT_SERVER),true) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.$(LIBRARY_SUFFIX) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX) - ifeq ($(ARCH_DATA_MODEL),32) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX) - endif - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.diz - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.diz - ifeq ($(ARCH_DATA_MODEL),32) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.diz - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.diz - endif - else - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_db.debuginfo - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm_dtrace.debuginfo - ifeq ($(ARCH_DATA_MODEL),32) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_db.debuginfo - EXPORT_LIST += $(EXPORT_SERVER_DIR)/64/libjvm_dtrace.debuginfo - endif - endif - endif -endif -ifeq ($(JVM_VARIANT_CLIENT),true) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.$(LIBRARY_SUFFIX) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.$(LIBRARY_SUFFIX) - ifeq ($(ARCH_DATA_MODEL),32) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.$(LIBRARY_SUFFIX) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.$(LIBRARY_SUFFIX) - endif - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.diz - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.diz - ifeq ($(ARCH_DATA_MODEL),32) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.diz - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.diz - endif - else - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_db.debuginfo - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm_dtrace.debuginfo - ifeq ($(ARCH_DATA_MODEL),32) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_db.debuginfo - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/64/libjvm_dtrace.debuginfo - endif - endif - endif -endif diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make deleted file mode 100644 index 2c65059a213..00000000000 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ /dev/null @@ -1,387 +0,0 @@ -# -# Copyright (c) 2005, 2014, 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. -# -# - -# Rules to build jvm_db/dtrace, used by vm.make - -# We build libjvm_dtrace/libjvm_db/dtrace for COMPILER1 and COMPILER2 -# but not for CORE configuration. - -ifneq ("${TYPE}", "CORE") - -ifdef USE_GCC - -dtraceCheck: - $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for gcc builds" - -else - -DtraceOutDir = $(GENERATED)/dtracefiles - -JVM_DB = libjvm_db -LIBJVM_DB = libjvm_db.so - -LIBJVM_DB_DEBUGINFO = libjvm_db.debuginfo -LIBJVM_DB_DIZ = libjvm_db.diz - -JVM_DTRACE = jvm_dtrace -LIBJVM_DTRACE = libjvm_dtrace.so - -LIBJVM_DTRACE_DEBUGINFO = libjvm_dtrace.debuginfo -LIBJVM_DTRACE_DIZ = libjvm_dtrace.diz - -JVMOFFS = JvmOffsets -JVMOFFS.o = $(JVMOFFS).o -GENOFFS = generate$(JVMOFFS) - -DTRACE_SRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/dtrace -DTRACE_COMMON_SRCDIR = $(GAMMADIR)/src/os/posix/dtrace -DTRACE = dtrace -DTRACE.o = $(DTRACE).o -DTRACE_JHELPER = dtrace_jhelper -DTRACE_JHELPER.o = $(DTRACE_JHELPER).o - -# to remove '-g' option which causes link problems -# also '-z nodefs' is used as workaround -GENOFFS_CFLAGS = $(shell echo $(CFLAGS) | sed -e 's/ -g / /g' -e 's/ -g0 / /g';) - -ifdef LP64 -DTRACE_OPTS = -64 -D_LP64 -endif - -# making libjvm_db - -# Use mapfile with libjvm_db.so -LIBJVM_DB_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_db -LFLAGS_JVM_DB += $(MAPFLAG:FILENAME=$(LIBJVM_DB_MAPFILE)) - -# Use mapfile with libjvm_dtrace.so -LIBJVM_DTRACE_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jvm_dtrace -LFLAGS_JVM_DTRACE += $(MAPFLAG:FILENAME=$(LIBJVM_DTRACE_MAPFILE)) - -ifdef USE_GCC -LFLAGS_JVM_DB += -D_REENTRANT $(PICFLAG) -LFLAGS_JVM_DTRACE += -D_REENTRANT $(PICFLAG) -else -LFLAGS_JVM_DB += -mt $(PICFLAG) -xnolib -LFLAGS_JVM_DTRACE += -mt $(PICFLAG) -xnolib -ldl -endif - -ISA = $(subst i386,i486,$(shell isainfo -n)) - -# Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so -ifneq ("${ISA}","${BUILDARCH}") - -XLIBJVM_DIR = 64 -XLIBJVM_DB = $(XLIBJVM_DIR)/$(LIBJVM_DB) -XLIBJVM_DTRACE = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE) - -XLIBJVM_DB_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DB_DEBUGINFO) -XLIBJVM_DB_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ) -XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO) -XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ) - -$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ - $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ - $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO) -# Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not -# in the link name: - ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ) - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) -# Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not -# in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) ) - $(RM) $(XLIBJVM_DB_DEBUGINFO) - endif -endif - -$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \ - $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. $(EXTRA_CFLAGS) \ - $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c \ - $(EXTRA_LDFLAGS) -lc -lthread -ldoor -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO) -# Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not -# in the link name: - ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ) - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) -# Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not -# in the archived name: - ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO)) - $(RM) $(XLIBJVM_DTRACE_DEBUGINFO) - endif -endif - -endif # ifneq ("${ISA}","${BUILDARCH}") - -ifdef USE_GCC -LFLAGS_GENOFFS += -D_REENTRANT -else -LFLAGS_GENOFFS += -mt -xnolib -norunpath -endif - -lib$(GENOFFS).so: $(DTRACE_SRCDIR)/$(GENOFFS).cpp $(DTRACE_SRCDIR)/$(GENOFFS).h \ - $(LIBJVM.o) - $(QUIETLY) $(CXX) $(CXXFLAGS) $(GENOFFS_CFLAGS) $(SHARED_FLAG) $(PICFLAG) \ - $(LFLAGS_GENOFFS) -o $@ $(DTRACE_SRCDIR)/$(GENOFFS).cpp -lc - -$(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).so - $(QUIETLY) $(LINK.CXX) -z nodefs -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ - ./lib$(GENOFFS).so - -CONDITIONALLY_UPDATE_JVMOFFS_TARGET = \ - if cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - rm -f $@ && mv $@.tmp $@ && echo Updated $@; \ - fi - -# $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. -$(JVMOFFS).h: $(GENOFFS) - $(QUIETLY) LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp - $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) - -$(JVMOFFS)Index.h: $(GENOFFS) - $(QUIETLY) LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp - $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) - -$(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h - $(QUIETLY) LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp - $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) - -$(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp - $(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp - -$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \ - $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) - $(RM) $(LIBJVM_DB_DEBUGINFO) - endif -endif - -$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) - @echo $(LOG_INFO) Making $@ - $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. $(EXTRA_CFLAGS) \ - $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c \ - $(EXTRA_LDFLAGS) -lc -lthread -ldoor -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) - $(RM) $(LIBJVM_DTRACE_DEBUGINFO) - endif -endif - -$(DTRACE).d: $(DTRACE_COMMON_SRCDIR)/hotspot.d $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d \ - $(DTRACE_COMMON_SRCDIR)/hs_private.d - $(QUIETLY) cat $^ > $@ - -$(DTRACE_JHELPER).d: $(DTRACE_SRCDIR)/jhelper.d - $(QUIETLY) cat $^ > $@ - -DTraced_Files = ciEnv.o \ - classLoadingService.o \ - compileBroker.o \ - hashtable.o \ - instanceKlass.o \ - java.o \ - jni.o \ - jvm.o \ - memoryManager.o \ - nmethod.o \ - objectMonitor.o \ - runtimeService.o \ - sharedRuntime.o \ - synchronizer.o \ - thread.o \ - unsafe.o \ - vmThread.o \ - vmCMSOperations.o \ - vmPSOperations.o \ - vmGCOperations.o \ - -# Dtrace is available, so we build $(DTRACE.o) -$(DTRACE.o): $(DTRACE).d $(DTraced_Files) - @echo $(LOG_INFO) Compiling $(DTRACE).d - - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ - $(sort $(DTraced_Files)) ||\ - STATUS=$$?;\ - if [ x"$$STATUS" = x"1" ]; then \ - if [ x`uname -r` = x"5.10" -a \ - x`uname -p` = x"sparc" ]; then\ - echo "*****************************************************************";\ - echo "* If you are building server compiler, and the error message is ";\ - echo "* \"incorrect ELF machine type...\", you have run into solaris bug ";\ - echo "* 6213962, \"dtrace -G doesn't work on sparcv8+ object files\".";\ - echo "* Either patch/upgrade your system (>= S10u1_15), or set the ";\ - echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ - echo "* dtrace probes for this build.";\ - echo "*****************************************************************";\ - elif [ x`uname -r` = x"5.10" ]; then\ - echo "*****************************************************************";\ - echo "* If you are seeing 'syntax error near \"umpiconninfo_t\"' on Solaris";\ - echo "* 10, try doing 'cd /usr/lib/dtrace && gzip mpi.d' as root, ";\ - echo "* or set the environment variable HOTSPOT_DISABLE_DTRACE_PROBES";\ - echo "* to disable dtrace probes for this build.";\ - echo "*****************************************************************";\ - else \ - echo "*****************************************************************";\ - echo "* If you cannot fix dtrace build issues, try to ";\ - echo "* set the environment variable HOTSPOT_DISABLE_DTRACE_PROBES";\ - echo "* to disable dtrace probes for this build.";\ - echo "*****************************************************************";\ - fi; \ - fi;\ - exit $$STATUS - # Since some DTraced_Files are in LIBJVM.o and they are touched by this - # command, and libgenerateJvmOffsets.so depends on LIBJVM.o, 'make' will - # think it needs to rebuild libgenerateJvmOffsets.so and thus JvmOffsets* - # files, but it doesn't, so we touch the necessary files to prevent later - # recompilation. Note: we only touch the necessary files if they already - # exist in order to close a race where an empty file can be created - # before the real build rule is executed. - # But, we can't touch the *.h files: This rule depends - # on them, and that would cause an infinite cycle of rebuilding. - # Neither the *.h or *.ccp files need to be touched, since they have - # rules which do not update them when the generator file has not - # changed their contents. - $(QUIETLY) if [ -f lib$(GENOFFS).so ]; then touch lib$(GENOFFS).so; fi - $(QUIETLY) if [ -f $(GENOFFS) ]; then touch $(GENOFFS); fi - $(QUIETLY) if [ -f $(JVMOFFS.o) ]; then touch $(JVMOFFS.o); fi - - -$(DtraceOutDir): - mkdir $(DtraceOutDir) - -$(DtraceOutDir)/hotspot.h: $(DTRACE_COMMON_SRCDIR)/hotspot.d | $(DtraceOutDir) - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot.d - -$(DtraceOutDir)/hotspot_jni.h: $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d | $(DtraceOutDir) - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hotspot_jni.d - -$(DtraceOutDir)/hs_private.h: $(DTRACE_COMMON_SRCDIR)/hs_private.d | $(DtraceOutDir) - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -h -o $@ -s $(DTRACE_COMMON_SRCDIR)/hs_private.d - -dtrace_gen_headers: $(DtraceOutDir)/hotspot.h $(DtraceOutDir)/hotspot_jni.h $(DtraceOutDir)/hs_private.h - -# The jhelper.d and hotspot probes are separated into two different SUNW_dof sections. -# Now the jhelper.d is built without the -Xlazyload flag. -$(DTRACE_JHELPER.o) : $(DTRACE_JHELPER).d $(JVMOFFS).h $(JVMOFFS)Index.h - @echo $(LOG_INFO) Compiling $(DTRACE_JHELPER).d - $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -o $@ -s $(DTRACE_JHELPER).d - -.PHONY: dtraceCheck - -SYSTEM_DTRACE_PROG = /usr/sbin/dtrace -PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace -systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG}) -patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG}) - -ifneq ("$(patchDtraceFound)", "") -DTRACE_PROG=$(PATCH_DTRACE_PROG) -DTRACE_INCL=-I/opt/SUNWdtrd/include -else -ifneq ("$(systemDtraceFound)", "") -DTRACE_PROG=$(SYSTEM_DTRACE_PROG) -else - -endif # ifneq ("$(systemDtraceFound)", "") -endif # ifneq ("$(patchDtraceFound)", "") - -ifneq ("${DTRACE_PROG}", "") -ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") - -DTRACE_OBJS = $(DTRACE.o) $(JVMOFFS.o) $(DTRACE_JHELPER.o) -CFLAGS += $(DTRACE_INCL) -DDTRACE_ENABLED -MAPFILE_DTRACE_OPT = $(MAPFILE_DTRACE) - -dtraceCheck: - -else # manually disabled - -dtraceCheck: - $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled via environment variable" - -endif # ifeq ("${HOTSPOT_DISABLE_DTRACE_PROBES}", "") - -else # No dtrace program found - -dtraceCheck: - $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled: not supported by system" - -endif # ifneq ("${dtraceFound}", "") - -endif # ifdef USE_GCC - -else # CORE build - -dtraceCheck: - $(QUIETLY) echo $(LOG_INFO) "**NOTICE** Dtrace support disabled for CORE builds" - -endif # ifneq ("${TYPE}", "CORE") diff --git a/hotspot/make/solaris/makefiles/fastdebug.make b/hotspot/make/solaris/makefiles/fastdebug.make deleted file mode 100644 index 3719c3edbda..00000000000 --- a/hotspot/make/solaris/makefiles/fastdebug.make +++ /dev/null @@ -1,127 +0,0 @@ -# -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# 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. -# -# - -# Sets make macros for making debug version of VM - -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -# They may also specify FASTDEBUG_CFLAGS, but it defaults to DEBUG_CFLAGS. - -FASTDEBUG_CFLAGS$(FASTDEBUG_CFLAGS) = $(DEBUG_CFLAGS) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -ifeq ("${Platform_compiler}", "sparcWorks") -OPT_CFLAGS/SLOWER = -xO2 - -ifeq ($(COMPILER_REV_NUMERIC), 510) -# Avoid apparent crash because of corrupted methodHandle in a tail call -OPT_CFLAGS/simpleThresholdPolicy.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT) -# CC 5.10 has bug XXXXX with -xO4 -OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/SLOWER) -endif # COMPILER_REV_NUMERIC == 510 - -ifeq ($(COMPILER_REV_NUMERIC), 509) -# To avoid jvm98 crash -OPT_CFLAGS/instanceKlass.o = $(OPT_CFLAGS/SLOWER) -endif # COMPILER_NUMERIC_REV == 509 - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) -# dtrace cannot handle tail call optimization (6672627, 6693876) -OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT) -# this hangs in iropt now (7113504) -OPT_CFLAGS/compileBroker.o = $(OPT_CFLAGS/SLOWER) -endif # COMPILER_NUMERIC_REV >= 509 - -ifeq ($(COMPILER_REV_NUMERIC), 505) -# CC 5.5 has bug 4908364 with -xO4 (Fixed in 5.6) -OPT_CFLAGS/library_call.o = $(OPT_CFLAGS/SLOWER) -endif # COMPILER_REV_NUMERIC == 505 - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \<= 504), 1) -# Compilation of *_.cpp can take an hour or more at O3. Use O2 -# See comments at top of sparc.make. -OPT_CFLAGS/ad_$(Platform_arch_model).o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/dfa_$(Platform_arch_model).o = $(OPT_CFLAGS/SLOWER) -endif # COMPILER_REV_NUMERIC <= 504 - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 505), 1) -# Same problem with Solaris/x86 compiler (both 5.0 and 5.2) on ad_x86_{32,64}.cpp. -# CC build time is also too long for ad_$(Platform_arch_model)_{gen,misc}.o -OPT_CFLAGS/ad_$(Platform_arch_model).o = -c -OPT_CFLAGS/ad_$(Platform_arch_model)_gen.o = -c -OPT_CFLAGS/ad_$(Platform_arch_model)_misc.o = -c -ifeq ($(Platform_arch), x86) -# Same problem for the wrapper roosts: jni.o jvm.o -OPT_CFLAGS/jni.o = -c -OPT_CFLAGS/jvm.o = -c -# Same problem in parse2.o (probably the Big Switch over bytecodes) -OPT_CFLAGS/parse2.o = -c -endif # Platform_arch == x86 -endif - -# Frame size > 100k if we allow inlining via -g0! -DEBUG_CFLAGS/bytecodeInterpreter.o = -g -DEBUG_CFLAGS/bytecodeInterpreterWithChecks.o = -g -ifeq ($(Platform_arch), x86) -# ube explodes on x86 -OPT_CFLAGS/bytecodeInterpreter.o = -xO1 -OPT_CFLAGS/bytecodeInterpreterWithChecks.o = -xO1 -endif # Platform_arch == x86 - -endif # Platform_compiler == sparcWorks - -# Workaround for a bug in dtrace. If ciEnv::post_compiled_method_load_event() -# is inlined, the resulting dtrace object file needs a reference to this -# function, whose symbol name is too long for dtrace. So disable inlining -# for this method for now. (fix this when dtrace bug 6258412 is fixed) -OPT_CFLAGS/ciEnv.o = $(OPT_CFLAGS) -xinline=no%__1cFciEnvbFpost_compiled_method_load_event6MpnHnmethod__v_ - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# The following lines are copied from debug.make, except that we -# consult FASTDEBUG_CFLAGS instead of DEBUG_CFLAGS. -# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make -DEBUG_CFLAGS/DEFAULT= $(FASTDEBUG_CFLAGS) -DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@)) -CFLAGS += $(DEBUG_CFLAGS/BYFILE) - -# Linker mapfiles -MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers \ - $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-debug - -# This mapfile is only needed when compiling with dtrace support, -# and mustn't be otherwise. -MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE) - -VERSION = optimized -SYSDEFS += -DASSERT -DCHECK_UNHANDLED_OOPS -PICFLAGS = DEFAULT diff --git a/hotspot/make/solaris/makefiles/gcc.make b/hotspot/make/solaris/makefiles/gcc.make deleted file mode 100644 index d31237acbf1..00000000000 --- a/hotspot/make/solaris/makefiles/gcc.make +++ /dev/null @@ -1,241 +0,0 @@ -# -# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# 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. -# -# - -#------------------------------------------------------------------------ -# CC, CXX & AS - -# If a SPEC is not set already, then use these defaults. -ifeq ($(SPEC),) - CXX = g++ - CC = gcc - AS = $(CC) -c - MCS = /usr/ccs/bin/mcs -endif - -Compiler = gcc - -# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only -# prints the numbers (e.g. "2.95", "3.2.1") -CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) -CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) -CC_VER_MICRO := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f3) - -# Check for the versions of C++ and C compilers ($CXX and $CC) used. - -# Get the last thing on the line that looks like x.x+ (x is a digit). -COMPILER_REV := \ -$(shell $(CXX) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1) -CC_COMPILER_REV := \ -$(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2) - - -# check for precompiled headers support -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0" -# Allow the user to turn off precompiled headers from the command line. -ifneq ($(USE_PRECOMPILED_HEADER),0) -PRECOMPILED_HEADER_DIR=. -PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp -PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch -endif -endif - - -#------------------------------------------------------------------------ -# Compiler flags - -# position-independent code -PICFLAG = -fPIC - -VM_PICFLAG/LIBJVM = $(PICFLAG) -VM_PICFLAG/AOUT = -VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) - -CFLAGS += $(VM_PICFLAG) -CFLAGS += -fno-rtti -CFLAGS += -fno-exceptions -CFLAGS += -D_REENTRANT -CFLAGS += -fcheck-new - -ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) - -ARCHFLAG/sparc = -m32 -mcpu=v9 -ARCHFLAG/sparcv9 = -m64 -mcpu=v9 -ARCHFLAG/i486 = -m32 -march=i586 -ARCHFLAG/amd64 = -m64 -march=k8 - - -# Optional sub-directory in /usr/lib where BUILDARCH libraries are kept. -ISA_DIR=$(ISA_DIR/$(BUILDARCH)) -ISA_DIR/amd64=/amd64 -ISA_DIR/i486= -ISA_DIR/sparcv9=/64 - - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) -ASFLAGS += $(ARCHFLAG) - -ifeq ($(BUILDARCH), amd64) -ASFLAGS += -march=k8 -march=amd64 -LFLAGS += -march=k8 -endif - - -# Use C++ Interpreter -ifdef CC_INTERP - CFLAGS += -DCC_INTERP -endif - -# Keep temporary files (.ii, .s) -ifdef NEED_ASM - CFLAGS += -save-temps -else - CFLAGS += -pipe -endif - - -# Compiler warnings are treated as errors -WARNINGS_ARE_ERRORS ?= -Werror - -# Enable these warnings. See 'info gcc' about details on these options -WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef -Wformat=2 -CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) - -# Special cases -CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) - -# optimization control flags (Used by fastdebug and release variants) -OPT_CFLAGS/NOOPT=-O0 -OPT_CFLAGS/DEBUG=-O0 -OPT_CFLAGS/SIZE=-Os -OPT_CFLAGS/SPEED=-O3 - -OPT_CFLAGS_DEFAULT ?= SPEED - -# Hotspot uses very unstrict aliasing turn this optimization off -# This option is added to CFLAGS rather than OPT_CFLAGS -# so that OPT_CFLAGS overrides get this option too. -CFLAGS += -fno-strict-aliasing - -ifdef OPT_CFLAGS - ifneq ("$(origin OPT_CFLAGS)", "command line") - $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.") - endif -endif - -OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS) - -# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp -# if we use expensive-optimizations -# Note: all ia64 setting reflect the ones for linux -# No actial testing was performed: there is no Solaris on ia64 presently -ifeq ($(BUILDARCH), ia64) -OPT_CFLAGS/bytecodeInterpreter.o += -fno-expensive-optimizations -endif - -# Work around some compiler bugs. -ifeq ($(USE_CLANG), true) - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) - OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) - endif -else - # Do not allow GCC 4.1.1 - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 1 \& $(CC_VER_MICRO) = 1), 1) - $(error "GCC $(CC_VER_MAJOR).$(CC_VER_MINOR).$(CC_VER_MICRO) not supported because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27724") - endif - # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) - OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT) - endif -endif - -# Flags for generating make dependency flags. -ifneq ($(CC_VER_MAJOR), 2) -DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d) -endif - -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -ifeq ($(USE_PRECOMPILED_HEADER),0) -CFLAGS += -DDONT_USE_PRECOMPILED_HEADER -endif - -#------------------------------------------------------------------------ -# Linker flags - -# statically link libstdc++.so, work with gcc but ignored by g++ -STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic - - -ifdef USE_GNULD - # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. - ifneq ($(CC_VER_MAJOR), 2) - STATIC_LIBGCC += -static-libgcc - endif - - # Enable linker optimization - LFLAGS += -Xlinker -O1 - - ifneq (, findstring(debug,$(BUILD_FLAVOR))) - # for relocations read-only - LFLAGS += -Xlinker -z -Xlinker relro - - ifeq ($(BUILD_FLAVOR), debug) - # disable incremental relocations linking - LFLAGS += -Xlinker -z -Xlinker now - endif - endif - - ifeq ($(BUILDARCH), ia64) - # Note: all ia64 setting reflect the ones for linux - # No actual testing was performed: there is no Solaris on ia64 presently - LFLAGS += -Wl,-relax - endif - - # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. - MAPFLAG = -Xlinker --version-script=FILENAME -else - MAPFLAG = -Xlinker -M -Xlinker FILENAME -endif - -# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj -SONAMEFLAG = -Xlinker -soname=SONAME - -# Build shared library -SHARED_FLAG = -shared - -#------------------------------------------------------------------------ -# Debug flags - -# Allow no optimizations. -DEBUG_CFLAGS=-O0 - -# Enable debug symbols -DEBUG_CFLAGS += -g - -# Enable bounds checking. -ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1" - # stack smashing checks. - DEBUG_CFLAGS += -fstack-protector-all --param ssp-buffer-size=1 -endif diff --git a/hotspot/make/solaris/makefiles/hp.make b/hotspot/make/solaris/makefiles/hp.make deleted file mode 100644 index d0b10265560..00000000000 --- a/hotspot/make/solaris/makefiles/hp.make +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1998, 2008, 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. -# -# - -# Sets make macros for making premium version of VM - -TYPE=HP - -CFLAGS += -DCOMPILER2 diff --git a/hotspot/make/solaris/makefiles/hp1.make b/hotspot/make/solaris/makefiles/hp1.make deleted file mode 100644 index 2e37a6ead33..00000000000 --- a/hotspot/make/solaris/makefiles/hp1.make +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1999, 2008, 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. -# -# - -# Sets make macros for making premium version of VM - -TYPE=HP1 - -CFLAGS += -DCOMPILER1 diff --git a/hotspot/make/solaris/makefiles/i486.make b/hotspot/make/solaris/makefiles/i486.make deleted file mode 100644 index c2e6ff8395a..00000000000 --- a/hotspot/make/solaris/makefiles/i486.make +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright (c) 1998, 2010, 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. -# -# - -# Must also specify if CPU is little endian -CFLAGS += -DVM_LITTLE_ENDIAN - -# TLS helper, assembled from .s file - -# -# Special case flags for compilers and compiler versions on i486. -# -ifeq ("${Platform_compiler}", "sparcWorks") -# ILD is gone as of SS11 (5.8), not supported in SS10 (5.7) -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1) - # - # Bug in ild causes it to fail randomly. Until we get a fix we can't - # use ild. - # - ILDFLAG/debug = -xildoff -endif -endif diff --git a/hotspot/make/solaris/makefiles/jsig.make b/hotspot/make/solaris/makefiles/jsig.make deleted file mode 100644 index 392f78c1651..00000000000 --- a/hotspot/make/solaris/makefiles/jsig.make +++ /dev/null @@ -1,81 +0,0 @@ -# -# Copyright (c) 2005, 2014, 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. -# -# - -# Rules to build signal interposition library, used by vm.make - -# libjsig.so: signal interposition library -JSIG = jsig -LIBJSIG = lib$(JSIG).so - -LIBJSIG_DEBUGINFO = lib$(JSIG).debuginfo -LIBJSIG_DIZ = lib$(JSIG).diz - -JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm - -DEST_JSIG = $(JDK_LIBDIR)/$(LIBJSIG) -DEST_JSIG_DEBUGINFO = $(JDK_LIBDIR)/$(LIBJSIG_DEBUGINFO) -DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ) - -LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig - -LFLAGS_JSIG += $(MAPFLAG:FILENAME=$(LIBJSIG_MAPFILE)) - -ifdef USE_GCC -LFLAGS_JSIG += -D_REENTRANT -else -LFLAGS_JSIG += -mt -xnolib -endif - -$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE) - @echo $(LOG_INFO) Making signal interposition lib... - $(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ - $(EXTRA_CFLAGS) \ - $(LFLAGS_JSIG) $(EXTRA_LDFLAGS) \ - -o $@ $(JSIGSRCDIR)/jsig.c -ldl -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) - $(RM) $(LIBJSIG_DEBUGINFO) - endif -endif - -install_jsig: $(LIBJSIG) - @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" - $(QUIETLY) test ! -f $(LIBJSIG_DEBUGINFO) || \ - $(CP) -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO) - $(QUIETLY) test ! -f $(LIBJSIG_DIZ) || \ - $(CP) -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ) - $(QUIETLY) $(CP) -f $(LIBJSIG) $(DEST_JSIG) && echo "Done" - -.PHONY: install_jsig diff --git a/hotspot/make/solaris/makefiles/jvmti.make b/hotspot/make/solaris/makefiles/jvmti.make deleted file mode 100644 index 93b9f6ed885..00000000000 --- a/hotspot/make/solaris/makefiles/jvmti.make +++ /dev/null @@ -1,115 +0,0 @@ -# -# Copyright (c) 2003, 2010, 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. -# -# - -# This makefile (jvmti.make) is included from the jvmti.make in the -# build directories. -# -# It knows how to build and run the tools to generate jvmti. - -include $(GAMMADIR)/make/solaris/makefiles/rules.make - -# ######################################################################### - -GENERATED = ../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles - -JvmtiSrcDir = $(GAMMADIR)/src/share/vm/prims -InterpreterSrcDir = $(GAMMADIR)/src/share/vm/interpreter - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(JvmtiSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -JvmtiGeneratedNames = \ - jvmtiEnv.hpp \ - jvmtiEnter.cpp \ - jvmtiEnterTrace.cpp \ - jvmtiEnvRecommended.cpp\ - bytecodeInterpreterWithChecks.cpp\ - jvmti.h \ - -JvmtiEnvFillSource = $(JvmtiSrcDir)/jvmtiEnvFill.java -JvmtiEnvFillClass = $(JvmtiOutDir)/jvmtiEnvFill.class - -JvmtiGenSource = $(JvmtiSrcDir)/jvmtiGen.java -JvmtiGenClass = $(JvmtiOutDir)/jvmtiGen.class - -JvmtiGeneratedFiles = $(JvmtiGeneratedNames:%=$(JvmtiOutDir)/%) - -XSLT = $(QUIETLY) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -.PHONY: all jvmtidocs clean cleanall - -# ######################################################################### - -all: $(JvmtiGeneratedFiles) - -both = $(JvmtiGenClass) $(JvmtiSrcDir)/jvmti.xml $(JvmtiSrcDir)/jvmtiLib.xsl - -$(JvmtiGenClass): $(JvmtiGenSource) - $(QUIETLY) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiGenSource) - -$(JvmtiEnvFillClass): $(JvmtiEnvFillSource) - $(QUIETLY) $(COMPILE.JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) - -$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti - -$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp - -$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace - -$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp - $(QUIETLY) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp - -$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp - -$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h - -jvmtidocs: $(JvmtiOutDir)/jvmti.html - -$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo $(LOG_INFO) Generating $@ - $(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html - -# ######################################################################### - -clean : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -cleanall : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -# ######################################################################### diff --git a/hotspot/make/solaris/makefiles/mapfile-vers b/hotspot/make/solaris/makefiles/mapfile-vers deleted file mode 100644 index 3de0dd99af5..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - JVM_handle_solaris_signal; - - # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; - - # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE - - local: - *; -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-COMPILER1 b/hotspot/make/solaris/makefiles/mapfile-vers-COMPILER1 deleted file mode 100644 index f3a02560561..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-COMPILER1 +++ /dev/null @@ -1,43 +0,0 @@ -# - -# -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - # Dtrace support - __1cJCodeCacheG_heaps_; - __1cIUniverseO_collectedHeap_; - __1cGMethodG__vtbl_; - __1cHnmethodG__vtbl_; - __1cICodeBlobG__vtbl_; - __1cKBufferBlobG__vtbl_; - __1cLRuntimeStubG__vtbl_; - __1cNSafepointBlobG__vtbl_; - __1cSDeoptimizationBlobG__vtbl_; - - __JvmOffsets; -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-COMPILER2 b/hotspot/make/solaris/makefiles/mapfile-vers-COMPILER2 deleted file mode 100644 index 383ba3cc9a9..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-COMPILER2 +++ /dev/null @@ -1,46 +0,0 @@ -# - -# -# Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - # Dtrace support - __1cJCodeCacheG_heaps_; - __1cIUniverseO_collectedHeap_; - __1cGMethodG__vtbl_; - __1cHnmethodG__vtbl_; - __1cICodeBlobG__vtbl_; - __1cKBufferBlobG__vtbl_; - __1cLRuntimeStubG__vtbl_; - __1cNSafepointBlobG__vtbl_; - __1cSDeoptimizationBlobG__vtbl_; - - __1cNExceptionBlobG__vtbl_; - __1cQUncommonTrapBlobG__vtbl_; - - __JvmOffsets; -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-CORE b/hotspot/make/solaris/makefiles/mapfile-vers-CORE deleted file mode 100644 index ed5896ba709..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-CORE +++ /dev/null @@ -1,31 +0,0 @@ -# - -# -# Copyright (c) 2003, 2008, 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-TIERED b/hotspot/make/solaris/makefiles/mapfile-vers-TIERED deleted file mode 100644 index 2f2c69d477e..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-TIERED +++ /dev/null @@ -1,45 +0,0 @@ -# - -# -# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - # Dtrace support - __1cJCodeCacheG_heaps_; - __1cIUniverseO_collectedHeap_; - __1cGMethodG__vtbl_; - __1cHnmethodG__vtbl_; - __1cICodeBlobG__vtbl_; - __1cKBufferBlobG__vtbl_; - __1cLRuntimeStubG__vtbl_; - __1cNSafepointBlobG__vtbl_; - __1cSDeoptimizationBlobG__vtbl_; - __1cNExceptionBlobG__vtbl_; - __1cQUncommonTrapBlobG__vtbl_; - - __JvmOffsets; -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-debug b/hotspot/make/solaris/makefiles/mapfile-vers-debug deleted file mode 100644 index f6b63d5a4bf..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-debug +++ /dev/null @@ -1,33 +0,0 @@ -# - -# -# Copyright (c) 2000, 2008, 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. -# -# - -# Define public interface. - -SUNWprivate_1.1 { - global: - - # miscellaneous -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-jsig b/hotspot/make/solaris/makefiles/mapfile-vers-jsig deleted file mode 100644 index 8a675046b6e..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-jsig +++ /dev/null @@ -1,40 +0,0 @@ -# - -# -# Copyright (c) 2005, 2008, 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. -# -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - JVM_begin_signal_setting; - JVM_end_signal_setting; - JVM_get_libjsig_version; - JVM_get_signal_action; - sigaction; - signal; - sigset; - local: - *; -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-jvm_db b/hotspot/make/solaris/makefiles/mapfile-vers-jvm_db deleted file mode 100644 index 9ee418d01a2..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-jvm_db +++ /dev/null @@ -1,38 +0,0 @@ -# - -# -# Copyright (c) 2005, 2008, 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. -# -# - -# Define library interface. - -SUNWprivate_1.1 { - global: - Jagent_create; - Jagent_destroy; - Jframe_iter; - #Jget_vframe; - #Jlookup_by_regs; - local: - *; -}; diff --git a/hotspot/make/solaris/makefiles/mapfile-vers-jvm_dtrace b/hotspot/make/solaris/makefiles/mapfile-vers-jvm_dtrace deleted file mode 100644 index f9aaa19ba9d..00000000000 --- a/hotspot/make/solaris/makefiles/mapfile-vers-jvm_dtrace +++ /dev/null @@ -1,37 +0,0 @@ -# - -# -# Copyright (c) 2006, 2008, 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. -# -# - -# Define library interface for JVM-DTrace interface - -SUNWprivate_1.1 { - global: - jvm_attach; - jvm_get_last_error; - jvm_enable_dtprobes; - jvm_detach; - local: - *; -}; diff --git a/hotspot/make/solaris/makefiles/optimized.make b/hotspot/make/solaris/makefiles/optimized.make deleted file mode 100644 index f353628aec8..00000000000 --- a/hotspot/make/solaris/makefiles/optimized.make +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# Sets make macros for making optimized version of HotSpot VM -# (This is the "product", not the "release" version.) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) -ifeq ("${Platform_compiler}", "sparcWorks") - -ifeq ($(COMPILER_REV_NUMERIC), 510) -# CC 5.10 has bug XXXXX with -xO4 -OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2) -endif # COMPILER_REV_NUMERIC == 510 - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) -# dtrace cannot handle tail call optimization (6672627, 6693876) -OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT) -endif # COMPILER_NUMERIC_REV >= 509 - -# Workaround SS11 bug 6345274 (all platforms) (Fixed in SS11 patch and SS12) -ifeq ($(COMPILER_REV_NUMERIC),508) -OPT_CFLAGS/ciTypeFlow.o = $(OPT_CFLAGS/O2) -endif # COMPILER_REV_NUMERIC == 508 - -endif # Platform_compiler == sparcWorks - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) - -# Linker mapfiles -MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers - -# This mapfile is only needed when compiling with dtrace support, -# and mustn't be otherwise. -MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE) - -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -VERSION = optimized diff --git a/hotspot/make/solaris/makefiles/product.make b/hotspot/make/solaris/makefiles/product.make deleted file mode 100644 index b36159fdcc8..00000000000 --- a/hotspot/make/solaris/makefiles/product.make +++ /dev/null @@ -1,103 +0,0 @@ -# -# 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 -# 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. -# -# - -# Sets make macros for making optimized version of HotSpot VM -# (This is the "product", not the "release" version.) - -# Compiler specific OPT_CFLAGS are passed in from gcc.make, sparcWorks.make -OPT_CFLAGS/DEFAULT= $(OPT_CFLAGS) -OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) - -# Workaround for a bug in dtrace. If ciEnv::post_compiled_method_load_event() -# is inlined, the resulting dtrace object file needs a reference to this -# function, whose symbol name is too long for dtrace. So disable inlining -# for this method for now. (fix this when dtrace bug 6258412 is fixed) -ifndef USE_GCC -OPT_CFLAGS/ciEnv.o = $(OPT_CFLAGS) -xinline=no%__1cFciEnvbFpost_compiled_method_load_event6MpnHnmethod__v_ -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/ciEnv.o += -g0 -xs -endif -endif - -# Need extra inlining to get oop_ps_push_contents functions to perform well enough. -ifndef USE_GCC -OPT_CFLAGS/psPromotionManager.o = $(OPT_CFLAGS) -W2,-Ainline:inc=1000 -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/psPromotionManager.o += -g0 -xs -endif -endif - -# (OPT_CFLAGS/SLOWER is also available, to alter compilation of buggy files) -ifeq ("${Platform_compiler}", "sparcWorks") - -ifeq ($(COMPILER_REV_NUMERIC), 510) -# CC 5.10 has bug XXXXX with -xO4 -OPT_CFLAGS/jvmtiClassFileReconstituter.o = $(OPT_CFLAGS/O2) -# Avoid apparent crash because of corrupted methodHandle in a tail call -OPT_CFLAGS/simpleThresholdPolicy.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT) -endif # COMPILER_REV_NUMERIC == 510 - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) -# dtrace cannot handle tail call optimization (6672627, 6693876) -OPT_CFLAGS/jni.o = $(OPT_CFLAGS/DEFAULT) $(OPT_CCFLAGS/NO_TAIL_CALL_OPT) -# The -g0 -xs flag is added to OPT_CFLAGS in sparcWorks.make, but lost in case of -# per-file overrides of OPT_CFLAGS. Restore it here. This is mainly needed -# to provide a good baseline to compare the new build against. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/jni.o += -g0 -xs -endif -endif # COMPILER_NUMERIC_REV >= 509 - -# Workaround SS11 bug 6345274 (all platforms) (Fixed in SS11 patch and SS12) -ifeq ($(COMPILER_REV_NUMERIC),508) -OPT_CFLAGS/ciTypeFlow.o = $(OPT_CFLAGS/O2) -endif # COMPILER_REV_NUMERIC == 508 - -endif # Platform_compiler == sparcWorks - -# If you set HOTSPARC_GENERIC=yes, you disable all OPT_CFLAGS settings -CFLAGS$(HOTSPARC_GENERIC) += $(OPT_CFLAGS/BYFILE) -# Set the environment variable HOTSPARC_GENERIC to "true" -# to inhibit the effect of the previous line on CFLAGS. - -# Linker mapfiles -MAPFILE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers - -ifndef USE_GCC -# This mapfile is only needed when compiling with dtrace support, -# and mustn't be otherwise. -MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE) - -endif - -# If we can create .debuginfo files, then the VM is stripped in vm.make -# and this macro is not used. -# LINK_LIB.CXX/POST_HOOK += $(STRIP_LIB.CXX/POST_HOOK) - -SYSDEFS += -DPRODUCT -VERSION = optimized diff --git a/hotspot/make/solaris/makefiles/reorder_CORE_amd64 b/hotspot/make/solaris/makefiles/reorder_CORE_amd64 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/hotspot/make/solaris/makefiles/rules.make b/hotspot/make/solaris/makefiles/rules.make deleted file mode 100644 index a35b9dacd8c..00000000000 --- a/hotspot/make/solaris/makefiles/rules.make +++ /dev/null @@ -1,200 +0,0 @@ -# -# Copyright (c) 2000, 2014, 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. -# -# - -# Common rules/macros for the vm, adlc. - -# Tell make that .cpp is important -.SUFFIXES: .cpp $(SUFFIXES) - -DEMANGLER = c++filt -DEMANGLE = $(DEMANGLER) < $@ > .$@ && $(MV) -f .$@ $@ - -# $(CC) is the c compiler (cc/gcc), $(CXX) is the c++ compiler (CC/g++). -CC_COMPILE = $(CC) $(CXXFLAGS) $(CFLAGS) -CXX_COMPILE = $(CXX) $(CXXFLAGS) $(CFLAGS) - -AS.S = $(AS) $(ASFLAGS) - -COMPILE.CC = $(CC_COMPILE) -c -GENASM.CC = $(CC_COMPILE) -S -LINK.CC = $(CC) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -LINK_LIB.CC = $(CC) $(LFLAGS) $(SHARED_FLAG) -PREPROCESS.CC = $(CC_COMPILE) -E - -COMPILE.CXX = $(CXX_COMPILE) -c -GENASM.CXX = $(CXX_COMPILE) -S -LINK.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) $(PROF_AOUT_FLAGS) -LINK_NOPROF.CXX = $(CXX) $(LFLAGS) $(AOUT_FLAGS) -LINK_LIB.CXX = $(CXX) $(LFLAGS) $(SHARED_FLAG) -PREPROCESS.CXX = $(CXX_COMPILE) -E - -# Effect of REMOVE_TARGET is to delete out-of-date files during "gnumake -k". -REMOVE_TARGET = rm -f $@ - -# Note use of ALT_BOOTDIR to explicitly specify location of java and -# javac; this is the same environment variable used in the J2SE build -# process for overriding the default spec, which is BOOTDIR. -# Note also that we fall back to using JAVA_HOME if neither of these is -# specified. - -ifdef ALT_BOOTDIR - -RUN.JAVA = $(ALT_BOOTDIR)/bin/java -RUN.JAVAP = $(ALT_BOOTDIR)/bin/javap -RUN.JAVAH = $(ALT_BOOTDIR)/bin/javah -RUN.JAR = $(ALT_BOOTDIR)/bin/jar -COMPILE.JAVAC = $(ALT_BOOTDIR)/bin/javac -COMPILE.RMIC = $(ALT_BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(ALT_BOOTDIR) - -else - -ifdef BOOTDIR - -RUN.JAVA = $(BOOTDIR)/bin/java -RUN.JAVAP = $(BOOTDIR)/bin/javap -RUN.JAVAH = $(BOOTDIR)/bin/javah -RUN.JAR = $(BOOTDIR)/bin/jar -COMPILE.JAVAC = $(BOOTDIR)/bin/javac -COMPILE.RMIC = $(BOOTDIR)/bin/rmic -BOOT_JAVA_HOME = $(BOOTDIR) - -else - -ifdef JAVA_HOME - -RUN.JAVA = $(JAVA_HOME)/bin/java -RUN.JAVAP = $(JAVA_HOME)/bin/javap -RUN.JAVAH = $(JAVA_HOME)/bin/javah -RUN.JAR = $(JAVA_HOME)/bin/jar -COMPILE.JAVAC = $(JAVA_HOME)/bin/javac -COMPILE.RMIC = $(JAVA_HOME)/bin/rmic -BOOT_JAVA_HOME = $(JAVA_HOME) - -else - -# take from the PATH, if ALT_BOOTDIR, BOOTDIR and JAVA_HOME are not defined - -RUN.JAVA = java -RUN.JAVAP = javap -RUN.JAVAH = javah -RUN.JAR = jar -COMPILE.JAVAC = javac -COMPILE.RMIC = rmic - -endif -endif -endif - -COMPILE.JAVAC += $(BOOTSTRAP_JAVAC_FLAGS) - -SUM = /usr/bin/sum - -# 'gmake MAKE_VERBOSE=y' gives all the gory details. -QUIETLY$(MAKE_VERBOSE) = @ -RUN.JAR$(MAKE_VERBOSE) += >/dev/null - -# Settings for javac -JAVAC_FLAGS = -g -encoding ascii - -# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system) -# Fall back to the values here if it's not set (hotspot only builds) -ifeq ($(BOOT_JDK_SOURCETARGET),) -BOOTSTRAP_SOURCETARGET := -source 8 -target 8 -else -BOOTSTRAP_SOURCETARGET := $(BOOT_JDK_SOURCETARGET) -endif - -BOOTSTRAP_JAVAC_FLAGS = $(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET) - -# With parallel makes, print a message at the end of compilation. -ifeq ($(findstring j,$(MFLAGS)),j) -COMPILE_DONE = && { echo Done with $<; } -endif - -# Include NONPIC_OBJ_FILES definition -ifndef LP64 -include $(GAMMADIR)/make/pic.make -endif - -include $(GAMMADIR)/make/altsrc.make - -# Sun compiler for 64 bit Solaris does not support building non-PIC object files. -ifdef LP64 -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE) -else -%.o: %.cpp - @echo $(LOG_INFO) Compiling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(if $(findstring $@, $(NONPIC_OBJ_FILES)), \ - $(subst $(VM_PICFLAG), ,$(COMPILE.CXX)) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE), \ - $(COMPILE.CXX) $(DEPFLAGS) -o $@ $< $(COMPILE_DONE)) -endif - -%.o: %.s - @echo $(LOG_INFO) Assembling $< - $(QUIETLY) $(REMOVE_TARGET) - $(QUIETLY) $(AS.S) -o $@ $< $(COMPILE_DONE) - -%.s: %.cpp - @echo $(LOG_INFO) Generating assembly for $< - $(QUIETLY) $(GENASM.CXX) -o $@ $< - $(QUIETLY) $(DEMANGLE) $(COMPILE_DONE) - -# Intermediate files (for debugging macros) -%.i: %.cpp - @echo $(LOG_INFO) Preprocessing $< to $@ - $(QUIETLY) $(PREPROCESS.CXX) $< > $@ $(COMPILE_DONE) - -# Override gnumake built-in rules which do sccs get operations badly. -# (They put the checked out code in the current directory, not in the -# directory of the original file.) Since this is a symptom of a teamware -# failure, and since not all problems can be detected by gnumake due -# to incomplete dependency checking... just complain and stop. -%:: s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -%:: SCCS/s.% - @echo "=========================================================" - @echo File $@ - @echo is out of date with respect to its SCCS file. - @echo This file may be from an unresolved Teamware conflict. - @echo This is also a symptom of a Teamware bringover/putback failure - @echo in which SCCS files are updated but not checked out. - @echo Check for other out of date files in your workspace. - @echo "=========================================================" - @exit 666 - -.PHONY: default diff --git a/hotspot/make/solaris/makefiles/sparc.make b/hotspot/make/solaris/makefiles/sparc.make deleted file mode 100644 index ff507f2fab8..00000000000 --- a/hotspot/make/solaris/makefiles/sparc.make +++ /dev/null @@ -1,124 +0,0 @@ -# -# Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -Obj_Files += solaris_sparc.o -ASFLAGS += $(AS_ARCHFLAG) - -ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 505), 1) -# For 5.2 ad_sparc file is compiled with -O2 %%%% remove when adlc is fixed -OPT_CFLAGS/ad_sparc.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/dfa_sparc.o = $(OPT_CFLAGS/SLOWER) -# CC drops core on systemDictionary.o in -xO4 mode -OPT_CFLAGS/systemDictionary.o = $(OPT_CFLAGS/SLOWER) -# SC5.0 bug 4284168 -OPT_CFLAGS/carRememberedSet.o = $(OPT_CFLAGS/O2) -# Temporarily drop the optimization level for compiling -# jniHandles.cpp to O3 from O4; see bug 4309181 -OPT_CFLAGS/jniHandles.o = $(OPT_CFLAGS/O2) -# CC brings an US-II to its knees compiling the vmStructs asserts under -xO4 -OPT_CFLAGS/vmStructs.o = $(OPT_CFLAGS/O2) -endif # COMPILER_REV_NUMERIC < 505 -else -# Options for gcc -OPT_CFLAGS/ad_sparc.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/dfa_sparc.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/systemDictionary.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/carRememberedSet.o = $(OPT_CFLAGS/O2) -OPT_CFLAGS/jniHandles.o = $(OPT_CFLAGS/O2) -OPT_CFLAGS/vmStructs.o = $(OPT_CFLAGS/O2) -endif - -# File-specific adjustments to the PICFLAG, applicable only to SPARC, -# which has a very tight limit on global constant references. - -# Old files which seemed hot at one point or another: -#PICFLAG/runtime.o = $(PICFLAG/BETTER) -#PICFLAG/generateOopMap.o = $(PICFLAG/BETTER) -#PICFLAG/thread.o = $(PICFLAG/BETTER) -#PICFLAG/parse2.o = $(PICFLAG/BETTER) -#PICFLAG/parse1.o = $(PICFLAG/BETTER) -#PICFLAG/universe.o = $(PICFLAG/BETTER) -#PICFLAG/safepoint.o = $(PICFLAG/BETTER) -#PICFLAG/parse3.o = $(PICFLAG/BETTER) -#PICFLAG/compile.o = $(PICFLAG/BETTER) -#PICFLAG/codeBlob.o = $(PICFLAG/BETTER) -#PICFLAG/mutexLocker.o = $(PICFLAG/BETTER) -#PICFLAG/nativeInst_sparc.o = $(PICFLAG/BETTER) -#PICFLAG/methodLiveness.o = $(PICFLAG/BETTER) -#PICFLAG/synchronizer.o = $(PICFLAG/BETTER) -#PICFLAG/method.o = $(PICFLAG/BETTER) -#PICFLAG/space.o = $(PICFLAG/BETTER) -#PICFLAG/interpreterRT_sparc.o = $(PICFLAG/BETTER) -#PICFLAG/generation.o = $(PICFLAG/BETTER) -#PICFLAG/markSweep.o = $(PICFLAG/BETTER) -#PICFLAG/parseHelper.o = $(PICFLAG/BETTER) - -# Confirmed by function-level profiling: -PICFLAG/scavenge.o = $(PICFLAG/BETTER) -PICFLAG/instanceKlass.o = $(PICFLAG/BETTER) -PICFLAG/frame.o = $(PICFLAG/BETTER) -PICFLAG/phaseX.o = $(PICFLAG/BETTER) -PICFLAG/lookupCache.o = $(PICFLAG/BETTER) -PICFLAG/chaitin.o = $(PICFLAG/BETTER) -PICFLAG/type.o = $(PICFLAG/BETTER) -PICFLAG/jvm.o = $(PICFLAG/BETTER) -PICFLAG/jni.o = $(PICFLAG/BETTER) -PICFLAG/matcher.o = $(PICFLAG/BETTER) - -# New from module-level profiling (trustworthy?): -PICFLAG/rememberedSet.o = $(PICFLAG/BETTER) -PICFLAG/frame_sparc.o = $(PICFLAG/BETTER) -PICFLAG/live.o = $(PICFLAG/BETTER) -PICFLAG/vectset.o = $(PICFLAG/BETTER) -PICFLAG/objArrayKlass.o = $(PICFLAG/BETTER) -PICFLAG/do_call.o = $(PICFLAG/BETTER) -PICFLAG/loopnode.o = $(PICFLAG/BETTER) -PICFLAG/cfgnode.o = $(PICFLAG/BETTER) -PICFLAG/ifg.o = $(PICFLAG/BETTER) -PICFLAG/vframe.o = $(PICFLAG/BETTER) -PICFLAG/postaloc.o = $(PICFLAG/BETTER) -PICFLAG/carRememberedSet.o = $(PICFLAG/BETTER) -PICFLAG/gcm.o = $(PICFLAG/BETTER) -PICFLAG/coalesce.o = $(PICFLAG/BETTER) -PICFLAG/oop.o = $(PICFLAG/BETTER) -PICFLAG/oopMap.o = $(PICFLAG/BETTER) -PICFLAG/resourceArea.o = $(PICFLAG/BETTER) -PICFLAG/node.o = $(PICFLAG/BETTER) -PICFLAG/dict.o = $(PICFLAG/BETTER) -PICFLAG/domgraph.o = $(PICFLAG/BETTER) -PICFLAG/dfa_sparc.o = $(PICFLAG/BETTER) -PICFLAG/block.o = $(PICFLAG/BETTER) -PICFLAG/javaClasses.o = $(PICFLAG/BETTER) - -# New hot files: -PICFLAG/classes.o = $(PICFLAG/BETTER) -#PICFLAG/ad_sparc.o = $(PICFLAG/BETTER) -PICFLAG/nmethod.o = $(PICFLAG/BETTER) -PICFLAG/relocInfo.o = $(PICFLAG/BETTER) -PICFLAG/codeBuffer_sparc.o = $(PICFLAG/BETTER) -PICFLAG/callnode.o = $(PICFLAG/BETTER) -PICFLAG/multnode.o = $(PICFLAG/BETTER) -PICFLAG/os_solaris.o = $(PICFLAG/BETTER) -PICFLAG/typeArrayKlass.o = $(PICFLAG/BETTER) diff --git a/hotspot/make/solaris/makefiles/sparcWorks.make b/hotspot/make/solaris/makefiles/sparcWorks.make deleted file mode 100644 index 5c66b2f3d20..00000000000 --- a/hotspot/make/solaris/makefiles/sparcWorks.make +++ /dev/null @@ -1,565 +0,0 @@ -# -# 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 -# 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. -# -# - -# If a SPEC is not set already, then use these defaults. -ifeq ($(SPEC),) - # Compiler-specific flags for sparcworks. - CC = cc - CXX = CC - - # Note that this 'as' is an older version of the Sun Studio 'fbe', and will - # use the older style options. The 'fbe' options will match 'cc' and 'CC'. - AS = /usr/ccs/bin/as - - NM = /usr/ccs/bin/nm - NAWK = /bin/nawk - - MCS = /usr/ccs/bin/mcs - STRIP = /usr/ccs/bin/strip -endif - -# Check for the versions of C++ and C compilers ($CXX and $CC) used. - -# Get the last thing on the line that looks like x.x+ (x is a digit). -COMPILER_REV := \ -$(shell $(CXX) -V 2>&1 | sed -n 's/^.*[ ,\t]C++[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p') -CC_COMPILER_REV := \ -$(shell $(CC) -V 2>&1 | sed -n 's/^.*[ ,\t]C[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p') - -# Pick which compiler is validated -# Validated compiler for JDK9 is SS12.4 (5.13) -VALIDATED_COMPILER_REVS := 5.13 -VALIDATED_CC_COMPILER_REVS := 5.13 - -# Warning messages about not using the above validated versions -ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := $(strip ${VALIDATED_COMPILER_REVS}) -ifeq ($(filter ${ENFORCE_COMPILER_REV},${COMPILER_REV}),) -PRINTABLE_CC_REVS := $(subst $(shell echo ' '), or ,${ENFORCE_COMPILER_REV}) -dummy_var_to_enforce_compiler_rev := $(shell \ - echo >&2 WARNING: You are using CC version ${COMPILER_REV} and \ - should be using version ${PRINTABLE_CC_REVS}.; \ - echo >&2 Set ENFORCE_COMPILER_REV=${COMPILER_REV} to avoid this \ - warning.) -endif - -ENFORCE_CC_COMPILER_REV${ENFORCE_CC_COMPILER_REV} := $(strip ${VALIDATED_CC_COMPILER_REVS}) -ifeq ($(filter ${ENFORCE_CC_COMPILER_REV},${CC_COMPILER_REV}),) -PRINTABLE_C_REVS := $(subst $(shell echo ' '), or ,${ENFORCE_CC_COMPILER_REV}) -dummy_var_to_enforce_c_compiler_rev := $(shell \ - echo >&2 WARNING: You are using cc version ${CC_COMPILER_REV} and \ - should be using version ${PRINTABLE_C_REVS}.; \ - echo >&2 Set ENFORCE_CC_COMPILER_REV=${CC_COMPILER_REV} to avoid this \ - warning.) -endif - -COMPILER_REV_NUMERIC := $(shell echo $(COMPILER_REV) | awk -F. '{ print $$1 * 100 + $$2 }') - -# Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/04 -# and newer; objects with a dependency on this symbol will not run on older -# Solaris 8. -JVM_FAIL_IF_UNDEFINED = __fabsf - -JVM_CHECK_SYMBOLS = $(NM) -u -p $(LIBJVM.o) | \ - $(NAWK) -v f="${JVM_FAIL_IF_UNDEFINED}" \ - 'BEGIN { c=split(f,s); rc=0; } \ - /:$$/ { file = $$1; } \ - /[^:]$$/ { for(n=1;n<=c;++n) { \ - if($$1==s[n]) { \ - printf("JVM_CHECK_SYMBOLS: %s contains illegal symbol %s\n", \ - file,$$1); \ - rc=1; \ - } \ - } \ - } \ - END { exit rc; }' - -LINK_LIB.CXX/PRE_HOOK += $(JVM_CHECK_SYMBOLS) || exit 1; - -# New architecture options started in SS12 (5.9), we need both styles to build. -# The older arch options for SS11 (5.8) or older and also for /usr/ccs/bin/as. -# Note: default for 32bit sparc is now the same as v8plus, so the -# settings below have changed all 32bit sparc builds to be v8plus. -ARCHFLAG_OLD/sparc = -xarch=v8plus -ARCHFLAG_NEW/sparc = -m32 -xarch=sparc -ARCHFLAG_OLD/sparcv9 = -xarch=v9 -ARCHFLAG_NEW/sparcv9 = -m64 -xarch=sparc -ARCHFLAG_OLD/i486 = -ARCHFLAG_NEW/i486 = -m32 -ARCHFLAG_OLD/amd64 = -xarch=amd64 -ARCHFLAG_NEW/amd64 = -m64 - -# Select the ARCHFLAGs and other SS12 (5.9) options -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) - ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc) - ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9) - ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486) - ARCHFLAG/amd64 = $(ARCHFLAG_NEW/amd64) -else - ARCHFLAG/sparc = $(ARCHFLAG_OLD/sparc) - ARCHFLAG/sparcv9 = $(ARCHFLAG_OLD/sparcv9) - ARCHFLAG/i486 = $(ARCHFLAG_OLD/i486) - ARCHFLAG/amd64 = $(ARCHFLAG_OLD/amd64) -endif - -# ARCHFLAGS for the current build arch -ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) -AS_ARCHFLAG = $(ARCHFLAG_OLD/$(BUILDARCH)) - -# Optional sub-directory in /usr/lib where BUILDARCH libraries are kept. -ISA_DIR=$(ISA_DIR/$(BUILDARCH)) -ISA_DIR/sparcv9=/sparcv9 -ISA_DIR/amd64=/amd64 - -# Use these to work around compiler bugs: -OPT_CFLAGS/SLOWER=-xO3 -OPT_CFLAGS/O2=-xO2 -OPT_CFLAGS/NOOPT=-xO1 - -# Flags for creating the dependency files. -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) -DEPFLAGS = -xMMD -xMF $(DEP_DIR)/$(@:%=%.d) -endif - -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp. -CFLAGS += -DDONT_USE_PRECOMPILED_HEADER - -# Compiler warnings are treated as errors -WARNINGS_ARE_ERRORS ?= -xwe -CFLAGS_WARN = $(WARNINGS_ARE_ERRORS) - -################################################ -# Begin current (>=5.9) Forte compiler options # -################################################# - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) -ifeq ($(Platform_arch), x86) -OPT_CFLAGS/NO_TAIL_CALL_OPT = -Wu,-O~yz -OPT_CCFLAGS/NO_TAIL_CALL_OPT = -Qoption ube -O~yz -OPT_CFLAGS/stubGenerator_x86_32.o = $(OPT_CFLAGS) -xspace -OPT_CFLAGS/stubGenerator_x86_64.o = $(OPT_CFLAGS) -xspace -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/stubGenerator_x86_32.o += -g0 -xs - OPT_CFLAGS/stubGenerator_x86_64.o += -g0 -xs -endif -endif # Platform_arch == x86 -ifeq ("${Platform_arch}", "sparc") -OPT_CFLAGS/stubGenerator_sparc.o = $(OPT_CFLAGS) -xspace -# The debug flag is added to OPT_CFLAGS, but lost in case of per-file overrides -# of OPT_CFLAGS. Restore it here. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS/stubGenerator_sparc.o += -g0 -xs -endif -endif -endif # COMPILER_REV_NUMERIC >= 509 - -################################################# -# Begin current (>=5.6) Forte compiler options # -################################################# - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 506), 1) - -ifeq ("${Platform_arch}", "sparc") - -# We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) -ifndef LP64 -CFLAGS += -xmemalign=4s -endif - -endif - -endif - -################################################# -# Begin current (>=5.5) Forte compiler options # -################################################# - -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LIB_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) - -ifeq ("${Platform_arch}", "sparc") - -# Flags for Optimization - -# [phh] Commented out pending verification that we do indeed want -# to potentially bias against u1 and u3 targets. -#CFLAGS += -xchip=ultra2 - -OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) - -endif # sparc - -ifeq ("${Platform_arch_model}", "x86_32") - -OPT_CFLAGS=-xtarget=pentium -xO4 $(EXTRA_OPT_CFLAGS) - -endif # 32bit x86 - -ifeq ("${Platform_arch_model}", "x86_64") - -ASFLAGS += $(AS_ARCHFLAG) -CFLAGS += $(ARCHFLAG/amd64) -# this one seemed useless -LFLAGS_VM += $(ARCHFLAG/amd64) -# this one worked -LFLAGS += $(ARCHFLAG/amd64) -AOUT_FLAGS += $(ARCHFLAG/amd64) - -# -xO3 is faster than -xO4 on specjbb with SS10 compiler -OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) - -endif # 64bit x86 - -# Inline functions -CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_${Platform_arch}/vm/solaris_${Platform_arch_model}.il - -# no more exceptions -CFLAGS/NOEX=-features=no%except - - -# avoid compilation problems arising from fact that C++ compiler tries -# to search for external template definition by just compiling additional -# source files in th same context -CFLAGS += -template=no%extdef - -# Reduce code bloat by reverting back to 5.0 behavior for static initializers -CFLAGS += -features=no%split_init - -# Use -D_Crun_inline_placement so we don't get references to -# __1c2n6FIpv_0_ or void*operator new(unsigned,void*) -# This avoids the hard requirement of the newer Solaris C++ runtime patches. -# NOTE: This is an undocumented feature of the SS10 compiler. See 6306698. -CFLAGS += -D_Crun_inline_placement - -# PIC is safer for SPARC, and is considerably slower -# a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC" -PICFLAG = -KPIC -PICFLAG/DEFAULT = $(PICFLAG) -# [RGV] Need to figure which files to remove to get link to work -#PICFLAG/BETTER = -pic -PICFLAG/BETTER = $(PICFLAG/DEFAULT) -PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) - -# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. -MAPFLAG = -M FILENAME - -# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj -SONAMEFLAG = -h SONAME - -# Build shared library -SHARED_FLAG = -G - -# We don't need libCstd.so and librwtools7.so, only libCrun.so -CFLAGS += -library=%none -LFLAGS += -library=%none - -LFLAGS += -mt - -endif # COMPILER_REV_NUMERIC >= 505 - -###################################### -# End 5.5 Forte compiler options # -###################################### - -###################################### -# Begin 5.2 Forte compiler options # -###################################### - -ifeq ($(COMPILER_REV_NUMERIC), 502) - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LIB_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) - -ifeq ("${Platform_arch}", "sparc") - -# Flags for Optimization - -# [phh] Commented out pending verification that we do indeed want -# to potentially bias against u1 and u3 targets. -#CFLAGS += -xchip=ultra2 - -ifdef LP64 -# SC5.0 tools on v9 are flakey at -xO4 -# [phh] Is this still true for 6.1? -OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS) -else -OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) -endif - -endif # sparc - -ifeq ("${Platform_arch_model}", "x86_32") - -OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS) - -# SC5.0 tools on x86 are flakey at -xO4 -# [phh] Is this still true for 6.1? -OPT_CFLAGS+=-xO3 - -endif # 32bit x86 - -# no more exceptions -CFLAGS/NOEX=-noex - -# Inline functions -CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_${Platform_arch}/vm/solaris_${Platform_arch_model}.il - -# Reduce code bloat by reverting back to 5.0 behavior for static initializers -CFLAGS += -Qoption ccfe -one_static_init - -# PIC is safer for SPARC, and is considerably slower -# a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC" -PICFLAG = -KPIC -PICFLAG/DEFAULT = $(PICFLAG) -# [RGV] Need to figure which files to remove to get link to work -#PICFLAG/BETTER = -pic -PICFLAG/BETTER = $(PICFLAG/DEFAULT) -PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) - -# Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file. -MAPFLAG = -M FILENAME - -# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj -SONAMEFLAG = -h SONAME - -# Build shared library -SHARED_FLAG = -G - -# Would be better if these weren't needed, since we link with CC, but -# at present removing them causes run-time errors -LFLAGS += -library=Crun -LIBS += -library=Crun -lCrun - -endif # COMPILER_REV_NUMERIC == 502 - -################################## -# End 5.2 Forte compiler options # -################################## - -################################## -# Begin old 5.1 compiler options # -################################## -ifeq ($(COMPILER_REV_NUMERIC), 501) - -_JUNK_ := $(shell echo >&2 \ - "*** ERROR: sparkWorks.make incomplete for 5.1 compiler") - @exit 1 -endif -################################## -# End old 5.1 compiler options # -################################## - -################################## -# Begin old 5.0 compiler options # -################################## - -ifeq (${COMPILER_REV_NUMERIC}, 500) - -# Had to hoist this higher apparently because of other changes. Must -# come before -xarch specification. -# NOTE: native says optimize for the machine doing the compile, bad news. -CFLAGS += -xtarget=native - -CFLAGS += $(ARCHFLAG) -AOUT_FLAGS += $(ARCHFLAG) -LIB_FLAGS += $(ARCHFLAG) -LFLAGS += $(ARCHFLAG) - -CFLAGS += -library=iostream -LFLAGS += -library=iostream -library=Crun -LIBS += -library=iostream -library=Crun -lCrun - -# Flags for Optimization -ifdef LP64 -# SC5.0 tools on v9 are flakey at -xO4 -OPT_CFLAGS=-xO3 $(EXTRA_OPT_CFLAGS) -else -OPT_CFLAGS=-xO4 $(EXTRA_OPT_CFLAGS) -endif - -ifeq ("${Platform_arch}", "sparc") - -CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.il - -endif # sparc - -ifeq ("${Platform_arch_model}", "x86_32") -OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS) -ifeq ("${COMPILER_REV_NUMERIC}", "500") -# SC5.0 tools on x86 are flakey at -xO4 -OPT_CFLAGS+=-xO3 -else -OPT_CFLAGS+=-xO4 -endif - -CFLAGS += $(GAMMADIR)/src/os_cpu/solaris_x86/vm/solaris_x86_32.il - -endif # 32bit x86 - -# The following options run into misaligned ldd problem (raj) -#OPT_CFLAGS = -fast -O4 $(ARCHFLAG/sparc) -xchip=ultra - -# no more exceptions -CFLAGS/NOEX=-noex - -# PIC is safer for SPARC, and is considerably slower -# a file foo.o which wants to compile -pic can set "PICFLAG/foo.o = -PIC" -PICFLAG = -PIC -PICFLAG/DEFAULT = $(PICFLAG) -# [RGV] Need to figure which files to remove to get link to work -#PICFLAG/BETTER = -pic -PICFLAG/BETTER = $(PICFLAG/DEFAULT) -PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) - -endif # COMPILER_REV_NUMERIC = 500 - -################################ -# End old 5.0 compiler options # -################################ - -ifeq ("${COMPILER_REV_NUMERIC}", "402") -# 4.2 COMPILERS SHOULD NO LONGER BE USED -_JUNK_ := $(shell echo >&2 \ - "*** ERROR: SC4.2 compilers are not supported by this code base!") - @exit 1 -endif - -# do not include shared lib path in a.outs -AOUT_FLAGS += -norunpath -LFLAGS_VM = -norunpath -z noversion - -# need position-indep-code for shared libraries -# (ild appears to get errors on PIC code, so we'll try non-PIC for debug) -ifeq ($(PICFLAGS),DEFAULT) -VM_PICFLAG/LIBJVM = $(PICFLAG/DEFAULT) -else -VM_PICFLAG/LIBJVM = $(PICFLAG/BYFILE) -endif -VM_PICFLAG/AOUT = - -VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) -CFLAGS += $(VM_PICFLAG) - -# less dynamic linking (no PLTs, please) -#LIB_FLAGS += $(LINK_MODE) -# %%%%% despite -znodefs, -Bsymbolic gets link errors -- Rose - -LINK_MODE = $(LINK_MODE/$(VERSION)) -LINK_MODE/debug = -LINK_MODE/optimized = -Bsymbolic -znodefs - -# Have thread local errnos -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) -CFLAGS += -mt -else -CFLAGS += -D_REENTRANT -endif - -ifdef CC_INTERP -# C++ Interpreter -CFLAGS += -DCC_INTERP -endif - -# Flags for Debugging -# The -g0 setting allows the C++ frontend to inline, which is a big win. -# The -xs setting disables 'lazy debug info' which puts everything in -# the .so instead of requiring the '.o' files. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - OPT_CFLAGS += -g0 -xs -endif -DEBUG_CFLAGS = -g -FASTDEBUG_CFLAGS = -g0 -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - DEBUG_CFLAGS += -xs - FASTDEBUG_CFLAGS += -xs -endif - -# Enable the following CFLAGS additions if you need to compare the -# built ELF objects. -# -# The -g option makes static data global and the "-Qoption ccfe -# -xglobalstatic" option tells the compiler to not globalize static -# data using a unique globalization prefix. Instead force the use of -# a static globalization prefix based on the source filepath so the -# objects from two identical compilations are the same. -# EXTRA_CFLAGS only covers vm_version.cpp for some reason -#EXTRA_CFLAGS += -Qoption ccfe -xglobalstatic -#OPT_CFLAGS += -Qoption ccfe -xglobalstatic -#DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic -#FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic - -ifeq (${COMPILER_REV_NUMERIC}, 502) -COMPILER_DATE := $(shell $(CXX) -V 2>&1 | sed -n '/^.*[ ]C++[ ]\([1-9]\.[0-9][0-9]*\)/p' | awk '{ print $$NF; }') -ifeq (${COMPILER_DATE}, 2001/01/31) -# disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy -# use an innocuous value because it will get -g if it's empty -FASTDEBUG_CFLAGS = -c -endif -endif - -# Uncomment or 'gmake CFLAGS_BROWSE=-sbfast' to get source browser information. -# CFLAGS_BROWSE = -sbfast -CFLAGS += $(CFLAGS_BROWSE) - -# ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7) -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1) - # use ild when debugging (but when optimizing we want reproducible results) - ILDFLAG = $(ILDFLAG/$(VERSION)) - ILDFLAG/debug = -xildon - ILDFLAG/optimized = - AOUT_FLAGS += $(ILDFLAG) -endif - -# Where to put the *.o files (a.out, or shared library)? -LINK_INTO = $(LINK_INTO/$(VERSION)) -LINK_INTO/debug = LIBJVM -LINK_INTO/optimized = LIBJVM - -# We link the debug version into the a.out because: -# 1. ild works on a.out but not shared libraries, and using ild -# can cut rebuild times by 25% for small changes. (ILD is gone in SS11) -# 2. dbx cannot gracefully set breakpoints in shared libraries -# - -# apply this setting to link into the shared library even in the debug version: -ifdef LP64 -LINK_INTO = LIBJVM -else -#LINK_INTO = LIBJVM -endif - -# Also, strip debug and line number information (worth about 1.7Mb). -# If we can create .debuginfo files, then the VM is stripped in vm.make -# and this macro is not used. -STRIP_LIB.CXX/POST_HOOK = $(STRIP) -x $@ || exit 1; -# STRIP_LIB.CXX/POST_HOOK is incorporated into LINK_LIB.CXX/POST_HOOK -# in certain configurations, such as product.make. Other configurations, -# such as debug.make, do not include the strip operation. diff --git a/hotspot/make/solaris/makefiles/sparcv9.make b/hotspot/make/solaris/makefiles/sparcv9.make deleted file mode 100644 index ae2fad447f9..00000000000 --- a/hotspot/make/solaris/makefiles/sparcv9.make +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (c) 1999, 2010, 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. -# -# - -ASFLAGS += $(AS_ARCHFLAG) - -ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 505), 1) -# When optimized fully, stubGenerator_sparc.cpp -# has bogus code for the routine -# StubGenerator::generate_flush_callers_register_windows() -OPT_CFLAGS/stubGenerator_sparc.o = $(OPT_CFLAGS/SLOWER) - -# For now ad_sparc file is compiled with -O2 %%%% remove when adlc is fixed -OPT_CFLAGS/ad_sparc.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/dfa_sparc.o = $(OPT_CFLAGS/SLOWER) - -# CC brings an US-II to its knees compiling the vmStructs asserts under -xO4 -OPT_CFLAGS/vmStructs.o = $(OPT_CFLAGS/O2) -endif - -else -#Options for gcc -OPT_CFLAGS/stubGenerator_sparc.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/ad_sparc.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/dfa_sparc.o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/vmStructs.o = $(OPT_CFLAGS/O2) -endif diff --git a/hotspot/make/solaris/makefiles/tiered.make b/hotspot/make/solaris/makefiles/tiered.make deleted file mode 100644 index da79ade9fdc..00000000000 --- a/hotspot/make/solaris/makefiles/tiered.make +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2006, 2008, 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. -# -# - -# Sets make macros for making tiered version of VM - -TYPE=TIERED - -VM_SUBDIR = server - -CFLAGS += -DCOMPILER2 -DCOMPILER1 diff --git a/hotspot/make/solaris/makefiles/top.make b/hotspot/make/solaris/makefiles/top.make deleted file mode 100644 index 0786477af79..00000000000 --- a/hotspot/make/solaris/makefiles/top.make +++ /dev/null @@ -1,141 +0,0 @@ -# -# Copyright (c) 1998, 2014, 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. -# -# - -# top.make is included in the Makefile in the build directories. -# It DOES NOT include the vm dependency info in order to be faster. -# Its main job is to implement the incremental form of make lists. -# It also: -# -builds and runs adlc via adlc.make -# -generates JVMTI source and docs via jvmti.make (JSR-163) - -# It assumes the following flags are set: -# CFLAGS Platform_file, Src_Dirs_I, Src_Dirs_V, SYSDEFS, AOUT, Jvm_Obj_Files - -# -- D. Ungar (5/97) from a file by Bill Bush - -# Don't override the built-in $(MAKE). -# Instead, use "gmake" (or "gnumake") from the command line. --Rose -#MAKE = gmake - -include $(GAMMADIR)/make/altsrc.make - -GENERATED = ../generated -VM = $(GAMMADIR)/src/share/vm -Plat_File = $(Platform_file) -CDG = cd $(GENERATED); - -Cached_plat = $(GENERATED)/platform.current - -AD_Dir = $(GENERATED)/adfiles -ADLC = $(AD_Dir)/adlc -AD_Spec = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad) -AD_Src = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc) -AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp -AD_Files = $(AD_Names:%=$(AD_Dir)/%) - -# AD_Files_If_Required/COMPILER1 = ad_stuff -AD_Files_If_Required/COMPILER2 = ad_stuff -AD_Files_If_Required/TIERED = ad_stuff -AD_Files_If_Required = $(AD_Files_If_Required/$(TYPE)) - -# Wierd argument adjustment for "gnumake -j..." -adjust-mflags = $(GENERATED)/adjust-mflags -# If SPEC is set, it's from configure and it's already controlling concurrency -# for us. Skip setting -j with HOTSPOT_BUILD_JOBS. -ifeq ($(SPEC), ) - MFLAGS-adjusted = -r `$(adjust-mflags) "$(MFLAGS)" "$(HOTSPOT_BUILD_JOBS)"` -else - MFLAGS-adjusted = -r $(MFLAGS) -endif - - -# default target: update lists, make vm -# done in stages to force sequential order with parallel make -# - -default: vm_build_preliminaries the_vm - @echo All done. - -# This is an explicit dependency for the sake of parallel makes. -vm_build_preliminaries: checks $(Cached_plat) $(AD_Files_If_Required) jvmti_stuff trace_stuff dtrace_stuff - @# We need a null action here, so implicit rules don't get consulted. - -$(Cached_plat): $(Plat_File) - $(CDG) $(CP) $(Plat_File) $(Cached_plat) - -# make AD files as necessary -ad_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f adlc.make $(MFLAGS-adjusted) - -# generate JVMTI files from the spec -jvmti_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f jvmti.make $(MFLAGS-adjusted) - -# generate trace files -trace_stuff: jvmti_stuff $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f trace.make $(MFLAGS-adjusted) - -dtrace_stuff: $(Cached_plat) $(adjust-mflags) - @$(MAKE) -f dtrace.make dtrace_gen_headers $(MFLAGS-adjusted) GENERATED=$(GENERATED) - -# and the VM: must use other makefile with dependencies included - -# We have to go to great lengths to get control over the -jN argument -# to the recursive invocation of vm.make. The problem is that gnumake -# resets -jN to -j1 for recursive runs. (How helpful.) -# Note that the user must specify the desired parallelism level via a -# command-line or environment variable name HOTSPOT_BUILD_JOBS. -$(adjust-mflags): $(GAMMADIR)/make/$(Platform_os_family)/makefiles/adjust-mflags.sh - @+rm -f $@ $@+ - @+cat $< > $@+ - @+chmod +x $@+ - @+mv $@+ $@ - -the_vm: vm_build_preliminaries $(adjust-mflags) - @$(MAKE) -f vm.make $(MFLAGS-adjusted) - -install: the_vm - @$(MAKE) -f vm.make $@ - -# next rules support "make foo.[oi]" - -%.o %.i %.s: - $(MAKE) -f vm.make $(MFLAGS) $@ - #$(MAKE) -f vm.make $@ - -# this should force everything to be rebuilt -clean: - rm -f $(GENERATED)/*.class - $(MAKE) -f vm.make $(MFLAGS) clean - -# just in case it doesn't, this should do it -realclean: - $(MAKE) -f vm.make $(MFLAGS) clean - rm -fr $(GENERATED) - -.PHONY: default vm_build_preliminaries -.PHONY: lists ad_stuff jvmti_stuff trace_stuff the_vm clean realclean -.PHONY: checks check_os_version install - -.NOTPARALLEL: diff --git a/hotspot/make/solaris/makefiles/trace.make b/hotspot/make/solaris/makefiles/trace.make deleted file mode 100644 index effe34061ce..00000000000 --- a/hotspot/make/solaris/makefiles/trace.make +++ /dev/null @@ -1,119 +0,0 @@ -# -# Copyright (c) 2003, 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. -# -# - -# This makefile (trace.make) is included from the trace.make in the -# build directories. -# -# It knows how to build and run the tools to generate trace files. - -include $(GAMMADIR)/make/solaris/makefiles/rules.make -include $(GAMMADIR)/make/altsrc.make - -# ######################################################################### - -HAS_ALT_SRC := false -ifndef OPENJDK - ifneq ($(wildcard $(HS_ALT_SRC)/share/vm/trace), ) - HAS_ALT_SRC := true - endif -endif - -TOPDIR = $(shell echo `pwd`) -GENERATED = $(TOPDIR)/../generated -JvmtiOutDir = $(GENERATED)/jvmtifiles -TraceOutDir = $(GENERATED)/tracefiles - -TraceAltSrcDir = $(HS_ALT_SRC)/share/vm/trace -TraceSrcDir = $(HS_COMMON_SRC)/share/vm/trace - -# set VPATH so make knows where to look for source files -Src_Dirs_V += $(TraceSrcDir) $(TraceAltSrcDir) -VPATH += $(Src_Dirs_V:%=%:) - -TraceGeneratedNames = \ - traceEventClasses.hpp \ - traceEventIds.hpp \ - traceTypes.hpp - -ifeq ($(HAS_ALT_SRC), true) -TraceGeneratedNames += \ - traceRequestables.hpp \ - traceEventControl.hpp -endif - -TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%) - -XSLT = $(REMOTE) $(RUN.JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -TraceXml = $(TraceSrcDir)/trace.xml -ifeq ($(HAS_ALT_SRC), true) - TraceXml = $(TraceAltSrcDir)/trace.xml -endif - -XML_DEPS = $(TraceXml) $(TraceSrcDir)/tracetypes.xml \ - $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod \ - $(TraceSrcDir)/tracerelationdecls.xml $(TraceSrcDir)/traceevents.xml -ifeq ($(HAS_ALT_SRC), true) - XML_DEPS += $(TraceAltSrcDir)/traceeventscustom.xml \ - $(TraceAltSrcDir)/traceeventtypes.xml -endif - -.PHONY: all clean cleanall - -# ######################################################################### - -all: $(TraceGeneratedFiles) - -GENERATE_CODE= \ - $(QUIETLY) echo $(LOG_INFO) Generating $@; \ - $(XSLT) -IN $(word 1,$^) -XSL $(word 2,$^) -OUT $@ - -$(TraceOutDir)/traceEventIds.hpp: $(TraceXml) $(TraceSrcDir)/traceEventIds.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceTypes.hpp: $(TraceXml) $(TraceSrcDir)/traceTypes.xsl $(XML_DEPS) - $(GENERATE_CODE) - -ifeq ($(HAS_ALT_SRC), false) - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -else - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceRequestables.hpp: $(TraceXml) $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS) - $(GENERATE_CODE) - -$(TraceOutDir)/traceEventControl.hpp: $(TraceXml) $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS) - $(GENERATE_CODE) - -endif - -# ######################################################################### - -clean cleanall: - rm $(TraceGeneratedFiles) diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make deleted file mode 100644 index 270a8ceeda1..00000000000 --- a/hotspot/make/solaris/makefiles/vm.make +++ /dev/null @@ -1,352 +0,0 @@ -# -# Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Rules to build JVM and related libraries, included from vm.make in the build -# directory. - -# Common build rules. -MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles -include $(MAKEFILES_DIR)/rules.make -include $(GAMMADIR)/make/altsrc.make - -default: build - -#---------------------------------------------------------------------- -# Defs - -GENERATED = ../generated -DEP_DIR = $(GENERATED)/dependencies - -# reads the generated files defining the set of .o's and the .o .h dependencies --include $(DEP_DIR)/*.d - -# read machine-specific adjustments (%%% should do this via buildtree.make?) -include $(MAKEFILES_DIR)/$(BUILDARCH).make - -# set VPATH so make knows where to look for source files -# Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm -# The adfiles directory contains ad_.[ch]pp. -# The jvmtifiles directory contains jvmti*.[ch]pp -Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles $(GENERATED)/tracefiles -VPATH += $(Src_Dirs_V:%=%:) - -# set INCLUDES for C preprocessor -Src_Dirs_I += $(GENERATED) -INCLUDES += $(Src_Dirs_I:%=-I%) - -# SYMFLAG is used by {dtrace,jsig}.make. -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - # always build with debug info when we can create .debuginfo files - # and disable 'lazy debug info' so the .so has everything. - SYMFLAG = -g -xs -else - ifeq (${VERSION}, debug) - SYMFLAG = -g - else - SYMFLAG = - endif -endif - -# The following variables are defined in the generated flags.make file. -JDK_VER_DEFS = -DVERSION_MAJOR=$(VERSION_MAJOR) \ - -DVERSION_MINOR=$(VERSION_MINOR) \ - -DVERSION_SECURITY=$(VERSION_SECURITY) \ - -DVERSION_PATCH=$(VERSION_PATCH) \ - -DVERSION_BUILD=$(VERSION_BUILD) -VM_VER_DEFS = -DHOTSPOT_VERSION_STRING="\"$(HOTSPOT_VERSION_STRING)\"" \ - -DVERSION_STRING="\"$(VERSION_STRING)\"" \ - -DDEBUG_LEVEL="\"$(DEBUG_LEVEL)\"" \ - $(JDK_VER_DEFS) -HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" -BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" -VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\"" - -CXXFLAGS = \ - ${SYSDEFS} \ - ${INCLUDES} \ - ${BUILD_USER} \ - ${HS_LIB_ARCH} \ - ${VM_DISTRO} - -# This is VERY important! The version define must only be supplied to vm_version.o -# If not, ccache will not re-use the cache at all, since the version string might contain -# a time and date. -CXXFLAGS/vm_version.o += ${VM_VER_DEFS} - -CXXFLAGS/BYFILE = $(CXXFLAGS/$@) - -# File specific flags -CXXFLAGS += $(CXXFLAGS/BYFILE) - -# Large File Support -ifneq ($(LP64), 1) -CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64 -endif # ifneq ($(LP64), 1) - -# CFLAGS_WARN holds compiler options to suppress/enable warnings. -CFLAGS += $(CFLAGS_WARN) - -# Do not use C++ exception handling -CFLAGS += $(CFLAGS/NOEX) - -# Extra flags from gnumake's invocation or environment -CFLAGS += $(EXTRA_CFLAGS) - -# Math Library (libm.so), do not use -lm. -# There might be two versions of libm.so on the build system: -# libm.so.1 and libm.so.2, and we want libm.so.1. -# Depending on the Solaris release being used to build with, -# /usr/lib/libm.so could point at a libm.so.2, so we are -# explicit here so that the libjvm.so you have built will work on an -# older Solaris release that might not have libm.so.2. -# This is a critical factor in allowing builds on Solaris 10 or newer -# to run on Solaris 8 or 9. -# -LIBM=/usr/lib$(ISA_DIR)/libm.so.1 - -ifeq ("${Platform_compiler}", "sparcWorks") -# The whole megilla: -ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) -# Old Comment: List the libraries in the order the compiler was designed for -# Not sure what the 'designed for' comment is referring too above. -# The order may not be too significant anymore, but I have placed this -# older libm before libCrun, just to make sure it's found and used first. -LIBS += -lsocket -lsched -ldl $(LIBM) -lCrun -lthread -ldoor -lc -ldemangle -lnsl -else -ifeq ($(COMPILER_REV_NUMERIC), 502) -# SC6.1 has it's own libm.so: specifying anything else provokes a name conflict. -LIBS += -ldl -lthread -lsocket -lm -lsched -ldoor -ldemangle -else -LIBS += -ldl -lthread -lsocket $(LIBM) -lsched -ldoor -ldemangle -endif # 502 -endif # 505 -else -LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle -endif # sparcWorks - -LIBS += -lkstat -lrt - -# By default, link the *.o into the library, not the executable. -LINK_INTO$(LINK_INTO) = LIBJVM - -JDK_LIBDIR = $(JAVA_HOME)/lib/$(LIBARCH) - -#---------------------------------------------------------------------- -# jvm_db & dtrace -include $(MAKEFILES_DIR)/dtrace.make - -#---------------------------------------------------------------------- -# JVM - -JVM = jvm -LIBJVM = lib$(JVM).so - -LIBJVM_DEBUGINFO = lib$(JVM).debuginfo -LIBJVM_DIZ = lib$(JVM).diz - -SPECIAL_PATHS:=adlc c1 dist gc opto shark libadt - -SOURCE_PATHS=\ - $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \ - \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \)) -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm -SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm - -CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path)) -CORE_PATHS+=$(GENERATED)/jvmtifiles $(GENERATED)/tracefiles - -ifneq ($(INCLUDE_TRACE), false) -CORE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \ - find $(HS_ALT_SRC)/share/vm/jfr -type d; \ - fi) -endif - -COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1) -COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1 - -COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto) -COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt) -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto -COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt -COMPILER2_PATHS += $(GENERATED)/adfiles - -# Include dirs per type. -Src_Dirs/CORE := $(CORE_PATHS) -Src_Dirs/COMPILER1 := $(CORE_PATHS) $(COMPILER1_PATHS) -Src_Dirs/COMPILER2 := $(CORE_PATHS) $(COMPILER2_PATHS) -Src_Dirs/TIERED := $(CORE_PATHS) $(COMPILER1_PATHS) $(COMPILER2_PATHS) -Src_Dirs/ZERO := $(CORE_PATHS) -Src_Dirs/SHARK := $(CORE_PATHS) $(SHARK_PATHS) -Src_Dirs := $(Src_Dirs/$(TYPE)) - -COMPILER2_SPECIFIC_FILES := opto libadt bcEscapeAnalyzer.cpp c2_\* runtime_\* -COMPILER1_SPECIFIC_FILES := c1_\* -SHARK_SPECIFIC_FILES := shark -ZERO_SPECIFIC_FILES := zero - -# Always exclude these. -Src_Files_EXCLUDE += dtrace jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp - -# Exclude per type. -Src_Files_EXCLUDE/CORE := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER1 := $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/COMPILER2 := $(COMPILER1_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/TIERED := $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) -Src_Files_EXCLUDE/ZERO := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp -Src_Files_EXCLUDE/SHARK := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) - -Src_Files_EXCLUDE += $(Src_Files_EXCLUDE/$(TYPE)) - -# Special handling of arch model. -ifeq ($(Platform_arch_model), x86_32) -Src_Files_EXCLUDE += \*x86_64\* -endif -ifeq ($(Platform_arch_model), x86_64) -Src_Files_EXCLUDE += \*x86_32\* -endif - -# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE. -define findsrc - $(notdir $(shell find $(1)/. ! -name . -prune \ - -a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \ - -a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \))) -endef - -Src_Files := $(foreach e,$(Src_Dirs),$(call findsrc,$(e))) - -Obj_Files = $(sort $(addsuffix .o,$(basename $(Src_Files)))) - -JVM_OBJ_FILES = $(Obj_Files) $(DTRACE_OBJS) - -vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES)) - -MAPFILE_SHARE := $(GAMMADIR)/make/share/makefiles/mapfile-vers - -MAPFILE_EXT_SRC := $(HS_ALT_MAKE)/share/makefiles/mapfile-ext -ifneq ("$(wildcard $(MAPFILE_EXT_SRC))","") -MAPFILE_EXT := $(MAPFILE_EXT_SRC) -endif - -mapfile : $(MAPFILE) $(MAPFILE_SHARE) vm.def $(MAPFILE_EXT) - rm -f $@ - cat $(MAPFILE) $(MAPFILE_DTRACE_OPT) \ - | $(NAWK) '{ \ - if ($$0 ~ "INSERT VTABLE SYMBOLS HERE") { \ - system ("cat ${MAPFILE_SHARE} $(MAPFILE_EXT) vm.def"); \ - } else { \ - print $$0; \ - } \ - }' > $@ - -mapfile_extended : mapfile $(MAPFILE_DTRACE_OPT) - rm -f $@ - cat $^ > $@ - -vm.def: $(Obj_Files) - sh $(GAMMADIR)/make/solaris/makefiles/build_vm_def.sh *.o > $@ - - -ifeq ($(LINK_INTO),AOUT) - LIBJVM.o = - LIBJVM_MAPFILE = - LIBS_VM = $(LIBS) -else - LIBJVM.o = $(JVM_OBJ_FILES) - LIBJVM_MAPFILE$(LDNOMAP) = mapfile_extended - LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE)) - LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM)) - LFLAGS_VM += -Wl,-z,defs -ifndef USE_GCC - LIBS_VM = $(LIBS) -else - # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to - # get around library dependency and compatibility issues. Must use gcc not - # g++ to link. - LFLAGS_VM += $(STATIC_LIBGCC) - LIBS_VM += $(STATIC_STDCXX) $(LIBS) -endif -endif - -LFLAGS_VM += $(EXTRA_LDFLAGS) - -ifdef USE_GCC -LINK_VM = $(LINK_LIB.CC) -else -LINK_VM = $(LINK_LIB.CXX) -endif -# making the library: -$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) -ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),) - @echo $(LOG_INFO) Linking vm... - $(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK) - $(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM) - $(QUIETLY) $(LINK_LIB.CXX/POST_HOOK) - $(QUIETLY) rm -f $@.1 && ln -s $@ $@.1 -ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -x $@ - # implied else here is no stripping at all - endif - endif - ifeq ($(ZIP_DEBUGINFO_FILES),1) - $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) - $(RM) $(LIBJVM_DEBUGINFO) - endif -endif -endif # filter -sbfast -xsbfast - - -DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR) -DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM) -DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO) -DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ) - -install_jvm: $(LIBJVM) - @echo "Copying $(LIBJVM) to $(DEST_JVM)" - $(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \ - $(CP) -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO) - $(QUIETLY) test ! -f $(LIBJVM_DIZ) || \ - $(CP) -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ) - $(QUIETLY) $(CP) -f $(LIBJVM) $(DEST_JVM) && echo "Done" - -#---------------------------------------------------------------------- -# Other files - -# Signal interposition library -include $(MAKEFILES_DIR)/jsig.make - -#---------------------------------------------------------------------- - -build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) dtraceCheck - -install: install_jvm install_jsig - -.PHONY: default build install install_jvm diff --git a/hotspot/make/solaris/platform_amd64 b/hotspot/make/solaris/platform_amd64 deleted file mode 100644 index f85242b1d30..00000000000 --- a/hotspot/make/solaris/platform_amd64 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = x86 - -arch_model = x86_64 - -os_arch = solaris_x86 - -os_arch_model = solaris_x86_64 - -lib_arch = amd64 - -compiler = sparcWorks - -sysdefs = -DSOLARIS -DSPARC_WORKS -DAMD64 diff --git a/hotspot/make/solaris/platform_amd64.gcc b/hotspot/make/solaris/platform_amd64.gcc deleted file mode 100644 index ebd495bca40..00000000000 --- a/hotspot/make/solaris/platform_amd64.gcc +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = x86 - -arch_model = x86_64 - -os_arch = solaris_x86 - -os_arch_model = solaris_x86_64 - -lib_arch = amd64 - -compiler = gcc - -sysdefs = -DSOLARIS -D_GNU_SOURCE -DAMD64 diff --git a/hotspot/make/solaris/platform_i486 b/hotspot/make/solaris/platform_i486 deleted file mode 100644 index 91d4c5e7a64..00000000000 --- a/hotspot/make/solaris/platform_i486 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = x86 - -arch_model = x86_32 - -os_arch = solaris_x86 - -os_arch_model = solaris_x86_32 - -lib_arch = i386 - -compiler = sparcWorks - -sysdefs = -DSOLARIS -DSPARC_WORKS -DIA32 diff --git a/hotspot/make/solaris/platform_i486.gcc b/hotspot/make/solaris/platform_i486.gcc deleted file mode 100644 index 61d55e1b59e..00000000000 --- a/hotspot/make/solaris/platform_i486.gcc +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = x86 - -arch_model = x86_32 - -os_arch = solaris_x86 - -os_arch_model = solaris_x86_32 - -lib_arch = i386 - -compiler = gcc - -sysdefs = -DSOLARIS -D_GNU_SOURCE -DIA32 diff --git a/hotspot/make/solaris/platform_sparc b/hotspot/make/solaris/platform_sparc deleted file mode 100644 index 424088ef53f..00000000000 --- a/hotspot/make/solaris/platform_sparc +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = sparc - -arch_model = sparc - -os_arch = solaris_sparc - -os_arch_model = solaris_sparc - -lib_arch = sparc - -compiler = sparcWorks - -sysdefs = -DSOLARIS -DSPARC_WORKS -DSPARC diff --git a/hotspot/make/solaris/platform_sparc.gcc b/hotspot/make/solaris/platform_sparc.gcc deleted file mode 100644 index 9a900f49384..00000000000 --- a/hotspot/make/solaris/platform_sparc.gcc +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = sparc - -arch_model = sparc - -os_arch = solaris_sparc - -os_arch_model = solaris_sparc - -lib_arch = sparc - -compiler = gcc - -sysdefs = -DSOLARIS -D_GNU_SOURCE -DSPARC diff --git a/hotspot/make/solaris/platform_sparcv9 b/hotspot/make/solaris/platform_sparcv9 deleted file mode 100644 index a17dd08d29d..00000000000 --- a/hotspot/make/solaris/platform_sparcv9 +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = sparc - -arch_model = sparc - -os_arch = solaris_sparc - -os_arch_model = solaris_sparc - -lib_arch = sparcv9 - -compiler = sparcWorks - -sysdefs = -DSOLARIS -DSPARC_WORKS -DSPARC diff --git a/hotspot/make/solaris/platform_sparcv9.gcc b/hotspot/make/solaris/platform_sparcv9.gcc deleted file mode 100644 index 2824381774b..00000000000 --- a/hotspot/make/solaris/platform_sparcv9.gcc +++ /dev/null @@ -1,15 +0,0 @@ -os_family = solaris - -arch = sparc - -arch_model = sparc - -os_arch = solaris_sparc - -os_arch_model = solaris_sparc - -lib_arch = sparcv9 - -compiler = gcc - -sysdefs = -DSOLARIS -D_GNU_SOURCE -DSPARC diff --git a/hotspot/src/share/tools/ProjectCreator/ArgsParser.java b/hotspot/make/src/classes/build/tools/projectcreator/ArgsParser.java similarity index 96% rename from hotspot/src/share/tools/ProjectCreator/ArgsParser.java rename to hotspot/make/src/classes/build/tools/projectcreator/ArgsParser.java index ca5d0a337f1..97dff3e460d 100644 --- a/hotspot/src/share/tools/ProjectCreator/ArgsParser.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/ArgsParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,8 @@ * */ +package build.tools.projectcreator; + class ArgIterator { String[] args; int i; diff --git a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java b/hotspot/make/src/classes/build/tools/projectcreator/BuildConfig.java similarity index 94% rename from hotspot/src/share/tools/ProjectCreator/BuildConfig.java rename to hotspot/make/src/classes/build/tools/projectcreator/BuildConfig.java index 0ce7ecf039e..81e555233e2 100644 --- a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/BuildConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,8 @@ * */ +package build.tools.projectcreator; + import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; @@ -37,7 +39,7 @@ class BuildConfig { if (ci == null) { String comp = (String)getField(null, "CompilerVersion"); try { - ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance(); + ci = (CompilerInterface)Class.forName("build.tools.projectcreator.CompilerInterface" + comp).newInstance(); } catch (Exception cnfe) { System.err.println("Cannot find support for compiler " + comp); throw new RuntimeException(cnfe.toString()); @@ -66,6 +68,8 @@ class BuildConfig { String buildSpace = getFieldString(null, "BuildSpace"); String outDir = buildBase; String jdkTargetRoot = getFieldString(null, "JdkTargetRoot"); + String makeBinary = getFieldString(null, "MakeBinary"); + String makeOutput = expandFormat(getFieldString(null, "MakeOutput")); put("Id", flavourBuild); put("OutputDir", outDir); @@ -74,6 +78,8 @@ class BuildConfig { put("BuildSpace", buildSpace); put("OutputDll", outDir + Util.sep + outDll); put("JdkTargetRoot", jdkTargetRoot); + put("MakeBinary", makeBinary); + put("MakeOutput", makeOutput); context = new String [] {flavourBuild, flavour, build, null}; } @@ -148,9 +154,11 @@ class BuildConfig { String relativeAltSrcInclude = getFieldString(null, "RelativeAltSrcInclude"); Vector v = getFieldVector(null, "AltRelativeInclude"); - for (String pathPart : v) { - if (path.contains(relativeAltSrcInclude + Util.sep + pathPart)) { - return true; + if (v != null) { + for (String pathPart : v) { + if (path.contains(relativeAltSrcInclude + Util.sep + pathPart)) { + return true; + } } } return false; @@ -360,8 +368,7 @@ class BuildConfig { static boolean appliesToTieredBuild(String cfg) { return (cfg != null && - (cfg.startsWith("compiler1") || - cfg.startsWith("compiler2"))); + cfg.startsWith("server")); } // Filters out the IgnoreFile and IgnorePaths since they are @@ -372,7 +379,7 @@ class BuildConfig { static String getTieredBuildCfg(String cfg) { assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg; - return "tiered" + cfg.substring(9); + return "server"; } static Object getField(String cfg, String field) { @@ -524,7 +531,7 @@ class C1DebugConfig extends GenericDebugNonKernelConfig { } C1DebugConfig() { - initNames("compiler1", "debug", "jvm.dll"); + initNames("client", "debug", "jvm.dll"); init(getIncludes(), getDefines()); } } @@ -535,7 +542,7 @@ class C1FastDebugConfig extends GenericDebugNonKernelConfig { } C1FastDebugConfig() { - initNames("compiler1", "fastdebug", "jvm.dll"); + initNames("client", "fastdebug", "jvm.dll"); init(getIncludes(), getDefines()); } } @@ -546,7 +553,7 @@ class TieredDebugConfig extends GenericDebugNonKernelConfig { } TieredDebugConfig() { - initNames("tiered", "debug", "jvm.dll"); + initNames("server", "debug", "jvm.dll"); init(getIncludes(), getDefines()); } } @@ -557,7 +564,7 @@ class TieredFastDebugConfig extends GenericDebugNonKernelConfig { } TieredFastDebugConfig() { - initNames("tiered", "fastdebug", "jvm.dll"); + initNames("server", "fastdebug", "jvm.dll"); init(getIncludes(), getDefines()); } } @@ -576,14 +583,14 @@ abstract class ProductConfig extends BuildConfig { class C1ProductConfig extends ProductConfig { C1ProductConfig() { - initNames("compiler1", "product", "jvm.dll"); + initNames("client", "product", "jvm.dll"); init(getIncludes(), getDefines()); } } class TieredProductConfig extends ProductConfig { TieredProductConfig() { - initNames("tiered", "product", "jvm.dll"); + initNames("server", "product", "jvm.dll"); init(getIncludes(), getDefines()); } } diff --git a/hotspot/src/share/tools/ProjectCreator/FileTreeCreator.java b/hotspot/make/src/classes/build/tools/projectcreator/FileTreeCreator.java similarity index 66% rename from hotspot/src/share/tools/ProjectCreator/FileTreeCreator.java rename to hotspot/make/src/classes/build/tools/projectcreator/FileTreeCreator.java index a81132c7029..385903e676f 100644 --- a/hotspot/src/share/tools/ProjectCreator/FileTreeCreator.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/FileTreeCreator.java @@ -1,3 +1,29 @@ +/* + * Copyright (c) 2012, 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 build.tools.projectcreator; + import java.nio.file.FileSystems; import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; diff --git a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java b/hotspot/make/src/classes/build/tools/projectcreator/FileTreeCreatorVC10.java similarity index 98% rename from hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java rename to hotspot/make/src/classes/build/tools/projectcreator/FileTreeCreatorVC10.java index cb0fe33577e..fb7a77f7256 100644 --- a/hotspot/src/share/tools/ProjectCreator/FileTreeCreatorVC10.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/FileTreeCreatorVC10.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -22,6 +22,8 @@ * */ +package build.tools.projectcreator; + import static java.nio.file.FileVisitResult.CONTINUE; import java.io.IOException; diff --git a/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java b/hotspot/make/src/classes/build/tools/projectcreator/ProjectCreator.java similarity index 98% rename from hotspot/src/share/tools/ProjectCreator/ProjectCreator.java rename to hotspot/make/src/classes/build/tools/projectcreator/ProjectCreator.java index f1e16ea8a45..d5478230a42 100644 --- a/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/ProjectCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -22,6 +22,8 @@ * */ +package build.tools.projectcreator; + public class ProjectCreator { public static void usage() { diff --git a/hotspot/src/share/tools/ProjectCreator/Util.java b/hotspot/make/src/classes/build/tools/projectcreator/Util.java similarity index 96% rename from hotspot/src/share/tools/ProjectCreator/Util.java rename to hotspot/make/src/classes/build/tools/projectcreator/Util.java index ca830780048..9741c151dae 100644 --- a/hotspot/src/share/tools/ProjectCreator/Util.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,8 @@ * */ +package build.tools.projectcreator; + import java.util.*; import java.io.File; diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatform.java b/hotspot/make/src/classes/build/tools/projectcreator/WinGammaPlatform.java similarity index 98% rename from hotspot/src/share/tools/ProjectCreator/WinGammaPlatform.java rename to hotspot/make/src/classes/build/tools/projectcreator/WinGammaPlatform.java index a87d4471511..bc0cad7eb01 100644 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatform.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/WinGammaPlatform.java @@ -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 @@ -22,6 +22,8 @@ * */ +package build.tools.projectcreator; + import java.io.File; import java.io.IOException; import java.io.PrintWriter; @@ -317,6 +319,18 @@ public abstract class WinGammaPlatform { HsArgHandler.STRING ), + new HsArgRule("-makeBinary", + "MakeBinary", + null, + HsArgHandler.STRING + ), + + new HsArgRule("-makeOutput", + "MakeOutput", + null, + HsArgHandler.STRING + ), + new HsArgRule("-platformName", "PlatformName", null, @@ -554,10 +568,6 @@ public abstract class WinGammaPlatform { usage(); } - if (BuildConfig.getField(null, "UseToGeneratePch") == null) { - throw new RuntimeException("ERROR: need to specify one file to compute PCH, with -useToGeneratePch flag"); - } - BuildConfig.putField(null, "PlatformObject", this); } diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java b/hotspot/make/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java similarity index 91% rename from hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java rename to hotspot/make/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java index 3225f1e551d..d44fb04c588 100644 --- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java +++ b/hotspot/make/src/classes/build/tools/projectcreator/WinGammaPlatformVC10.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,8 @@ * */ +package build.tools.projectcreator; + import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -71,6 +73,7 @@ public class WinGammaPlatformVC10 extends WinGammaPlatform { startTag("PropertyGroup", "Label", "Globals"); tagData("ProjectGuid", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}"); + tagData("Keyword", "MakeFileProj"); tag("SccProjectName"); tag("SccLocalPath"); endTag(); @@ -79,9 +82,8 @@ public class WinGammaPlatformVC10 extends WinGammaPlatform { for (BuildConfig cfg : allConfigs) { startTag(cfg, "PropertyGroup", "Label", "Configuration"); - tagData("ConfigurationType", "DynamicLibrary"); - tagData("UseOfMfc", "false"); - tagData("PlatformToolset", "v120"); + tagData("ConfigurationType", "Makefile"); + tagData("UseDebugLibraries", "true"); endTag(); } @@ -111,6 +113,14 @@ public class WinGammaPlatformVC10 extends WinGammaPlatform { tag(cfg, "CodeAnalysisRules"); tag(cfg, "CodeAnalysisRuleAssemblies"); } + for (BuildConfig cfg : allConfigs) { + tagData(cfg, "NMakeBuildCommandLine", cfg.get("MakeBinary") + " -f ../../Makefile import-hotspot LOG=info"); + tagData(cfg, "NMakeReBuildCommandLine", cfg.get("MakeBinary") + " -f ../../Makefile clean-hotspot import-hotspot LOG=info"); + tagData(cfg, "NMakeCleanCommandLine", cfg.get("MakeBinary") + " -f ../../Makefile clean-hotspot LOG=info"); + tagData(cfg, "NMakeOutput", cfg.get("MakeOutput") + Util.sep + "jvm.dll"); + tagData(cfg, "NMakePreprocessorDefinitions", Util.join(";", cfg.getDefines())); + tagData(cfg, "NMakeIncludeSearchPath", Util.join(";", cfg.getIncludes())); + } endTag(); for (BuildConfig cfg : allConfigs) { @@ -123,11 +133,6 @@ public class WinGammaPlatformVC10 extends WinGammaPlatform { tagV(cfg.getV("LinkerFlags")); endTag(); - startTag("PreLinkEvent"); - tagData("Message", BuildConfig.getFieldString(null, "PrelinkDescription")); - tagData("Command", cfg.expandFormat(BuildConfig.getFieldString(null, "PrelinkCommand").replace("\t", "\r\n"))); - endTag(); - endTag(); } @@ -162,18 +167,13 @@ public class WinGammaPlatformVC10 extends WinGammaPlatform { for (BuildConfig cfg : allConfigs) { startTag(cfg, "PropertyGroup"); tagData("LocalDebuggerCommand", cfg.get("JdkTargetRoot") + "\\bin\\java.exe"); - // The JVM loads some libraries using a path relative to - // itself because it expects to be in a JRE or a JDK. The java - // launcher's '-XXaltjvm=' option allows the JVM to be outside - // the JRE or JDK so '-Dsun.java.launcher.is_altjvm=true' - // forces a fake JAVA_HOME relative path to be used to - // find the other libraries. The '-XX:+PauseAtExit' option + // Since we run "make hotspot-import", we get the correct jvm.dll by java.exe. + // The '-XX:+PauseAtExit' option // causes the VM to wait for key press before exiting; this // allows any stdout or stderr messages to be seen before // the cmdtool exits. - tagData("LocalDebuggerCommandArguments", "-XXaltjvm=$(TargetDir) " - + "-Dsun.java.launcher.is_altjvm=true " - + "-XX:+UnlockDiagnosticVMOptions -XX:+PauseAtExit"); + tagData("LocalDebuggerCommandArguments", + "-XX:+UnlockDiagnosticVMOptions -XX:+PauseAtExit"); tagData("LocalDebuggerEnvironment", "JAVA_HOME=" + cfg.get("JdkTargetRoot")); endTag(); } @@ -209,11 +209,6 @@ public class WinGammaPlatformVC10 extends WinGammaPlatform { tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); endTag(); } - startTag("Filter", "Include", "Resource Files"); - UUID uuid = UUID.randomUUID(); - tagData("UniqueIdentifier", "{" + uuid.toString() + "}"); - tagData("Extensions", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"); - endTag(); endTag(); //TODO - do I need to split cpp and hpp files? diff --git a/hotspot/makefiles/symbols/symbols-aix b/hotspot/make/symbols/symbols-aix similarity index 100% rename from hotspot/makefiles/symbols/symbols-aix rename to hotspot/make/symbols/symbols-aix diff --git a/hotspot/makefiles/symbols/symbols-aix-debug b/hotspot/make/symbols/symbols-aix-debug similarity index 100% rename from hotspot/makefiles/symbols/symbols-aix-debug rename to hotspot/make/symbols/symbols-aix-debug diff --git a/hotspot/makefiles/symbols/symbols-linux b/hotspot/make/symbols/symbols-linux similarity index 100% rename from hotspot/makefiles/symbols/symbols-linux rename to hotspot/make/symbols/symbols-linux diff --git a/hotspot/makefiles/symbols/symbols-macosx b/hotspot/make/symbols/symbols-macosx similarity index 100% rename from hotspot/makefiles/symbols/symbols-macosx rename to hotspot/make/symbols/symbols-macosx diff --git a/hotspot/makefiles/symbols/symbols-shared b/hotspot/make/symbols/symbols-shared similarity index 100% rename from hotspot/makefiles/symbols/symbols-shared rename to hotspot/make/symbols/symbols-shared diff --git a/hotspot/makefiles/symbols/symbols-solaris b/hotspot/make/symbols/symbols-solaris similarity index 100% rename from hotspot/makefiles/symbols/symbols-solaris rename to hotspot/make/symbols/symbols-solaris diff --git a/hotspot/makefiles/symbols/symbols-solaris-dtrace-compiler1 b/hotspot/make/symbols/symbols-solaris-dtrace-compiler1 similarity index 100% rename from hotspot/makefiles/symbols/symbols-solaris-dtrace-compiler1 rename to hotspot/make/symbols/symbols-solaris-dtrace-compiler1 diff --git a/hotspot/makefiles/symbols/symbols-solaris-dtrace-compiler2 b/hotspot/make/symbols/symbols-solaris-dtrace-compiler2 similarity index 100% rename from hotspot/makefiles/symbols/symbols-solaris-dtrace-compiler2 rename to hotspot/make/symbols/symbols-solaris-dtrace-compiler2 diff --git a/hotspot/makefiles/symbols/symbols-unix b/hotspot/make/symbols/symbols-unix similarity index 100% rename from hotspot/makefiles/symbols/symbols-unix rename to hotspot/make/symbols/symbols-unix diff --git a/hotspot/make/test/GtestImage.gmk b/hotspot/make/test/GtestImage.gmk new file mode 100644 index 00000000000..f24b1a73fcd --- /dev/null +++ b/hotspot/make/test/GtestImage.gmk @@ -0,0 +1,67 @@ +# +# 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. 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. +# + +default: all + +include $(SPEC) +include MakeBase.gmk + +$(foreach v, $(JVM_VARIANTS), \ + $(eval $(call SetupCopyFiles, COPY_GTEST_$v, \ + SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/gtest, \ + DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \ + FILES := $(call SHARED_LIBRARY,jvm) gtestLauncher$(EXE_SUFFIX), \ + )) \ + $(eval TARGETS += $$(COPY_GTEST_$v)) \ +) + +ifeq ($(OPENJDK_TARGET_OS), windows) + $(foreach v, $(JVM_VARIANTS), \ + $(eval $(call SetupCopyFiles, COPY_GTEST_MSVCR_$v, \ + DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \ + FILES := $(MSVCR_DLL) $(MSVCP_DLL), \ + FLATTEN := true, \ + )) \ + $(eval TARGETS += $$(COPY_GTEST_MSVCR_$v)) \ + $(eval $(call SetupCopyFiles, COPY_GTEST_PDB_$v, \ + SRC := $(HOTSPOT_OUTPUTDIR)/variant-$v/libjvm/gtest, \ + DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \ + FILES := jvm.pdb gtestLauncher.pdb, \ + )) \ + $(eval TARGETS += $$(COPY_GTEST_PDB_$v)) \ + ) +endif + +ifeq ($(OPENJDK_TARGET_OS), solaris) + $(foreach v, $(JVM_VARIANTS), \ + $(eval $(call SetupCopyFiles, COPY_GTEST_STLPORT_$v, \ + DEST := $(TEST_IMAGE_DIR)/hotspot/gtest/$v, \ + FILES := $(STLPORT_LIB), \ + )) \ + $(eval TARGETS += $$(COPY_GTEST_STLPORT_$v)) \ + ) +endif + +all: $(TARGETS) diff --git a/hotspot/make/test/JtregNative.gmk b/hotspot/make/test/JtregNative.gmk index 62478ce6923..4e61967e859 100644 --- a/hotspot/make/test/JtregNative.gmk +++ b/hotspot/make/test/JtregNative.gmk @@ -51,6 +51,7 @@ BUILD_HOTSPOT_JTREG_NATIVE_SRC := \ $(HOTSPOT_TOPDIR)/test/compiler/floatingpoint/ \ $(HOTSPOT_TOPDIR)/test/compiler/calls \ $(HOTSPOT_TOPDIR)/test/compiler/native \ + $(HOTSPOT_TOPDIR)/test/testlibrary/jvmti \ # # Add conditional directories here when needed. @@ -62,6 +63,7 @@ endif ifeq ($(TOOLCHAIN_TYPE), solstudio) BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_liboverflow := -lc + BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_libSimpleClassFileLoadHook := -lc endif BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native diff --git a/hotspot/make/windows/build.bat b/hotspot/make/windows/build.bat deleted file mode 100644 index d81bb6dbd99..00000000000 --- a/hotspot/make/windows/build.bat +++ /dev/null @@ -1,85 +0,0 @@ -@echo off -REM -REM Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. -REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -REM -REM This code is free software; you can redistribute it and/or modify it -REM under the terms of the GNU General Public License version 2 only, as -REM published by the Free Software Foundation. -REM -REM This code is distributed in the hope that it will be useful, but WITHOUT -REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -REM version 2 for more details (a copy is included in the LICENSE file that -REM accompanied this code). -REM -REM You should have received a copy of the GNU General Public License version -REM 2 along with this work; if not, write to the Free Software Foundation, -REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -REM or visit www.oracle.com if you need additional information or have any -REM questions. -REM -REM - -REM Set HotSpotWorkSpace to the directory two steps above this script -for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi) - -REM -REM Since we don't have uname and we could be cross-compiling, -REM Use the compiler to determine which ARCH we are building -REM -cl 2>&1 1>&3 | findstr x64>NUL -if %errorlevel% == 0 goto amd64 -set VCPROJ=%HotSpotWorkSpace%\build\vs-i486\jvm.vcxproj -set PLATFORM=x86 -goto testmkshome -:amd64 -set VCPROJ=%HotSpotWorkSpace%\build\vs-amd64\jvm.vcxproj -set PLATFORM=x64 -goto testmkshome - -:testmkshome -if not "%HOTSPOTMKSHOME%" == "" goto testjavahome -if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin -if not "%HOTSPOTMKSHOME%" == "" goto testjavahome -if exist c:\cygwin64\bin set HOTSPOTMKSHOME=c:\cygwin64\bin -if not "%HOTSPOTMKSHOME%" == "" goto testjavahome -echo Error: please set variable HOTSPOTMKSHOME to place where -echo your MKS/Cygwin installation is -echo. -goto end - -:testjavahome -if not "%JAVA_HOME%" == "" goto testbuildversion -echo Error: please set variable JAVA_HOME to a bootstrap JDK -echo. -goto end - -:testbuildversion -if "%1" == "compiler1" goto testdebuglevel -if "%1" == "tiered" goto testdebuglevel -goto usage - -:testdebuglevel -if "%2" == "product" goto build -if "%2" == "debug" goto build -if "%2" == "fastdebug" goto build -goto usage - -:build -if NOT EXIST %VCPROJ% call %~dp0\create.bat %JAVA_HOME% -msbuild /Property:Platform=%PLATFORM% /Property:Configuration=%1_%2 /v:m %VCPROJ% -goto end - -:usage -echo Usage: build version debuglevel -echo. -echo where: -echo version is "compiler1" or "tiered", -echo debuglevel is "product", "debug" or "fastdebug" -exit /b 1 - -:end -exit /b %errorlevel% diff --git a/hotspot/make/windows/build.make b/hotspot/make/windows/build.make deleted file mode 100644 index 603f15c0c0b..00000000000 --- a/hotspot/make/windows/build.make +++ /dev/null @@ -1,253 +0,0 @@ -# -# Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Note: this makefile is invoked both from build.bat and from the J2SE -# control workspace in exactly the same manner; the required -# environment variables (Variant, WorkSpace, BootStrapDir, BuildUser, HOTSPOT_BUILD_VERSION) -# are passed in as command line arguments. - -# Note: Running nmake or build.bat from the Windows command shell requires -# that "sh" be accessible on the PATH. An MKS install does this. - -# If we haven't set an ARCH yet use x86 -# create.bat and build.bat will set it, if used. -!ifndef ARCH -ARCH=x86 -!endif - - -# Must be one of these values (if value comes in from env, can't trust it) -!if "$(ARCH)" != "x86" -!if "$(ARCH)" != "ia64" -ARCH=x86 -!endif -!endif - -# At this point we should be certain that ARCH has a definition -# now determine the BUILDARCH -# - -# the default BUILDARCH -BUILDARCH=i486 - -# Allow control workspace to force Itanium or AMD64 builds with LP64 -ARCH_TEXT= -!ifdef LP64 -!if "$(LP64)" == "1" -ARCH_TEXT=64-Bit -!if "$(ARCH)" == "x86" -BUILDARCH=amd64 -!else -BUILDARCH=ia64 -!endif -!endif -!endif - -!if "$(BUILDARCH)" != "ia64" -!ifndef CC_INTERP -!ifndef FORCE_TIERED -FORCE_TIERED=1 -!endif -!endif -!endif - -!if "$(BUILDARCH)" == "amd64" -Platform_arch=x86 -Platform_arch_model=x86_64 -!endif -!if "$(BUILDARCH)" == "i486" -Platform_arch=x86 -Platform_arch_model=x86_32 -!endif - -# Supply these from the command line or the environment -# It doesn't make sense to default this one -Variant= -# It doesn't make sense to default this one -WorkSpace= - -variantDir = windows_$(BUILDARCH)_$(Variant) - -realVariant=$(Variant) -VARIANT_TEXT=Core -!if "$(Variant)" == "compiler1" -VARIANT_TEXT=Client -!elseif "$(Variant)" == "compiler2" -!if "$(FORCE_TIERED)" == "1" -VARIANT_TEXT=Server -realVariant=tiered -!else -VARIANT_TEXT=Server -!endif -!elseif "$(Variant)" == "tiered" -VARIANT_TEXT=Tiered -!endif - -######################################################################### -# Parameters for VERSIONINFO resource for jvm.dll. -# These can be overridden via the nmake.exe command line. -# They are overridden by RE during the control builds. -# -!include "$(WorkSpace)/make/jdk_version" - -# Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro -# or make/hotspot_distro. -!ifndef HOTSPOT_VM_DISTRO -!ifndef OPENJDK -!if exists($(WorkSpace)\src\closed) -!include $(WorkSpace)\make\hotspot_distro -!else -!include $(WorkSpace)\make\openjdk_distro -!endif -!else -!include $(WorkSpace)\make\openjdk_distro -!endif -!endif - -HS_FILEDESC=$(HOTSPOT_VM_DISTRO) $(ARCH_TEXT) $(VARIANT_TEXT) VM - -# JDK ProductVersion: -# 1.5.0_-b will have DLL version 5.0.wx*10.yz -# Thus, 1.5.0_10-b04 will be 5.0.100.4 -# 1.6.0-b01 will be 6.0.0.1 -# 1.6.0_01a-b02 will be 6.0.11.2 -# -# STANDALONE_JDK_* variables are defined in make/jdk_version or on command line -# -!if "$(JDK_VER)" == "" -JDK_VER=$(STANDALONE_JDK_MAJOR_VER),$(STANDALONE_JDK_MINOR_VER),$(STANDALONE_JDK_SECURITY_VER),$(STANDALONE_JDK_PATCH_VER) -!endif -!if "$(JDK_DOTVER)" == "" -JDK_DOTVER=$(STANDALONE_JDK_MAJOR_VER).$(STANDALONE_JDK_MINOR_VER).$(STANDALONE_JDK_SECURITY_VER).$(STANDALONE_JDK_PATCH_VER) -!endif -!if "$(VERSION_SHORT)" == "" -VERSION_SHORT=$(STANDALONE_JDK_MAJOR_VER).$(STANDALONE_JDK_MINOR_VER).$(STANDALONE_JDK_SECURITY_VER) -!endif - -HS_VER=$(JDK_VER) -HS_DOTVER=$(JDK_DOTVER) - -!if "$(HOTSPOT_RELEASE_VERSION)" == "" -HOTSPOT_RELEASE_VERSION=$(VERSION_STRING) -!endif - -!if "$(HOTSPOT_VERSION_STRING)" == "" -HOTSPOT_VERSION_STRING=$(HOTSPOT_RELEASE_VERSION) -!endif - -# End VERSIONINFO parameters - -# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK -!ifndef OPENJDK -!if !exists($(WorkSpace)\src\closed) -OPENJDK=true -!endif -!endif - -######################################################################### - -defaultTarget: product - -# The product or release build is an optimized build, and is the default - -# note that since all the build targets depend on local.make that BUILDARCH -# and Platform_arch and Platform_arch_model will get set in local.make -# and there is no need to pass them thru here on the command line -# -product release optimized: checks $(variantDir) $(variantDir)\local.make sanity - cd $(variantDir) - nmake -nologo -f $(WorkSpace)\make\windows\makefiles\top.make BUILD_FLAVOR=product ARCH=$(ARCH) - -# The debug build is an optional build -debug: checks $(variantDir) $(variantDir)\local.make sanity - cd $(variantDir) - nmake -nologo -f $(WorkSpace)\make\windows\makefiles\top.make BUILD_FLAVOR=debug ARCH=$(ARCH) -fastdebug: checks $(variantDir) $(variantDir)\local.make sanity - cd $(variantDir) - nmake -nologo -f $(WorkSpace)\make\windows\makefiles\top.make BUILD_FLAVOR=fastdebug ARCH=$(ARCH) - -# target to create just the directory structure -tree: checks $(variantDir) $(variantDir)\local.make sanity - mkdir $(variantDir)\product - mkdir $(variantDir)\debug - mkdir $(variantDir)\fastdebug - -sanity: - @ echo; - @ cd $(variantDir) - @ nmake -nologo -f $(WorkSpace)\make\windows\makefiles\sanity.make - @ cd .. - @ echo; - -clean: checkVariant - - rm -r -f $(variantDir) - -$(variantDir): - mkdir $(variantDir) - -$(variantDir)\local.make: checks - @ echo # Generated file > $@ - @ echo Variant=$(realVariant) >> $@ - @ echo WorkSpace=$(WorkSpace) >> $@ - @ echo BootStrapDir=$(BootStrapDir) >> $@ - @ if "$(USERNAME)" NEQ "" echo BuildUser=$(USERNAME) >> $@ - @ echo HS_VER=$(HS_VER) >> $@ - @ echo HS_DOTVER=$(HS_DOTVER) >> $@ - @ echo HS_COMPANY=$(COMPANY_NAME) >> $@ - @ echo HS_FILEDESC=$(HS_FILEDESC) >> $@ - @ echo HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) >> $@ - @ if "$(OPENJDK)" NEQ "" echo OPENJDK=$(OPENJDK) >> $@ - @ echo HS_COPYRIGHT=$(HOTSPOT_VM_COPYRIGHT) >> $@ - @ echo HS_NAME=$(PRODUCT_NAME) $(VERSION_SHORT) >> $@ - @ echo HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) >> $@ - @ echo JDK_VER=$(JDK_VER) >> $@ - @ echo JDK_DOTVER=$(JDK_DOTVER) >> $@ - @ echo VERSION_STRING=$(VERSION_STRING) >> $@ - @ echo BUILDARCH=$(BUILDARCH) >> $@ - @ echo Platform_arch=$(Platform_arch) >> $@ - @ echo Platform_arch_model=$(Platform_arch_model) >> $@ - @ echo CXX=$(CXX) >> $@ - @ echo LD=$(LD) >> $@ - @ echo MT=$(MT) >> $@ - @ echo RC=$(RC) >> $@ - @ sh $(WorkSpace)/make/windows/get_msc_ver.sh >> $@ - @ if "$(ENABLE_FULL_DEBUG_SYMBOLS)" NEQ "" echo ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) >> $@ - @ if "$(ZIP_DEBUGINFO_FILES)" NEQ "" echo ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) >> $@ - @ if "$(RM)" NEQ "" echo RM=$(RM) >> $@ - @ if "$(CP)" NEQ "" echo CP=$(CP) >> $@ - @ if "$(MV)" NEQ "" echo MV=$(MV) >> $@ - @ if "$(ZIPEXE)" NEQ "" echo ZIPEXE=$(ZIPEXE) >> $@ - -checks: checkVariant checkWorkSpace - -checkVariant: - @ if "$(Variant)"=="" echo Need to specify "Variant=[tiered|compiler2|compiler1|core]" && false - @ if "$(Variant)" NEQ "tiered" if "$(Variant)" NEQ "compiler2" if "$(Variant)" NEQ "compiler1" if "$(Variant)" NEQ "core" \ - echo Need to specify "Variant=[tiered|compiler2|compiler1|core]" && false - -checkWorkSpace: - @ if "$(WorkSpace)"=="" echo Need to specify "WorkSpace=..." && false - -checkBuildID: - @ if "$(BuildID)"=="" echo Need to specify "BuildID=..." && false diff --git a/hotspot/make/windows/build_vm_def.sh b/hotspot/make/windows/build_vm_def.sh deleted file mode 100644 index 7224970058a..00000000000 --- a/hotspot/make/windows/build_vm_def.sh +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# This shell script builds a vm.def file for the current VM variant. -# The .def file exports vtbl symbols which allow the Serviceability -# Agent to run on Windows. See make/windows/projectfiles/*/vm.def -# for more information. -# -# The script expects to be executed in the directory containing all of -# the object files. - -# Note that we currently do not have a way to set HotSpotMksHome in -# the batch build, but so far this has not seemed to be a problem. The -# reason this environment variable is necessary is that it seems that -# Windows truncates very long PATHs when executing shells like MKS's -# sh, and it has been found that sometimes `which sh` fails. -if [ "x$HOTSPOTMKSHOME" != "x" ]; then - MKS_HOME="$HOTSPOTMKSHOME" -else - SH=`which sh` - MKS_HOME=`dirname "$SH"` -fi - -AWK="$MKS_HOME/awk.exe" -if [ ! -e $AWK ]; then - AWK="$MKS_HOME/gawk.exe" -fi -GREP="$MKS_HOME/grep.exe" -SORT="$MKS_HOME/sort.exe" -UNIQ="$MKS_HOME/uniq.exe" -CAT="$MKS_HOME/cat.exe" -RM="$MKS_HOME/rm.exe" -DUMPBIN="link.exe /dump" -export VS_UNICODE_OUTPUT= - -echo "EXPORTS" > vm1.def - -# When called from IDE the first param should contain the link version, otherwise may be nill -if [ "x$1" != "x" ]; then -LD_VER="$1" -fi - -if [ "x$LD_VER" != "x800" -a "x$LD_VER" != "x900" -a "x$LD_VER" != "x1000" ]; then -$DUMPBIN /symbols *.obj | "$GREP" "??_7.*@@6B@" | "$GREP" -v "type_info" | "$AWK" '{print $7}' | "$SORT" | "$UNIQ" > vm2.def -else -# Can't use pipes when calling cl.exe or link.exe from IDE. Using transit file vm3.def -$DUMPBIN /OUT:vm3.def /symbols *.obj -"$CAT" vm3.def | "$GREP" "??_7.*@@6B@" | "$GREP" -v "type_info" | "$AWK" '{print $7}' | "$SORT" | "$UNIQ" > vm2.def -"$RM" -f vm3.def -fi - -"$CAT" vm1.def vm2.def > vm.def -"$RM" -f vm1.def vm2.def diff --git a/hotspot/make/windows/create.bat b/hotspot/make/windows/create.bat deleted file mode 100644 index a2cdaaaff0b..00000000000 --- a/hotspot/make/windows/create.bat +++ /dev/null @@ -1,198 +0,0 @@ -@echo off -REM -REM Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -REM -REM This code is free software; you can redistribute it and/or modify it -REM under the terms of the GNU General Public License version 2 only, as -REM published by the Free Software Foundation. -REM -REM This code is distributed in the hope that it will be useful, but WITHOUT -REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -REM version 2 for more details (a copy is included in the LICENSE file that -REM accompanied this code). -REM -REM You should have received a copy of the GNU General Public License version -REM 2 along with this work; if not, write to the Free Software Foundation, -REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -REM or visit www.oracle.com if you need additional information or have any -REM questions. -REM -REM - -REM This is the interactive build setup script (as opposed to the batch -REM build execution script). It creates $HotSpotBuildSpace if necessary, -REM copies the appropriate files out of $HotSpotWorkSpace into it, and -REM builds and runs ProjectCreator in it. This has the side-effect of creating -REM the vm.vcproj file in the buildspace, which is then used in Visual C++. - -REM -REM Since we don't have uname and we could be cross-compiling, -REM Use the compiler to determine which ARCH we are building -REM -REM Note: Running this batch file from the Windows command shell requires -REM that "grep" be accessible on the PATH. An MKS install does this. -REM - -cl 2>NUL >NUL -if %errorlevel% == 0 goto nexttest -echo Make sure cl.exe is in your PATH before running this script. -goto end - -:nexttest -grep -V 2>NUL >NUL -if %errorlevel% == 0 goto testit -echo Make sure grep.exe is in your PATH before running this script. Either cygwin or MKS should work. -goto end - - -:testit -cl 2>&1 | grep "x64" >NUL -if %errorlevel% == 0 goto amd64 -set ARCH=x86 -set BUILDARCH=i486 -set Platform_arch=x86 -set Platform_arch_model=x86_32 -goto done -:amd64 -set ARCH=x86 -set BUILDARCH=amd64 -set Platform_arch=x86 -set Platform_arch_model=x86_64 -:done - -setlocal - -if "%1" == "" goto usage - -if not "%2" == "" goto usage - -REM Set HotSpotWorkSpace to the directy two steps above this script -for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi) -set HotSpotBuildRoot=%HotSpotWorkSpace%build -set HotSpotBuildSpace=%HotSpotBuildRoot%\vs-%BUILDARCH% -set HotSpotJDKDist=%1 - - -REM figure out MSC version -for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i - -echo ************************************************************** -echo MSC_VER = "%MSC_VER%" -set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj -echo %ProjectFile% -echo ************************************************************** - -REM Test all variables to see whether the directories they -REM reference exist - -if exist %HotSpotWorkSpace% goto test1 - -echo Error: directory pointed to by HotSpotWorkSpace -echo does not exist, or the variable is not set. -echo. -goto usage - -:test1 -if exist %HotSpotBuildSpace% goto test2 -if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace% -if exist %HotSpotBuildSpace% goto test2 -echo Error: directory pointed to by HotSpotBuildSpace -echo does not exist, or the variable is not set. -echo. -goto usage - -:test2 -if exist %HotSpotJDKDist% goto test3 -echo Error: directory pointed to by %HotSpotJDKDist% -echo does not exist, or the variable is not set. -echo. -goto usage - -:test3 -if not "%HOTSPOTMKSHOME%" == "" goto makedir -if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin -if not "%HOTSPOTMKSHOME%" == "" goto makedir -if exist c:\cygwin64\bin set HOTSPOTMKSHOME=c:\cygwin64\bin -if not "%HOTSPOTMKSHOME%" == "" goto makedir -echo Warning: please set variable HOTSPOTMKSHOME to place where -echo your MKS/Cygwin installation is -echo. -goto usage - -:generatefiles -if NOT EXIST %HotSpotBuildSpace%\%1\generated mkdir %HotSpotBuildSpace%\%1\generated -copy %HotSpotWorkSpace%\make\windows\projectfiles\%1\* %HotSpotBuildSpace%\%1\generated > NUL - -REM force regneration of ProjectFile -if exist %ProjectFile% del %ProjectFile% - -echo -- %1 -- -echo # Generated file! > %HotSpotBuildSpace%\%1\local.make -echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%1\local.make -echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%1\local.make -echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%1\local.make -echo. >> %HotSpotBuildSpace%\%1\local.make -echo Variant=%1 >> %HotSpotBuildSpace%\%1\local.make -echo WorkSpace=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%1\local.make -echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%1\local.make -echo HOTSPOTBUILDROOT=%HotSpotBuildRoot% >> %HotSpotBuildSpace%\%1\local.make -echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%1\local.make -echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%1\local.make -echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%1\local.make -echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%1\local.make -echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%1\local.make -echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%1\local.make -echo MSC_VER=%MSC_VER% >> %HotSpotBuildSpace%\%1\local.make - -for /D %%j in (debug, fastdebug, product) do ( - if NOT EXIST %HotSpotBuildSpace%\%1\%%j mkdir %HotSpotBuildSpace%\%1\%%j -) - -pushd %HotSpotBuildSpace%\%1\generated -nmake /nologo -popd - -goto :eof - - -:makedir -echo NOTE: Using the following settings: -echo HotSpotWorkSpace=%HotSpotWorkSpace% -echo HotSpotBuildSpace=%HotSpotBuildSpace% -echo HotSpotJDKDist=%HotSpotJDKDist% - -echo COPYFILES %BUILDARCH% -call :generatefiles compiler1 -call :generatefiles tiered - -pushd %HotSpotBuildRoot% -REM It doesn't matter which variant we use here, "tiered" is as good as any of the others - we need the common variables -nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\tiered\local.make %ProjectFile% - -popd - -goto end - -:usage -echo Usage: create HotSpotJDKDist -echo. -echo This is the VS build setup script (as opposed to the batch -echo build execution script). It creates a build directory if necessary, -echo copies the appropriate files out of the workspace into it, and -echo builds and runs ProjectCreator in it. This has the side-effect of creating -echo the %ProjectFile% file in the build space, which is then used in Visual C++. -echo. -echo The HotSpotJDKDist defines the JDK that should be used when running the JVM. -echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection. -echo. -echo NOTE that it is now NOT safe to modify any of the files in the build -echo space, since they may be overwritten whenever this script is run or -echo nmake is run in that directory. - -:end - -endlocal diff --git a/hotspot/make/windows/create_obj_files.sh b/hotspot/make/windows/create_obj_files.sh deleted file mode 100644 index 685f7f3b0f5..00000000000 --- a/hotspot/make/windows/create_obj_files.sh +++ /dev/null @@ -1,167 +0,0 @@ -# -# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -set -e - -# Note that we currently do not have a way to set HotSpotMksHome in -# the batch build, but so far this has not seemed to be a problem. The -# reason this environment variable is necessary is that it seems that -# Windows truncates very long PATHs when executing shells like MKS's -# sh, and it has been found that sometimes `which sh` fails. - -if [ "x$HotSpotMksHome" != "x" ]; then - TOOL_DIR="$HotSpotMksHome" -else - # HotSpotMksHome is not set so use the directory that contains "sh". - # This works with both MKS and Cygwin. - SH=`which sh` - TOOL_DIR=`dirname "$SH"` -fi - -DIRNAME="$TOOL_DIR/dirname" -FIND="$TOOL_DIR/find" - -TYPE=$1 -Platform_arch=$2 -Platform_arch_model=$3 -Platform_os_family=windows -Platform_os_arch=windows_$Platform_arch - -WorkSpace=$4 -GENERATED=$5 - -COMMONSRC_REL=src -ALTSRC_REL=src/closed # Change this to pick up alt sources from somewhere else - -COMMONSRC=${WorkSpace}/${COMMONSRC_REL} -if [ "x$OPENJDK" != "xtrue" ]; then - ALTSRC=${WorkSpace}/${ALTSRC_REL} -else - ALTSRC=PATH_THAT_DOES_NOT_EXIST -fi - -BASE_PATHS="`if [ -d ${ALTSRC}/share/vm ]; then $FIND ${ALTSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc -o -name opto -o -name shark -o -name libadt \); fi`" -BASE_PATHS="${BASE_PATHS} ` $FIND ${COMMONSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc -o -name opto -o -name shark -o -name libadt \)`" - -for sd in \ - share/vm/gc/shared \ - os/${Platform_os_family}/vm \ - cpu/${Platform_arch}/vm \ - os_cpu/${Platform_os_arch}/vm; do - if [ -d "${ALTSRC}/${sd}" ]; then - BASE_PATHS="${BASE_PATHS} ${ALTSRC}/${sd}" - fi - BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/${sd}" -done - -BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles ${GENERATED}/tracefiles" - -if [ -d "${ALTSRC}/share/vm/jfr/buffers" ]; then - BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/buffers" -fi - -BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/share/vm/prims/wbtestmethods" - -# shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS. -if [ -d "${ALTSRC}/share/vm/gc" ]; then - BASE_PATHS="${BASE_PATHS} `$FIND ${ALTSRC}/share/vm/gc ! -name gc -prune -type d \! -name shared`" -fi -BASE_PATHS="${BASE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc ! -name gc -prune -type d \! -name shared`" - -if [ -d "${ALTSRC}/share/vm/c1" ]; then - COMPILER1_PATHS="${ALTSRC}/share/vm/c1" -fi -COMPILER1_PATHS="${COMPILER1_PATHS} ${COMMONSRC}/share/vm/c1" - -if [ -d "${ALTSRC}/share/vm/opto" ]; then - COMPILER2_PATHS="${ALTSRC}/share/vm/opto" -fi -COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/opto" -if [ -d "${ALTSRC}/share/vm/libadt" ]; then - COMPILER2_PATHS="${COMPILER2_PATHS} ${ALTSRC}/share/vm/libadt" -fi -COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/libadt" -COMPILER2_PATHS="${COMPILER2_PATHS} ${GENERATED}/adfiles" - -# Include dirs per type. -case "${TYPE}" in - "compiler1") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS}" ;; - "compiler2") Src_Dirs="${BASE_PATHS} ${COMPILER2_PATHS}" ;; - "tiered") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS} ${COMPILER2_PATHS}" ;; - "zero") Src_Dirs="${BASE_PATHS}" ;; - "shark") Src_Dirs="${BASE_PATHS}" ;; -esac - -COMPILER2_SPECIFIC_FILES="opto libadt bcEscapeAnalyzer.cpp c2_* runtime_*" -COMPILER1_SPECIFIC_FILES="c1_*" -JVMCI_SPECIFIC_FILES="*jvmci* *JVMCI*" -SHARK_SPECIFIC_FILES="shark" -ZERO_SPECIFIC_FILES="zero" - -# Always exclude these. -Src_Files_EXCLUDE="jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp" - -# Exclude per type. -case "${TYPE}" in - "compiler1") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER2_SPECIFIC_FILES} ${JVMCI_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;; - "compiler2") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; - "tiered") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; - "zero") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${COMPILER2_SPECIFIC_FILES} ${JVMCI_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;; - "shark") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${COMPILER2_SPECIFIC_FILES} ${JVMCI_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES}" ;; -esac - -# Special handling of arch model. -case "${Platform_arch_model}" in - "x86_32") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} *x86_64* ${JVMCI_SPECIFIC_FILES}" ;; - "x86_64") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} *x86_32*" ;; -esac - -# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE. -function findsrc { - $FIND ${1}/. ! -name . -prune \ - -a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \ - -a \! \( -name ${Src_Files_EXCLUDE// / -o -name } \) \ - | sed 's/.*\/\(.*\)/\1/'; -} - -Src_Files= -for e in ${Src_Dirs}; do - Src_Files="${Src_Files}`findsrc ${e}` " -done - -Obj_Files=" " -for e in ${Src_Files}; do - o="${e%\.[!.]*}.obj" - set +e - chk=`expr "${Obj_Files}" : ".* $o"` - set -e - if [ "$chk" != 0 ]; then - echo "# INFO: skipping duplicate $o" - continue - fi - Obj_Files="${Obj_Files}$o " -done -Obj_Files=`echo ${Obj_Files} | tr ' ' '\n' | LC_ALL=C sort` - -echo Obj_Files=${Obj_Files} diff --git a/hotspot/make/windows/cross_build.bat b/hotspot/make/windows/cross_build.bat deleted file mode 100644 index 36eac52b2fe..00000000000 --- a/hotspot/make/windows/cross_build.bat +++ /dev/null @@ -1,61 +0,0 @@ -@echo off -REM -REM Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. -REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -REM -REM This code is free software; you can redistribute it and/or modify it -REM under the terms of the GNU General Public License version 2 only, as -REM published by the Free Software Foundation. -REM -REM This code is distributed in the hope that it will be useful, but WITHOUT -REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -REM version 2 for more details (a copy is included in the LICENSE file that -REM accompanied this code). -REM -REM You should have received a copy of the GNU General Public License version -REM 2 along with this work; if not, write to the Free Software Foundation, -REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -REM -REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -REM or visit www.oracle.com if you need additional information or have any -REM questions. -REM -REM - -REM Cross compile IA64 compiler2 VM -REM Usage: -REM cross_compile flavor workspace bootstrap_dir [build_id] -REM %1 %2 %3 %4 -REM -REM Set current directory -for /F %%i in ('cd') do set CD=%%i -echo Setting up Visual C++ Compilation Environment -if "%MSVCDir%" == "" goto setdir1 -goto setenv1 -:setdir1 -SET MSVCDir=C:\Program Files\Microsoft Visual Studio\VC98 -:setenv1 -SET OLDINCLUDE=%INCLUDE% -SET OLDLIB=%LIB% -SET OLDPATH=%PATH% -call "%MSVCDir%\Bin\VCVARS32" -call %2\make\windows\build %1 adlc %2 %3 %4 -SET INCLUDE=%OLDINCLUDE% -SET LIB=%OLDLIB% -SET PATH=%OLDPATH% -echo Setting up 64-BIT Compilation Environment -if "%MSSdk%" == "" goto setdir2 -goto setenv2 -:setdir2 -SET MSSdk=C:\Program Files\Microsoft SDK -:setenv2 -call "%MSSdk%\SetEnv.bat" /XP64 -SET ALT_ADLC_PATH=%CD%\windows_i486_compiler2\generated -call %2\make\windows\build %1 compiler2 %2 %3 %4 -SET INCLUDE=%OLDINCLUDE% -SET LIB=%OLDLIB% -SET PATH=%OLDPATH% -SET OLDINCLUDE= -SET OLDLIB= -SET OLDPATH= diff --git a/hotspot/make/windows/get_msc_ver.sh b/hotspot/make/windows/get_msc_ver.sh deleted file mode 100644 index 89c7a3f8c8f..00000000000 --- a/hotspot/make/windows/get_msc_ver.sh +++ /dev/null @@ -1,93 +0,0 @@ -# -# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -set -e - -# This shell script echoes "MSC_VER=" -# It ignores the micro version component. -# Examples: -# cl version 12.00.8804 returns "MSC_VER=1200" -# cl version 13.10.3077 returns "MSC_VER=1310" -# cl version 14.00.30701 returns "MSC_VER=1399" (OLD_MSSDK version) -# cl version 14.00.40310.41 returns "MSC_VER=1400" -# cl version 15.00.21022.8 returns "MSC_VER=1500" - -# Note that we currently do not have a way to set HotSpotMksHome in -# the batch build, but so far this has not seemed to be a problem. The -# reason this environment variable is necessary is that it seems that -# Windows truncates very long PATHs when executing shells like MKS's -# sh, and it has been found that sometimes `which sh` fails. - -if [ "x$HotSpotMksHome" != "x" ]; then - TOOL_DIR="$HotSpotMksHome" -else - # HotSpotMksHome is not set so use the directory that contains "sh". - # This works with both MKS and Cygwin. - SH=`which sh` - TOOL_DIR=`dirname "$SH"` -fi - -DIRNAME="$TOOL_DIR/dirname" -HEAD="$TOOL_DIR/head" -ECHO="$TOOL_DIR/echo" -EXPR="$TOOL_DIR/expr" -CUT="$TOOL_DIR/cut" -SED="$TOOL_DIR/sed" - -if [ "x$FORCE_MSC_VER" != "x" ]; then - echo "MSC_VER=$FORCE_MSC_VER" -else - MSC_VER_RAW=`cl 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'` - MSC_VER_MAJOR=`"$ECHO" $MSC_VER_RAW | "$CUT" -d'.' -f1` - MSC_VER_MINOR=`"$ECHO" $MSC_VER_RAW | "$CUT" -d'.' -f2` - MSC_VER_MICRO=`"$ECHO" $MSC_VER_RAW | "$CUT" -d'.' -f3` - if [ "${MSC_VER_MAJOR}" -eq 14 -a "${MSC_VER_MINOR}" -eq 0 -a "${MSC_VER_MICRO}" -eq 30701 ] ; then - # This said 1400 but it was really more like VS2003 (VC7) in terms of options - MSC_VER=1399 - else - MSC_VER=`"$EXPR" $MSC_VER_MAJOR \* 100 + $MSC_VER_MINOR` - fi - echo "MSC_VER=$MSC_VER" - echo "MSC_VER_RAW=$MSC_VER_RAW" -fi - -if [ "x$FORCE_LD_VER" != "x" ]; then - echo "LD_VER=$FORCE_LD_VER" -else - # use the "link" command that is co-located with the "cl" command - cl_cmd=`which cl` - if [ "x$cl_cmd" != "x" ]; then - link_cmd=`$DIRNAME "$cl_cmd"`/link - else - # which can't find "cl" so just use which ever "link" we find - link_cmd="link" - fi - LD_VER_RAW=`"$link_cmd" 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'` - LD_VER_MAJOR=`"$ECHO" $LD_VER_RAW | "$CUT" -d'.' -f1` - LD_VER_MINOR=`"$ECHO" $LD_VER_RAW | "$CUT" -d'.' -f2` - LD_VER_MICRO=`"$ECHO" $LD_VER_RAW | "$CUT" -d'.' -f3` - LD_VER=`"$EXPR" $LD_VER_MAJOR \* 100 + $LD_VER_MINOR` - echo "LD_VER=$LD_VER" - echo "LD_VER_RAW=$LD_VER_RAW" -fi diff --git a/hotspot/make/windows/jvmexp.lcf b/hotspot/make/windows/jvmexp.lcf deleted file mode 100644 index 6489d02e266..00000000000 --- a/hotspot/make/windows/jvmexp.lcf +++ /dev/null @@ -1,10 +0,0 @@ --export:JNI_GetDefaultJavaVMInitArgs --export:JNI_CreateJavaVM --export:JNI_GetCreatedJavaVMs - --export:jio_snprintf --export:jio_printf --export:jio_fprintf --export:jio_vfprintf --export:jio_vsnprintf - diff --git a/hotspot/make/windows/jvmexp_g.lcf b/hotspot/make/windows/jvmexp_g.lcf deleted file mode 100644 index 6489d02e266..00000000000 --- a/hotspot/make/windows/jvmexp_g.lcf +++ /dev/null @@ -1,10 +0,0 @@ --export:JNI_GetDefaultJavaVMInitArgs --export:JNI_CreateJavaVM --export:JNI_GetCreatedJavaVMs - --export:jio_snprintf --export:jio_printf --export:jio_fprintf --export:jio_vfprintf --export:jio_vsnprintf - diff --git a/hotspot/make/windows/makefiles/adlc.make b/hotspot/make/windows/makefiles/adlc.make deleted file mode 100644 index 781e3ac4048..00000000000 --- a/hotspot/make/windows/makefiles/adlc.make +++ /dev/null @@ -1,119 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - - -# Rules for building adlc.exe - -# Need exception handling support here -# $(MS_RUNTIME_OPTION) ( with /D_STATIC_CPPLIB) -# causes adlc.exe to link with the static -# multithread Standard C++ library (libcpmt.lib) instead of -# the dynamic version (msvcprt.lib), which is not included -# in any of the free tools. -EXH_FLAGS=$(GX_OPTION) $(MS_RUNTIME_OPTION) - -!ifdef ALT_ADLC_PATH -ADLC=$(ALT_ADLC_PATH)\adlc.exe -!else -ADLC=adlc -!endif - -!ifdef LP64 -ADLCFLAGS=-q -T -D_LP64 -!else -ADLCFLAGS=-q -T -U_LP64 -!endif - -ADLC_CXX_FLAGS=$(CXX_FLAGS) /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE - -CXX_INCLUDE_DIRS=\ - /I "..\generated" \ - /I "$(WorkSpace)\src\share\vm" \ - /I "$(WorkSpace)\src\os\windows\vm" \ - /I "$(WorkSpace)\src\cpu\$(Platform_arch)\vm" - -!if "$(Platform_arch_model)" == "$(Platform_arch)" -SOURCES_AD=\ - $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad -!else -SOURCES_AD=\ - $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad \ - $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch).ad -!endif - -# NOTE! If you add any files here, you must also update GENERATED_NAMES_IN_DIR -# and ProjectCreatorIDEOptions in projectcreator.make. -GENERATED_NAMES=\ - ad_$(Platform_arch_model).cpp \ - ad_$(Platform_arch_model).hpp \ - ad_$(Platform_arch_model)_clone.cpp \ - ad_$(Platform_arch_model)_expand.cpp \ - ad_$(Platform_arch_model)_format.cpp \ - ad_$(Platform_arch_model)_gen.cpp \ - ad_$(Platform_arch_model)_misc.cpp \ - ad_$(Platform_arch_model)_peephole.cpp \ - ad_$(Platform_arch_model)_pipeline.cpp \ - adGlobals_$(Platform_arch_model).hpp \ - dfa_$(Platform_arch_model).cpp - -# NOTE! This must be kept in sync with GENERATED_NAMES -GENERATED_NAMES_IN_DIR=\ - $(AdlcOutDir)\ad_$(Platform_arch_model).cpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model).hpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model)_clone.cpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model)_expand.cpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model)_format.cpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model)_gen.cpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model)_misc.cpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model)_peephole.cpp \ - $(AdlcOutDir)\ad_$(Platform_arch_model)_pipeline.cpp \ - $(AdlcOutDir)\adGlobals_$(Platform_arch_model).hpp \ - $(AdlcOutDir)\dfa_$(Platform_arch_model).cpp - -{$(WorkSpace)\src\share\vm\adlc}.cpp.obj:: - $(CXX) $(ADLC_CXX_FLAGS) $(EXH_FLAGS) $(CXX_INCLUDE_DIRS) /c $< - -{$(WorkSpace)\src\share\vm\opto}.cpp.obj:: - $(CXX) $(ADLC_CXX_FLAGS) $(EXH_FLAGS) $(CXX_INCLUDE_DIRS) /c $< - -adlc.exe: main.obj adlparse.obj archDesc.obj arena.obj dfa.obj dict2.obj filebuff.obj \ - forms.obj formsopt.obj formssel.obj opcodes.obj output_c.obj output_h.obj - $(LD) $(LD_FLAGS) /subsystem:console /out:$@ $** -!if "$(MT)" != "" -# The previous link command created a .manifest file that we want to -# insert into the linked artifact so we do not need to track it -# separately. Use ";#2" for .dll and ";#1" for .exe: - $(MT) /manifest $@.manifest /outputresource:$@;#1 -!endif - -$(GENERATED_NAMES_IN_DIR): $(Platform_arch_model).ad adlc.exe - rm -f $(GENERATED_NAMES) - if exist $(AdlcOutDir) rmdir /s /q $(AdlcOutDir) - mkdir $(AdlcOutDir) - $(ADLC) $(ADLCFLAGS) $(Platform_arch_model).ad - mv $(GENERATED_NAMES) $(AdlcOutDir)/ - -$(Platform_arch_model).ad: $(SOURCES_AD) - rm -f $(Platform_arch_model).ad - cat $(SOURCES_AD) >$(Platform_arch_model).ad diff --git a/hotspot/make/windows/makefiles/compile.make b/hotspot/make/windows/makefiles/compile.make deleted file mode 100644 index 0af2574c251..00000000000 --- a/hotspot/make/windows/makefiles/compile.make +++ /dev/null @@ -1,197 +0,0 @@ -# -# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Generic compiler settings -!if "x$(CXX)" == "x" -CXX=cl.exe -!endif - -# CXX Flags: (these vary slightly from VC6->VS2003->VS2005 compilers) -# /nologo Supress copyright message at every cl.exe startup -# /W3 Warning level 3 -# /Zi Include debugging information -# /d2Zi+ Extended debugging symbols for optimized code (/Zo in VS2013 Update 3 and later) -# /WX Treat any warning error as a fatal error -# /MD Use dynamic multi-threaded runtime (msvcrt.dll or msvc*NN.dll) -# /MTd Use static multi-threaded runtime debug versions -# /O1 Optimize for size (/Os), skips /Oi -# /O2 Optimize for speed (/Ot), adds /Oi to /O1 -# /Ox Old "all optimizations flag" for VC6 (in /O1) -# /Oy Use frame pointer register as GP reg (in /Ox and /O1) -# /GF Merge string constants and put in read-only memory (in /O1) -# /Gy Func level link (in /O1, allows for link-time func ordering) -# /Gs Inserts stack probes (in /O1) -# /GS Inserts security stack checks in some functions (VS2005 default) -# /Oi Use intrinsics (in /O2) -# /Od Disable all optimizations -# /MP Use multiple cores for compilation -# -# NOTE: Normally following any of the above with a '-' will turn off that flag -# -# 6655385: For VS2003/2005 we now specify /Oy- (disable frame pointer -# omission.) This has little to no effect on performance while vastly -# improving the quality of crash log stack traces involving jvm.dll. - -# These are always used in all compiles -CXX_FLAGS=$(EXTRA_CFLAGS) /nologo /W3 - -!if "$(WARNINGS_AS_ERRORS)" != "false" -CXX_FLAGS=$(CXX_FLAGS) /WX -!endif - -# Let's add debug information when Full Debug Symbols is enabled -!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" -CXX_FLAGS=$(CXX_FLAGS) /Zi /d2Zi+ -!endif - -# Based on BUILDARCH we add some flags and select the default compiler name -!if "$(BUILDARCH)" == "ia64" -MACHINE=IA64 -CXX_FLAGS=$(CXX_FLAGS) /D "CC_INTERP" /D "_LP64" /D "IA64" -!endif - -!if "$(BUILDARCH)" == "amd64" -MACHINE=AMD64 -CXX_FLAGS=$(CXX_FLAGS) /D "_LP64" /D "AMD64" -LP64=1 -!endif - -!if "$(BUILDARCH)" == "i486" -MACHINE=I386 -# VS2013 generates bad l2f without /arch:IA32 -CXX_FLAGS=$(CXX_FLAGS) /D "IA32" /arch:IA32 -!endif - -CXX_FLAGS=$(CXX_FLAGS) /D "WIN32" /D "_WINDOWS" -# Must specify this for sharedRuntimeTrig.cpp -CXX_FLAGS=$(CXX_FLAGS) /D "VM_LITTLE_ENDIAN" - -# Used for platform dispatching -CXX_FLAGS=$(CXX_FLAGS) /D TARGET_OS_FAMILY_windows -CXX_FLAGS=$(CXX_FLAGS) /D TARGET_ARCH_$(Platform_arch) -CXX_FLAGS=$(CXX_FLAGS) /D TARGET_ARCH_MODEL_$(Platform_arch_model) -CXX_FLAGS=$(CXX_FLAGS) /D TARGET_OS_ARCH_windows_$(Platform_arch) -CXX_FLAGS=$(CXX_FLAGS) /D TARGET_OS_ARCH_MODEL_windows_$(Platform_arch_model) -CXX_FLAGS=$(CXX_FLAGS) /D TARGET_COMPILER_visCPP - - -# MSC_VER is a 4 digit number that tells us what compiler is being used -# and is generated when the local.make file is created by build.make -# via the script get_msc_ver.sh -# -# If MSC_VER is set, it overrides the above default setting. -# But it should be set. -# Possible values: -# 1200 is for VC6 -# 1300 and 1310 is VS2003 or VC7 -# 1399 is our fake number for the VS2005 compiler that really isn't 1400 -# 1400 is for VS2005 -# 1500 is for VS2008 -# 1600 is for VS2010 -# 1700 is for VS2012 -# 1800 is for VS2013 -# Do not confuse this MSC_VER with the predefined macro _MSC_VER that the -# compiler provides, when MSC_VER==1399, _MSC_VER will be 1400. -# Normally they are the same, but a pre-release of the VS2005 compilers -# in the Windows 64bit Platform SDK said it was 1400 when it was really -# closer to VS2003 in terms of option spellings, so we use 1399 for that -# 1400 version that really isn't 1400. -# See the file get_msc_ver.sh for more info. - -# By default, we do not want to use the debug version of the msvcrt.dll file -# but if MFC_DEBUG is defined in the environment it will be used. -MS_RUNTIME_OPTION = /MD -!if "$(MFC_DEBUG)" == "true" -MS_RUNTIME_OPTION = /MTd /D "_DEBUG" -!endif - -# VS2012 and later won't work with: -# /D _STATIC_CPPLIB /D _DISABLE_DEPRECATE_STATIC_CPPLIB -!if "$(MSC_VER)" < "1700" -# Always add the _STATIC_CPPLIB flag -STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB /D _DISABLE_DEPRECATE_STATIC_CPPLIB -MS_RUNTIME_OPTION = $(MS_RUNTIME_OPTION) $(STATIC_CPPLIB_OPTION) -!endif -CXX_FLAGS=$(CXX_FLAGS) $(MS_RUNTIME_OPTION) - -PRODUCT_OPT_OPTION = /O2 /Oy- -FASTDEBUG_OPT_OPTION = /O2 /Oy- -DEBUG_OPT_OPTION = /Od -GX_OPTION = /EHsc -LD_FLAGS = /manifest $(LD_FLAGS) -MP_FLAG = /MP -# Manifest Tool - used in VS2005 and later to adjust manifests stored -# as resources inside build artifacts. -!if "x$(MT)" == "x" -MT=mt.exe -!endif -!if "$(BUILDARCH)" == "i486" -LD_FLAGS = /SAFESEH $(LD_FLAGS) -!endif - -CXX_FLAGS = $(CXX_FLAGS) $(MP_FLAG) - -# If NO_OPTIMIZATIONS is defined in the environment, turn everything off -!ifdef NO_OPTIMIZATIONS -PRODUCT_OPT_OPTION = $(DEBUG_OPT_OPTION) -FASTDEBUG_OPT_OPTION = $(DEBUG_OPT_OPTION) -!endif - -# Generic linker settings -!if "x$(LD)" == "x" -LD=link.exe -!endif -LD_FLAGS= $(LD_FLAGS) kernel32.lib user32.lib gdi32.lib winspool.lib \ - comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \ - uuid.lib Wsock32.lib winmm.lib version.lib /nologo /machine:$(MACHINE) /opt:REF \ - /opt:ICF,8 -!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" -LD_FLAGS= $(LD_FLAGS) /map /debug -!endif - - -!if $(MSC_VER) >= 1600 -LD_FLAGS= $(LD_FLAGS) psapi.lib -!endif - -# Resource compiler settings -!if "x$(RC)" == "x" -RC=rc.exe -!endif -RC_FLAGS=/D "HS_VER=$(HS_VER)" \ - /D "HS_DOTVER=$(HS_DOTVER)" \ - /D "HS_BUILD_ID=$(HS_BUILD_ID)" \ - /D "JDK_VER=$(JDK_VER)" \ - /D "JDK_DOTVER=$(JDK_DOTVER)" \ - /D "HS_COMPANY=$(HS_COMPANY)" \ - /D "HS_FILEDESC=$(HS_FILEDESC)" \ - /D "HS_COPYRIGHT=$(HS_COPYRIGHT)" \ - /D "HS_FNAME=$(HS_FNAME)" \ - /D "HS_INTERNAL_NAME=$(HS_INTERNAL_NAME)" \ - /D "HS_NAME=$(HS_NAME)" - -# Need this to match the CXX_FLAGS settings -!if "$(MFC_DEBUG)" == "true" -RC_FLAGS = $(RC_FLAGS) /D "_DEBUG" -!endif diff --git a/hotspot/make/windows/makefiles/debug.make b/hotspot/make/windows/makefiles/debug.make deleted file mode 100644 index 3ad45627467..00000000000 --- a/hotspot/make/windows/makefiles/debug.make +++ /dev/null @@ -1,68 +0,0 @@ -# -# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -HS_INTERNAL_NAME=jvm -HS_FNAME=$(HS_INTERNAL_NAME).dll -AOUT=$(HS_FNAME) -GENERATED=../generated - -# Allow the user to turn off precompiled headers from the command line. -!if "$(USE_PRECOMPILED_HEADER)" != "0" -BUILD_PCH_FILE=_build_pch_file.obj -!endif - -default:: $(BUILD_PCH_FILE) $(AOUT) - -!include ../local.make -!include compile.make - -# _NMT_NOINLINE_ informs NMT that no inlining by Compiler -CXX_FLAGS=$(CXX_FLAGS) $(DEBUG_OPT_OPTION) /D "_NMT_NOINLINE_" - -!include $(WorkSpace)/make/windows/makefiles/vm.make -!include local.make - -HS_BUILD_ID=$(HOTSPOT_VERSION_STRING)-debug - -# Force resources to be rebuilt every time -$(Res_Files): FORCE - -# NOTE: Changes in this file was just to give a proper command line when linking -# for use when developing the new build, and should not be integrated. -$(AOUT): $(Res_Files) $(Obj_Files) vm.def - $(LD) $(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files) -!if "$(MT)" != "" -# The previous link command created a .manifest file that we want to -# insert into the linked artifact so we do not need to track it -# separately. Use ";#2" for .dll and ";#1" for .exe: - $(MT) /manifest $@.manifest /outputresource:$@;#2 -!endif -!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" -!if "$(ZIP_DEBUGINFO_FILES)" == "1" - $(ZIPEXE) -q $*.diz $*.map $*.pdb - $(RM) $*.map $*.pdb -!endif -!endif - -!include $(WorkSpace)/make/windows/makefiles/shared.make diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make deleted file mode 100644 index fbbe6f16490..00000000000 --- a/hotspot/make/windows/makefiles/defs.make +++ /dev/null @@ -1,282 +0,0 @@ -# -# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -# The common definitions for hotspot windows builds. -# Include the top level defs.make under make directory instead of this one. -# This file is included into make/defs.make. -# On windows it is only used to construct parameters for -# make/windows/build.make when make/Makefile is used to build VM. - -SLASH_JAVA ?= J: -PATH_SEP = ; - -MAKE_ARGS += WARNINGS_AS_ERRORS=$(WARNINGS_AS_ERRORS) - -# Need PLATFORM (os-arch combo names) for jdk and hotspot, plus libarch name -ifeq ($(ARCH_DATA_MODEL),32) - ARCH_DATA_MODEL=32 - PLATFORM=windows-i586 - VM_PLATFORM=windows_i486 - HS_ARCH=x86 - MAKE_ARGS += ARCH=x86 - MAKE_ARGS += BUILDARCH=i486 - MAKE_ARGS += Platform_arch=x86 - MAKE_ARGS += Platform_arch_model=x86_32 -endif - -ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) x86),) - ARCH_DATA_MODEL=32 - PLATFORM=windows-i586 - VM_PLATFORM=windows_i486 - HS_ARCH=x86 - MAKE_ARGS += ARCH=x86 - MAKE_ARGS += BUILDARCH=i486 - MAKE_ARGS += Platform_arch=x86 - MAKE_ARGS += Platform_arch_model=x86_32 -endif - -ifneq ($(ARCH_DATA_MODEL),32) - ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) ia64),) - ARCH_DATA_MODEL=64 - PLATFORM=windows-ia64 - VM_PLATFORM=windows_ia64 - HS_ARCH=ia64 - MAKE_ARGS += LP64=1 - MAKE_ARGS += ARCH=ia64 - MAKE_ARGS += BUILDARCH=ia64 - MAKE_ARGS += Platform_arch=ia64 - MAKE_ARGS += Platform_arch_model=ia64 - endif - -# http://support.microsoft.com/kb/888731 : this can be either -# AMD64 for AMD, or EM64T for Intel chips. - ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) AMD64),) - ARCH_DATA_MODEL=64 - PLATFORM=windows-amd64 - VM_PLATFORM=windows_amd64 - HS_ARCH=x86 - MAKE_ARGS += LP64=1 - MAKE_ARGS += ARCH=x86 - MAKE_ARGS += BUILDARCH=amd64 - MAKE_ARGS += Platform_arch=x86 - MAKE_ARGS += Platform_arch_model=x86_64 - endif - -ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) EM64T),) - ARCH_DATA_MODEL=64 - PLATFORM=windows-amd64 - VM_PLATFORM=windows_amd64 - HS_ARCH=x86 - MAKE_ARGS += LP64=1 - MAKE_ARGS += ARCH=x86 - MAKE_ARGS += BUILDARCH=amd64 - MAKE_ARGS += Platform_arch=x86 - MAKE_ARGS += Platform_arch_model=x86_64 - endif - -# NB later OS versions than 2003 may report "Intel64" - ifneq ($(shell $(ECHO) $(PROCESSOR_IDENTIFIER) | $(GREP) Intel64),) - ARCH_DATA_MODEL=64 - PLATFORM=windows-amd64 - VM_PLATFORM=windows_amd64 - HS_ARCH=x86 - MAKE_ARGS += LP64=1 - MAKE_ARGS += ARCH=x86 - MAKE_ARGS += BUILDARCH=amd64 - MAKE_ARGS += Platform_arch=x86 - MAKE_ARGS += Platform_arch_model=x86_64 - endif -endif - -# Full Debug Symbols has been enabled on Windows since JDK1.4.1 so -# there is no need for an "earlier than JDK7 check". -# The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product -# builds is enabled with debug info files ZIP'ed to save space. For -# BUILD_FLAVOR != product builds, FDS is always enabled, after all a -# debug build without debug info isn't very useful. -# The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled. -# -# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be -# disabled for a BUILD_FLAVOR == product build. -# -# Note: Use of a different variable name for the FDS override option -# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS -# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass -# in options via environment variables, use of distinct variables -# prevents strange behaviours. For example, in a BUILD_FLAVOR != -# product build, the FULL_DEBUG_SYMBOLS environment variable will be -# 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If -# the same variable name is used, then different values can be picked -# up by different parts of the build. Just to be clear, we only need -# two variable names because the incoming option value can be -# overridden in some situations, e.g., a BUILD_FLAVOR != product -# build. - -# Due to the multiple sub-make processes that occur this logic gets -# executed multiple times. We reduce the noise by at least checking that -# BUILD_FLAVOR has been set. -ifneq ($(BUILD_FLAVOR),) - ifeq ($(BUILD_FLAVOR), product) - FULL_DEBUG_SYMBOLS ?= 1 - ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS) - else - # debug variants always get Full Debug Symbols (if available) - ENABLE_FULL_DEBUG_SYMBOLS = 1 - endif - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") - MAKE_ARGS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) - - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ZIP_DEBUGINFO_FILES ?= 1 - else - ZIP_DEBUGINFO_FILES=0 - endif - MAKE_ARGS += ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) -endif - -MAKE_ARGS += RM="$(RM)" -MAKE_ARGS += ZIPEXE=$(ZIPEXE) -MAKE_ARGS += CP="${CP}" -MAKE_ARGS += MV="${MV}" - - -# On 32 bit windows we build server and client, on 64 bit just server. -ifeq ($(JVM_VARIANTS),) - ifeq ($(ARCH_DATA_MODEL), 32) - JVM_VARIANTS:=client,server - JVM_VARIANT_CLIENT:=true - JVM_VARIANT_SERVER:=true - else - JVM_VARIANTS:=server - JVM_VARIANT_SERVER:=true - endif -endif - -JDK_INCLUDE_SUBDIR=win32 - -# Library suffix -LIBRARY_SUFFIX=dll - -# next parameters are defined in $(GAMMADIR)/make/defs.make. -MAKE_ARGS += VERSION_SHORT=$(VERSION_SHORT) -MAKE_ARGS += VERSION_MAJOR=$(VERSION_MAJOR) -MAKE_ARGS += VERSION_MINOR=$(VERSION_MINOR) -MAKE_ARGS += VERSION_SECURITY=$(VERSION_SECURITY) -MAKE_ARGS += VERSION_PATCH=$(VERSION_PATCH) -MAKE_ARGS += VERSION_BUILD=$(VERSION_BUILD) -MAKE_ARGS += DEBUG_LEVEL=$(DEBUG_LEVEL) - -# JDK_DOTVER and JDK_VER are needed in Windows RC files -COMMA:=, -MAKE_ARGS += JDK_DOTVER=$(VERSION_NUMBER_FOUR_POSITIONS) -MAKE_ARGS += JDK_VER=$(subst .,$(COMMA),$(VERSION_NUMBER_FOUR_POSITIONS)) - -NMAKE= MAKEFLAGS= MFLAGS= EXTRA_CFLAGS="$(EXTRA_CFLAGS)" nmake -NOLOGO -ifndef SYSTEM_UNAME - SYSTEM_UNAME := $(shell uname) - export SYSTEM_UNAME -endif - -# Check for CYGWIN -ifneq (,$(findstring CYGWIN,$(SYSTEM_UNAME))) - USING_CYGWIN=true -else - USING_CYGWIN=false -endif -# Check for MinGW -ifneq (,$(findstring MINGW,$(SYSTEM_UNAME))) - USING_MINGW=true -endif - -# Windows wants particular paths due to nmake (must be after macros defined) -# It is important that gnumake invokes nmake with C:\\...\\ formated -# strings so that nmake gets C:\...\ style strings. -# Check for CYGWIN -ifeq ($(USING_CYGWIN), true) - ABS_OUTPUTDIR := $(subst /,\\,$(shell /bin/cygpath -m -a "$(OUTPUTDIR)")) - ABS_BOOTDIR := $(subst /,\\,$(shell /bin/cygpath -m -a "$(BOOTDIR)")) - ABS_GAMMADIR := $(subst /,\\,$(shell /bin/cygpath -m -a "$(GAMMADIR)")) - ABS_OS_MAKEFILE := $(shell /bin/cygpath -m -a "$(HS_MAKE_DIR)/$(OSNAME)")/build.make -else ifeq ($(USING_MINGW), true) - ABS_OUTPUTDIR := $(shell $(CD) $(OUTPUTDIR);$(PWD)) - ABS_BOOTDIR := $(shell $(CD) $(BOOTDIR);$(PWD)) - ABS_GAMMADIR := $(shell $(CD) $(GAMMADIR);$(PWD)) - ABS_OS_MAKEFILE := $(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME);$(PWD))/build.make - else - ABS_OUTPUTDIR := $(subst /,\\,$(shell $(CD) $(OUTPUTDIR);$(PWD))) - ABS_BOOTDIR := $(subst /,\\,$(shell $(CD) $(BOOTDIR);$(PWD))) - ABS_GAMMADIR := $(subst /,\\,$(shell $(CD) $(GAMMADIR);$(PWD))) - ABS_OS_MAKEFILE := $(subst /,\\,$(shell $(CD) $(HS_MAKE_DIR)/$(OSNAME);$(PWD))/build.make) -endif - -EXPORT_SERVER_DIR = $(EXPORT_BIN_DIR)/server -EXPORT_CLIENT_DIR = $(EXPORT_BIN_DIR)/client - -ifeq ($(JVM_VARIANT_SERVER),true) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.$(LIBRARY_SUFFIX) - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.diz - else - EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.pdb - EXPORT_LIST += $(EXPORT_SERVER_DIR)/jvm.map - endif - endif -endif -ifeq ($(JVM_VARIANT_CLIENT),true) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.$(LIBRARY_SUFFIX) - ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - ifeq ($(ZIP_DEBUGINFO_FILES),1) - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.diz - else - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.pdb - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/jvm.map - endif - endif -endif - -EXPORT_LIST += $(EXPORT_LIB_DIR)/jvm.lib - -# Propagate compiler and tools paths from configure to nmake. -# Need to make sure they contain \\ and not /. -ifneq ($(SPEC),) - ifeq ($(USING_CYGWIN), true) - MAKE_ARGS += CXX="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(CXX)))" - MAKE_ARGS += LD="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(LD)))" - MAKE_ARGS += RC="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(RC)))" - MAKE_ARGS += MT="$(subst /,\\,$(shell /bin/cygpath -s -m -a $(MT)))" - else - MAKE_ARGS += CXX="$(subst /,\\,$(CXX))" - MAKE_ARGS += LD="$(subst /,\\,$(LD))" - MAKE_ARGS += RC="$(subst /,\\,$(RC))" - MAKE_ARGS += MT="$(subst /,\\,$(MT))" - endif -endif - -ifdef OPENJDK - MAKE_ARGS += OPENJDK="$(OPENJDK)" -endif diff --git a/hotspot/make/windows/makefiles/fastdebug.make b/hotspot/make/windows/makefiles/fastdebug.make deleted file mode 100644 index ea6fc41a42a..00000000000 --- a/hotspot/make/windows/makefiles/fastdebug.make +++ /dev/null @@ -1,67 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -HS_INTERNAL_NAME=jvm -HS_FNAME=$(HS_INTERNAL_NAME).dll -AOUT=$(HS_FNAME) -GENERATED=../generated - -# Allow the user to turn off precompiled headers from the command line. -!if "$(USE_PRECOMPILED_HEADER)" != "0" -BUILD_PCH_FILE=_build_pch_file.obj -!endif - -default:: $(BUILD_PCH_FILE) $(AOUT) - -!include ../local.make -!include compile.make - -CXX_FLAGS=$(CXX_FLAGS) $(FASTDEBUG_OPT_OPTION) - -!include $(WorkSpace)/make/windows/makefiles/vm.make -!include local.make - -HS_BUILD_ID=$(HOTSPOT_VERSION_STRING)-fastdebug - -# Force resources to be rebuilt every time -$(Res_Files): FORCE - -# NOTE: Changes in this file was just to give a proper command line when linking -# for use when developing the new build, and should not be integrated. -$(AOUT): $(Res_Files) $(Obj_Files) vm.def - $(LD) $(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files) -!if "$(MT)" != "" -# The previous link command created a .manifest file that we want to -# insert into the linked artifact so we do not need to track it -# separately. Use ";#2" for .dll and ";#1" for .exe: - $(MT) /manifest $@.manifest /outputresource:$@;#2 -!endif -!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" -!if "$(ZIP_DEBUGINFO_FILES)" == "1" - $(ZIPEXE) -q $*.diz $*.map $*.pdb - $(RM) $*.map $*.pdb -!endif -!endif - -!include $(WorkSpace)/make/windows/makefiles/shared.make diff --git a/hotspot/make/windows/makefiles/generated.make b/hotspot/make/windows/makefiles/generated.make deleted file mode 100644 index e376c7499cb..00000000000 --- a/hotspot/make/windows/makefiles/generated.make +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -!include ../local.make -!include $(WorkSpace)/make/windows/makefiles/projectcreator.make -!include local.make - -# Pick up rules for building JVMTI (JSR-163) -JvmtiOutDir=jvmtifiles -!include $(WorkSpace)/make/windows/makefiles/jvmti.make - -# Pick up rules for building trace -TraceOutDir=tracefiles -!include $(WorkSpace)/make/windows/makefiles/trace.make - -AdlcOutDir=adfiles - -!if ("$(Variant)" == "compiler2") || ("$(Variant)" == "tiered") -default:: $(AdlcOutDir)/ad_$(Platform_arch_model).cpp $(AdlcOutDir)/dfa_$(Platform_arch_model).cpp $(JvmtiGeneratedFiles) $(TraceGeneratedFiles) buildobjfiles -!else -default:: $(JvmtiGeneratedFiles) $(TraceGeneratedFiles) buildobjfiles -!endif - -buildobjfiles: - @ sh $(WorkSpace)/make/windows/create_obj_files.sh $(Variant) $(Platform_arch) $(Platform_arch_model) $(WorkSpace) . > objfiles.make - -classes/ProjectCreator.class: $(ProjectCreatorSources) - if exist classes rmdir /s /q classes - mkdir classes - $(COMPILE_JAVAC) -classpath $(WorkSpace)\src\share\tools\ProjectCreator -d classes $(ProjectCreatorSources) - -!if ("$(Variant)" == "compiler2") || ("$(Variant)" == "tiered") - -!include $(WorkSpace)/make/windows/makefiles/compile.make -!include $(WorkSpace)/make/windows/makefiles/adlc.make - -!endif - -!include $(WorkSpace)/make/windows/makefiles/shared.make diff --git a/hotspot/make/windows/makefiles/jvmti.make b/hotspot/make/windows/makefiles/jvmti.make deleted file mode 100644 index ce29fe34daa..00000000000 --- a/hotspot/make/windows/makefiles/jvmti.make +++ /dev/null @@ -1,114 +0,0 @@ -# -# Copyright (c) 2003, 2008, 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. -# -# - -# This makefile (jvmti.make) is included from the jvmti.make in the -# build directories. -# -# It knows how to build and run the tools to generate jvmti. - -!include $(WorkSpace)/make/windows/makefiles/rules.make - -# ######################################################################### - -JvmtiSrcDir = $(WorkSpace)/src/share/vm/prims -InterpreterSrcDir = $(WorkSpace)/src/share/vm/interpreter - -JvmtiGeneratedNames = \ - jvmtiEnv.hpp \ - jvmtiEnter.cpp \ - jvmtiEnterTrace.cpp \ - jvmtiEnvRecommended.cpp \ - bytecodeInterpreterWithChecks.cpp \ - jvmti.h \ - -JvmtiEnvFillSource = $(JvmtiSrcDir)/jvmtiEnvFill.java -JvmtiEnvFillClass = $(JvmtiOutDir)/jvmtiEnvFill.class - -JvmtiGenSource = $(JvmtiSrcDir)/jvmtiGen.java -JvmtiGenClass = $(JvmtiOutDir)/jvmtiGen.class - -#Note: JvmtiGeneratedFiles must be kept in sync with JvmtiGeneratedNames by hand. -#Should be equivalent #to "JvmtiGeneratedFiles = $(JvmtiGeneratedNames:%=$(JvmtiOutDir)/%)" -JvmtiGeneratedFiles = \ - $(JvmtiOutDir)/jvmtiEnv.hpp \ - $(JvmtiOutDir)/jvmtiEnter.cpp \ - $(JvmtiOutDir)/jvmtiEnterTrace.cpp \ - $(JvmtiOutDir)/jvmtiEnvRecommended.cpp\ - $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp\ - $(JvmtiOutDir)/jvmti.h \ - -XSLT = $(RUN_JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -# ######################################################################### - -both = $(JvmtiGenClass) $(JvmtiSrcDir)/jvmti.xml $(JvmtiSrcDir)/jvmtiLib.xsl - -default:: - @if not exist $(JvmtiOutDir) mkdir $(JvmtiOutDir) - -$(JvmtiGenClass): $(JvmtiGenSource) - $(COMPILE_JAVAC) -d $(JvmtiOutDir) $(JvmtiGenSource) - -$(JvmtiEnvFillClass): $(JvmtiEnvFillSource) - @$(COMPILE_JAVAC) -d $(JvmtiOutDir) $(JvmtiEnvFillSource) - -$(JvmtiOutDir)/jvmtiEnter.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ - @$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnter.cpp -PARAM interface jvmti - -$(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp: $(JvmtiGenClass) $(InterpreterSrcDir)/bytecodeInterpreter.cpp $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl - @echo Generating $@ - @$(XSLT) -IN $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xml -XSL $(InterpreterSrcDir)/bytecodeInterpreterWithChecks.xsl -OUT $(JvmtiOutDir)/bytecodeInterpreterWithChecks.cpp - -$(JvmtiOutDir)/jvmtiEnterTrace.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnter.xsl - @echo Generating $@ - @$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnter.xsl -OUT $(JvmtiOutDir)/jvmtiEnterTrace.cpp -PARAM interface jvmti -PARAM trace Trace - -$(JvmtiOutDir)/jvmtiEnvRecommended.cpp: $(both) $(JvmtiSrcDir)/jvmtiEnv.xsl $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiEnvFillClass) - @echo Generating $@ - @$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiEnv.xsl -OUT $(JvmtiOutDir)/jvmtiEnvStub.cpp - @$(RUN_JAVA) -classpath $(JvmtiOutDir) jvmtiEnvFill $(JvmtiSrcDir)/jvmtiEnv.cpp $(JvmtiOutDir)/jvmtiEnvStub.cpp $(JvmtiOutDir)/jvmtiEnvRecommended.cpp - -$(JvmtiOutDir)/jvmtiEnv.hpp: $(both) $(JvmtiSrcDir)/jvmtiHpp.xsl - @echo Generating $@ - @$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiHpp.xsl -OUT $(JvmtiOutDir)/jvmtiEnv.hpp - -$(JvmtiOutDir)/jvmti.h: $(both) $(JvmtiSrcDir)/jvmtiH.xsl - @echo Generating $@ - @$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmtiH.xsl -OUT $(JvmtiOutDir)/jvmti.h - -jvmtidocs: $(JvmtiOutDir)/jvmti.html - -$(JvmtiOutDir)/jvmti.html: $(both) $(JvmtiSrcDir)/jvmti.xsl - @echo Generating $@ - @$(XSLT) -IN $(JvmtiSrcDir)/jvmti.xml -XSL $(JvmtiSrcDir)/jvmti.xsl -OUT $(JvmtiOutDir)/jvmti.html - -# ######################################################################### - -cleanall : - rm $(JvmtiGenClass) $(JvmtiEnvFillClass) $(JvmtiGeneratedFiles) - -# ######################################################################### - -.PHONY: jvmtidocs cleanall diff --git a/hotspot/make/windows/makefiles/product.make b/hotspot/make/windows/makefiles/product.make deleted file mode 100644 index 09e750acc07..00000000000 --- a/hotspot/make/windows/makefiles/product.make +++ /dev/null @@ -1,72 +0,0 @@ -# -# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -HS_INTERNAL_NAME=jvm -HS_FNAME=$(HS_INTERNAL_NAME).dll -AOUT=$(HS_FNAME) -GENERATED=../generated - -# Allow the user to turn off precompiled headers from the command line. -!if "$(USE_PRECOMPILED_HEADER)" != "0" -BUILD_PCH_FILE=_build_pch_file.obj -!endif - -default:: $(BUILD_PCH_FILE) $(AOUT) - -!include ../local.make -!include compile.make - -CXX_FLAGS=$(CXX_FLAGS) $(PRODUCT_OPT_OPTION) - -RELEASE= - -RC_FLAGS=$(RC_FLAGS) /D "NDEBUG" - -!include $(WorkSpace)/make/windows/makefiles/vm.make -!include local.make - -HS_BUILD_ID=$(HOTSPOT_VERSION_STRING) - -# Force resources to be rebuilt every time -$(Res_Files): FORCE - -# NOTE: Changes in this file was just to give a proper command line when linking -# for use when developing the new build, and should not be integrated. -$(AOUT): $(Res_Files) $(Obj_Files) vm.def - $(LD) $(LD_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files) - -!if "$(MT)" != "" -# The previous link command created a .manifest file that we want to -# insert into the linked artifact so we do not need to track it -# separately. Use ";#2" for .dll and ";#1" for .exe: - $(MT) /manifest $@.manifest /outputresource:$@;#2 -!endif -!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1" -!if "$(ZIP_DEBUGINFO_FILES)" == "1" - $(ZIPEXE) -q $*.diz $*.map $*.pdb - $(RM) $*.map $*.pdb -!endif -!endif - -!include $(WorkSpace)/make/windows/makefiles/shared.make diff --git a/hotspot/make/windows/makefiles/projectcreator.make b/hotspot/make/windows/makefiles/projectcreator.make deleted file mode 100644 index e48a07b14dc..00000000000 --- a/hotspot/make/windows/makefiles/projectcreator.make +++ /dev/null @@ -1,210 +0,0 @@ -# -# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -!include $(WorkSpace)/make/windows/makefiles/rules.make - -# This is used externally by both batch and IDE builds, so can't -# reference any of the HOTSPOTWORKSPACE, HOTSPOTBUILDSPACE, -# HOTSPOTRELEASEBINDEST, or HOTSPOTDEBUGBINDEST environment variables. - -ProjectCreatorSources=\ - $(WorkSpace)\src\share\tools\ProjectCreator\ProjectCreator.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreator.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\FileTreeCreatorVC10.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatform.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC10.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\Util.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\BuildConfig.java \ - $(WorkSpace)\src\share\tools\ProjectCreator\ArgsParser.java - -# This is only used internally -ProjectCreatorIncludesPRIVATE=\ - -relativeAltSrcInclude src\closed \ - -altRelativeInclude share\vm \ - -altRelativeInclude os\windows\vm \ - -altRelativeInclude os_cpu\windows_$(Platform_arch)\vm \ - -altRelativeInclude cpu\$(Platform_arch)\vm \ - -relativeInclude src\share\vm \ - -relativeInclude src\share\vm\precompiled \ - -relativeInclude src\share\vm\prims\wbtestmethods \ - -relativeInclude src\share\vm\prims \ - -relativeInclude src\os\windows\vm \ - -relativeInclude src\os_cpu\windows_$(Platform_arch)\vm \ - -relativeInclude src\cpu\$(Platform_arch)\vm \ - -absoluteInclude $(HOTSPOTBUILDSPACE)/%f/generated \ - -relativeSrcInclude src \ - -absoluteSrcInclude $(HOTSPOTBUILDSPACE) \ - -ignorePath $(HOTSPOTBUILDSPACE) \ - -ignorePath share\vm\adlc \ - -ignorePath share\vm\shark \ - -ignorePath share\tools \ - -ignorePath solaris \ - -ignorePath posix \ - -ignorePath sparc \ - -ignorePath linux \ - -ignorePath bsd \ - -ignorePath osx \ - -ignorePath arm \ - -ignorePath ppc \ - -ignorePath zero \ - -ignorePath aix \ - -ignorePath aarch64 \ - -ignorePath jdk.vm.ci \ - -hidePath .hg - - -# This is referenced externally by both the IDE and batch builds -ProjectCreatorOptions= - -# This is used externally, but only by the IDE builds, so we can -# reference environment variables which aren't defined in the batch -# build process. - -ProjectCreatorIDEOptions = \ - -useToGeneratePch java.cpp \ - -disablePch os_windows.cpp \ - -disablePch os_windows_$(Platform_arch).cpp \ - -disablePch osThread_windows.cpp \ - -disablePch bytecodeInterpreter.cpp \ - -disablePch bytecodeInterpreterWithChecks.cpp \ - -disablePch getThread_windows_$(Platform_arch).cpp \ - -disablePch_compiler2 opcodes.cpp - -# Common options for the IDE builds for c1, and c2 -ProjectCreatorIDEOptions=\ - $(ProjectCreatorIDEOptions) \ - -sourceBase $(HOTSPOTWORKSPACE) \ - -buildBase $(HOTSPOTBUILDSPACE)\%f\%b \ - -buildSpace $(HOTSPOTBUILDSPACE) \ - -startAt src \ - -compiler $(VcVersion) \ - -projectFileName $(HOTSPOTBUILDSPACE)\$(ProjectFile) \ - -jdkTargetRoot $(HOTSPOTJDKDIST) \ - -define ALIGN_STACK_FRAMES \ - -define VM_LITTLE_ENDIAN \ - -prelink "" "Generating vm.def..." "cd $(HOTSPOTBUILDSPACE)\%f\%b set HOTSPOTMKSHOME=$(HOTSPOTMKSHOME) set JAVA_HOME=$(HOTSPOTJDKDIST) $(HOTSPOTMKSHOME)\sh $(HOTSPOTWORKSPACE)\make\windows\build_vm_def.sh $(LD_VER)" \ - -ignorePath src\jdk.hotspot.agent \ - -ignoreFile jsig.c \ - -ignoreFile jvmtiEnvRecommended.cpp \ - -ignoreFile jvmtiEnvStub.cpp \ - -ignoreFile globalDefinitions_gcc.hpp \ - -ignoreFile globalDefinitions_sparcWorks.hpp \ - -ignoreFile version.rc \ - -ignoreFile Xusage.txt \ - -define TARGET_ARCH_x86 \ - -define TARGET_OS_ARCH_windows_x86 \ - -define TARGET_OS_FAMILY_windows \ - -define TARGET_COMPILER_visCPP \ - -define INCLUDE_TRACE=1 \ - $(ProjectCreatorIncludesPRIVATE) - -# Add in build-specific options -!if "$(BUILDARCH)" == "i486" -ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ - -platformName Win32 \ - -ignorePath x86_64 \ - -ignorePath src\share\vm\jvmci \ - -ignoreFile jvmciCodeInstaller_x86.cpp \ - -define IA32 \ - -define INCLUDE_JVMCI=0 \ - -define TARGET_ARCH_MODEL_x86_32 -!else -!if "$(BUILDARCH)" == "amd64" -ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ - -platformName x64 \ - -ignorePath x86_32 \ - -define AMD64 \ - -define _LP64 \ - -define INCLUDE_JVMCI=1 \ - -define TARGET_ARCH_MODEL_x86_64 \ - -define TARGET_OS_ARCH_MODEL_windows_x86_64 -!endif -!endif - -ProjectCreatorIDEOptionsIgnoreCompiler1=\ - -ignorePath_TARGET compiler1 \ - -ignorePath_TARGET tiered \ - -ignorePath_TARGET c1_ - -ProjectCreatorIDEOptionsIgnoreCompiler2=\ - -ignorePath_TARGET compiler2 \ - -ignorePath_TARGET tiered \ - -ignorePath_TARGET src/share/vm/opto \ - -ignorePath_TARGET src/share/vm/libadt \ - -ignorePath_TARGET adfiles \ - -ignoreFile_TARGET bcEscapeAnalyzer.cpp \ - -ignoreFile_TARGET bcEscapeAnalyzer.hpp \ - -ignorePath_TARGET chaitin \ - -ignorePath_TARGET c2_ \ - -ignorePath_TARGET runtime_ \ - -ignoreFile_TARGET ciTypeFlow.cpp \ - -ignoreFile_TARGET ciTypeFlow.hpp \ - -ignoreFile_TARGET $(Platform_arch_model).ad - -################################################## -# Client(C1) compiler specific options -################################################## -ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ - -define_compiler1 COMPILER1 \ -$(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1) - -################################################## -# Server(C2) compiler specific options -################################################## -#NOTE! This list must be kept in sync with GENERATED_NAMES in adlc.make. -ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ - -define_compiler2 COMPILER2 \ - -additionalFile_compiler2 $(Platform_arch_model).ad \ - -additionalFile_compiler2 ad_$(Platform_arch_model).cpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model).hpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model)_clone.cpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model)_expand.cpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model)_format.cpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model)_gen.cpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model)_misc.cpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model)_peephole.cpp \ - -additionalFile_compiler2 ad_$(Platform_arch_model)_pipeline.cpp \ - -additionalFile_compiler2 adGlobals_$(Platform_arch_model).hpp \ - -additionalFile_compiler2 dfa_$(Platform_arch_model).cpp \ - $(ProjectCreatorIDEOptionsIgnoreCompiler1:TARGET=compiler2) - -# Add in the jvmti (JSR-163) options -# NOTE: do not pull in jvmtiEnvRecommended.cpp. This file is generated -# so the programmer can diff it with jvmtiEnv.cpp to be sure the -# code merge was done correctly (@see jvmti.make and jvmtiEnvFill.java). -# If so, they would then check it in as a new version of jvmtiEnv.cpp. -ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ - -additionalFile jvmtiEnv.hpp \ - -additionalFile jvmtiEnter.cpp \ - -additionalFile jvmtiEnterTrace.cpp \ - -additionalFile jvmti.h \ - -additionalFile bytecodeInterpreterWithChecks.cpp \ - -additionalFile traceEventClasses.hpp \ - -additionalFile traceEventIds.hpp \ -!if "$(OPENJDK)" != "true" - -additionalFile traceRequestables.hpp \ - -additionalFile traceEventControl.hpp \ - -additionalFile traceProducer.cpp \ -!endif - -additionalFile traceTypes.hpp diff --git a/hotspot/make/windows/makefiles/rules.make b/hotspot/make/windows/makefiles/rules.make deleted file mode 100644 index 2bd02379060..00000000000 --- a/hotspot/make/windows/makefiles/rules.make +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright (c) 2003, 2014, 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. -# -# - -# These are the commands used externally to compile and run. -# The \ are used here for traditional Windows apps and " quoted to get -# past the Unix-like shell: -!ifdef BootStrapDir -RUN_JAVA="$(BootStrapDir)\bin\java" -RUN_JAVAP="$(BootStrapDir)\bin\javap" -RUN_JAVAH="$(BootStrapDir)\bin\javah" -RUN_JAR="$(BootStrapDir)\bin\jar" -COMPILE_JAVAC="$(BootStrapDir)\bin\javac" $(BOOTSTRAP_JAVAC_FLAGS) -COMPILE_RMIC="$(BootStrapDir)\bin\rmic" -BOOT_JAVA_HOME=$(BootStrapDir) -!else -RUN_JAVA=java -RUN_JAVAP=javap -RUN_JAVAH=javah -RUN_JAR=jar -COMPILE_JAVAC=javac $(BOOTSTRAP_JAVAC_FLAGS) -COMPILE_RMIC=rmic -BOOT_JAVA_HOME= -!endif - -# Settings for javac -JAVAC_FLAGS=-g -encoding ascii - -# Prefer BOOT_JDK_SOURCETARGET if it's set (typically by the top build system) -# Fall back to the values here if it's not set (hotspot only builds) -!ifndef BOOT_JDK_SOURCETARGET -BOOTSTRAP_SOURCETARGET=-source 8 -target 8 -!else -BOOTSTRAP_SOURCETARGET=$(BOOT_JDK_SOURCETARGET) -!endif - -BOOTSTRAP_JAVAC_FLAGS=$(JAVAC_FLAGS) $(BOOTSTRAP_SOURCETARGET) - -# VS2012 and VS2013 loads VS10 projects just fine (and will -# upgrade them automatically to VS2012 format). -VcVersion=VC10 -ProjectFile=jvm.vcxproj - diff --git a/hotspot/make/windows/makefiles/sanity.make b/hotspot/make/windows/makefiles/sanity.make deleted file mode 100644 index 515b0bb1b50..00000000000 --- a/hotspot/make/windows/makefiles/sanity.make +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (c) 2006, 2014, 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. -# -# - -!include local.make - -all: checkCL checkLink - -checkCL: - @ if "$(MSC_VER)" NEQ "1600" if "$(MSC_VER)" NEQ "1700" if "$(MSC_VER)" NEQ "1800" \ - echo *** WARNING *** Unsupported cl.exe version detected: $(MSC_VER) ($(RAW_MSC_VER)), only 1600/1700/1800 (Visual Studio 2010/2012/2013) are supported. - -checkLink: - @ if "$(LD_VER)" NEQ "1000" if "$(LD_VER)" NEQ "1100" if "$(LD_VER)" NEQ "1200" \ - echo *** WARNING *** Unsupported link.exe version detected: $(LD_VER) ($(RAW_LD_VER)), only 1000/1100/1200 (Visual Studio 2010/2012/2013) are supported. diff --git a/hotspot/make/windows/makefiles/shared.make b/hotspot/make/windows/makefiles/shared.make deleted file mode 100644 index 06cd75f0e5e..00000000000 --- a/hotspot/make/windows/makefiles/shared.make +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -DEFAULTACTIONS=clean post_update create - -default:: $(SUBDIRS) - -!ifndef DIR -DIR=. -!endif - -!ifndef CXX -CXX=cl.exe -!endif - - -!ifdef SUBDIRS -# \ is used below because $(MAKE) is nmake here, which expects Windows paths -$(SUBDIRS): FORCE - @if not exist $@ mkdir $@ - @if not exist $@/local.make echo # Empty > $@/local.make - @echo nmake $(ACTION) in $(DIR)/$@ - cd $@ && $(MAKE) -NOLOGO -f $(WorkSpace)\make\windows\makefiles\$@.make $(ACTION) DIR=$(DIR)\$@ BUILD_FLAVOR=$(BUILD_FLAVOR) -!endif - -# Creates the needed directory -create:: -!if "$(DIR)" != "." - @echo mkdir $(DIR) -!endif - -# Epilog to update for generating derived files -post_update:: - -# Removes scrap files -clean:: FORCE - -@rm -f *.OLD *.publish - -# Remove all scrap files and all generated files -pure:: clean - -@rm -f *.OLD *.publish - -$(DEFAULTACTIONS) $(ACTIONS):: -!ifdef SUBDIRS - @$(MAKE) -nologo ACTION=$@ DIR=$(DIR) -!endif - -FORCE: - - diff --git a/hotspot/make/windows/makefiles/top.make b/hotspot/make/windows/makefiles/top.make deleted file mode 100644 index fb9c2a25c2f..00000000000 --- a/hotspot/make/windows/makefiles/top.make +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 1997, 2008, 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. -# -# - -!include local.make - -!ifdef ADLC_ONLY -SUBDIRS=generated -!else -SUBDIRS=generated $(BUILD_FLAVOR) -!endif - -!include $(WorkSpace)/make/windows/makefiles/shared.make - diff --git a/hotspot/make/windows/makefiles/trace.make b/hotspot/make/windows/makefiles/trace.make deleted file mode 100644 index d52391386d0..00000000000 --- a/hotspot/make/windows/makefiles/trace.make +++ /dev/null @@ -1,132 +0,0 @@ -# -# Copyright (c) 2003, 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. -# -# - -# This makefile (trace.make) is included from the trace.make in the -# build directories. -# -# It knows how to build and run the tools to generate trace files. - -!include $(WorkSpace)/make/windows/makefiles/rules.make - -# ######################################################################### - - -TraceAltSrcDir = $(WorkSpace)\src\closed\share\vm\trace -TraceSrcDir = $(WorkSpace)\src\share\vm\trace - -!ifndef OPENJDK -!if EXISTS($(TraceAltSrcDir)) -HAS_ALT_SRC = true -!endif -!endif - -!ifndef OPENJDK -!if EXISTS($(TraceAltSrcDir)) -HAS_ALT_SRC = true -!endif -!endif - -TraceGeneratedNames = \ - traceEventClasses.hpp \ - traceEventIds.hpp \ - traceTypes.hpp - -!ifdef HAS_ALT_SRC -TraceGeneratedNames = $(TraceGeneratedNames) \ - traceRequestables.hpp \ - traceEventControl.hpp -!endif - - -#Note: TraceGeneratedFiles must be kept in sync with TraceGeneratedNames by hand. -#Should be equivalent to "TraceGeneratedFiles = $(TraceGeneratedNames:%=$(TraceOutDir)/%)" -TraceGeneratedFiles = \ - $(TraceOutDir)/traceEventClasses.hpp \ - $(TraceOutDir)/traceEventIds.hpp \ - $(TraceOutDir)/traceTypes.hpp - -!ifdef HAS_ALT_SRC -TraceGeneratedFiles = $(TraceGeneratedFiles) \ - $(TraceOutDir)/traceRequestables.hpp \ - $(TraceOutDir)/traceEventControl.hpp -!endif - -XSLT = $(QUIETLY) $(REMOTE) $(RUN_JAVA) -classpath $(JvmtiOutDir) jvmtiGen - -TraceXml = $(TraceSrcDir)/trace.xml - -!ifdef HAS_ALT_SRC -TraceXml = $(TraceAltSrcDir)/trace.xml -!endif - -XML_DEPS = $(TraceXml) $(TraceSrcDir)/tracetypes.xml \ - $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod \ - $(TraceSrcDir)/tracerelationdecls.xml $(TraceSrcDir)/traceevents.xml - -!ifdef HAS_ALT_SRC -XML_DEPS = $(XML_DEPS) $(TraceAltSrcDir)/traceeventscustom.xml \ - $(TraceAltSrcDir)/traceeventtypes.xml -!endif - -.PHONY: all clean cleanall - -# ######################################################################### - -default:: - @if not exist $(TraceOutDir) mkdir $(TraceOutDir) - -$(TraceOutDir)/traceEventIds.hpp: $(TraceSrcDir)/traceEventIds.xsl $(XML_DEPS) - @echo Generating $@ - $(XSLT) -IN $(TraceXml) -XSL $(TraceSrcDir)/traceEventIds.xsl -OUT $(TraceOutDir)/traceEventIds.hpp - -$(TraceOutDir)/traceTypes.hpp: $(TraceSrcDir)/traceTypes.xsl $(XML_DEPS) - @echo Generating $@ - $(XSLT) -IN $(TraceXml) -XSL $(TraceSrcDir)/traceTypes.xsl -OUT $(TraceOutDir)/traceTypes.hpp - -!ifndef HAS_ALT_SRC - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) - @echo Generating OpenJDK $@ - $(XSLT) -IN $(TraceXml) -XSL $(TraceSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp - -!else - -$(TraceOutDir)/traceEventClasses.hpp: $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS) - @echo Generating AltSrc $@ - $(XSLT) -IN $(TraceXml) -XSL $(TraceAltSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp - -$(TraceOutDir)/traceRequestables.hpp: $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS) - @echo Generating AltSrc $@ - $(XSLT) -IN $(TraceXml) -XSL $(TraceAltSrcDir)/traceRequestables.xsl -OUT $(TraceOutDir)/traceRequestables.hpp - -$(TraceOutDir)/traceEventControl.hpp: $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS) - @echo Generating AltSrc $@ - $(XSLT) -IN $(TraceXml) -XSL $(TraceAltSrcDir)/traceEventControl.xsl -OUT $(TraceOutDir)/traceEventControl.hpp - -!endif - -# ######################################################################### - -cleanall : - rm $(TraceGeneratedFiles) diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make deleted file mode 100644 index a1391a04413..00000000000 --- a/hotspot/make/windows/makefiles/vm.make +++ /dev/null @@ -1,428 +0,0 @@ -# -# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# 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. -# -# - -# Resource file containing VERSIONINFO -Res_Files=.\version.res - -!include ..\generated\objfiles.make - -COMMONSRC=$(WorkSpace)\src -ALTSRC=$(WorkSpace)\src\closed - -!ifdef RELEASE -CXX_FLAGS=$(CXX_FLAGS) /D "PRODUCT" -!else -CXX_FLAGS=$(CXX_FLAGS) /D "ASSERT" -!if "$(BUILDARCH)" == "amd64" -CXX_FLAGS=$(CXX_FLAGS) /homeparams -!endif -!endif - -!if "$(Variant)" == "compiler1" -CXX_FLAGS=$(CXX_FLAGS) /D "COMPILER1" /D INCLUDE_JVMCI=0 -!endif - -!if "$(Variant)" == "compiler2" -CXX_FLAGS=$(CXX_FLAGS) /D "COMPILER2" -!if "$(BUILDARCH)" == "i486" -CXX_FLAGS=$(CXX_FLAGS) /D INCLUDE_JVMCI=0 -!endif -!endif - -!if "$(Variant)" == "tiered" -CXX_FLAGS=$(CXX_FLAGS) /D "COMPILER1" /D "COMPILER2" -!if "$(BUILDARCH)" == "i486" -CXX_FLAGS=$(CXX_FLAGS) /D INCLUDE_JVMCI=0 -!endif -!endif - -!if "$(BUILDARCH)" == "i486" -HOTSPOT_LIB_ARCH=i386 -!else -HOTSPOT_LIB_ARCH=$(BUILDARCH) -!endif - -# The following variables are defined in the generated local.make file. -CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_VERSION_STRING=\"$(HOTSPOT_VERSION_STRING)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_MAJOR=$(VERSION_MAJOR)" -CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_MINOR=$(VERSION_MINOR)" -CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_SECURITY=$(VERSION_SECURITY)" -CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_PATCH=$(VERSION_PATCH)" -CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_BUILD=$(VERSION_BUILD)" -CXX_FLAGS=$(CXX_FLAGS) /D "VERSION_STRING=\"$(VERSION_STRING)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "DEBUG_LEVEL=\"$(DEBUG_LEVEL)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_LIB_ARCH=\"$(HOTSPOT_LIB_ARCH)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\"" - -CXX_FLAGS=$(CXX_FLAGS) $(CXX_INCLUDE_DIRS) - -# Define that so jni.h is on correct side -CXX_FLAGS=$(CXX_FLAGS) /D "_JNI_IMPLEMENTATION_" - -!if "$(BUILDARCH)" == "ia64" -STACK_SIZE="/STACK:1048576,262144" -!else -STACK_SIZE= -!endif - -!if "$(BUILDARCH)" == "ia64" -# AsyncGetCallTrace is not supported on IA64 yet -AGCT_EXPORT= -!else -AGCT_EXPORT=/export:AsyncGetCallTrace -!endif - -# If you modify exports below please do the corresponding changes in -# src/share/tools/ProjectCreator/WinGammaPlatformVC7.java -!if "$(BUILDARCH)" == "amd64" -EXPORT_LIST= -!else -EXPORT_LIST=/export:JNI_GetDefaultJavaVMInitArgs \ - /export:JNI_CreateJavaVM \ - /export:JVM_FindClassFromBootLoader \ - /export:JNI_GetCreatedJavaVMs \ - /export:jio_snprintf \ - /export:jio_printf \ - /export:jio_fprintf \ - /export:jio_vfprintf \ - /export:jio_vsnprintf \ - $(AGCT_EXPORT) \ - /export:JVM_GetVersionInfo \ - /export:JVM_InitAgentProperties -!endif - -LD_FLAGS=$(LD_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 $(EXPORT_LIST) - -CXX_INCLUDE_DIRS=/I "..\generated" - -!ifndef OPENJDK -!if exists($(ALTSRC)\share\vm) -CXX_INCLUDE_DIRS=$(CXX_INCLUDE_DIRS) /I "$(ALTSRC)\share\vm" -!endif - -!if exists($(ALTSRC)\os\windows\vm) -CXX_INCLUDE_DIRS=$(CXX_INCLUDE_DIRS) /I "$(ALTSRC)\os\windows\vm" -!endif - -!if exists($(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm) -CXX_INCLUDE_DIRS=$(CXX_INCLUDE_DIRS) /I "$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm" -!endif - -!if exists($(ALTSRC)\cpu\$(Platform_arch)\vm) -CXX_INCLUDE_DIRS=$(CXX_INCLUDE_DIRS) /I "$(ALTSRC)\cpu\$(Platform_arch)\vm" -!endif -!endif # OPENJDK - -CXX_INCLUDE_DIRS=$(CXX_INCLUDE_DIRS) \ - /I "$(COMMONSRC)\share\vm" \ - /I "$(COMMONSRC)\share\vm\precompiled" \ - /I "$(COMMONSRC)\share\vm\prims" \ - /I "$(COMMONSRC)\os\windows\vm" \ - /I "$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm" \ - /I "$(COMMONSRC)\cpu\$(Platform_arch)\vm" - -CXX_DONT_USE_PCH=/D DONT_USE_PRECOMPILED_HEADER - -!if "$(USE_PRECOMPILED_HEADER)" != "0" -CXX_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp" -!if "$(MSC_VER)" > "1600" -# VS2012 requires this object file to be listed: -LD_FLAGS=$(LD_FLAGS) _build_pch_file.obj -!endif -!else -CXX_USE_PCH=$(CXX_DONT_USE_PCH) -!endif - -# Where to find the source code for the virtual machine (is this used?) -VM_PATH=../generated -VM_PATH=$(VM_PATH);../generated/adfiles -VM_PATH=$(VM_PATH);../generated/jvmtifiles -VM_PATH=$(VM_PATH);../generated/tracefiles -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/c1 -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/jvmci -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/compiler -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/code -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/interpreter -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/ci -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/classfile -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc/parallel -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc/shared -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc/serial -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc/cms -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc/g1 -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/asm -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/logging -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/memory -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/oops -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/prims -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/prims/wbtestmethods -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/runtime -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/services -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/trace -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/utilities -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/libadt -VM_PATH=$(VM_PATH);$(WorkSpace)/src/os/windows/vm -VM_PATH=$(VM_PATH);$(WorkSpace)/src/os_cpu/windows_$(Platform_arch)/vm -VM_PATH=$(VM_PATH);$(WorkSpace)/src/cpu/$(Platform_arch)/vm -VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/opto - -!ifndef OPENJDK -!if exists($(ALTSRC)\share\vm\jfr) -VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr -VM_PATH=$(VM_PATH);$(ALTSRC)/share/vm/jfr/buffers -!endif -!endif # OPENJDK - -VM_PATH={$(VM_PATH)} - -# Special case files not using precompiled header files. - -c1_RInfo_$(Platform_arch).obj: $(WorkSpace)\src\cpu\$(Platform_arch)\vm\c1_RInfo_$(Platform_arch).cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\cpu\$(Platform_arch)\vm\c1_RInfo_$(Platform_arch).cpp - -os_windows.obj: $(WorkSpace)\src\os\windows\vm\os_windows.cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\os\windows\vm\os_windows.cpp - -os_windows_$(Platform_arch).obj: $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\os_windows_$(Platform_arch).cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\os_windows_$(Platform_arch).cpp - -osThread_windows.obj: $(WorkSpace)\src\os\windows\vm\osThread_windows.cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\os\windows\vm\osThread_windows.cpp - -conditionVar_windows.obj: $(WorkSpace)\src\os\windows\vm\conditionVar_windows.cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\os\windows\vm\conditionVar_windows.cpp - -getThread_windows_$(Platform_arch).obj: $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\getThread_windows_$(Platform_arch).cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm\getThread_windows_$(Platform_arch).cpp - -opcodes.obj: $(WorkSpace)\src\share\vm\opto\opcodes.cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\share\vm\opto\opcodes.cpp - -bytecodeInterpreter.obj: $(WorkSpace)\src\share\vm\interpreter\bytecodeInterpreter.cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c $(WorkSpace)\src\share\vm\interpreter\bytecodeInterpreter.cpp - -bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp - $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp - -# Default rules for the Virtual Machine -{$(COMMONSRC)\share\vm\c1}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\compiler}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\code}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\interpreter}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\ci}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\classfile}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\jvmci}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\gc\parallel}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\gc\shared}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\gc\serial}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\gc\cms}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\gc\g1}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\asm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\logging}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\memory}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\oops}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\prims}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\prims\wbtestmethods}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\runtime}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\services}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\trace}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\utilities}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\libadt}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\share\vm\opto}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\os\windows\vm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -# This guy should remain a single colon rule because -# otherwise we can't specify the output filename. -# NOTE: Changes in this file was just to give a proper command line when linking -# for use when developing the new build, and should not be integrated. -{$(COMMONSRC)\os\windows\vm}.rc.res: - $(RC) $(RC_FLAGS) /fo"$@" $< - -{$(COMMONSRC)\cpu\$(Platform_arch)\vm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -!ifndef OPENJDK -{$(ALTSRC)\share\vm\c1}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\compiler}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\code}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\interpreter}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\ci}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\classfile}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\gc\parallel}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\gc\shared}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\gc\serial}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\gc\cms}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\gc\g1}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\asm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\logging}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\memory}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\oops}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\prims}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\prims\wbtestmethods}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\runtime}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\services}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\trace}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\utilities}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\libadt}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\opto}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\os\windows\vm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -# otherwise we can't specify the output filename. -{$(ALTSRC)\os\windows\vm}.rc.res: - @$(RC) $(RC_FLAGS) /fo"$@" $< - -{$(ALTSRC)\cpu\$(Platform_arch)\vm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\jfr}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{$(ALTSRC)\share\vm\jfr\buffers}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< -!endif - -{..\generated\incls}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{..\generated\adfiles}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{..\generated\jvmtifiles}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -{..\generated\tracefiles}.cpp.obj:: - $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $< - -default:: - -_build_pch_file.obj: - @echo #include "precompiled.hpp" > ../generated/_build_pch_file.cpp - $(CXX) $(CXX_FLAGS) /Fp"vm.pch" /Yc"precompiled.hpp" /c ../generated/_build_pch_file.cpp - -vm.def: $(Obj_Files) - sh $(WorkSpace)/make/windows/build_vm_def.sh diff --git a/hotspot/make/windows/projectfiles/common/Makefile b/hotspot/make/windows/projectfiles/common/Makefile deleted file mode 100644 index 3fe5abc938e..00000000000 --- a/hotspot/make/windows/projectfiles/common/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -# -# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# - -!ifdef LOCAL_MAKE -!include $(LOCAL_MAKE) -!endif - - -WorkSpace=$(HOTSPOTWORKSPACE) - -!ifdef ALT_BOOTDIR -BootStrapDir=$(ALT_BOOTDIR) -!else -!ifdef BOOTDIR -BootStrapDir=$(BOOTDIR) -!else -!ifdef JAVA_HOME -BootStrapDir=$(JAVA_HOME) -!else -!ifdef HOTSPOTJDKDIST -BootStrapDir=$(HOTSPOTJDKDIST) -!endif -!endif -!endif -!endif - -# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK -!ifndef OPENJDK -!if !exists($(WorkSpace)\src\closed) -OPENJDK=true -!endif -!endif - - -!include $(HOTSPOTWORKSPACE)/make/windows/makefiles/projectcreator.make -!include $(WorkSpace)/make/windows/makefiles/compile.make - -# Pick up rules for building JVMTI (JSR-163) -JvmtiOutDir=$(HOTSPOTBUILDSPACE)\$(Variant)\generated\jvmtifiles -!include $(HOTSPOTWORKSPACE)/make/windows/makefiles/jvmti.make - -# Pick up rules for building trace -TraceOutDir=$(HOTSPOTBUILDSPACE)\$(Variant)\generated\tracefiles -!include $(HOTSPOTWORKSPACE)/make/windows/makefiles/trace.make - -!if "$(Variant)" == "compiler2" -# Pick up rules for building adlc -!include $(HOTSPOTWORKSPACE)/make/windows/makefiles/adlc.make -!endif - -!if "$(Variant)" == "tiered" -# Pick up rules for building adlc -!include $(HOTSPOTWORKSPACE)/make/windows/makefiles/adlc.make -!endif - -HS_INTERNAL_NAME=jvm - -default:: $(AdditionalTargets) $(JvmtiGeneratedFiles) $(TraceGeneratedFiles) - -!include $(HOTSPOTWORKSPACE)/make/jdk_version - -VERSION_MAJOR=$(STANDALONE_JDK_MAJOR_VER) -VERSION_MINOR=$(STANDALONE_JDK_MINOR_VER) -VERSION_SECURITY=$(STANDALONE_JDK_SECURITY_VER) -VERSION_PATCH=$(STANDALONE_JDK_PATCH_VER) - -!if "$(VERSION_BUILD)" == "" -VERSION_BUILD=0 -!endif - -!if "$(VERSION_OPT)" != "" -HOTSPOT_PRE = internal-$(VERSION_OPT) -!else -HOTSPOT_PRE = internal -!endif -!if "$(VERSION_STRING)" == "" -VERSION_STRING="\\\"$(VERSION_MAJOR)-$(HOTSPOT_PRE)+$(VERSION_BUILD)-$(USERNAME).vsbuild\\\"" -!endif -HOTSPOT_VERSION_STRING=$(VERSION_STRING) - -# Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set, -# and if it is not see if we have the src/closed directory -!if "$(HOTSPOT_VM_DISTRO)" != "" -HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -!else -!if exists($(HOTSPOTWORKSPACE)\src\closed) -HOTSPOT_VM_DISTRO="\\\"Java HotSpot(TM)\\\"" -!else -HOTSPOT_VM_DISTRO="\\\"OpenJDK\\\"" -!endif - -!endif - - - -ReleaseOptions = -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define HOTSPOT_VERSION_STRING=$(HOTSPOT_VERSION_STRING) -define VERSION_MAJOR=$(VERSION_MAJOR) -define VERSION_MINOR=$(VERSION_MINOR) -define VERSION_SECURITY=$(VERSION_SECURITY) -define VERSION_PATCH=$(VERSION_PATCH) -define VERSION_BUILD=$(VERSION_BUILD) -define VERSION_STRING=$(VERSION_STRING) -ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions) - -$(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class - @$(RUN_JAVA) -Djava.class.path="$(HOTSPOTBUILDSPACE)/classes" ProjectCreator WinGammaPlatform$(VcVersion) $(ProjectCreatorIDEOptions) - -clean: - @rm -rf $(HOTSPOTBUILDSPACE)/classes - @rm -r $(HOTSPOTBUILDSPACE)/$(ProjectFile) - -$(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class: $(ProjectCreatorSources) - @if exist $(HOTSPOTBUILDSPACE)\classes rmdir /s /q $(HOTSPOTBUILDSPACE)\classes - @mkdir $(HOTSPOTBUILDSPACE)\classes - @$(COMPILE_JAVAC) -classpath $(HOTSPOTWORKSPACE)\src\share\tools\ProjectCreator -d $(HOTSPOTBUILDSPACE)/classes $(ProjectCreatorSources) - -FORCE: diff --git a/hotspot/make/windows/projectfiles/compiler1/Makefile b/hotspot/make/windows/projectfiles/compiler1/Makefile deleted file mode 100644 index 183a27647dd..00000000000 --- a/hotspot/make/windows/projectfiles/compiler1/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 1999, 2010, 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. -# -# - -!include ../local.make - -!include $(HOTSPOTWORKSPACE)/make/windows/projectfiles/common/Makefile diff --git a/hotspot/make/windows/projectfiles/compiler1/vm.def b/hotspot/make/windows/projectfiles/compiler1/vm.def deleted file mode 100644 index b450e81fd01..00000000000 --- a/hotspot/make/windows/projectfiles/compiler1/vm.def +++ /dev/null @@ -1,7 +0,0 @@ -; -; This .DEF file is a placeholder for one which is automatically -; generated during the build process. See -; make\windows\build_vm_def.sh and -; make\windows\makefiles\projectcreator.make (esp. the "-prelink" -; options). -; diff --git a/hotspot/make/windows/projectfiles/compiler1/vm.dsw b/hotspot/make/windows/projectfiles/compiler1/vm.dsw deleted file mode 100644 index 934f51afdb3..00000000000 --- a/hotspot/make/windows/projectfiles/compiler1/vm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "vm"=.\vm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsp b/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsp deleted file mode 100644 index 557cce42c76..00000000000 --- a/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsp +++ /dev/null @@ -1,142 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ADLCompiler" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ADLCompiler - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ADLCompiler.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ADLCompiler.mak" CFG="ADLCompiler - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ADLCompiler - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ADLCompiler - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ADLCompiler - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\adlc\Release" -# PROP Intermediate_Dir ".\adlc\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "." /I "$(HotSpotWorkSpace)\src\share\vm\opto" /I "$(HotSpotWorkSpace)\src\share\vm\prims" /I "$(HotSpotWorkSpace)\src\share\vm\lookup" /I "$(HotSpotWorkSpace)\src\share\vm\interpreter" /I "$(HotSpotWorkSpace)\src\share\vm\asm" /I "$(HotSpotWorkSpace)\src\share\vm\compiler" /I "$(HotSpotWorkSpace)\src\share\vm\utilities" /I "$(HotSpotWorkSpace)\src\share\vm\code" /I "$(HotSpotWorkSpace)\src\share\vm\oops" /I "$(HotSpotWorkSpace)\src\share\vm\runtime" /I "$(HotSpotWorkSpace)\src\share\vm\memory" /I "$(HotSpotWorkSpace)\src\share\vm\libadt" /I "$(HotSpotWorkSpace)\src\cpu\i486\vm" /I "$(HotSpotWorkSpace)\src\os\win32\vm" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo /o".\adlc\Release\adlc.bsc" -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:".\bin\adlc.exe" - -!ELSEIF "$(CFG)" == "ADLCompiler - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\adlc\Debug" -# PROP Intermediate_Dir ".\adlc\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /ML /W3 /WX /Gm /GX /Zi /Od /I "." /I "$(HotSpotWorkSpace)\src\share\vm\opto" /I "$(HotSpotWorkSpace)\src\share\vm\prims" /I "$(HotSpotWorkSpace)\src\share\vm\lookup" /I "$(HotSpotWorkSpace)\src\share\vm\interpreter" /I "$(HotSpotWorkSpace)\src\share\vm\asm" /I "$(HotSpotWorkSpace)\src\share\vm\compiler" /I "$(HotSpotWorkSpace)\src\share\vm\utilities" /I "$(HotSpotWorkSpace)\src\share\vm\code" /I "$(HotSpotWorkSpace)\src\share\vm\oops" /I "$(HotSpotWorkSpace)\src\share\vm\runtime" /I "$(HotSpotWorkSpace)\src\share\vm\memory" /I "$(HotSpotWorkSpace)\src\share\vm\libadt" /I "$(HotSpotWorkSpace)\src\cpu\i486\vm" /I "$(HotSpotWorkSpace)\src\os\win32\vm" /D "WIN32" /D "_WINDOWS" /D "ASSERT" /Fr /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /o".\adlc\Debug\adlc.bsc" -# SUBTRACT BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc.exe" - -!ENDIF - -# Begin Target - -# Name "ADLCompiler - Win32 Release" -# Name "ADLCompiler - Win32 Debug" -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\adlparse.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\archDesc.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\arena.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\dfa.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\dict2.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\filebuff.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\forms.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\formsopt.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\formssel.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\main.cpp" -# SUBTRACT CPP /YX /Yc -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\opto\opcodes.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\output_c.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\output_h.cpp" -# End Source File -# End Target -# End Project - \ No newline at end of file diff --git a/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsw b/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsw deleted file mode 100644 index 0ad5370ed81..00000000000 --- a/hotspot/make/windows/projectfiles/compiler2/ADLCompiler.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "ADLCompiler"=".\ADLCompiler.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/hotspot/make/windows/projectfiles/compiler2/Makefile b/hotspot/make/windows/projectfiles/compiler2/Makefile deleted file mode 100644 index 1df97d232a8..00000000000 --- a/hotspot/make/windows/projectfiles/compiler2/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 1998, 2010, 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. -# -# - -!include ../local.make -AdlcOutDir=$(HOTSPOTBUILDSPACE)\$(Variant)\generated\adfiles -AdditionalTargets=$(AdlcOutDir)\ad_$(Platform_arch_model).cpp $(AdlcOutDir)\dfa_$(Platform_arch_model).cpp - -!include $(HOTSPOTWORKSPACE)/make/windows/projectfiles/common/Makefile diff --git a/hotspot/make/windows/projectfiles/compiler2/vm.def b/hotspot/make/windows/projectfiles/compiler2/vm.def deleted file mode 100644 index b450e81fd01..00000000000 --- a/hotspot/make/windows/projectfiles/compiler2/vm.def +++ /dev/null @@ -1,7 +0,0 @@ -; -; This .DEF file is a placeholder for one which is automatically -; generated during the build process. See -; make\windows\build_vm_def.sh and -; make\windows\makefiles\projectcreator.make (esp. the "-prelink" -; options). -; diff --git a/hotspot/make/windows/projectfiles/compiler2/vm.dsw b/hotspot/make/windows/projectfiles/compiler2/vm.dsw deleted file mode 100644 index 26aab5c3b16..00000000000 --- a/hotspot/make/windows/projectfiles/compiler2/vm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "vm"=.\vm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/hotspot/make/windows/projectfiles/core/Makefile b/hotspot/make/windows/projectfiles/core/Makefile deleted file mode 100644 index 5b23a8467cb..00000000000 --- a/hotspot/make/windows/projectfiles/core/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 1998, 2010, 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. -# -# - -!include ../local.make - -!include $(HOTSPOTWORKSPACE)/make/windows/projectfiles/common/Makefile diff --git a/hotspot/make/windows/projectfiles/core/vm.def b/hotspot/make/windows/projectfiles/core/vm.def deleted file mode 100644 index b450e81fd01..00000000000 --- a/hotspot/make/windows/projectfiles/core/vm.def +++ /dev/null @@ -1,7 +0,0 @@ -; -; This .DEF file is a placeholder for one which is automatically -; generated during the build process. See -; make\windows\build_vm_def.sh and -; make\windows\makefiles\projectcreator.make (esp. the "-prelink" -; options). -; diff --git a/hotspot/make/windows/projectfiles/core/vm.dsw b/hotspot/make/windows/projectfiles/core/vm.dsw deleted file mode 100644 index 934f51afdb3..00000000000 --- a/hotspot/make/windows/projectfiles/core/vm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "vm"=.\vm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsp b/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsp deleted file mode 100644 index 557cce42c76..00000000000 --- a/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsp +++ /dev/null @@ -1,142 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ADLCompiler" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ADLCompiler - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ADLCompiler.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ADLCompiler.mak" CFG="ADLCompiler - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ADLCompiler - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ADLCompiler - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ADLCompiler - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir ".\adlc\Release" -# PROP Intermediate_Dir ".\adlc\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "." /I "$(HotSpotWorkSpace)\src\share\vm\opto" /I "$(HotSpotWorkSpace)\src\share\vm\prims" /I "$(HotSpotWorkSpace)\src\share\vm\lookup" /I "$(HotSpotWorkSpace)\src\share\vm\interpreter" /I "$(HotSpotWorkSpace)\src\share\vm\asm" /I "$(HotSpotWorkSpace)\src\share\vm\compiler" /I "$(HotSpotWorkSpace)\src\share\vm\utilities" /I "$(HotSpotWorkSpace)\src\share\vm\code" /I "$(HotSpotWorkSpace)\src\share\vm\oops" /I "$(HotSpotWorkSpace)\src\share\vm\runtime" /I "$(HotSpotWorkSpace)\src\share\vm\memory" /I "$(HotSpotWorkSpace)\src\share\vm\libadt" /I "$(HotSpotWorkSpace)\src\cpu\i486\vm" /I "$(HotSpotWorkSpace)\src\os\win32\vm" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo /o".\adlc\Release\adlc.bsc" -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:".\bin\adlc.exe" - -!ELSEIF "$(CFG)" == "ADLCompiler - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir ".\adlc\Debug" -# PROP Intermediate_Dir ".\adlc\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /ML /W3 /WX /Gm /GX /Zi /Od /I "." /I "$(HotSpotWorkSpace)\src\share\vm\opto" /I "$(HotSpotWorkSpace)\src\share\vm\prims" /I "$(HotSpotWorkSpace)\src\share\vm\lookup" /I "$(HotSpotWorkSpace)\src\share\vm\interpreter" /I "$(HotSpotWorkSpace)\src\share\vm\asm" /I "$(HotSpotWorkSpace)\src\share\vm\compiler" /I "$(HotSpotWorkSpace)\src\share\vm\utilities" /I "$(HotSpotWorkSpace)\src\share\vm\code" /I "$(HotSpotWorkSpace)\src\share\vm\oops" /I "$(HotSpotWorkSpace)\src\share\vm\runtime" /I "$(HotSpotWorkSpace)\src\share\vm\memory" /I "$(HotSpotWorkSpace)\src\share\vm\libadt" /I "$(HotSpotWorkSpace)\src\cpu\i486\vm" /I "$(HotSpotWorkSpace)\src\os\win32\vm" /D "WIN32" /D "_WINDOWS" /D "ASSERT" /Fr /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /o".\adlc\Debug\adlc.bsc" -# SUBTRACT BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc.exe" - -!ENDIF - -# Begin Target - -# Name "ADLCompiler - Win32 Release" -# Name "ADLCompiler - Win32 Debug" -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\adlparse.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\archDesc.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\arena.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\dfa.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\dict2.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\filebuff.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\forms.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\formsopt.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\formssel.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\main.cpp" -# SUBTRACT CPP /YX /Yc -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\opto\opcodes.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\output_c.cpp" -# End Source File -# Begin Source File - -SOURCE="$(HotSpotWorkSpace)\src\share\vm\adlc\output_h.cpp" -# End Source File -# End Target -# End Project - \ No newline at end of file diff --git a/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsw b/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsw deleted file mode 100644 index 0ad5370ed81..00000000000 --- a/hotspot/make/windows/projectfiles/tiered/ADLCompiler.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "ADLCompiler"=".\ADLCompiler.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/hotspot/make/windows/projectfiles/tiered/Makefile b/hotspot/make/windows/projectfiles/tiered/Makefile deleted file mode 100644 index 5398cb99d46..00000000000 --- a/hotspot/make/windows/projectfiles/tiered/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright (c) 2006, 2010, 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. -# -# - -!include ../local.make -AdlcOutDir=$(HOTSPOTBUILDSPACE)\$(Variant)\generated\adfiles -AdditionalTargets=$(AdlcOutDir)\ad_$(Platform_arch_model).cpp $(AdlcOutDir)\dfa_$(Platform_arch_model).cpp - -!include $(HOTSPOTWORKSPACE)/make/windows/projectfiles/common/Makefile diff --git a/hotspot/make/windows/projectfiles/tiered/vm.def b/hotspot/make/windows/projectfiles/tiered/vm.def deleted file mode 100644 index b450e81fd01..00000000000 --- a/hotspot/make/windows/projectfiles/tiered/vm.def +++ /dev/null @@ -1,7 +0,0 @@ -; -; This .DEF file is a placeholder for one which is automatically -; generated during the build process. See -; make\windows\build_vm_def.sh and -; make\windows\makefiles\projectcreator.make (esp. the "-prelink" -; options). -; diff --git a/hotspot/make/windows/projectfiles/tiered/vm.dsw b/hotspot/make/windows/projectfiles/tiered/vm.dsw deleted file mode 100644 index 26aab5c3b16..00000000000 --- a/hotspot/make/windows/projectfiles/tiered/vm.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 5.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "vm"=.\vm.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/hotspot/src/cpu/aarch64/vm/aarch64.ad b/hotspot/src/cpu/aarch64/vm/aarch64.ad index e92411bab18..5359f30f29c 100644 --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad @@ -996,6 +996,7 @@ definitions %{ source_hpp %{ #include "gc/shared/cardTableModRefBS.hpp" +#include "opto/addnode.hpp" class CallStubImpl { @@ -1061,6 +1062,9 @@ class HandlerImpl { // predicate controlling translation of StoreCM bool unnecessary_storestore(const Node *storecm); + + // predicate controlling addressing modes + bool size_fits_all_mem_uses(AddPNode* addp, int shift); %} source %{ @@ -3077,7 +3081,7 @@ uint MachSpillCopyNode::implementation(CodeBuffer *cbuf, PhaseRegAlloc *ra_, boo assert((src_lo_rc != rc_int && dst_lo_rc != rc_int), "sanity"); if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) { // stack->stack - assert((src_offset & 7) && (dst_offset & 7), "unaligned stack offset"); + assert((src_offset & 7) == 0 && (dst_offset & 7) == 0, "unaligned stack offset"); if (ireg == Op_VecD) { __ unspill(rscratch1, true, src_offset); __ spill(rscratch1, true, dst_offset); @@ -3325,9 +3329,15 @@ int HandlerImpl::emit_deopt_handler(CodeBuffer& cbuf) const bool Matcher::match_rule_supported(int opcode) { - // TODO - // identify extra cases that we might want to provide match rules for - // e.g. Op_StrEquals and other intrinsics + switch (opcode) { + case Op_StrComp: + case Op_StrIndexOf: + if (CompactStrings) return false; + break; + default: + break; + } + if (!has_match_rule(opcode)) { return false; } @@ -3346,6 +3356,10 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen) { return ret_value; // Per default match rules are supported. } +const bool Matcher::has_predicated_vectors(void) { + return false; +} + const int Matcher::float_pressure(int default_pressure_threshold) { return default_pressure_threshold; } @@ -3439,11 +3453,6 @@ const int Matcher::float_cmove_cost() { // Does the CPU require late expand (see block.cpp for description of late expand)? const bool Matcher::require_postalloc_expand = false; -// Should the Matcher clone shifts on addressing modes, expecting them -// to be subsumed into complex addressing expressions or compute them -// into registers? True for Intel but false for most RISCs -const bool Matcher::clone_shift_expressions = false; - // Do we need to mask the count passed to shift instructions or does // the cpu only look at the lower 5/6 bits anyway? const bool Matcher::need_masked_shift_count = false; @@ -3562,6 +3571,119 @@ const RegMask Matcher::method_handle_invoke_SP_save_mask() { return FP_REG_mask(); } +bool size_fits_all_mem_uses(AddPNode* addp, int shift) { + for (DUIterator_Fast imax, i = addp->fast_outs(imax); i < imax; i++) { + Node* u = addp->fast_out(i); + if (u->is_Mem()) { + int opsize = u->as_Mem()->memory_size(); + assert(opsize > 0, "unexpected memory operand size"); + if (u->as_Mem()->memory_size() != (1<in(AddPNode::Offset); + if (off->Opcode() == Op_LShiftL && off->in(2)->is_Con() && + size_fits_all_mem_uses(m, off->in(2)->get_int()) && + // Are there other uses besides address expressions? + !is_visited(off)) { + address_visited.set(off->_idx); // Flag as address_visited + mstack.push(off->in(2), Visit); + Node *conv = off->in(1); + if (conv->Opcode() == Op_ConvI2L && + // Are there other uses besides address expressions? + !is_visited(conv)) { + address_visited.set(conv->_idx); // Flag as address_visited + mstack.push(conv->in(1), Pre_Visit); + } else { + mstack.push(conv, Pre_Visit); + } + address_visited.test_set(m->_idx); // Flag as address_visited + mstack.push(m->in(AddPNode::Address), Pre_Visit); + mstack.push(m->in(AddPNode::Base), Pre_Visit); + return true; + } else if (off->Opcode() == Op_ConvI2L && + // Are there other uses besides address expressions? + !is_visited(off)) { + address_visited.test_set(m->_idx); // Flag as address_visited + address_visited.set(off->_idx); // Flag as address_visited + mstack.push(off->in(1), Pre_Visit); + mstack.push(m->in(AddPNode::Address), Pre_Visit); + mstack.push(m->in(AddPNode::Base), Pre_Visit); + return true; + } + return false; +} + +// Transform: +// (AddP base (AddP base address (LShiftL index con)) offset) +// into: +// (AddP base (AddP base offset) (LShiftL index con)) +// to take full advantage of ARM's addressing modes +void Compile::reshape_address(AddPNode* addp) { + Node *addr = addp->in(AddPNode::Address); + if (addr->is_AddP() && addr->in(AddPNode::Base) == addp->in(AddPNode::Base)) { + const AddPNode *addp2 = addr->as_AddP(); + if ((addp2->in(AddPNode::Offset)->Opcode() == Op_LShiftL && + addp2->in(AddPNode::Offset)->in(2)->is_Con() && + size_fits_all_mem_uses(addp, addp2->in(AddPNode::Offset)->in(2)->get_int())) || + addp2->in(AddPNode::Offset)->Opcode() == Op_ConvI2L) { + + // Any use that can't embed the address computation? + for (DUIterator_Fast imax, i = addp->fast_outs(imax); i < imax; i++) { + Node* u = addp->fast_out(i); + if (!u->is_Mem() || u->is_LoadVector() || u->is_StoreVector() || u->Opcode() == Op_StoreCM) { + return; + } + } + + Node* off = addp->in(AddPNode::Offset); + Node* addr2 = addp2->in(AddPNode::Address); + Node* base = addp->in(AddPNode::Base); + + Node* new_addr = NULL; + // Check whether the graph already has the new AddP we need + // before we create one (no GVN available here). + for (DUIterator_Fast imax, i = addr2->fast_outs(imax); i < imax; i++) { + Node* u = addr2->fast_out(i); + if (u->is_AddP() && + u->in(AddPNode::Base) == base && + u->in(AddPNode::Address) == addr2 && + u->in(AddPNode::Offset) == off) { + new_addr = u; + break; + } + } + + if (new_addr == NULL) { + new_addr = new AddPNode(base, addr2, off); + } + Node* new_off = addp2->in(AddPNode::Offset); + addp->set_req(AddPNode::Address, new_addr); + if (addr->outcnt() == 0) { + addr->disconnect_inputs(NULL, this); + } + addp->set_req(AddPNode::Offset, new_off); + if (off->outcnt() == 0) { + off->disconnect_inputs(NULL, this); + } + } + } +} + // helper for encoding java_to_runtime calls on sim // // this is needed to compute the extra arguments required when @@ -3631,12 +3753,10 @@ typedef void (MacroAssembler::* mem_vector_insn)(FloatRegister Rt, // encoder that the index needs to be sign extended, so we have to // enumerate all the cases. switch (opcode) { - case INDINDEXSCALEDOFFSETI2L: case INDINDEXSCALEDI2L: - case INDINDEXSCALEDOFFSETI2LN: case INDINDEXSCALEDI2LN: - case INDINDEXOFFSETI2L: - case INDINDEXOFFSETI2LN: + case INDINDEXI2L: + case INDINDEXI2LN: scale = Address::sxtw(size); break; default: @@ -3646,12 +3766,8 @@ typedef void (MacroAssembler::* mem_vector_insn)(FloatRegister Rt, if (index == -1) { (masm.*insn)(reg, Address(base, disp)); } else { - if (disp == 0) { - (masm.*insn)(reg, Address(base, as_Register(index), scale)); - } else { - masm.lea(rscratch1, Address(base, disp)); - (masm.*insn)(reg, Address(rscratch1, as_Register(index), scale)); - } + assert(disp == 0, "unsupported address mode: disp = %d", disp); + (masm.*insn)(reg, Address(base, as_Register(index), scale)); } } @@ -3662,9 +3778,7 @@ typedef void (MacroAssembler::* mem_vector_insn)(FloatRegister Rt, Address::extend scale; switch (opcode) { - case INDINDEXSCALEDOFFSETI2L: case INDINDEXSCALEDI2L: - case INDINDEXSCALEDOFFSETI2LN: case INDINDEXSCALEDI2LN: scale = Address::sxtw(size); break; @@ -3675,12 +3789,8 @@ typedef void (MacroAssembler::* mem_vector_insn)(FloatRegister Rt, if (index == -1) { (masm.*insn)(reg, Address(base, disp)); } else { - if (disp == 0) { - (masm.*insn)(reg, Address(base, as_Register(index), scale)); - } else { - masm.lea(rscratch1, Address(base, disp)); - (masm.*insn)(reg, Address(rscratch1, as_Register(index), scale)); - } + assert(disp == 0, "unsupported address mode: disp = %d", disp); + (masm.*insn)(reg, Address(base, as_Register(index), scale)); } } @@ -4190,55 +4300,6 @@ encode %{ } %} - enc_class aarch64_enc_clear_array_reg_reg(iRegL_R11 cnt, iRegP_R10 base) %{ - MacroAssembler _masm(&cbuf); - Register cnt_reg = as_Register($cnt$$reg); - Register base_reg = as_Register($base$$reg); - // base is word aligned - // cnt is count of words - - Label loop; - Label entry; - -// Algorithm: -// -// scratch1 = cnt & 7; -// cnt -= scratch1; -// p += scratch1; -// switch (scratch1) { -// do { -// cnt -= 8; -// p[-8] = 0; -// case 7: -// p[-7] = 0; -// case 6: -// p[-6] = 0; -// // ... -// case 1: -// p[-1] = 0; -// case 0: -// p += 8; -// } while (cnt); -// } - - const int unroll = 8; // Number of str(zr) instructions we'll unroll - - __ andr(rscratch1, cnt_reg, unroll - 1); // tmp1 = cnt % unroll - __ sub(cnt_reg, cnt_reg, rscratch1); // cnt -= unroll - // base_reg always points to the end of the region we're about to zero - __ add(base_reg, base_reg, rscratch1, Assembler::LSL, exact_log2(wordSize)); - __ adr(rscratch2, entry); - __ sub(rscratch2, rscratch2, rscratch1, Assembler::LSL, 2); - __ br(rscratch2); - __ bind(loop); - __ sub(cnt_reg, cnt_reg, unroll); - for (int i = -unroll; i < 0; i++) - __ str(zr, Address(base_reg, i * wordSize)); - __ bind(entry); - __ add(base_reg, base_reg, unroll * wordSize); - __ cbnz(cnt_reg, loop); - %} - /// mov envcodings enc_class aarch64_enc_movw_imm(iRegI dst, immI src) %{ @@ -5351,6 +5412,36 @@ operand immIOffset() interface(CONST_INTER); %} +operand immIOffset4() +%{ + predicate(Address::offset_ok_for_immed(n->get_int(), 2)); + match(ConI); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + +operand immIOffset8() +%{ + predicate(Address::offset_ok_for_immed(n->get_int(), 3)); + match(ConI); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + +operand immIOffset16() +%{ + predicate(Address::offset_ok_for_immed(n->get_int(), 4)); + match(ConI); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + operand immLoffset() %{ predicate(Address::offset_ok_for_immed(n->get_long())); @@ -5361,6 +5452,36 @@ operand immLoffset() interface(CONST_INTER); %} +operand immLoffset4() +%{ + predicate(Address::offset_ok_for_immed(n->get_long(), 2)); + match(ConL); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + +operand immLoffset8() +%{ + predicate(Address::offset_ok_for_immed(n->get_long(), 3)); + match(ConL); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + +operand immLoffset16() +%{ + predicate(Address::offset_ok_for_immed(n->get_long(), 4)); + match(ConL); + + op_cost(0); + format %{ %} + interface(CONST_INTER); +%} + // 32 bit integer valid for add sub immediate operand immIAddSub() %{ @@ -6083,65 +6204,10 @@ operand indirect(iRegP reg) %} %} -operand indIndexScaledOffsetI(iRegP reg, iRegL lreg, immIScale scale, immIU12 off) -%{ - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP reg (LShiftL lreg scale)) off); - op_cost(INSN_COST); - format %{ "$reg, $lreg lsl($scale), $off" %} - interface(MEMORY_INTER) %{ - base($reg); - index($lreg); - scale($scale); - disp($off); - %} -%} - -operand indIndexScaledOffsetL(iRegP reg, iRegL lreg, immIScale scale, immLU12 off) -%{ - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP reg (LShiftL lreg scale)) off); - op_cost(INSN_COST); - format %{ "$reg, $lreg lsl($scale), $off" %} - interface(MEMORY_INTER) %{ - base($reg); - index($lreg); - scale($scale); - disp($off); - %} -%} - -operand indIndexOffsetI2L(iRegP reg, iRegI ireg, immLU12 off) -%{ - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP reg (ConvI2L ireg)) off); - op_cost(INSN_COST); - format %{ "$reg, $ireg, $off I2L" %} - interface(MEMORY_INTER) %{ - base($reg); - index($ireg); - scale(0x0); - disp($off); - %} -%} - -operand indIndexScaledOffsetI2L(iRegP reg, iRegI ireg, immIScale scale, immLU12 off) -%{ - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP reg (LShiftL (ConvI2L ireg) scale)) off); - op_cost(INSN_COST); - format %{ "$reg, $ireg sxtw($scale), $off I2L" %} - interface(MEMORY_INTER) %{ - base($reg); - index($ireg); - scale($scale); - disp($off); - %} -%} - operand indIndexScaledI2L(iRegP reg, iRegI ireg, immIScale scale) %{ constraint(ALLOC_IN_RC(ptr_reg)); + predicate(size_fits_all_mem_uses(n->as_AddP(), n->in(AddPNode::Offset)->in(2)->get_int())); match(AddP reg (LShiftL (ConvI2L ireg) scale)); op_cost(0); format %{ "$reg, $ireg sxtw($scale), 0, I2L" %} @@ -6156,6 +6222,7 @@ operand indIndexScaledI2L(iRegP reg, iRegI ireg, immIScale scale) operand indIndexScaled(iRegP reg, iRegL lreg, immIScale scale) %{ constraint(ALLOC_IN_RC(ptr_reg)); + predicate(size_fits_all_mem_uses(n->as_AddP(), n->in(AddPNode::Offset)->in(2)->get_int())); match(AddP reg (LShiftL lreg scale)); op_cost(0); format %{ "$reg, $lreg lsl($scale)" %} @@ -6167,6 +6234,20 @@ operand indIndexScaled(iRegP reg, iRegL lreg, immIScale scale) %} %} +operand indIndexI2L(iRegP reg, iRegI ireg) +%{ + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP reg (ConvI2L ireg)); + op_cost(0); + format %{ "$reg, $ireg, 0, I2L" %} + interface(MEMORY_INTER) %{ + base($reg); + index($ireg); + scale(0x0); + disp(0x0); + %} +%} + operand indIndex(iRegP reg, iRegL lreg) %{ constraint(ALLOC_IN_RC(ptr_reg)); @@ -6195,6 +6276,48 @@ operand indOffI(iRegP reg, immIOffset off) %} %} +operand indOffI4(iRegP reg, immIOffset4 off) +%{ + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP reg off); + op_cost(0); + format %{ "[$reg, $off]" %} + interface(MEMORY_INTER) %{ + base($reg); + index(0xffffffff); + scale(0x0); + disp($off); + %} +%} + +operand indOffI8(iRegP reg, immIOffset8 off) +%{ + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP reg off); + op_cost(0); + format %{ "[$reg, $off]" %} + interface(MEMORY_INTER) %{ + base($reg); + index(0xffffffff); + scale(0x0); + disp($off); + %} +%} + +operand indOffI16(iRegP reg, immIOffset16 off) +%{ + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP reg off); + op_cost(0); + format %{ "[$reg, $off]" %} + interface(MEMORY_INTER) %{ + base($reg); + index(0xffffffff); + scale(0x0); + disp($off); + %} +%} + operand indOffL(iRegP reg, immLoffset off) %{ constraint(ALLOC_IN_RC(ptr_reg)); @@ -6209,6 +6332,47 @@ operand indOffL(iRegP reg, immLoffset off) %} %} +operand indOffL4(iRegP reg, immLoffset4 off) +%{ + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP reg off); + op_cost(0); + format %{ "[$reg, $off]" %} + interface(MEMORY_INTER) %{ + base($reg); + index(0xffffffff); + scale(0x0); + disp($off); + %} +%} + +operand indOffL8(iRegP reg, immLoffset8 off) +%{ + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP reg off); + op_cost(0); + format %{ "[$reg, $off]" %} + interface(MEMORY_INTER) %{ + base($reg); + index(0xffffffff); + scale(0x0); + disp($off); + %} +%} + +operand indOffL16(iRegP reg, immLoffset16 off) +%{ + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP reg off); + op_cost(0); + format %{ "[$reg, $off]" %} + interface(MEMORY_INTER) %{ + base($reg); + index(0xffffffff); + scale(0x0); + disp($off); + %} +%} operand indirectN(iRegN reg) %{ @@ -6225,69 +6389,9 @@ operand indirectN(iRegN reg) %} %} -operand indIndexScaledOffsetIN(iRegN reg, iRegL lreg, immIScale scale, immIU12 off) -%{ - predicate(Universe::narrow_oop_shift() == 0); - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP (DecodeN reg) (LShiftL lreg scale)) off); - op_cost(0); - format %{ "$reg, $lreg lsl($scale), $off\t# narrow" %} - interface(MEMORY_INTER) %{ - base($reg); - index($lreg); - scale($scale); - disp($off); - %} -%} - -operand indIndexScaledOffsetLN(iRegN reg, iRegL lreg, immIScale scale, immLU12 off) -%{ - predicate(Universe::narrow_oop_shift() == 0); - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP (DecodeN reg) (LShiftL lreg scale)) off); - op_cost(INSN_COST); - format %{ "$reg, $lreg lsl($scale), $off\t# narrow" %} - interface(MEMORY_INTER) %{ - base($reg); - index($lreg); - scale($scale); - disp($off); - %} -%} - -operand indIndexOffsetI2LN(iRegN reg, iRegI ireg, immLU12 off) -%{ - predicate(Universe::narrow_oop_shift() == 0); - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP (DecodeN reg) (ConvI2L ireg)) off); - op_cost(INSN_COST); - format %{ "$reg, $ireg, $off I2L\t# narrow" %} - interface(MEMORY_INTER) %{ - base($reg); - index($ireg); - scale(0x0); - disp($off); - %} -%} - -operand indIndexScaledOffsetI2LN(iRegN reg, iRegI ireg, immIScale scale, immLU12 off) -%{ - predicate(Universe::narrow_oop_shift() == 0); - constraint(ALLOC_IN_RC(ptr_reg)); - match(AddP (AddP (DecodeN reg) (LShiftL (ConvI2L ireg) scale)) off); - op_cost(INSN_COST); - format %{ "$reg, $ireg sxtw($scale), $off I2L\t# narrow" %} - interface(MEMORY_INTER) %{ - base($reg); - index($ireg); - scale($scale); - disp($off); - %} -%} - operand indIndexScaledI2LN(iRegN reg, iRegI ireg, immIScale scale) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && size_fits_all_mem_uses(n->as_AddP(), n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (DecodeN reg) (LShiftL (ConvI2L ireg) scale)); op_cost(0); @@ -6302,7 +6406,7 @@ operand indIndexScaledI2LN(iRegN reg, iRegI ireg, immIScale scale) operand indIndexScaledN(iRegN reg, iRegL lreg, immIScale scale) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && size_fits_all_mem_uses(n->as_AddP(), n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (DecodeN reg) (LShiftL lreg scale)); op_cost(0); @@ -6315,6 +6419,21 @@ operand indIndexScaledN(iRegN reg, iRegL lreg, immIScale scale) %} %} +operand indIndexI2LN(iRegN reg, iRegI ireg) +%{ + predicate(Universe::narrow_oop_shift() == 0); + constraint(ALLOC_IN_RC(ptr_reg)); + match(AddP (DecodeN reg) (ConvI2L ireg)); + op_cost(0); + format %{ "$reg, $ireg, 0, I2L\t# narrow" %} + interface(MEMORY_INTER) %{ + base($reg); + index($ireg); + scale(0x0); + disp(0x0); + %} +%} + operand indIndexN(iRegN reg, iRegL lreg) %{ predicate(Universe::narrow_oop_shift() == 0); @@ -6521,7 +6640,9 @@ operand iRegL2I(iRegL reg) %{ interface(REG_INTER) %} -opclass vmem(indirect, indIndex, indOffI, indOffL); +opclass vmem4(indirect, indIndex, indOffI4, indOffL4); +opclass vmem8(indirect, indIndex, indOffI8, indOffL8); +opclass vmem16(indirect, indIndex, indOffI16, indOffL16); //----------OPERAND CLASSES---------------------------------------------------- // Operand Classes are groups of operands that are used as to simplify @@ -6533,9 +6654,8 @@ opclass vmem(indirect, indIndex, indOffI, indOffL); // memory is used to define read/write location for load/store // instruction defs. we can turn a memory op into an Address -opclass memory(indirect, indIndexScaledOffsetI, indIndexScaledOffsetL, indIndexOffsetI2L, indIndexScaledOffsetI2L, indIndexScaled, indIndexScaledI2L, indIndex, indOffI, indOffL, - indirectN, indIndexScaledOffsetIN, indIndexScaledOffsetLN, indIndexOffsetI2LN, indIndexScaledOffsetI2LN, indIndexScaledN, indIndexScaledI2LN, indIndexN, indOffIN, indOffLN); - +opclass memory(indirect, indIndexScaled, indIndexScaledI2L, indIndexI2L, indIndex, indOffI, indOffL, + indirectN, indIndexScaledN, indIndexScaledI2LN, indIndexI2LN, indIndexN, indOffIN, indOffLN); // iRegIorL2I is used for src inputs in rules for 32 bit int (I) // operations. it allows the src to be either an iRegI or a (ConvL2I @@ -7053,7 +7173,7 @@ pipe_class vmovi_reg_imm128(vecX dst) NEON_FP : S3; %} -pipe_class vload_reg_mem64(vecD dst, vmem mem) +pipe_class vload_reg_mem64(vecD dst, vmem8 mem) %{ single_instruction; dst : S5(write); @@ -7062,7 +7182,7 @@ pipe_class vload_reg_mem64(vecD dst, vmem mem) NEON_FP : S3; %} -pipe_class vload_reg_mem128(vecX dst, vmem mem) +pipe_class vload_reg_mem128(vecX dst, vmem16 mem) %{ single_instruction; dst : S5(write); @@ -7071,7 +7191,7 @@ pipe_class vload_reg_mem128(vecX dst, vmem mem) NEON_FP : S3; %} -pipe_class vstore_reg_mem64(vecD src, vmem mem) +pipe_class vstore_reg_mem64(vecD src, vmem8 mem) %{ single_instruction; mem : ISS(read); @@ -7080,7 +7200,7 @@ pipe_class vstore_reg_mem64(vecD src, vmem mem) NEON_FP : S3; %} -pipe_class vstore_reg_mem128(vecD src, vmem mem) +pipe_class vstore_reg_mem128(vecD src, vmem16 mem) %{ single_instruction; mem : ISS(read); @@ -12123,21 +12243,21 @@ instruct rorL_rReg_Var_C0(iRegLNoSp dst, iRegL src, iRegI shift, immI0 c0, rFlag %} %} -instruct rorI_rReg_Var_C_32(iRegLNoSp dst, iRegL src, iRegI shift, immI_32 c_32, rFlagsReg cr) +instruct rorI_rReg_Var_C_32(iRegINoSp dst, iRegI src, iRegI shift, immI_32 c_32, rFlagsReg cr) %{ match(Set dst (OrI (URShiftI src shift) (LShiftI src (SubI c_32 shift)))); expand %{ - rorL_rReg(dst, src, shift, cr); + rorI_rReg(dst, src, shift, cr); %} %} -instruct rorI_rReg_Var_C0(iRegLNoSp dst, iRegL src, iRegI shift, immI0 c0, rFlagsReg cr) +instruct rorI_rReg_Var_C0(iRegINoSp dst, iRegI src, iRegI shift, immI0 c0, rFlagsReg cr) %{ match(Set dst (OrI (URShiftI src shift) (LShiftI src (SubI c0 shift)))); expand %{ - rorL_rReg(dst, src, shift, cr); + rorI_rReg(dst, src, shift, cr); %} %} @@ -13363,7 +13483,24 @@ instruct clearArray_reg_reg(iRegL_R11 cnt, iRegP_R10 base, Universe dummy, rFlag ins_cost(4 * INSN_COST); format %{ "ClearArray $cnt, $base" %} - ins_encode(aarch64_enc_clear_array_reg_reg(cnt, base)); + ins_encode %{ + __ zero_words($base$$Register, $cnt$$Register); + %} + + ins_pipe(pipe_class_memory); +%} + +instruct clearArray_imm_reg(immL cnt, iRegP_R10 base, iRegL_R11 tmp, Universe dummy, rFlagsReg cr) +%{ + match(Set dummy (ClearArray cnt base)); + effect(USE_KILL base, TEMP tmp); + + ins_cost(4 * INSN_COST); + format %{ "ClearArray $cnt, $base" %} + + ins_encode %{ + __ zero_words($base$$Register, (u_int64_t)$cnt$$constant); + %} ins_pipe(pipe_class_memory); %} @@ -14797,10 +14934,10 @@ instruct partialSubtypeCheckVsZero(iRegP_R4 sub, iRegP_R0 super, iRegP_R2 temp, ins_pipe(pipe_class_memory); %} -instruct string_compare(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2, +instruct string_compareU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2, iRegI_R0 result, iRegP_R10 tmp1, rFlagsReg cr) %{ - predicate(!CompactStrings); + predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2))); effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr); @@ -14819,7 +14956,7 @@ instruct string_compare(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cn instruct string_indexof(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, iRegI_R2 cnt2, iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr) %{ - predicate(!CompactStrings); + predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 cnt2))); effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr); @@ -14839,7 +14976,7 @@ instruct string_indexof_con(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, immI_le_4 int_cnt2, iRegI_R0 result, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI tmp4, rFlagsReg cr) %{ - predicate(!CompactStrings); + predicate(((StrIndexOfNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (StrIndexOf (Binary str1 cnt1) (Binary str2 int_cnt2))); effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt1, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr); @@ -14856,10 +14993,27 @@ instruct string_indexof_con(iRegP_R1 str1, iRegI_R4 cnt1, iRegP_R3 str2, ins_pipe(pipe_class_memory); %} -instruct string_equals(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt, +instruct string_equalsL(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt, iRegI_R0 result, rFlagsReg cr) %{ - predicate(!CompactStrings); + predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::LL); + match(Set result (StrEquals (Binary str1 str2) cnt)); + effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr); + + format %{ "String Equals $str1,$str2,$cnt -> $result" %} + ins_encode %{ + // Count is in 8-bit bytes; non-Compact chars are 16 bits. + __ arrays_equals($str1$$Register, $str2$$Register, + $result$$Register, $cnt$$Register, + 1, /*is_string*/true); + %} + ins_pipe(pipe_class_memory); +%} + +instruct string_equalsU(iRegP_R1 str1, iRegP_R3 str2, iRegI_R4 cnt, + iRegI_R0 result, rFlagsReg cr) +%{ + predicate(((StrEqualsNode*)n)->encoding() == StrIntrinsicNode::UU); match(Set result (StrEquals (Binary str1 str2) cnt)); effect(USE_KILL str1, USE_KILL str2, USE_KILL cnt, KILL cr); @@ -14907,6 +15061,40 @@ instruct array_equalsC(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result, %} +// fast char[] to byte[] compression +instruct string_compress(iRegP_R2 src, iRegP_R1 dst, iRegI_R3 len, + vRegD_V0 tmp1, vRegD_V1 tmp2, + vRegD_V2 tmp3, vRegD_V3 tmp4, + iRegI_R0 result, rFlagsReg cr) +%{ + match(Set result (StrCompressedCopy src (Binary dst len))); + effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL cr); + + format %{ "String Compress $src,$dst -> $result // KILL R1, R2, R3, R4" %} + ins_encode %{ + __ char_array_compress($src$$Register, $dst$$Register, $len$$Register, + $tmp1$$FloatRegister, $tmp2$$FloatRegister, + $tmp3$$FloatRegister, $tmp4$$FloatRegister, + $result$$Register); + %} + ins_pipe( pipe_slow ); +%} + +// fast byte[] to char[] inflation +instruct string_inflate(Universe dummy, iRegP_R0 src, iRegP_R1 dst, iRegI_R2 len, + vRegD tmp1, vRegD tmp2, vRegD tmp3, iRegP_R3 tmp4, rFlagsReg cr) +%{ + match(Set dummy (StrInflatedCopy src (Binary dst len))); + effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL cr); + + format %{ "String Inflate $src,$dst // KILL $tmp1, $tmp2" %} + ins_encode %{ + __ byte_array_inflate($src$$Register, $dst$$Register, $len$$Register, + $tmp1$$FloatRegister, $tmp2$$FloatRegister, $tmp3$$FloatRegister, $tmp4$$Register); + %} + ins_pipe(pipe_class_memory); +%} + // encode char[] to byte[] in ISO_8859_1 instruct encode_iso_array(iRegP_R2 src, iRegP_R1 dst, iRegI_R3 len, vRegD_V0 Vtmp1, vRegD_V1 Vtmp2, @@ -14948,7 +15136,7 @@ instruct tlsLoadP(thread_RegP dst) // ====================VECTOR INSTRUCTIONS===================================== // Load vector (32 bits) -instruct loadV4(vecD dst, vmem mem) +instruct loadV4(vecD dst, vmem4 mem) %{ predicate(n->as_LoadVector()->memory_size() == 4); match(Set dst (LoadVector mem)); @@ -14959,7 +15147,7 @@ instruct loadV4(vecD dst, vmem mem) %} // Load vector (64 bits) -instruct loadV8(vecD dst, vmem mem) +instruct loadV8(vecD dst, vmem8 mem) %{ predicate(n->as_LoadVector()->memory_size() == 8); match(Set dst (LoadVector mem)); @@ -14970,7 +15158,7 @@ instruct loadV8(vecD dst, vmem mem) %} // Load Vector (128 bits) -instruct loadV16(vecX dst, vmem mem) +instruct loadV16(vecX dst, vmem16 mem) %{ predicate(n->as_LoadVector()->memory_size() == 16); match(Set dst (LoadVector mem)); @@ -14981,7 +15169,7 @@ instruct loadV16(vecX dst, vmem mem) %} // Store Vector (32 bits) -instruct storeV4(vecD src, vmem mem) +instruct storeV4(vecD src, vmem4 mem) %{ predicate(n->as_StoreVector()->memory_size() == 4); match(Set mem (StoreVector mem src)); @@ -14992,7 +15180,7 @@ instruct storeV4(vecD src, vmem mem) %} // Store Vector (64 bits) -instruct storeV8(vecD src, vmem mem) +instruct storeV8(vecD src, vmem8 mem) %{ predicate(n->as_StoreVector()->memory_size() == 8); match(Set mem (StoreVector mem src)); @@ -15003,7 +15191,7 @@ instruct storeV8(vecD src, vmem mem) %} // Store Vector (128 bits) -instruct storeV16(vecX src, vmem mem) +instruct storeV16(vecX src, vmem16 mem) %{ predicate(n->as_StoreVector()->memory_size() == 16); match(Set mem (StoreVector mem src)); diff --git a/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp index 77f49a72854..a09f2684af6 100644 --- a/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -177,4 +177,6 @@ void AbstractInterpreter::layout_activation(Method* method, } *interpreter_frame->interpreter_frame_cache_addr() = method->constants()->cache(); + *interpreter_frame->interpreter_frame_mirror_addr() = + method->method_holder()->java_mirror(); } diff --git a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp index 965a5c8072f..8c7901e3aca 100644 --- a/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/assembler_aarch64.hpp @@ -1032,12 +1032,28 @@ public: system(0b00, 0b011, 0b00011, SY, 0b110); } - void dc(Register Rt) { - system(0b01, 0b011, 0b0111, 0b1011, 0b001, Rt); + void sys(int op1, int CRn, int CRm, int op2, + Register rt = (Register)0b11111) { + system(0b01, op1, CRn, CRm, op2, rt); } - void ic(Register Rt) { - system(0b01, 0b011, 0b0111, 0b0101, 0b001, Rt); + // Only implement operations accessible from EL0 or higher, i.e., + // op1 CRn CRm op2 + // IC IVAU 3 7 5 1 + // DC CVAC 3 7 10 1 + // DC CVAU 3 7 11 1 + // DC CIVAC 3 7 14 1 + // DC ZVA 3 7 4 1 + // So only deal with the CRm field. + enum icache_maintenance {IVAU = 0b0101}; + enum dcache_maintenance {CVAC = 0b1010, CVAU = 0b1011, CIVAC = 0b1110, ZVA = 0b100}; + + void dc(dcache_maintenance cm, Register Rt) { + sys(0b011, 0b0111, cm, 0b001, Rt); + } + + void ic(icache_maintenance cm, Register Rt) { + sys(0b011, 0b0111, cm, 0b001, Rt); } // A more convenient access to dmb for our purposes @@ -2245,18 +2261,18 @@ public: rf(Vn, 5), rf(Rd, 0); } -#define INSN(NAME, opc, opc2) \ - void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, int shift){ \ - starti; \ - /* The encodings for the immh:immb fields (bits 22:16) are \ - * 0001 xxx 8B/16B, shift = xxx \ - * 001x xxx 4H/8H, shift = xxxx \ - * 01xx xxx 2S/4S, shift = xxxxx \ - * 1xxx xxx 1D/2D, shift = xxxxxx (1D is RESERVED) \ - */ \ - assert((1 << ((T>>1)+3)) > shift, "Invalid Shift value"); \ - f(0, 31), f(T & 1, 30), f(opc, 29), f(0b011110, 28, 23), \ - f((1 << ((T>>1)+3))|shift, 22, 16); f(opc2, 15, 10), rf(Vn, 5), rf(Vd, 0); \ +#define INSN(NAME, opc, opc2) \ + void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, int shift){ \ + starti; \ + /* The encodings for the immh:immb fields (bits 22:16) are \ + * 0001 xxx 8B/16B, shift = xxx \ + * 001x xxx 4H/8H, shift = xxxx \ + * 01xx xxx 2S/4S, shift = xxxxx \ + * 1xxx xxx 1D/2D, shift = xxxxxx (1D is RESERVED) \ + */ \ + assert((1 << ((T>>1)+3)) > shift, "Invalid Shift value"); \ + f(0, 31), f(T & 1, 30), f(opc, 29), f(0b011110, 28, 23), \ + f((1 << ((T>>1)+3))|shift, 22, 16); f(opc2, 15, 10), rf(Vn, 5), rf(Vd, 0); \ } INSN(shl, 0, 0b010101); @@ -2347,6 +2363,24 @@ public: f(0b000001, 15, 10), rf(Vn, 5), rf(Vd, 0); } + // AdvSIMD ZIP/UZP/TRN +#define INSN(NAME, opcode) \ + void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm) { \ + starti; \ + f(0, 31), f(0b001110, 29, 24), f(0, 21), f(0b001110, 15, 10); \ + rf(Vm, 16), rf(Vn, 5), rf(Vd, 0); \ + f(T & 1, 30), f(T >> 1, 23, 22); \ + } + + INSN(uzp1, 0b001); + INSN(trn1, 0b010); + INSN(zip1, 0b011); + INSN(uzp2, 0b101); + INSN(trn2, 0b110); + INSN(zip2, 0b111); + +#undef INSN + // CRC32 instructions #define INSN(NAME, c, sf, sz) \ void NAME(Register Rd, Register Rn, Register Rm) { \ diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp index 976e69133bc..e34c6fa2691 100644 --- a/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp @@ -2942,6 +2942,10 @@ void LIR_Assembler::membar_loadstore() { __ membar(MacroAssembler::LoadStore); } void LIR_Assembler::membar_storeload() { __ membar(MacroAssembler::StoreLoad); } +void LIR_Assembler::on_spin_wait() { + Unimplemented(); +} + void LIR_Assembler::get_thread(LIR_Opr result_reg) { __ mov(result_reg->as_register(), rthread); } diff --git a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp index 191c4e45571..4690e75e3cf 100644 --- a/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -331,7 +331,7 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { length.load_item(); } - if (needs_store_check) { + if (needs_store_check || x->check_boolean()) { value.load_item(); } else { value.load_for_store(x->elt_type()); @@ -380,7 +380,8 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { // Seems to be a precise post_barrier(LIR_OprFact::address(array_addr), value.result()); } else { - __ move(value.result(), array_addr, null_check_info); + LIR_Opr result = maybe_mask_boolean(x, array.result(), value.result(), null_check_info); + __ move(result, array_addr, null_check_info); } } @@ -1029,6 +1030,14 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) { } } +void LIRGenerator::do_update_CRC32C(Intrinsic* x) { + Unimplemented(); +} + +void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { + fatal("vectorizedMismatch intrinsic is not implemented on this platform"); +} + // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f // _i2b, _i2c, _i2s void LIRGenerator::do_Convert(Convert* x) { @@ -1127,7 +1136,7 @@ void LIRGenerator::do_NewObjectArray(NewObjectArray* x) { void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); diff --git a/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp index f4170aeb85b..865ee69d1f7 100644 --- a/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/c2_globals_aarch64.hpp @@ -71,7 +71,7 @@ define_pd_global(bool, UseCISCSpill, true); define_pd_global(bool, OptoScheduling, false); define_pd_global(bool, OptoBundling, false); define_pd_global(bool, OptoRegScheduling, false); -define_pd_global(bool, SuperWordLoopUnrollAnalysis, false); +define_pd_global(bool, SuperWordLoopUnrollAnalysis, true); define_pd_global(intx, ReservedCodeCacheSize, 48*M); define_pd_global(intx, NonProfiledCodeHeapSize, 21*M); diff --git a/hotspot/src/cpu/aarch64/vm/compiledIC_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/compiledIC_aarch64.cpp index 103b936b5b4..bd4e55a5151 100644 --- a/hotspot/src/cpu/aarch64/vm/compiledIC_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/compiledIC_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -32,22 +32,6 @@ #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" -// Release the CompiledICHolder* associated with this call site is there is one. -void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - if (is_icholder_entry(call->destination())) { - NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); - InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); - } -} - -bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - return is_icholder_entry(call->destination()); -} - // ---------------------------------------------------------------------------- #define __ _masm. diff --git a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp index bce575a10af..42c61b9a33f 100644 --- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -221,21 +221,19 @@ bool frame::safe_for_sender(JavaThread *thread) { return jcw_safe; } - if (sender_blob->is_nmethod()) { - nmethod* nm = sender_blob->as_nmethod_or_null(); - if (nm != NULL) { - if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) || - nm->method()->is_method_handle_intrinsic()) { - return false; - } - } + CompiledMethod* nm = sender_blob->as_compiled_method_or_null(); + if (nm != NULL) { + if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) || + nm->method()->is_method_handle_intrinsic()) { + return false; + } } // If the frame size is 0 something (or less) is bad because every nmethod has a non-zero frame size // because the return address counts against the callee's frame. if (sender_blob->frame_size() <= 0) { - assert(!sender_blob->is_nmethod(), "should count return address at least"); + assert(!sender_blob->is_compiled(), "should count return address at least"); return false; } @@ -244,7 +242,7 @@ bool frame::safe_for_sender(JavaThread *thread) { // should not be anything but the call stub (already covered), the interpreter (already covered) // or an nmethod. - if (!sender_blob->is_nmethod()) { + if (!sender_blob->is_compiled()) { return false; } @@ -286,7 +284,7 @@ void frame::patch_pc(Thread* thread, address pc) { assert(_pc == *pc_addr || pc == *pc_addr, "must be"); *pc_addr = pc; _cb = CodeCache::find_blob(pc); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { assert(original_pc == _pc, "expected original PC to be stored before patching"); _deopt_state = is_deoptimized; @@ -371,7 +369,7 @@ frame frame::sender_for_entry_frame(RegisterMap* map) const { // Verifies the calculated original PC of a deoptimization PC for the // given unextended SP. #ifdef ASSERT -void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) { +void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) { frame fr; // This is ugly but it's better than to change {get,set}_original_pc @@ -391,12 +389,14 @@ void frame::adjust_unextended_sp() { // as any other call site. Therefore, no special action is needed when we are // returning to any of these call sites. - nmethod* sender_nm = (_cb == NULL) ? NULL : _cb->as_nmethod_or_null(); - if (sender_nm != NULL) { - // If the sender PC is a deoptimization point, get the original PC. - if (sender_nm->is_deopt_entry(_pc) || - sender_nm->is_deopt_mh_entry(_pc)) { - DEBUG_ONLY(verify_deopt_original_pc(sender_nm, _unextended_sp)); + if (_cb != NULL) { + CompiledMethod* sender_cm = _cb->as_compiled_method_or_null(); + if (sender_cm != NULL) { + // If the sender PC is a deoptimization point, get the original PC. + if (sender_cm->is_deopt_entry(_pc) || + sender_cm->is_deopt_mh_entry(_pc)) { + DEBUG_ONLY(verify_deopt_original_pc(sender_cm, _unextended_sp)); + } } } } diff --git a/hotspot/src/cpu/aarch64/vm/frame_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/frame_aarch64.hpp index 4332abce9f4..5bcee325945 100644 --- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -78,7 +78,9 @@ interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1, interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1, interpreter_frame_mdp_offset = interpreter_frame_method_offset - 1, - interpreter_frame_cache_offset = interpreter_frame_mdp_offset - 1, + interpreter_frame_padding_offset = interpreter_frame_mdp_offset - 1, + interpreter_frame_mirror_offset = interpreter_frame_padding_offset - 1, + interpreter_frame_cache_offset = interpreter_frame_mirror_offset - 1, interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1, interpreter_frame_bcp_offset = interpreter_frame_locals_offset - 1, interpreter_frame_initial_sp_offset = interpreter_frame_bcp_offset - 1, @@ -124,7 +126,7 @@ #ifdef ASSERT // Used in frame::sender_for_{interpreter,compiled}_frame - static void verify_deopt_original_pc( nmethod* nm, intptr_t* unextended_sp); + static void verify_deopt_original_pc( CompiledMethod* nm, intptr_t* unextended_sp); #endif public: diff --git a/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp b/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp index 7fce68be5b9..7c410aaa74b 100644 --- a/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp +++ b/hotspot/src/cpu/aarch64/vm/frame_aarch64.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -55,7 +55,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) { _cb = CodeCache::find_blob(pc); adjust_unextended_sp(); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; _deopt_state = is_deoptimized; @@ -79,10 +79,10 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address _cb = CodeCache::find_blob(pc); adjust_unextended_sp(); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; - assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod"); + assert(((CompiledMethod*)_cb)->insts_contains(_pc), "original PC must be in CompiledMethod"); _deopt_state = is_deoptimized; } else { _deopt_state = not_deoptimized; @@ -111,7 +111,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) { _cb = CodeCache::find_blob(_pc); adjust_unextended_sp(); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; _deopt_state = is_deoptimized; @@ -188,6 +188,12 @@ inline Method** frame::interpreter_frame_method_addr() const { return (Method**)addr_at(interpreter_frame_method_offset); } +// Mirror + +inline oop* frame::interpreter_frame_mirror_addr() const { + return (oop*)addr_at(interpreter_frame_mirror_offset); +} + // top of expression stack inline intptr_t* frame::interpreter_frame_tos_address() const { intptr_t* last_sp = interpreter_frame_last_sp(); diff --git a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp index 60edc02fc2a..604b8cd34fb 100644 --- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp @@ -48,9 +48,9 @@ define_pd_global(intx, InlineFrequencyCount, 100); #define DEFAULT_STACK_SHADOW_PAGES (4 DEBUG_ONLY(+5)) #define DEFAULT_STACK_RESERVED_PAGES (0) -#define MIN_STACK_YELLOW_PAGES 1 -#define MIN_STACK_RED_PAGES 1 -#define MIN_STACK_SHADOW_PAGES 1 +#define MIN_STACK_YELLOW_PAGES DEFAULT_STACK_YELLOW_PAGES +#define MIN_STACK_RED_PAGES DEFAULT_STACK_RED_PAGES +#define MIN_STACK_SHADOW_PAGES DEFAULT_STACK_SHADOW_PAGES #define MIN_STACK_RESERVED_PAGES (0) define_pd_global(intx, StackYellowPages, DEFAULT_STACK_YELLOW_PAGES); @@ -76,7 +76,8 @@ define_pd_global(bool, CompactStrings, false); // avoid biased locking while we are bootstrapping the aarch64 build define_pd_global(bool, UseBiasedLocking, false); -define_pd_global(intx, InitArrayShortSize, 18*BytesPerLong); +// Clear short arrays bigger than one word in an arch-specific way +define_pd_global(intx, InitArrayShortSize, BytesPerLong); #if defined(COMPILER1) || defined(COMPILER2) define_pd_global(intx, InlineSmallCode, 1000); @@ -84,7 +85,14 @@ define_pd_global(intx, InlineSmallCode, 1000); #ifdef BUILTIN_SIM #define UseBuiltinSim true -#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint) \ +#define ARCH_FLAGS(develop, \ + product, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(bool, NotifySimulator, UseBuiltinSim, \ "tell the AArch64 sim where we are in method code") \ @@ -116,7 +124,14 @@ define_pd_global(intx, InlineSmallCode, 1000); #define NotifySimulator false #define UseSimulatorCache false #define DisableBCCheck true -#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint) \ +#define ARCH_FLAGS(develop, \ + product, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(bool, NearCpool, true, \ "constant pool is close to instructions") \ @@ -131,6 +146,11 @@ define_pd_global(intx, InlineSmallCode, 1000); "Use SIMD instructions in generated memory move code") \ product(bool, UseLSE, false, \ "Use LSE instructions") \ + product(bool, UseBlockZeroing, true, \ + "Use DC ZVA for block zeroing") \ + product(intx, BlockZeroingLowLimit, 256, \ + "Minimum size in bytes when block zeroing will be used") \ + range(1, max_jint) \ product(bool, TraceTraps, false, "Trace all traps the signal handler") #endif diff --git a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp index 59d06cb65ee..22712102137 100644 --- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp @@ -27,12 +27,12 @@ #include "interp_masm_aarch64.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "logging/log.hpp" #include "oops/arrayOop.hpp" #include "oops/markOop.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" @@ -40,7 +40,43 @@ #include "runtime/thread.inline.hpp" -// Implementation of InterpreterMacroAssembler +void InterpreterMacroAssembler::narrow(Register result) { + + // Get method->_constMethod->_result_type + ldr(rscratch1, Address(rfp, frame::interpreter_frame_method_offset * wordSize)); + ldr(rscratch1, Address(rscratch1, Method::const_offset())); + ldrb(rscratch1, Address(rscratch1, ConstMethod::result_type_offset())); + + Label done, notBool, notByte, notChar; + + // common case first + cmpw(rscratch1, T_INT); + br(Assembler::EQ, done); + + // mask integer result to narrower return type. + cmpw(rscratch1, T_BOOLEAN); + br(Assembler::NE, notBool); + andw(result, result, 0x1); + b(done); + + bind(notBool); + cmpw(rscratch1, T_BYTE); + br(Assembler::NE, notByte); + sbfx(result, result, 0, 8); + b(done); + + bind(notByte); + cmpw(rscratch1, T_CHAR); + br(Assembler::NE, notChar); + ubfx(result, result, 0, 16); // truncate upper 16 bits + b(done); + + bind(notChar); + sbfx(result, result, 0, 16); // sign-extend short + + // Nothing to do for T_INT + bind(done); +} void InterpreterMacroAssembler::jump_to_entry(address entry) { assert(entry, "Entry must have been generated by now"); @@ -81,6 +117,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) { verify_oop(r0, state); break; case ltos: ldr(r0, val_addr); break; case btos: // fall through + case ztos: // fall through case ctos: // fall through case stos: // fall through case itos: ldrw(r0, val_addr); break; @@ -314,6 +351,7 @@ void InterpreterMacroAssembler::pop(TosState state) { switch (state) { case atos: pop_ptr(); break; case btos: + case ztos: case ctos: case stos: case itos: pop_i(); break; @@ -331,6 +369,7 @@ void InterpreterMacroAssembler::push(TosState state) { switch (state) { case atos: push_ptr(); break; case btos: + case ztos: case ctos: case stos: case itos: push_i(); break; @@ -1411,7 +1450,7 @@ void InterpreterMacroAssembler::notify_method_entry() { } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { get_method(c_rarg1); call_VM_leaf( CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), diff --git a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp index d56d17ab47a..dd73bf5283d 100644 --- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp @@ -245,6 +245,9 @@ class InterpreterMacroAssembler: public MacroAssembler { void update_mdp_by_constant(Register mdp_in, int constant); void update_mdp_for_ret(Register return_bci); + // narrow int return value + void narrow(Register result); + void profile_taken_branch(Register mdp, Register bumped_count); void profile_not_taken_branch(Register mdp); void profile_call(Register mdp); diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp index 0ede2e9847a..a271ba92ede 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp @@ -3217,6 +3217,14 @@ void MacroAssembler::load_klass(Register dst, Register src) { } } +void MacroAssembler::load_mirror(Register dst, Register method) { + const int mirror_offset = in_bytes(Klass::java_mirror_offset()); + ldr(dst, Address(rmethod, Method::const_offset())); + ldr(dst, Address(dst, ConstMethod::constants_offset())); + ldr(dst, Address(dst, ConstantPool::pool_holder_offset_in_bytes())); + ldr(dst, Address(dst, mirror_offset)); +} + void MacroAssembler::cmp_klass(Register oop, Register trial_klass, Register tmp) { if (UseCompressedClassPointers) { ldrw(tmp, Address(oop, oopDesc::klass_offset_in_bytes())); @@ -4085,7 +4093,10 @@ void MacroAssembler::load_byte_map_base(Register reg) { // and it might even be negative. unsigned long offset; adrp(reg, ExternalAddress((address)byte_map_base), offset); - assert(offset == 0, "misaligned card table base"); + // We expect offset to be zero with most collectors. + if (offset != 0) { + add(reg, reg, offset); + } } else { mov(reg, (uint64_t)byte_map_base); } @@ -4585,7 +4596,16 @@ void MacroAssembler::arrays_equals(Register a1, Register a2, assert(elem_size == 1 || elem_size == 2, "must be char or byte"); assert_different_registers(a1, a2, result, cnt1, rscratch1, rscratch2); - BLOCK_COMMENT(is_string ? "string_equals {" : "array_equals {"); +#ifndef PRODUCT + { + const char kind = (elem_size == 2) ? 'U' : 'L'; + char comment[64]; + snprintf(comment, sizeof comment, "%s%c%s {", + is_string ? "string_equals" : "array_equals", + kind, "{"); + BLOCK_COMMENT(comment); + } +#endif mov(result, false); @@ -4671,7 +4691,179 @@ void MacroAssembler::arrays_equals(Register a1, Register a2, } -// encode char[] to byte[] in ISO_8859_1 +// base: Address of a buffer to be zeroed, 8 bytes aligned. +// cnt: Count in HeapWords. +// is_large: True when 'cnt' is known to be >= BlockZeroingLowLimit. +void MacroAssembler::zero_words(Register base, Register cnt) +{ + if (UseBlockZeroing) { + block_zero(base, cnt); + } else { + fill_words(base, cnt, zr); + } +} + +// r10 = base: Address of a buffer to be zeroed, 8 bytes aligned. +// cnt: Immediate count in HeapWords. +// r11 = tmp: For use as cnt if we need to call out +#define ShortArraySize (18 * BytesPerLong) +void MacroAssembler::zero_words(Register base, u_int64_t cnt) +{ + Register tmp = r11; + int i = cnt & 1; // store any odd word to start + if (i) str(zr, Address(base)); + + if (cnt <= ShortArraySize / BytesPerLong) { + for (; i < (int)cnt; i += 2) + stp(zr, zr, Address(base, i * wordSize)); + } else if (UseBlockZeroing && cnt >= (u_int64_t)(BlockZeroingLowLimit >> LogBytesPerWord)) { + mov(tmp, cnt); + block_zero(base, tmp, true); + } else { + const int unroll = 4; // Number of stp(zr, zr) instructions we'll unroll + int remainder = cnt % (2 * unroll); + for (; i < remainder; i += 2) + stp(zr, zr, Address(base, i * wordSize)); + + Label loop; + Register cnt_reg = rscratch1; + Register loop_base = rscratch2; + cnt = cnt - remainder; + mov(cnt_reg, cnt); + // adjust base and prebias by -2 * wordSize so we can pre-increment + add(loop_base, base, (remainder - 2) * wordSize); + bind(loop); + sub(cnt_reg, cnt_reg, 2 * unroll); + for (i = 1; i < unroll; i++) + stp(zr, zr, Address(loop_base, 2 * i * wordSize)); + stp(zr, zr, Address(pre(loop_base, 2 * unroll * wordSize))); + cbnz(cnt_reg, loop); + } +} + +// base: Address of a buffer to be filled, 8 bytes aligned. +// cnt: Count in 8-byte unit. +// value: Value to be filled with. +// base will point to the end of the buffer after filling. +void MacroAssembler::fill_words(Register base, Register cnt, Register value) +{ +// Algorithm: +// +// scratch1 = cnt & 7; +// cnt -= scratch1; +// p += scratch1; +// switch (scratch1) { +// do { +// cnt -= 8; +// p[-8] = v; +// case 7: +// p[-7] = v; +// case 6: +// p[-6] = v; +// // ... +// case 1: +// p[-1] = v; +// case 0: +// p += 8; +// } while (cnt); +// } + + assert_different_registers(base, cnt, value, rscratch1, rscratch2); + + Label fini, skip, entry, loop; + const int unroll = 8; // Number of stp instructions we'll unroll + + cbz(cnt, fini); + tbz(base, 3, skip); + str(value, Address(post(base, 8))); + sub(cnt, cnt, 1); + bind(skip); + + andr(rscratch1, cnt, (unroll-1) * 2); + sub(cnt, cnt, rscratch1); + add(base, base, rscratch1, Assembler::LSL, 3); + adr(rscratch2, entry); + sub(rscratch2, rscratch2, rscratch1, Assembler::LSL, 1); + br(rscratch2); + + bind(loop); + add(base, base, unroll * 16); + for (int i = -unroll; i < 0; i++) + stp(value, value, Address(base, i * 16)); + bind(entry); + subs(cnt, cnt, unroll * 2); + br(Assembler::GE, loop); + + tbz(cnt, 0, fini); + str(value, Address(post(base, 8))); + bind(fini); +} + +// Use DC ZVA to do fast zeroing. +// base: Address of a buffer to be zeroed, 8 bytes aligned. +// cnt: Count in HeapWords. +// is_large: True when 'cnt' is known to be >= BlockZeroingLowLimit. +void MacroAssembler::block_zero(Register base, Register cnt, bool is_large) +{ + Label small; + Label store_pair, loop_store_pair, done; + Label base_aligned; + + assert_different_registers(base, cnt, rscratch1); + guarantee(base == r10 && cnt == r11, "fix register usage"); + + Register tmp = rscratch1; + Register tmp2 = rscratch2; + int zva_length = VM_Version::zva_length(); + + // Ensure ZVA length can be divided by 16. This is required by + // the subsequent operations. + assert (zva_length % 16 == 0, "Unexpected ZVA Length"); + + if (!is_large) cbz(cnt, done); + tbz(base, 3, base_aligned); + str(zr, Address(post(base, 8))); + sub(cnt, cnt, 1); + bind(base_aligned); + + // Ensure count >= zva_length * 2 so that it still deserves a zva after + // alignment. + if (!is_large || !(BlockZeroingLowLimit >= zva_length * 2)) { + int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit); + cmp(cnt, low_limit >> 3); + br(Assembler::LT, small); + } + + far_call(StubRoutines::aarch64::get_zero_longs()); + + bind(small); + + const int unroll = 8; // Number of stp instructions we'll unroll + Label small_loop, small_table_end; + + andr(tmp, cnt, (unroll-1) * 2); + sub(cnt, cnt, tmp); + add(base, base, tmp, Assembler::LSL, 3); + adr(tmp2, small_table_end); + sub(tmp2, tmp2, tmp, Assembler::LSL, 1); + br(tmp2); + + bind(small_loop); + add(base, base, unroll * 16); + for (int i = -unroll; i < 0; i++) + stp(zr, zr, Address(base, i * 16)); + bind(small_table_end); + subs(cnt, cnt, unroll * 2); + br(Assembler::GE, small_loop); + + tbz(cnt, 0, done); + str(zr, Address(post(base, 8))); + + bind(done); +} + +// Intrinsic for sun/nio/cs/ISO_8859_1$Encoder.implEncodeISOArray and +// java/lang/StringUTF16.compress. void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, Register result, FloatRegister Vtmp1, FloatRegister Vtmp2, @@ -4734,6 +4926,90 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, BIND(DONE); sub(result, result, len); // Return index where we stopped + // Return len == 0 if we processed all + // characters +} + + +// Inflate byte[] array to char[]. +void MacroAssembler::byte_array_inflate(Register src, Register dst, Register len, + FloatRegister vtmp1, FloatRegister vtmp2, FloatRegister vtmp3, + Register tmp4) { + Label big, done; + + assert_different_registers(src, dst, len, tmp4, rscratch1); + + fmovd(vtmp1 , zr); + lsrw(rscratch1, len, 3); + + cbnzw(rscratch1, big); + + // Short string: less than 8 bytes. + { + Label loop, around, tiny; + + subsw(len, len, 4); + andw(len, len, 3); + br(LO, tiny); + + // Use SIMD to do 4 bytes. + ldrs(vtmp2, post(src, 4)); + zip1(vtmp3, T8B, vtmp2, vtmp1); + strd(vtmp3, post(dst, 8)); + + cbzw(len, done); + + // Do the remaining bytes by steam. + bind(loop); + ldrb(tmp4, post(src, 1)); + strh(tmp4, post(dst, 2)); + subw(len, len, 1); + + bind(tiny); + cbnz(len, loop); + + bind(around); + b(done); + } + + // Unpack the bytes 8 at a time. + bind(big); + andw(len, len, 7); + + { + Label loop, around; + + bind(loop); + ldrd(vtmp2, post(src, 8)); + sub(rscratch1, rscratch1, 1); + zip1(vtmp3, T16B, vtmp2, vtmp1); + st1(vtmp3, T8H, post(dst, 16)); + cbnz(rscratch1, loop); + + bind(around); + } + + // Do the tail of up to 8 bytes. + sub(src, src, 8); + add(src, src, len, ext::uxtw, 0); + ldrd(vtmp2, Address(src)); + sub(dst, dst, 16); + add(dst, dst, len, ext::uxtw, 1); + zip1(vtmp3, T16B, vtmp2, vtmp1); + st1(vtmp3, T8H, Address(dst)); + + bind(done); +} + +// Compress char[] array to byte[]. +void MacroAssembler::char_array_compress(Register src, Register dst, Register len, + FloatRegister tmp1Reg, FloatRegister tmp2Reg, + FloatRegister tmp3Reg, FloatRegister tmp4Reg, + Register result) { + encode_iso_array(src, dst, len, result, + tmp1Reg, tmp2Reg, tmp3Reg, tmp4Reg); + cmp(len, zr); + csel(result, result, zr, EQ); } // get_thread() can be called anywhere inside generated code so we diff --git a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp index b114e1b9c80..0db161d5303 100644 --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -536,6 +536,15 @@ public: msr(0b011, 0b0100, 0b0100, 0b001, zr); } + // DCZID_EL0: op1 == 011 + // CRn == 0000 + // CRm == 0000 + // op2 == 111 + inline void get_dczid_el0(Register reg) + { + mrs(0b011, 0b0000, 0b0000, 0b111, reg); + } + // idiv variant which deals with MINLONG as dividend and -1 as divisor int corrected_idivl(Register result, Register ra, Register rb, bool want_remainder, Register tmp = rscratch1); @@ -770,6 +779,8 @@ public: void store_klass(Register dst, Register src); void cmp_klass(Register oop, Register trial_klass, Register tmp); + void load_mirror(Register dst, Register method); + void load_heap_oop(Register dst, Address src); void load_heap_oop_not_null(Register dst, Address src); @@ -1184,6 +1195,20 @@ public: Register result, Register cnt1, int elem_size, bool is_string); + void fill_words(Register base, Register cnt, Register value); + void zero_words(Register base, u_int64_t cnt); + void zero_words(Register base, Register cnt); + void block_zero(Register base, Register cnt, bool is_large = false); + + void byte_array_inflate(Register src, Register dst, Register len, + FloatRegister vtmp1, FloatRegister vtmp2, + FloatRegister vtmp3, Register tmp4); + + void char_array_compress(Register src, Register dst, Register len, + FloatRegister tmp1Reg, FloatRegister tmp2Reg, + FloatRegister tmp3Reg, FloatRegister tmp4Reg, + Register result); + void encode_iso_array(Register src, Register dst, Register len, Register result, FloatRegister Vtmp1, FloatRegister Vtmp2, diff --git a/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp index e36434cc183..88e1d3d1460 100644 --- a/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/nativeInst_aarch64.cpp @@ -99,7 +99,7 @@ address NativeCall::get_trampoline() { address bl_destination = MacroAssembler::pd_call_destination(call_addr); - if (code->content_contains(bl_destination) && + if (code->contains(bl_destination) && is_NativeCallTrampolineStub_at(bl_destination)) return bl_destination; diff --git a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp index 760256da378..6a5bb7a66b7 100644 --- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp @@ -31,9 +31,9 @@ #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interp_masm.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_aarch64.inline.hpp" @@ -1781,7 +1781,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { // protect the args we've loaded save_args(masm, total_c_args, c_arg, out_regs); __ mov_metadata(c_rarg1, method()); diff --git a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp index b0787ddf4a9..2355579ceab 100644 --- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp @@ -719,6 +719,48 @@ class StubGenerator: public StubCodeGenerator { } } + address generate_zero_longs(Register base, Register cnt) { + Register tmp = rscratch1; + Register tmp2 = rscratch2; + int zva_length = VM_Version::zva_length(); + Label initial_table_end, loop_zva; + Label fini; + + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "zero_longs"); + address start = __ pc(); + + // Base must be 16 byte aligned. If not just return and let caller handle it + __ tst(base, 0x0f); + __ br(Assembler::NE, fini); + // Align base with ZVA length. + __ neg(tmp, base); + __ andr(tmp, tmp, zva_length - 1); + + // tmp: the number of bytes to be filled to align the base with ZVA length. + __ add(base, base, tmp); + __ sub(cnt, cnt, tmp, Assembler::ASR, 3); + __ adr(tmp2, initial_table_end); + __ sub(tmp2, tmp2, tmp, Assembler::LSR, 2); + __ br(tmp2); + + for (int i = -zva_length + 16; i < 0; i += 16) + __ stp(zr, zr, Address(base, i)); + __ bind(initial_table_end); + + __ sub(cnt, cnt, zva_length >> 3); + __ bind(loop_zva); + __ dc(Assembler::ZVA, base); + __ subs(cnt, cnt, zva_length >> 3); + __ add(base, base, zva_length); + __ br(Assembler::GE, loop_zva); + __ add(cnt, cnt, zva_length >> 3); // count not zeroed by DC ZVA + __ bind(fini); + __ ret(lr); + + return start; + } + typedef enum { copy_forwards = 1, copy_backwards = -1 @@ -2021,6 +2063,154 @@ class StubGenerator: public StubCodeGenerator { return start; } + // + // Generate stub for array fill. If "aligned" is true, the + // "to" address is assumed to be heapword aligned. + // + // Arguments for generated stub: + // to: c_rarg0 + // value: c_rarg1 + // count: c_rarg2 treated as signed + // + address generate_fill(BasicType t, bool aligned, const char *name) { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", name); + address start = __ pc(); + + BLOCK_COMMENT("Entry:"); + + const Register to = c_rarg0; // source array address + const Register value = c_rarg1; // value + const Register count = c_rarg2; // elements count + + const Register bz_base = r10; // base for block_zero routine + const Register cnt_words = r11; // temp register + + __ enter(); + + Label L_fill_elements, L_exit1; + + int shift = -1; + switch (t) { + case T_BYTE: + shift = 0; + __ cmpw(count, 8 >> shift); // Short arrays (< 8 bytes) fill by element + __ bfi(value, value, 8, 8); // 8 bit -> 16 bit + __ bfi(value, value, 16, 16); // 16 bit -> 32 bit + __ br(Assembler::LO, L_fill_elements); + break; + case T_SHORT: + shift = 1; + __ cmpw(count, 8 >> shift); // Short arrays (< 8 bytes) fill by element + __ bfi(value, value, 16, 16); // 16 bit -> 32 bit + __ br(Assembler::LO, L_fill_elements); + break; + case T_INT: + shift = 2; + __ cmpw(count, 8 >> shift); // Short arrays (< 8 bytes) fill by element + __ br(Assembler::LO, L_fill_elements); + break; + default: ShouldNotReachHere(); + } + + // Align source address at 8 bytes address boundary. + Label L_skip_align1, L_skip_align2, L_skip_align4; + if (!aligned) { + switch (t) { + case T_BYTE: + // One byte misalignment happens only for byte arrays. + __ tbz(to, 0, L_skip_align1); + __ strb(value, Address(__ post(to, 1))); + __ subw(count, count, 1); + __ bind(L_skip_align1); + // Fallthrough + case T_SHORT: + // Two bytes misalignment happens only for byte and short (char) arrays. + __ tbz(to, 1, L_skip_align2); + __ strh(value, Address(__ post(to, 2))); + __ subw(count, count, 2 >> shift); + __ bind(L_skip_align2); + // Fallthrough + case T_INT: + // Align to 8 bytes, we know we are 4 byte aligned to start. + __ tbz(to, 2, L_skip_align4); + __ strw(value, Address(__ post(to, 4))); + __ subw(count, count, 4 >> shift); + __ bind(L_skip_align4); + break; + default: ShouldNotReachHere(); + } + } + + // + // Fill large chunks + // + __ lsrw(cnt_words, count, 3 - shift); // number of words + __ bfi(value, value, 32, 32); // 32 bit -> 64 bit + __ subw(count, count, cnt_words, Assembler::LSL, 3 - shift); + if (UseBlockZeroing) { + Label non_block_zeroing, rest; + // count >= BlockZeroingLowLimit && value == 0 + __ cmp(cnt_words, BlockZeroingLowLimit >> 3); + __ ccmp(value, 0 /* comparing value */, 0 /* NZCV */, Assembler::GE); + __ br(Assembler::NE, non_block_zeroing); + __ mov(bz_base, to); + __ block_zero(bz_base, cnt_words, true); + __ mov(to, bz_base); + __ b(rest); + __ bind(non_block_zeroing); + __ fill_words(to, cnt_words, value); + __ bind(rest); + } + else { + __ fill_words(to, cnt_words, value); + } + + // Remaining count is less than 8 bytes. Fill it by a single store. + // Note that the total length is no less than 8 bytes. + if (t == T_BYTE || t == T_SHORT) { + Label L_exit1; + __ cbzw(count, L_exit1); + __ add(to, to, count, Assembler::LSL, shift); // points to the end + __ str(value, Address(to, -8)); // overwrite some elements + __ bind(L_exit1); + __ leave(); + __ ret(lr); + } + + // Handle copies less than 8 bytes. + Label L_fill_2, L_fill_4, L_exit2; + __ bind(L_fill_elements); + switch (t) { + case T_BYTE: + __ tbz(count, 0, L_fill_2); + __ strb(value, Address(__ post(to, 1))); + __ bind(L_fill_2); + __ tbz(count, 1, L_fill_4); + __ strh(value, Address(__ post(to, 2))); + __ bind(L_fill_4); + __ tbz(count, 2, L_exit2); + __ strw(value, Address(to)); + break; + case T_SHORT: + __ tbz(count, 0, L_fill_4); + __ strh(value, Address(__ post(to, 2))); + __ bind(L_fill_4); + __ tbz(count, 1, L_exit2); + __ strw(value, Address(to)); + break; + case T_INT: + __ cbzw(count, L_exit2); + __ strw(value, Address(to)); + break; + default: ShouldNotReachHere(); + } + __ bind(L_exit2); + __ leave(); + __ ret(lr); + return start; + } + void generate_arraycopy_stubs() { address entry; address entry_jbyte_arraycopy; @@ -2033,6 +2223,8 @@ class StubGenerator: public StubCodeGenerator { generate_copy_longs(copy_f, r0, r1, rscratch2, copy_forwards); generate_copy_longs(copy_b, r0, r1, rscratch2, copy_backwards); + StubRoutines::aarch64::_zero_longs = generate_zero_longs(r10, r11); + //*** jbyte // Always need aligned and unaligned versions StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, &entry, @@ -2124,6 +2316,12 @@ class StubGenerator: public StubCodeGenerator { entry_jlong_arraycopy, entry_checkcast_arraycopy); + StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill"); + StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill"); + StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill"); + StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill"); + StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill"); + StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill"); } void generate_math_stubs() { Unimplemented(); } diff --git a/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.cpp index e7d7f5bce78..f5727ee03c6 100644 --- a/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.cpp @@ -43,6 +43,7 @@ address StubRoutines::aarch64::_float_sign_mask = NULL; address StubRoutines::aarch64::_float_sign_flip = NULL; address StubRoutines::aarch64::_double_sign_mask = NULL; address StubRoutines::aarch64::_double_sign_flip = NULL; +address StubRoutines::aarch64::_zero_longs = NULL; /** * crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.5/crc32.h diff --git a/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.hpp index 8764ebf7286..1355a6836df 100644 --- a/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/stubRoutines_aarch64.hpp @@ -61,6 +61,8 @@ class aarch64 { static address _double_sign_mask; static address _double_sign_flip; + static address _zero_longs; + public: static address get_previous_fp_entry() @@ -113,6 +115,11 @@ class aarch64 { return _double_sign_flip; } + static address get_zero_longs() + { + return _zero_longs; + } + private: static juint _crc_table[]; diff --git a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp index 7fe8f147c27..e78276ed8a7 100644 --- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp @@ -759,18 +759,13 @@ void TemplateInterpreterGenerator::lock_method() { // get synchronization object { - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); Label done; __ ldrw(r0, access_flags); __ tst(r0, JVM_ACC_STATIC); // get receiver (assume this is frequent case) __ ldr(r0, Address(rlocals, Interpreter::local_offset_in_bytes(0))); __ br(Assembler::EQ, done); - __ ldr(r0, Address(rmethod, Method::const_offset())); - __ ldr(r0, Address(r0, ConstMethod::constants_offset())); - __ ldr(r0, Address(r0, - ConstantPool::pool_holder_offset_in_bytes())); - __ ldr(r0, Address(r0, mirror_offset)); + __ load_mirror(r0, rmethod); #ifdef ASSERT { @@ -807,16 +802,16 @@ void TemplateInterpreterGenerator::lock_method() { void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { // initialize fixed part of activation frame if (native_call) { - __ sub(esp, sp, 12 * wordSize); + __ sub(esp, sp, 14 * wordSize); __ mov(rbcp, zr); - __ stp(esp, zr, Address(__ pre(sp, -12 * wordSize))); + __ stp(esp, zr, Address(__ pre(sp, -14 * wordSize))); // add 2 zero-initialized slots for native calls - __ stp(zr, zr, Address(sp, 10 * wordSize)); + __ stp(zr, zr, Address(sp, 12 * wordSize)); } else { - __ sub(esp, sp, 10 * wordSize); + __ sub(esp, sp, 12 * wordSize); __ ldr(rscratch1, Address(rmethod, Method::const_offset())); // get ConstMethod __ add(rbcp, rscratch1, in_bytes(ConstMethod::codes_offset())); // get codebase - __ stp(esp, rbcp, Address(__ pre(sp, -10 * wordSize))); + __ stp(esp, rbcp, Address(__ pre(sp, -12 * wordSize))); } if (ProfileInterpreter) { @@ -825,22 +820,26 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { __ cbz(rscratch1, method_data_continue); __ lea(rscratch1, Address(rscratch1, in_bytes(MethodData::data_offset()))); __ bind(method_data_continue); - __ stp(rscratch1, rmethod, Address(sp, 4 * wordSize)); // save Method* and mdp (method data pointer) + __ stp(rscratch1, rmethod, Address(sp, 6 * wordSize)); // save Method* and mdp (method data pointer) } else { - __ stp(zr, rmethod, Address(sp, 4 * wordSize)); // save Method* (no mdp) + __ stp(zr, rmethod, Address(sp, 6 * wordSize)); // save Method* (no mdp) } + // Get mirror and store it in the frame as GC root for this Method* + __ load_mirror(rscratch1, rmethod); + __ stp(rscratch1, zr, Address(sp, 4 * wordSize)); + __ ldr(rcpool, Address(rmethod, Method::const_offset())); __ ldr(rcpool, Address(rcpool, ConstMethod::constants_offset())); __ ldr(rcpool, Address(rcpool, ConstantPool::cache_offset_in_bytes())); __ stp(rlocals, rcpool, Address(sp, 2 * wordSize)); - __ stp(rfp, lr, Address(sp, 8 * wordSize)); - __ lea(rfp, Address(sp, 8 * wordSize)); + __ stp(rfp, lr, Address(sp, 10 * wordSize)); + __ lea(rfp, Address(sp, 10 * wordSize)); // set sender sp // leave last_sp as null - __ stp(zr, r13, Address(sp, 6 * wordSize)); + __ stp(zr, r13, Address(sp, 8 * wordSize)); // Move SP out of the way if (! native_call) { @@ -1242,15 +1241,11 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // pass mirror handle if static call { Label L; - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); __ ldrw(t, Address(rmethod, Method::access_flags_offset())); __ tst(t, JVM_ACC_STATIC); __ br(Assembler::EQ, L); // get mirror - __ ldr(t, Address(rmethod, Method::const_offset())); - __ ldr(t, Address(t, ConstMethod::constants_offset())); - __ ldr(t, Address(t, ConstantPool::pool_holder_offset_in_bytes())); - __ ldr(t, Address(t, mirror_offset)); + __ load_mirror(t, rmethod); // copy mirror into activation frame __ str(t, Address(rfp, frame::interpreter_frame_oop_temp_offset * wordSize)); // pass handle to mirror diff --git a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp index 6c8c5ac8bac..5c1a98463bf 100644 --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp @@ -229,6 +229,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code bc, Register bc_reg, switch (bc) { case Bytecodes::_fast_aputfield: case Bytecodes::_fast_bputfield: + case Bytecodes::_fast_zputfield: case Bytecodes::_fast_cputfield: case Bytecodes::_fast_dputfield: case Bytecodes::_fast_fputfield: @@ -1082,6 +1083,17 @@ void TemplateTable::bastore() // r1: index // r3: array index_check(r3, r1); // prefer index in r1 + + // Need to check whether array is boolean or byte + // since both types share the bastore bytecode. + __ load_klass(r2, r3); + __ ldrw(r2, Address(r2, Klass::layout_helper_offset())); + int diffbit_index = exact_log2(Klass::layout_helper_boolean_diffbit()); + Label L_skip; + __ tbz(r2, diffbit_index, L_skip); + __ andw(r0, r0, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1 + __ bind(L_skip); + __ lea(rscratch1, Address(r3, r1, Address::uxtw(0))); __ strb(r0, Address(rscratch1, arrayOopDesc::base_offset_in_bytes(T_BYTE))); @@ -2193,6 +2205,13 @@ void TemplateTable::_return(TosState state) if (_desc->bytecode() == Bytecodes::_return) __ membar(MacroAssembler::StoreStore); + // Narrow result if state is itos but result type is smaller. + // Need to narrow in the return bytecode rather than in generate_return_entry + // since compiled code callers expect the result to already be narrowed. + if (state == itos) { + __ narrow(r0); + } + __ remove_activation(state); __ ret(lr); } @@ -2386,7 +2405,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr const Address field(obj, off); - Label Done, notByte, notInt, notShort, notChar, + Label Done, notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble; // x86 uses a shift and mask or wings it with a shift plus assert @@ -2409,6 +2428,20 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ b(Done); __ bind(notByte); + __ cmp(flags, ztos); + __ br(Assembler::NE, notBool); + + // ztos (same code as btos) + __ ldrsb(r0, field); + __ push(ztos); + // Rewrite bytecode to be faster + if (!is_static) { + // use btos rewriting, no truncating to t/f bit is needed for getfield. + patch_bytecode(Bytecodes::_fast_bgetfield, bc, r1); + } + __ b(Done); + + __ bind(notBool); __ cmp(flags, atos); __ br(Assembler::NE, notObj); // atos @@ -2604,7 +2637,7 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr // field address const Address field(obj, off); - Label notByte, notInt, notShort, notChar, + Label notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble; // x86 uses a shift and mask or wings it with a shift plus assert @@ -2629,6 +2662,22 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr } __ bind(notByte); + __ cmp(flags, ztos); + __ br(Assembler::NE, notBool); + + // ztos + { + __ pop(ztos); + if (!is_static) pop_and_check_object(obj); + __ andw(r0, r0, 0x1); + __ strb(r0, field); + if (!is_static) { + patch_bytecode(Bytecodes::_fast_zputfield, bc, r1, true, byte_no); + } + __ b(Done); + } + + __ bind(notBool); __ cmp(flags, atos); __ br(Assembler::NE, notObj); @@ -2783,6 +2832,7 @@ void TemplateTable::jvmti_post_fast_field_mod() switch (bytecode()) { // load values into the jvalue object case Bytecodes::_fast_aputfield: __ push_ptr(r0); break; case Bytecodes::_fast_bputfield: // fall through + case Bytecodes::_fast_zputfield: // fall through case Bytecodes::_fast_sputfield: // fall through case Bytecodes::_fast_cputfield: // fall through case Bytecodes::_fast_iputfield: __ push_i(r0); break; @@ -2808,6 +2858,7 @@ void TemplateTable::jvmti_post_fast_field_mod() switch (bytecode()) { // restore tos values case Bytecodes::_fast_aputfield: __ pop_ptr(r0); break; case Bytecodes::_fast_bputfield: // fall through + case Bytecodes::_fast_zputfield: // fall through case Bytecodes::_fast_sputfield: // fall through case Bytecodes::_fast_cputfield: // fall through case Bytecodes::_fast_iputfield: __ pop_i(r0); break; @@ -2863,6 +2914,9 @@ void TemplateTable::fast_storefield(TosState state) case Bytecodes::_fast_iputfield: __ strw(r0, field); break; + case Bytecodes::_fast_zputfield: + __ andw(r0, r0, 0x1); // boolean is true if LSB is 1 + // fall through to bputfield case Bytecodes::_fast_bputfield: __ strb(r0, field); break; @@ -2982,7 +3036,7 @@ void TemplateTable::fast_xaccess(TosState state) __ null_check(r0); switch (state) { case itos: - __ ldr(r0, Address(r0, r1, Address::lsl(0))); + __ ldrw(r0, Address(r0, r1, Address::lsl(0))); break; case atos: __ load_heap_oop(r0, Address(r0, r1, Address::lsl(0))); @@ -3000,7 +3054,7 @@ void TemplateTable::fast_xaccess(TosState state) __ ldrw(r3, Address(r2, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()))); __ tbz(r3, ConstantPoolCacheEntry::is_volatile_shift, notVolatile); - __ membar(MacroAssembler::LoadLoad); + __ membar(MacroAssembler::LoadLoad | MacroAssembler::LoadStore); __ bind(notVolatile); } diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp index 40275cabfa0..bf96f24d621 100644 --- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp +++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp @@ -71,6 +71,7 @@ int VM_Version::_model2; int VM_Version::_variant; int VM_Version::_revision; int VM_Version::_stepping; +VM_Version::PsrInfo VM_Version::_psr_info = { 0, }; static BufferBlob* stub_blob; static const int stub_size = 550; @@ -95,13 +96,16 @@ class VM_Version_StubGenerator: public StubCodeGenerator { __ c_stub_prolog(1, 0, MacroAssembler::ret_type_void); #endif - // void getPsrInfo(VM_Version::CpuidInfo* cpuid_info); + // void getPsrInfo(VM_Version::PsrInfo* psr_info); address entry = __ pc(); - // TODO : redefine fields in CpuidInfo and generate - // code to fill them in + __ enter(); + __ get_dczid_el0(rscratch1); + __ strw(rscratch1, Address(c_rarg0, in_bytes(VM_Version::dczid_el0_offset()))); + + __ leave(); __ ret(lr); # undef __ @@ -118,6 +122,8 @@ void VM_Version::get_processor_features() { _supports_atomic_getset8 = true; _supports_atomic_getadd8 = true; + getPsrInfo_stub(&_psr_info); + if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256); if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) @@ -285,6 +291,18 @@ void VM_Version::get_processor_features() { FLAG_SET_DEFAULT(UseGHASHIntrinsics, false); } + if (is_zva_enabled()) { + if (FLAG_IS_DEFAULT(UseBlockZeroing)) { + FLAG_SET_DEFAULT(UseBlockZeroing, true); + } + if (FLAG_IS_DEFAULT(BlockZeroingLowLimit)) { + FLAG_SET_DEFAULT(BlockZeroingLowLimit, 4 * VM_Version::zva_length()); + } + } else if (UseBlockZeroing) { + warning("DC ZVA is not available on this CPU"); + FLAG_SET_DEFAULT(UseBlockZeroing, false); + } + // This machine allows unaligned memory accesses if (FLAG_IS_DEFAULT(UseUnalignedAccesses)) { FLAG_SET_DEFAULT(UseUnalignedAccesses, true); diff --git a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp index 2ed5e7ef9bd..25f5b929b3b 100644 --- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp +++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.hpp @@ -40,6 +40,10 @@ protected: static int _revision; static int _stepping; + struct PsrInfo { + uint32_t dczid_el0; + }; + static PsrInfo _psr_info; static void get_processor_features(); public: @@ -83,6 +87,17 @@ public: static int cpu_model2() { return _model2; } static int cpu_variant() { return _variant; } static int cpu_revision() { return _revision; } + static ByteSize dczid_el0_offset() { return byte_offset_of(PsrInfo, dczid_el0); } + static bool is_zva_enabled() { + // Check the DZP bit (bit 4) of dczid_el0 is zero + // and block size (bit 0~3) is not zero. + return ((_psr_info.dczid_el0 & 0x10) == 0 && + (_psr_info.dczid_el0 & 0xf) != 0); + } + static int zva_length() { + assert(is_zva_enabled(), "ZVA not available"); + return 4 << (_psr_info.dczid_el0 & 0xf); + } }; #endif // CPU_AARCH64_VM_VM_VERSION_AARCH64_HPP diff --git a/hotspot/src/cpu/ppc/vm/abstractInterpreter_ppc.cpp b/hotspot/src/cpu/ppc/vm/abstractInterpreter_ppc.cpp index eaff19ddf71..933a2f44db3 100644 --- a/hotspot/src/cpu/ppc/vm/abstractInterpreter_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/abstractInterpreter_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -152,6 +152,7 @@ void AbstractInterpreter::layout_activation(Method* method, intptr_t* top_frame_sp = is_top_frame ? sp : sp + (frame::abi_minframe_size - frame::abi_reg_args_size) / Interpreter::stackElementSize; interpreter_frame->interpreter_frame_set_method(method); + interpreter_frame->interpreter_frame_set_mirror(method->method_holder()->java_mirror()); interpreter_frame->interpreter_frame_set_locals(locals_base); interpreter_frame->interpreter_frame_set_cpcache(method->constants()->cache()); interpreter_frame->interpreter_frame_set_esp(esp); diff --git a/hotspot/src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp b/hotspot/src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp index b7bc0cbf50d..ed381b9d631 100644 --- a/hotspot/src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/c1_LIRAssembler_ppc.cpp @@ -2845,6 +2845,9 @@ void LIR_Assembler::membar_storeload() { __ membar(Assembler::StoreLoad); } +void LIR_Assembler::on_spin_wait() { + Unimplemented(); +} void LIR_Assembler::leal(LIR_Opr addr_opr, LIR_Opr dest) { LIR_Address* addr = addr_opr->as_address_ptr(); diff --git a/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp index 0d1cb4711bd..c3225419cc8 100644 --- a/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/c1_LIRGenerator_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1056,7 +1056,7 @@ void LIRGenerator::do_NewObjectArray(NewObjectArray* x) { void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); @@ -1428,3 +1428,11 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) { } } } + +void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { + fatal("vectorizedMismatch intrinsic is not implemented on this platform"); +} + +void LIRGenerator::do_update_CRC32C(Intrinsic* x) { + Unimplemented(); +} diff --git a/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp b/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp index 68dabc4b031..e50399de682 100644 --- a/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/compiledIC_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,22 +35,6 @@ #include "opto/matcher.hpp" #endif -// Release the CompiledICHolder* associated with this call site is there is one. -void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - if (is_icholder_entry(call->destination())) { - NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); - InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); - } -} - -bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - return is_icholder_entry(call->destination()); -} - // ---------------------------------------------------------------------------- // A PPC CompiledStaticCall looks like this: diff --git a/hotspot/src/cpu/ppc/vm/frame_ppc.hpp b/hotspot/src/cpu/ppc/vm/frame_ppc.hpp index 6f8f0296f83..ae6847ecab2 100644 --- a/hotspot/src/cpu/ppc/vm/frame_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/frame_ppc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -261,6 +261,7 @@ uint64_t ijava_reserved2; // Inserted for alignment. #endif uint64_t method; + uint64_t mirror; uint64_t locals; uint64_t monitors; uint64_t cpoolCache; diff --git a/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp b/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp index 7fce0585f10..d22f5b564e8 100644 --- a/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp +++ b/hotspot/src/cpu/ppc/vm/frame_ppc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -40,7 +40,7 @@ inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) { _fp = (intptr_t*)own_abi()->callers_sp; - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; _deopt_state = is_deoptimized; @@ -148,6 +148,11 @@ inline BasicObjectLock* frame::interpreter_frame_monitor_begin() const { inline Method** frame::interpreter_frame_method_addr() const { return (Method**) &(get_ijava_state()->method); } + +inline oop* frame::interpreter_frame_mirror_addr() const { + return (oop*) &(get_ijava_state()->mirror); +} + inline ConstantPoolCache** frame::interpreter_frame_cpoolcache_addr() const { return (ConstantPoolCache**) &(get_ijava_state()->cpoolCache); } diff --git a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp index 77f7a491b02..b69e4058507 100644 --- a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp @@ -79,7 +79,14 @@ define_pd_global(bool, CompactStrings, true); define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); // Platform dependent flag handling: flags only defined on this platform. -#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint) \ +#define ARCH_FLAGS(develop, \ + product, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ /* Load poll address from thread. This is used to implement per-thread */ \ /* safepoints on platforms != IA64. */ \ diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp index ce9d109dfdd..a18254f2f5b 100644 --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp @@ -3118,6 +3118,14 @@ void MacroAssembler::load_klass(Register dst, Register src) { } } +void MacroAssembler::load_mirror(Register mirror, Register method) { + const int mirror_offset = in_bytes(Klass::java_mirror_offset()); + ld(mirror, in_bytes(Method::const_offset()), method); + ld(mirror, in_bytes(ConstMethod::constants_offset()), mirror); + ld(mirror, ConstantPool::pool_holder_offset_in_bytes(), mirror); + ld(mirror, mirror_offset, mirror); +} + // Clear Array // Kills both input registers. tmp == R0 is allowed. void MacroAssembler::clear_memory_doubleword(Register base_ptr, Register cnt_dwords, Register tmp) { diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp index 53a269a83c2..180a1ddbae9 100644 --- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp +++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp @@ -647,6 +647,9 @@ class MacroAssembler: public Assembler { void load_klass(Register dst, Register src); void store_klass(Register dst_oop, Register klass, Register tmp = R0); void store_klass_gap(Register dst_oop, Register val = noreg); // Will store 0 if val not specified. + + void load_mirror(Register mirror, Register method); + static int instr_size_for_decode_klass_not_null(); void decode_klass_not_null(Register dst, Register src = noreg); Register encode_klass_not_null(Register dst, Register src = noreg); diff --git a/hotspot/src/cpu/ppc/vm/nativeInst_ppc.cpp b/hotspot/src/cpu/ppc/vm/nativeInst_ppc.cpp index 08704344050..70cd4ebbd91 100644 --- a/hotspot/src/cpu/ppc/vm/nativeInst_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/nativeInst_ppc.cpp @@ -137,7 +137,7 @@ address NativeCall::get_trampoline() { return NULL; address bl_destination = Assembler::bxx_destination(call_addr); - if (code->content_contains(bl_destination) && + if (code->contains(bl_destination) && is_NativeCallTrampolineStub_at(bl_destination)) return bl_destination; diff --git a/hotspot/src/cpu/ppc/vm/ppc.ad b/hotspot/src/cpu/ppc/vm/ppc.ad index 20521eb8e18..0dc5a4d2b45 100644 --- a/hotspot/src/cpu/ppc/vm/ppc.ad +++ b/hotspot/src/cpu/ppc/vm/ppc.ad @@ -817,6 +817,16 @@ source_hpp %{ source %{ +// Should the Matcher clone shifts on addressing modes, expecting them +// to be subsumed into complex addressing expressions or compute them +// into registers? +bool Matcher::clone_address_expressions(AddPNode* m, Matcher::MStack& mstack, VectorSet& address_visited) { + return clone_base_plus_offset_address(m, mstack, address_visited); +} + +void Compile::reshape_address(AddPNode* addp) { +} + // Optimize load-acquire. // // Check if acquire is unnecessary due to following operation that does @@ -1380,6 +1390,8 @@ void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { // Save return pc. ___(std) std(return_pc, _abi(lr), callers_sp); } + + C->set_frame_complete(cbuf.insts_size()); } #undef ___ #undef ___stop @@ -2047,6 +2059,10 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen) { return ret_value; // Per default match rules are supported. } +const bool Matcher::has_predicated_vectors(void) { + return false; +} + const int Matcher::float_pressure(int default_pressure_threshold) { return default_pressure_threshold; } @@ -2151,11 +2167,6 @@ const int Matcher::float_cmove_cost() { return ConditionalMoveLimit; } // Power6 requires postalloc expand (see block.cpp for description of postalloc expand). const bool Matcher::require_postalloc_expand = true; -// Should the Matcher clone shifts on addressing modes, expecting them to -// be subsumed into complex addressing expressions or compute them into -// registers? True for Intel but false for most RISCs. -const bool Matcher::clone_shift_expressions = false; - // Do we need to mask the count passed to shift instructions or does // the cpu only look at the lower 5/6 bits anyway? // PowerPC requires masked shift counts. @@ -2307,6 +2318,8 @@ const RegMask Matcher::method_handle_invoke_SP_save_mask() { return RegMask(); } +const bool Matcher::convi2l_type_required = true; + %} //----------ENCODING BLOCK----------------------------------------------------- diff --git a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp index ee8685f4f0a..38c83d39e65 100644 --- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp @@ -33,7 +33,6 @@ #include "interpreter/interp_masm.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_ppc.inline.hpp" diff --git a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp index 2eba3edacef..58222baa2fa 100644 --- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp @@ -825,17 +825,6 @@ class StubGenerator: public StubCodeGenerator { return start; } - // The following routine generates a subroutine to throw an asynchronous - // UnknownError when an unsafe access gets a fault that could not be - // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.) - // - address generate_handler_for_unsafe_access() { - StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access"); - address start = __ function_entry(); - __ unimplemented("StubRoutines::handler_for_unsafe_access", 93); - return start; - } - #if !defined(PRODUCT) // Wrapper which calls oopDesc::is_oop_or_null() // Only called by MacroAssembler::verify_oop @@ -3111,8 +3100,6 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError), false); StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false); - StubRoutines::_handler_for_unsafe_access_entry = generate_handler_for_unsafe_access(); - // support for verify_oop (must happen after universe_init) StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); diff --git a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp index 3602c646192..386990690a7 100644 --- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp +++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp @@ -871,7 +871,6 @@ void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratc // Get synchronization object to Rscratch2. { - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); Label Lstatic; Label Ldone; @@ -883,10 +882,7 @@ void TemplateInterpreterGenerator::lock_method(Register Rflags, Register Rscratc __ b(Ldone); __ bind(Lstatic); // Static case: Lock the java mirror - __ ld(Robj_to_lock, in_bytes(Method::const_offset()), R19_method); - __ ld(Robj_to_lock, in_bytes(ConstMethod::constants_offset()), Robj_to_lock); - __ ld(Robj_to_lock, ConstantPool::pool_holder_offset_in_bytes(), Robj_to_lock); - __ ld(Robj_to_lock, mirror_offset, Robj_to_lock); + __ load_mirror(Robj_to_lock, R19_method); __ bind(Ldone); __ verify_oop(Robj_to_lock); @@ -1051,10 +1047,14 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call, Regist __ addi(R26_monitor, R1_SP, - frame::ijava_state_size); __ addi(R15_esp, R26_monitor, - Interpreter::stackElementSize); + // Get mirror and store it in the frame as GC root for this Method* + __ load_mirror(R12_scratch2, R19_method); + // Store values. // R15_esp, R14_bcp, R26_monitor, R28_mdx are saved at java calls // in InterpreterMacroAssembler::call_from_interpreter. __ std(R19_method, _ijava_state_neg(method), R1_SP); + __ std(R12_scratch2, _ijava_state_neg(mirror), R1_SP); __ std(R21_sender_SP, _ijava_state_neg(sender_sp), R1_SP); __ std(R27_constPoolCache, _ijava_state_neg(cpoolCache), R1_SP); __ std(R18_locals, _ijava_state_neg(locals), R1_SP); @@ -1319,21 +1319,11 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { __ testbitdi(CCR0, R0, access_flags, JVM_ACC_STATIC_BIT); __ bfalse(CCR0, method_is_not_static); - // constants = method->constants(); - __ ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method); - __ ld(R11_scratch1, in_bytes(ConstMethod::constants_offset()), R11_scratch1); - // pool_holder = method->constants()->pool_holder(); - __ ld(R11_scratch1/*pool_holder*/, ConstantPool::pool_holder_offset_in_bytes(), - R11_scratch1/*constants*/); - - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); - - // mirror = pool_holder->klass_part()->java_mirror(); - __ ld(R0/*mirror*/, mirror_offset, R11_scratch1/*pool_holder*/); + __ load_mirror(R12_scratch2, R19_method); // state->_native_mirror = mirror; __ ld(R11_scratch1, 0, R1_SP); - __ std(R0/*mirror*/, _ijava_state_neg(oop_tmp), R11_scratch1); + __ std(R12_scratch2/*mirror*/, _ijava_state_neg(oop_tmp), R11_scratch1); // R4_ARG2 = &state->_oop_temp; __ addi(R4_ARG2, R11_scratch1, _ijava_state_neg(oop_tmp)); BIND(method_is_not_static); diff --git a/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp b/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp index d85bd78bbbd..f9ba7983fd2 100644 --- a/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -281,11 +281,12 @@ void AbstractInterpreter::layout_activation(Method* method, // Llast_SP will be same as SP as there is no adapter space *interpreter_frame->register_addr(Llast_SP) = (intptr_t) interpreter_frame->sp() - STACK_BIAS; *interpreter_frame->register_addr(LcpoolCache) = (intptr_t) method->constants()->cache(); + // save the mirror in the interpreter frame + *interpreter_frame->interpreter_frame_mirror_addr() = method->method_holder()->java_mirror(); #ifdef FAST_DISPATCH *interpreter_frame->register_addr(IdispatchTables) = (intptr_t) Interpreter::dispatch_table(); #endif - #ifdef ASSERT BasicObjectLock* mp = (BasicObjectLock*)monitors; diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp index 128f6c31171..8a9ef34eb46 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp @@ -3313,6 +3313,9 @@ void LIR_Assembler::membar_storeload() { __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad)); } +void LIR_Assembler::on_spin_wait() { + Unimplemented(); +} // Pack two sequential registers containing 32 bit values // into a single 64 bit register. diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp index de568fd7693..f4d84c8dd5d 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -869,6 +869,94 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) { } } +void LIRGenerator::do_update_CRC32C(Intrinsic* x) { + // Make all state_for calls early since they can emit code + LIR_Opr result = rlock_result(x); + int flags = 0; + switch (x->id()) { + case vmIntrinsics::_updateBytesCRC32C: + case vmIntrinsics::_updateDirectByteBufferCRC32C: { + + bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C); + int array_offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0; + + LIRItem crc(x->argument_at(0), this); + LIRItem buf(x->argument_at(1), this); + LIRItem off(x->argument_at(2), this); + LIRItem end(x->argument_at(3), this); + + buf.load_item(); + off.load_nonconstant(); + end.load_nonconstant(); + + // len = end - off + LIR_Opr len = end.result(); + LIR_Opr tmpA = new_register(T_INT); + LIR_Opr tmpB = new_register(T_INT); + __ move(end.result(), tmpA); + __ move(off.result(), tmpB); + __ sub(tmpA, tmpB, tmpA); + len = tmpA; + + LIR_Opr index = off.result(); + + if(off.result()->is_constant()) { + index = LIR_OprFact::illegalOpr; + array_offset += off.result()->as_jint(); + } + + LIR_Opr base_op = buf.result(); + + if (index->is_valid()) { + LIR_Opr tmp = new_register(T_LONG); + __ convert(Bytecodes::_i2l, index, tmp); + index = tmp; + if (index->is_constant()) { + array_offset += index->as_constant_ptr()->as_jint(); + index = LIR_OprFact::illegalOpr; + } else if (index->is_register()) { + LIR_Opr tmp2 = new_register(T_LONG); + LIR_Opr tmp3 = new_register(T_LONG); + __ move(base_op, tmp2); + __ move(index, tmp3); + __ add(tmp2, tmp3, tmp2); + base_op = tmp2; + } else { + ShouldNotReachHere(); + } + } + + LIR_Address* a = new LIR_Address(base_op, array_offset, T_BYTE); + + BasicTypeList signature(3); + signature.append(T_INT); + signature.append(T_ADDRESS); + signature.append(T_INT); + CallingConvention* cc = frame_map()->c_calling_convention(&signature); + const LIR_Opr result_reg = result_register_for(x->type()); + + LIR_Opr addr = new_pointer_register(); + __ leal(LIR_OprFact::address(a), addr); + + crc.load_item_force(cc->at(0)); + __ move(addr, cc->at(1)); + __ move(len, cc->at(2)); + + __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), getThreadTemp(), result_reg, cc->args()); + __ move(result_reg, result); + + break; + } + default: { + ShouldNotReachHere(); + } + } +} + +void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { + fatal("vectorizedMismatch intrinsic is not implemented on this platform"); +} + // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f // _i2b, _i2c, _i2s void LIRGenerator::do_Convert(Convert* x) { @@ -1034,7 +1122,7 @@ void LIRGenerator::do_NewObjectArray(NewObjectArray* x) { void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); diff --git a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp index d56af1661b1..c544e7ae994 100644 --- a/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/compiledIC_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -34,22 +34,6 @@ #include "opto/matcher.hpp" #endif -// Release the CompiledICHolder* associated with this call site is there is one. -void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - if (is_icholder_entry(call->destination())) { - NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); - InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); - } -} - -bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - return is_icholder_entry(call->destination()); -} - // ---------------------------------------------------------------------------- #define __ _masm. diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp index a9ac2a97a76..ab6aeeeeabf 100644 --- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -212,7 +212,7 @@ bool frame::safe_for_sender(JavaThread *thread) { // ok. adapter blobs never have a frame complete and are never ok. if (!_cb->is_frame_complete_at(_pc)) { - if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) { + if (_cb->is_compiled() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) { return false; } } @@ -304,7 +304,7 @@ bool frame::safe_for_sender(JavaThread *thread) { // because you must allocate window space if (sender_blob->frame_size() <= 0) { - assert(!sender_blob->is_nmethod(), "should count return address at least"); + assert(!sender_blob->is_compiled(), "should count return address at least"); return false; } @@ -315,7 +315,7 @@ bool frame::safe_for_sender(JavaThread *thread) { // the stack unwalkable. pd_get_top_frame_for_signal_handler tries to recover from this by unwinding // that initial frame and retrying. - if (!sender_blob->is_nmethod()) { + if (!sender_blob->is_compiled()) { return false; } @@ -358,9 +358,9 @@ void frame::init(intptr_t* sp, address pc, CodeBlob* cb) { } _deopt_state = unknown; #ifdef ASSERT - if ( _cb != NULL && _cb->is_nmethod()) { + if ( _cb != NULL && _cb->is_compiled()) { // Without a valid unextended_sp() we can't convert the pc to "original" - assert(!((nmethod*)_cb)->is_deopt_pc(_pc), "invariant broken"); + assert(!((CompiledMethod*)_cb)->is_deopt_pc(_pc), "invariant broken"); } #endif // ASSERT } @@ -393,7 +393,7 @@ frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpret // Check for MethodHandle call sites. if (_cb != NULL) { - nmethod* nm = _cb->as_nmethod_or_null(); + CompiledMethod* nm = _cb->as_compiled_method_or_null(); if (nm != NULL) { if (nm->is_deopt_mh_entry(_pc) || nm->is_method_handle_return(_pc)) { _sp_adjustment_by_callee = (intptr_t*) ((intptr_t) sp[L7_mh_SP_save->sp_offset_in_saved_window()] + STACK_BIAS) - sp; @@ -413,7 +413,7 @@ frame::frame(intptr_t* sp, intptr_t* younger_sp, bool younger_frame_is_interpret // this lookup as get_deopt_original_pc() needs a correct value for // unextended_sp() which uses _sp_adjustment_by_callee. if (_pc != NULL) { - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; _deopt_state = is_deoptimized; @@ -547,7 +547,7 @@ void frame::patch_pc(Thread* thread, address pc) { _cb = CodeCache::find_blob(pc); *O7_addr() = pc - pc_return_offset; _cb = CodeCache::find_blob(_pc); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { assert(original_pc == _pc, "expected original to be stored before patching"); _deopt_state = is_deoptimized; @@ -783,7 +783,7 @@ void frame::describe_pd(FrameValues& values, int frame_no) { if (is_interpreted_frame()) { DESCRIBE_FP_OFFSET(interpreter_frame_d_scratch_fp); DESCRIBE_FP_OFFSET(interpreter_frame_l_scratch_fp); - DESCRIBE_FP_OFFSET(interpreter_frame_padding); + DESCRIBE_FP_OFFSET(interpreter_frame_mirror); DESCRIBE_FP_OFFSET(interpreter_frame_oop_temp); // esp, according to Lesp (e.g. not depending on bci), if seems valid diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.hpp b/hotspot/src/cpu/sparc/vm/frame_sparc.hpp index cd91f52fd17..48cf45bd714 100644 --- a/hotspot/src/cpu/sparc/vm/frame_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -209,7 +209,8 @@ // 2 words, also used to save float regs across calls to C interpreter_frame_d_scratch_fp_offset = -2, interpreter_frame_l_scratch_fp_offset = -4, - interpreter_frame_padding_offset = -5, // for native calls only + interpreter_frame_mirror_offset = -5, // keep interpreted method alive + interpreter_frame_oop_temp_offset = -6, // for native calls only interpreter_frame_vm_locals_fp_offset = -6, // should be same as above, and should be zero mod 8 diff --git a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp index 01e24727863..e10261f5033 100644 --- a/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -163,6 +163,10 @@ inline void frame::interpreter_frame_set_monitors(BasicObjectLock* monitors) { *interpreter_frame_monitors_addr() = monitors; } +inline oop* frame::interpreter_frame_mirror_addr() const { + return (oop*)(fp() + interpreter_frame_mirror_offset); +} + // Constant pool cache // where LcpoolCache is saved: diff --git a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp index 66889ae73b3..1e1ef759b45 100644 --- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp @@ -92,7 +92,14 @@ define_pd_global(bool, CompactStrings, true); define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); -#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint) \ +#define ARCH_FLAGS(develop, \ + product, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(intx, UseVIS, 99, \ "Highest supported VIS instructions set on Sparc") \ diff --git a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp index 580b1336bf3..ba25825ca5a 100644 --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp @@ -26,13 +26,13 @@ #include "interp_masm_sparc.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "logging/log.hpp" #include "oops/arrayOop.hpp" #include "oops/markOop.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "oops/methodCounters.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" @@ -2645,7 +2645,7 @@ void InterpreterMacroAssembler::notify_method_entry() { } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), G2_thread, Lmethod); diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp index f6770b0c3db..5fe78adb684 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp @@ -3257,12 +3257,12 @@ void MacroAssembler::eden_allocate( if (var_size_in_bytes->is_valid()) { // size is unknown at compile time cmp(free, var_size_in_bytes); - br(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case + brx(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case delayed()->add(obj, var_size_in_bytes, end); } else { // size is known at compile time cmp(free, con_size_in_bytes); - br(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case + brx(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case delayed()->add(obj, con_size_in_bytes, end); } // Compare obj with the value at top_addr; if still equal, swap the value of @@ -3972,6 +3972,14 @@ void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_v card_table_write(bs->byte_map_base, tmp, store_addr); } +void MacroAssembler::load_mirror(Register mirror, Register method) { + const int mirror_offset = in_bytes(Klass::java_mirror_offset()); + ld_ptr(method, in_bytes(Method::const_offset()), mirror); + ld_ptr(mirror, in_bytes(ConstMethod::constants_offset()), mirror); + ld_ptr(mirror, ConstantPool::pool_holder_offset_in_bytes(), mirror); + ld_ptr(mirror, mirror_offset, mirror); +} + void MacroAssembler::load_klass(Register src_oop, Register klass) { // The number of bytes in this code is used by // MachCallDynamicJavaNode::ret_addr_offset() @@ -4516,18 +4524,10 @@ void MacroAssembler::string_compare(Register str1, Register str2, } // Compare the rest of the characters - if (ae == StrIntrinsicNode::UU) { - lduh(str1, limit1, chr1); - } else { - ldub(str1, limit1, chr1); - } + load_sized_value(Address(str1, limit1), chr1, (ae == StrIntrinsicNode::UU) ? 2 : 1, false); bind(Lloop); - if (ae == StrIntrinsicNode::LL) { - ldub(str2, limit2, chr2); - } else { - lduh(str2, limit2, chr2); - } + load_sized_value(Address(str2, limit2), chr2, (ae == StrIntrinsicNode::LL) ? 1 : 2, false); subcc(chr1, chr2, chr1); br(Assembler::notZero, false, Assembler::pt, Ldone); @@ -4539,11 +4539,7 @@ void MacroAssembler::string_compare(Register str1, Register str2, // annul LDUB if branch is not taken to prevent access past end of string br(Assembler::notZero, true, Assembler::pt, Lloop); - if (ae == StrIntrinsicNode::UU) { - delayed()->lduh(str1, limit2, chr1); - } else { - delayed()->ldub(str1, limit1, chr1); - } + delayed()->load_sized_value(Address(str1, limit1), chr1, (ae == StrIntrinsicNode::UU) ? 2 : 1, false); // If strings are equal up to min length, return the length difference. if (ae == StrIntrinsicNode::UU) { @@ -4563,23 +4559,24 @@ void MacroAssembler::string_compare(Register str1, Register str2, void MacroAssembler::array_equals(bool is_array_equ, Register ary1, Register ary2, Register limit, Register tmp, Register result, bool is_byte) { - Label Ldone, Lvector, Lloop; + Label Ldone, Lloop, Lremaining; assert_different_registers(ary1, ary2, limit, tmp, result); int length_offset = arrayOopDesc::length_offset_in_bytes(); int base_offset = arrayOopDesc::base_offset_in_bytes(is_byte ? T_BYTE : T_CHAR); + assert(base_offset % 8 == 0, "Base offset must be 8-byte aligned"); if (is_array_equ) { // return true if the same array cmp(ary1, ary2); brx(Assembler::equal, true, Assembler::pn, Ldone); - delayed()->add(G0, 1, result); // equal + delayed()->mov(1, result); // equal br_null(ary1, true, Assembler::pn, Ldone); - delayed()->mov(G0, result); // not equal + delayed()->clr(result); // not equal br_null(ary2, true, Assembler::pn, Ldone); - delayed()->mov(G0, result); // not equal + delayed()->clr(result); // not equal // load the lengths of arrays ld(Address(ary1, length_offset), limit); @@ -4588,81 +4585,77 @@ void MacroAssembler::array_equals(bool is_array_equ, Register ary1, Register ary // return false if the two arrays are not equal length cmp(limit, tmp); br(Assembler::notEqual, true, Assembler::pn, Ldone); - delayed()->mov(G0, result); // not equal + delayed()->clr(result); // not equal } cmp_zero_and_br(Assembler::zero, limit, Ldone, true, Assembler::pn); - delayed()->add(G0, 1, result); // zero-length arrays are equal + delayed()->mov(1, result); // zero-length arrays are equal if (is_array_equ) { // load array addresses add(ary1, base_offset, ary1); add(ary2, base_offset, ary2); + // set byte count + if (!is_byte) { + sll(limit, exact_log2(sizeof(jchar)), limit); + } } else { // We have no guarantee that on 64 bit the higher half of limit is 0 signx(limit); } - if (is_byte) { - Label Lskip; - // check for trailing byte - andcc(limit, 0x1, tmp); - br(Assembler::zero, false, Assembler::pt, Lskip); - delayed()->nop(); +#ifdef ASSERT + // Sanity check for doubleword (8-byte) alignment of ary1 and ary2. + // Guaranteed on 64-bit systems (see arrayOopDesc::header_size_in_bytes()). + Label Laligned; + or3(ary1, ary2, tmp); + andcc(tmp, 7, tmp); + br_null_short(tmp, Assembler::pn, Laligned); + STOP("First array element is not 8-byte aligned."); + should_not_reach_here(); + bind(Laligned); +#endif - // compare the trailing byte - sub(limit, sizeof(jbyte), limit); - ldub(ary1, limit, result); - ldub(ary2, limit, tmp); - cmp(result, tmp); - br(Assembler::notEqual, true, Assembler::pt, Ldone); - delayed()->mov(G0, result); // not equal - - // only one byte? - cmp_zero_and_br(zero, limit, Ldone, true, Assembler::pn); - delayed()->add(G0, 1, result); // zero-length arrays are equal - bind(Lskip); - } else if (is_array_equ) { - // set byte count - sll(limit, exact_log2(sizeof(jchar)), limit); - } - - // check for trailing character - andcc(limit, 0x2, tmp); - br(Assembler::zero, false, Assembler::pt, Lvector); - delayed()->nop(); - - // compare the trailing char - sub(limit, sizeof(jchar), limit); - lduh(ary1, limit, result); - lduh(ary2, limit, tmp); - cmp(result, tmp); - br(Assembler::notEqual, true, Assembler::pt, Ldone); - delayed()->mov(G0, result); // not equal - - // only one char? - cmp_zero_and_br(zero, limit, Ldone, true, Assembler::pn); - delayed()->add(G0, 1, result); // zero-length arrays are equal - - // word by word compare, dont't need alignment check - bind(Lvector); // Shift ary1 and ary2 to the end of the arrays, negate limit add(ary1, limit, ary1); add(ary2, limit, ary2); neg(limit, limit); - lduw(ary1, limit, result); + // MAIN LOOP + // Load and compare array elements of size 'byte_width' until the elements are not + // equal or we reached the end of the arrays. If the size of the arrays is not a + // multiple of 'byte_width', we simply read over the end of the array, bail out and + // compare the remaining bytes below by skipping the garbage bytes. + ldx(ary1, limit, result); bind(Lloop); - lduw(ary2, limit, tmp); - cmp(result, tmp); - br(Assembler::notEqual, true, Assembler::pt, Ldone); - delayed()->mov(G0, result); // not equal - inccc(limit, 2*sizeof(jchar)); - // annul LDUW if branch is not taken to prevent access past end of array - br(Assembler::notZero, true, Assembler::pt, Lloop); - delayed()->lduw(ary1, limit, result); // hoisted + ldx(ary2, limit, tmp); + inccc(limit, 8); + // Bail out if we reached the end (but still do the comparison) + br(Assembler::positive, false, Assembler::pn, Lremaining); + delayed()->cmp(result, tmp); + // Check equality of elements + brx(Assembler::equal, false, Assembler::pt, target(Lloop)); + delayed()->ldx(ary1, limit, result); + + ba(Ldone); + delayed()->clr(result); // not equal + + // TAIL COMPARISON + // We got here because we reached the end of the arrays. 'limit' is the number of + // garbage bytes we may have compared by reading over the end of the arrays. Shift + // out the garbage and compare the remaining elements. + bind(Lremaining); + // Optimistic shortcut: elements potentially including garbage are equal + brx(Assembler::equal, true, Assembler::pt, target(Ldone)); + delayed()->mov(1, result); // equal + // Shift 'limit' bytes to the right and compare + sll(limit, 3, limit); // bytes to bits + srlx(result, limit, result); + srlx(tmp, limit, tmp); + cmp(result, tmp); + clr(result); + movcc(Assembler::equal, false, xcc, 1, result); - add(G0, 1, result); // equals bind(Ldone); } @@ -4774,6 +4767,7 @@ void MacroAssembler::bis_zeroing(Register to, Register count, Register temp, Lab assert(UseBlockZeroing && VM_Version::has_block_zeroing(), "only works with BIS zeroing"); Register end = count; int cache_line_size = VM_Version::prefetch_data_size(); + assert(cache_line_size > 0, "cache line size should be known for this code"); // Minimum count when BIS zeroing can be used since // it needs membar which is expensive. int block_zero_size = MAX2(cache_line_size*3, (int)BlockZeroingLowLimit); @@ -4852,21 +4846,21 @@ void MacroAssembler::update_byte_crc32(Register crc, Register val, Register tabl // Reverse byte order of lower 32 bits, assuming upper 32 bits all zeros void MacroAssembler::reverse_bytes_32(Register src, Register dst, Register tmp) { - srlx(src, 24, dst); + srlx(src, 24, dst); - sllx(src, 32+8, tmp); - srlx(tmp, 32+24, tmp); - sllx(tmp, 8, tmp); - or3(dst, tmp, dst); + sllx(src, 32+8, tmp); + srlx(tmp, 32+24, tmp); + sllx(tmp, 8, tmp); + or3(dst, tmp, dst); - sllx(src, 32+16, tmp); - srlx(tmp, 32+24, tmp); - sllx(tmp, 16, tmp); - or3(dst, tmp, dst); + sllx(src, 32+16, tmp); + srlx(tmp, 32+24, tmp); + sllx(tmp, 16, tmp); + or3(dst, tmp, dst); - sllx(src, 32+24, tmp); - srlx(tmp, 32, tmp); - or3(dst, tmp, dst); + sllx(src, 32+24, tmp); + srlx(tmp, 32, tmp); + or3(dst, tmp, dst); } void MacroAssembler::movitof_revbytes(Register src, FloatRegister dst, Register tmp1, Register tmp2) { @@ -5118,3 +5112,176 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, Regi not1(crc); } +#define CHUNK_LEN 128 /* 128 x 8B = 1KB */ +#define CHUNK_K1 0x1307a0206 /* reverseBits(pow(x, CHUNK_LEN*8*8*3 - 32) mod P(x)) << 1 */ +#define CHUNK_K2 0x1a0f717c4 /* reverseBits(pow(x, CHUNK_LEN*8*8*2 - 32) mod P(x)) << 1 */ +#define CHUNK_K3 0x0170076fa /* reverseBits(pow(x, CHUNK_LEN*8*8*1 - 32) mod P(x)) << 1 */ + +void MacroAssembler::kernel_crc32c(Register crc, Register buf, Register len, Register table) { + + Label L_crc32c_head, L_crc32c_aligned; + Label L_crc32c_parallel, L_crc32c_parallel_loop; + Label L_crc32c_serial, L_crc32c_x32_loop, L_crc32c_x8, L_crc32c_x8_loop; + Label L_crc32c_done, L_crc32c_tail, L_crc32c_return; + + set(ExternalAddress(StubRoutines::crc32c_table_addr()), table); + + cmp_and_br_short(len, 0, Assembler::lessEqual, Assembler::pn, L_crc32c_return); + + // clear upper 32 bits of crc + clruwu(crc); + + and3(buf, 7, G4); + cmp_and_brx_short(G4, 0, Assembler::equal, Assembler::pt, L_crc32c_aligned); + + mov(8, G1); + sub(G1, G4, G4); + + // ------ process the misaligned head (7 bytes or less) ------ + bind(L_crc32c_head); + + // crc = (crc >>> 8) ^ byteTable[(crc ^ b) & 0xFF]; + ldub(buf, 0, G1); + update_byte_crc32(crc, G1, table); + + inc(buf); + dec(len); + cmp_and_br_short(len, 0, Assembler::equal, Assembler::pn, L_crc32c_return); + dec(G4); + cmp_and_br_short(G4, 0, Assembler::greater, Assembler::pt, L_crc32c_head); + + // ------ process the 8-byte-aligned body ------ + bind(L_crc32c_aligned); + nop(); + cmp_and_br_short(len, 8, Assembler::less, Assembler::pn, L_crc32c_tail); + + // reverse the byte order of lower 32 bits to big endian, and move to FP side + movitof_revbytes(crc, F0, G1, G3); + + set(CHUNK_LEN*8*4, G4); + cmp_and_br_short(len, G4, Assembler::less, Assembler::pt, L_crc32c_serial); + + // ------ process four 1KB chunks in parallel ------ + bind(L_crc32c_parallel); + + fzero(FloatRegisterImpl::D, F2); + fzero(FloatRegisterImpl::D, F4); + fzero(FloatRegisterImpl::D, F6); + + mov(CHUNK_LEN - 1, G4); + bind(L_crc32c_parallel_loop); + // schedule ldf's ahead of crc32c's to hide the load-use latency + ldf(FloatRegisterImpl::D, buf, 0, F8); + ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*8, F10); + ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*16, F12); + ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*24, F14); + crc32c(F0, F8, F0); + crc32c(F2, F10, F2); + crc32c(F4, F12, F4); + crc32c(F6, F14, F6); + inc(buf, 8); + dec(G4); + cmp_and_br_short(G4, 0, Assembler::greater, Assembler::pt, L_crc32c_parallel_loop); + + ldf(FloatRegisterImpl::D, buf, 0, F8); + ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*8, F10); + ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*16, F12); + crc32c(F0, F8, F0); + crc32c(F2, F10, F2); + crc32c(F4, F12, F4); + + inc(buf, CHUNK_LEN*24); + ldfl(FloatRegisterImpl::D, buf, G0, F14); // load in little endian + inc(buf, 8); + + prefetch(buf, 0, Assembler::severalReads); + prefetch(buf, CHUNK_LEN*8, Assembler::severalReads); + prefetch(buf, CHUNK_LEN*16, Assembler::severalReads); + prefetch(buf, CHUNK_LEN*24, Assembler::severalReads); + + // move to INT side, and reverse the byte order of lower 32 bits to little endian + movftoi_revbytes(F0, O4, G1, G4); + movftoi_revbytes(F2, O5, G1, G4); + movftoi_revbytes(F4, G5, G1, G4); + + // combine the results of 4 chunks + set64(CHUNK_K1, G3, G1); + xmulx(O4, G3, O4); + set64(CHUNK_K2, G3, G1); + xmulx(O5, G3, O5); + set64(CHUNK_K3, G3, G1); + xmulx(G5, G3, G5); + + movdtox(F14, G4); + xor3(O4, O5, O5); + xor3(G5, O5, O5); + xor3(G4, O5, O5); + + // reverse the byte order to big endian, via stack, and move to FP side + // TODO: use new revb instruction + add(SP, -8, G1); + srlx(G1, 3, G1); + sllx(G1, 3, G1); + stx(O5, G1, G0); + ldfl(FloatRegisterImpl::D, G1, G0, F2); // load in little endian + + crc32c(F6, F2, F0); + + set(CHUNK_LEN*8*4, G4); + sub(len, G4, len); + cmp_and_br_short(len, G4, Assembler::greaterEqual, Assembler::pt, L_crc32c_parallel); + nop(); + cmp_and_br_short(len, 0, Assembler::equal, Assembler::pt, L_crc32c_done); + + bind(L_crc32c_serial); + + mov(32, G4); + cmp_and_br_short(len, G4, Assembler::less, Assembler::pn, L_crc32c_x8); + + // ------ process 32B chunks ------ + bind(L_crc32c_x32_loop); + ldf(FloatRegisterImpl::D, buf, 0, F2); + crc32c(F0, F2, F0); + ldf(FloatRegisterImpl::D, buf, 8, F2); + crc32c(F0, F2, F0); + ldf(FloatRegisterImpl::D, buf, 16, F2); + crc32c(F0, F2, F0); + ldf(FloatRegisterImpl::D, buf, 24, F2); + inc(buf, 32); + crc32c(F0, F2, F0); + dec(len, 32); + cmp_and_br_short(len, G4, Assembler::greaterEqual, Assembler::pt, L_crc32c_x32_loop); + + bind(L_crc32c_x8); + nop(); + cmp_and_br_short(len, 8, Assembler::less, Assembler::pt, L_crc32c_done); + + // ------ process 8B chunks ------ + bind(L_crc32c_x8_loop); + ldf(FloatRegisterImpl::D, buf, 0, F2); + inc(buf, 8); + crc32c(F0, F2, F0); + dec(len, 8); + cmp_and_br_short(len, 8, Assembler::greaterEqual, Assembler::pt, L_crc32c_x8_loop); + + bind(L_crc32c_done); + + // move to INT side, and reverse the byte order of lower 32 bits to little endian + movftoi_revbytes(F0, crc, G1, G3); + + cmp_and_br_short(len, 0, Assembler::equal, Assembler::pt, L_crc32c_return); + + // ------ process the misaligned tail (7 bytes or less) ------ + bind(L_crc32c_tail); + + // crc = (crc >>> 8) ^ byteTable[(crc ^ b) & 0xFF]; + ldub(buf, 0, G1); + update_byte_crc32(crc, G1, table); + + inc(buf); + dec(len); + cmp_and_br_short(len, 0, Assembler::greater, Assembler::pt, L_crc32c_tail); + + bind(L_crc32c_return); + nop(); +} diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp index dbbfbbc1267..d94de09c948 100644 --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp @@ -1012,6 +1012,8 @@ public: inline void ldbool(const Address& a, Register d); inline void movbool( bool boolconst, Register d); + void load_mirror(Register mirror, Register method); + // klass oop manipulations if compressed void load_klass(Register src_oop, Register klass); void store_klass(Register klass, Register dst_oop); @@ -1418,6 +1420,8 @@ public: // Fold 8-bit data void fold_8bit_crc32(Register xcrc, Register table, Register xtmp, Register tmp); void fold_8bit_crc32(Register crc, Register table, Register tmp); + // CRC32C code for java.util.zip.CRC32C::updateBytes/updateDirectByteBuffer instrinsic. + void kernel_crc32c(Register crc, Register buf, Register len, Register table); }; diff --git a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp index 6727c14d63b..a587b55762e 100644 --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp @@ -28,9 +28,9 @@ #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_sparc.inline.hpp" @@ -2450,7 +2450,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { // create inner frame __ save_frame(0); __ mov(G2_thread, L7_thread_cache); diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index d669d8732b8..653da26ba0b 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -1904,6 +1904,10 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen) { return ret_value; // Per default match rules are supported. } +const bool Matcher::has_predicated_vectors(void) { + return false; +} + const int Matcher::float_pressure(int default_pressure_threshold) { return default_pressure_threshold; } @@ -1991,11 +1995,6 @@ const int Matcher::float_cmove_cost() { // Does the CPU require late expand (see block.cpp for description of late expand)? const bool Matcher::require_postalloc_expand = false; -// Should the Matcher clone shifts on addressing modes, expecting them to -// be subsumed into complex addressing expressions or compute them into -// registers? True for Intel but false for most RISCs -const bool Matcher::clone_shift_expressions = false; - // Do we need to mask the count passed to shift instructions or does // the cpu only look at the lower 5/6 bits anyway? const bool Matcher::need_masked_shift_count = false; @@ -2129,6 +2128,19 @@ const RegMask Matcher::method_handle_invoke_SP_save_mask() { return L7_REGP_mask(); } + +const bool Matcher::convi2l_type_required = true; + +// Should the Matcher clone shifts on addressing modes, expecting them +// to be subsumed into complex addressing expressions or compute them +// into registers? +bool Matcher::clone_address_expressions(AddPNode* m, Matcher::MStack& mstack, VectorSet& address_visited) { + return clone_base_plus_offset_address(m, mstack, address_visited); +} + +void Compile::reshape_address(AddPNode* addp) { +} + %} diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp index db2c5eefac8..8babb471137 100644 --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -64,20 +64,6 @@ static const Register& Lstub_temp = L2; // ------------------------------------------------------------------------------------------------------------------------- // Stub Code definitions -static address handle_unsafe_access() { - JavaThread* thread = JavaThread::current(); - address pc = thread->saved_exception_pc(); - address npc = thread->saved_exception_npc(); - // pc is the instruction which we must emulate - // doing a no-op is fine: return garbage from the load - - // request an async exception - thread->set_pending_unsafe_access_error(); - - // return address of next instruction to execute - return npc; -} - class StubGenerator: public StubCodeGenerator { private: @@ -746,62 +732,6 @@ class StubGenerator: public StubCodeGenerator { Label _atomic_add_stub; // called from other stubs - //------------------------------------------------------------------------------------------------------------------------ - // The following routine generates a subroutine to throw an asynchronous - // UnknownError when an unsafe access gets a fault that could not be - // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.) - // - // Arguments : - // - // trapping PC: O7 - // - // Results: - // posts an asynchronous exception, skips the trapping instruction - // - - address generate_handler_for_unsafe_access() { - StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access"); - address start = __ pc(); - - const int preserve_register_words = (64 * 2); - Address preserve_addr(FP, (-preserve_register_words * wordSize) + STACK_BIAS); - - Register Lthread = L7_thread_cache; - int i; - - __ save_frame(0); - __ mov(G1, L1); - __ mov(G2, L2); - __ mov(G3, L3); - __ mov(G4, L4); - __ mov(G5, L5); - for (i = 0; i < 64; i += 2) { - __ stf(FloatRegisterImpl::D, as_FloatRegister(i), preserve_addr, i * wordSize); - } - - address entry_point = CAST_FROM_FN_PTR(address, handle_unsafe_access); - BLOCK_COMMENT("call handle_unsafe_access"); - __ call(entry_point, relocInfo::runtime_call_type); - __ delayed()->nop(); - - __ mov(L1, G1); - __ mov(L2, G2); - __ mov(L3, G3); - __ mov(L4, G4); - __ mov(L5, G5); - for (i = 0; i < 64; i += 2) { - __ ldf(FloatRegisterImpl::D, preserve_addr, as_FloatRegister(i), i * wordSize); - } - - __ verify_thread(); - - __ jmp(O0, 0); - __ delayed()->restore(); - - return start; - } - - // Support for uint StubRoutine::Sparc::partial_subtype_check( Klass sub, Klass super ); // Arguments : // @@ -4909,11 +4839,6 @@ class StubGenerator: public StubCodeGenerator { return start; } -#define CHUNK_LEN 128 /* 128 x 8B = 1KB */ -#define CHUNK_K1 0x1307a0206 /* reverseBits(pow(x, CHUNK_LEN*8*8*3 - 32) mod P(x)) << 1 */ -#define CHUNK_K2 0x1a0f717c4 /* reverseBits(pow(x, CHUNK_LEN*8*8*2 - 32) mod P(x)) << 1 */ -#define CHUNK_K3 0x0170076fa /* reverseBits(pow(x, CHUNK_LEN*8*8*1 - 32) mod P(x)) << 1 */ - /** * Arguments: * @@ -4938,171 +4863,8 @@ class StubGenerator: public StubCodeGenerator { const Register len = O2; // number of bytes const Register table = O3; // byteTable - Label L_crc32c_head, L_crc32c_aligned; - Label L_crc32c_parallel, L_crc32c_parallel_loop; - Label L_crc32c_serial, L_crc32c_x32_loop, L_crc32c_x8, L_crc32c_x8_loop; - Label L_crc32c_done, L_crc32c_tail, L_crc32c_return; + __ kernel_crc32c(crc, buf, len, table); - __ cmp_and_br_short(len, 0, Assembler::lessEqual, Assembler::pn, L_crc32c_return); - - // clear upper 32 bits of crc - __ clruwu(crc); - - __ and3(buf, 7, G4); - __ cmp_and_brx_short(G4, 0, Assembler::equal, Assembler::pt, L_crc32c_aligned); - - __ mov(8, G1); - __ sub(G1, G4, G4); - - // ------ process the misaligned head (7 bytes or less) ------ - __ BIND(L_crc32c_head); - - // crc = (crc >>> 8) ^ byteTable[(crc ^ b) & 0xFF]; - __ ldub(buf, 0, G1); - __ update_byte_crc32(crc, G1, table); - - __ inc(buf); - __ dec(len); - __ cmp_and_br_short(len, 0, Assembler::equal, Assembler::pn, L_crc32c_return); - __ dec(G4); - __ cmp_and_br_short(G4, 0, Assembler::greater, Assembler::pt, L_crc32c_head); - - // ------ process the 8-byte-aligned body ------ - __ BIND(L_crc32c_aligned); - __ nop(); - __ cmp_and_br_short(len, 8, Assembler::less, Assembler::pn, L_crc32c_tail); - - // reverse the byte order of lower 32 bits to big endian, and move to FP side - __ movitof_revbytes(crc, F0, G1, G3); - - __ set(CHUNK_LEN*8*4, G4); - __ cmp_and_br_short(len, G4, Assembler::less, Assembler::pt, L_crc32c_serial); - - // ------ process four 1KB chunks in parallel ------ - __ BIND(L_crc32c_parallel); - - __ fzero(FloatRegisterImpl::D, F2); - __ fzero(FloatRegisterImpl::D, F4); - __ fzero(FloatRegisterImpl::D, F6); - - __ mov(CHUNK_LEN - 1, G4); - __ BIND(L_crc32c_parallel_loop); - // schedule ldf's ahead of crc32c's to hide the load-use latency - __ ldf(FloatRegisterImpl::D, buf, 0, F8); - __ ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*8, F10); - __ ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*16, F12); - __ ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*24, F14); - __ crc32c(F0, F8, F0); - __ crc32c(F2, F10, F2); - __ crc32c(F4, F12, F4); - __ crc32c(F6, F14, F6); - __ inc(buf, 8); - __ dec(G4); - __ cmp_and_br_short(G4, 0, Assembler::greater, Assembler::pt, L_crc32c_parallel_loop); - - __ ldf(FloatRegisterImpl::D, buf, 0, F8); - __ ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*8, F10); - __ ldf(FloatRegisterImpl::D, buf, CHUNK_LEN*16, F12); - __ crc32c(F0, F8, F0); - __ crc32c(F2, F10, F2); - __ crc32c(F4, F12, F4); - - __ inc(buf, CHUNK_LEN*24); - __ ldfl(FloatRegisterImpl::D, buf, G0, F14); // load in little endian - __ inc(buf, 8); - - __ prefetch(buf, 0, Assembler::severalReads); - __ prefetch(buf, CHUNK_LEN*8, Assembler::severalReads); - __ prefetch(buf, CHUNK_LEN*16, Assembler::severalReads); - __ prefetch(buf, CHUNK_LEN*24, Assembler::severalReads); - - // move to INT side, and reverse the byte order of lower 32 bits to little endian - __ movftoi_revbytes(F0, O4, G1, G4); - __ movftoi_revbytes(F2, O5, G1, G4); - __ movftoi_revbytes(F4, G5, G1, G4); - - // combine the results of 4 chunks - __ set64(CHUNK_K1, G3, G1); - __ xmulx(O4, G3, O4); - __ set64(CHUNK_K2, G3, G1); - __ xmulx(O5, G3, O5); - __ set64(CHUNK_K3, G3, G1); - __ xmulx(G5, G3, G5); - - __ movdtox(F14, G4); - __ xor3(O4, O5, O5); - __ xor3(G5, O5, O5); - __ xor3(G4, O5, O5); - - // reverse the byte order to big endian, via stack, and move to FP side - __ add(SP, -8, G1); - __ srlx(G1, 3, G1); - __ sllx(G1, 3, G1); - __ stx(O5, G1, G0); - __ ldfl(FloatRegisterImpl::D, G1, G0, F2); // load in little endian - - __ crc32c(F6, F2, F0); - - __ set(CHUNK_LEN*8*4, G4); - __ sub(len, G4, len); - __ cmp_and_br_short(len, G4, Assembler::greaterEqual, Assembler::pt, L_crc32c_parallel); - __ nop(); - __ cmp_and_br_short(len, 0, Assembler::equal, Assembler::pt, L_crc32c_done); - - __ BIND(L_crc32c_serial); - - __ mov(32, G4); - __ cmp_and_br_short(len, G4, Assembler::less, Assembler::pn, L_crc32c_x8); - - // ------ process 32B chunks ------ - __ BIND(L_crc32c_x32_loop); - __ ldf(FloatRegisterImpl::D, buf, 0, F2); - __ inc(buf, 8); - __ crc32c(F0, F2, F0); - __ ldf(FloatRegisterImpl::D, buf, 0, F2); - __ inc(buf, 8); - __ crc32c(F0, F2, F0); - __ ldf(FloatRegisterImpl::D, buf, 0, F2); - __ inc(buf, 8); - __ crc32c(F0, F2, F0); - __ ldf(FloatRegisterImpl::D, buf, 0, F2); - __ inc(buf, 8); - __ crc32c(F0, F2, F0); - __ dec(len, 32); - __ cmp_and_br_short(len, G4, Assembler::greaterEqual, Assembler::pt, L_crc32c_x32_loop); - - __ BIND(L_crc32c_x8); - __ nop(); - __ cmp_and_br_short(len, 8, Assembler::less, Assembler::pt, L_crc32c_done); - - // ------ process 8B chunks ------ - __ BIND(L_crc32c_x8_loop); - __ ldf(FloatRegisterImpl::D, buf, 0, F2); - __ inc(buf, 8); - __ crc32c(F0, F2, F0); - __ dec(len, 8); - __ cmp_and_br_short(len, 8, Assembler::greaterEqual, Assembler::pt, L_crc32c_x8_loop); - - __ BIND(L_crc32c_done); - - // move to INT side, and reverse the byte order of lower 32 bits to little endian - __ movftoi_revbytes(F0, crc, G1, G3); - - __ cmp_and_br_short(len, 0, Assembler::equal, Assembler::pt, L_crc32c_return); - - // ------ process the misaligned tail (7 bytes or less) ------ - __ BIND(L_crc32c_tail); - - // crc = (crc >>> 8) ^ byteTable[(crc ^ b) & 0xFF]; - __ ldub(buf, 0, G1); - __ update_byte_crc32(crc, G1, table); - - __ inc(buf); - __ dec(len); - __ cmp_and_br_short(len, 0, Assembler::greater, Assembler::pt, L_crc32c_tail); - - __ BIND(L_crc32c_return); - __ nop(); __ retl(); __ delayed()->nop(); @@ -5366,6 +5128,12 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_crc_table_adr = (address)StubRoutines::Sparc::_crc_table; StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32(); } + + if (UseCRC32CIntrinsics) { + // set table address before stub generation which use it + StubRoutines::_crc32c_table_addr = (address)StubRoutines::Sparc::_crc32c_table; + StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(); + } } @@ -5380,9 +5148,6 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError)); StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call)); - StubRoutines::_handler_for_unsafe_access_entry = - generate_handler_for_unsafe_access(); - // support for verify_oop (must happen after universe_init) StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop_subroutine(); @@ -5425,12 +5190,6 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_sha512_implCompress = generate_sha512_implCompress(false, "sha512_implCompress"); StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true, "sha512_implCompressMB"); } - - // generate CRC32C intrinsic code - if (UseCRC32CIntrinsics) { - StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(); - } - // generate Adler32 intrinsics code if (UseAdler32Intrinsics) { StubRoutines::_updateBytesAdler32 = generate_updateBytesAdler32(); diff --git a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp index f8083c0f273..63cbcf05945 100644 --- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -147,3 +147,62 @@ juint StubRoutines::Sparc::_crc_table[] = 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, 0x2d02ef8dUL }; + +/** + * CRC32C constants lookup table + */ +juint StubRoutines::Sparc::_crc32c_table[] = +{ + 0x00000000UL, 0xF26B8303UL, 0xE13B70F7UL, 0x1350F3F4UL, 0xC79A971FUL, + 0x35F1141CUL, 0x26A1E7E8UL, 0xD4CA64EBUL, 0x8AD958CFUL, 0x78B2DBCCUL, + 0x6BE22838UL, 0x9989AB3BUL, 0x4D43CFD0UL, 0xBF284CD3UL, 0xAC78BF27UL, + 0x5E133C24UL, 0x105EC76FUL, 0xE235446CUL, 0xF165B798UL, 0x030E349BUL, + 0xD7C45070UL, 0x25AFD373UL, 0x36FF2087UL, 0xC494A384UL, 0x9A879FA0UL, + 0x68EC1CA3UL, 0x7BBCEF57UL, 0x89D76C54UL, 0x5D1D08BFUL, 0xAF768BBCUL, + 0xBC267848UL, 0x4E4DFB4BUL, 0x20BD8EDEUL, 0xD2D60DDDUL, 0xC186FE29UL, + 0x33ED7D2AUL, 0xE72719C1UL, 0x154C9AC2UL, 0x061C6936UL, 0xF477EA35UL, + 0xAA64D611UL, 0x580F5512UL, 0x4B5FA6E6UL, 0xB93425E5UL, 0x6DFE410EUL, + 0x9F95C20DUL, 0x8CC531F9UL, 0x7EAEB2FAUL, 0x30E349B1UL, 0xC288CAB2UL, + 0xD1D83946UL, 0x23B3BA45UL, 0xF779DEAEUL, 0x05125DADUL, 0x1642AE59UL, + 0xE4292D5AUL, 0xBA3A117EUL, 0x4851927DUL, 0x5B016189UL, 0xA96AE28AUL, + 0x7DA08661UL, 0x8FCB0562UL, 0x9C9BF696UL, 0x6EF07595UL, 0x417B1DBCUL, + 0xB3109EBFUL, 0xA0406D4BUL, 0x522BEE48UL, 0x86E18AA3UL, 0x748A09A0UL, + 0x67DAFA54UL, 0x95B17957UL, 0xCBA24573UL, 0x39C9C670UL, 0x2A993584UL, + 0xD8F2B687UL, 0x0C38D26CUL, 0xFE53516FUL, 0xED03A29BUL, 0x1F682198UL, + 0x5125DAD3UL, 0xA34E59D0UL, 0xB01EAA24UL, 0x42752927UL, 0x96BF4DCCUL, + 0x64D4CECFUL, 0x77843D3BUL, 0x85EFBE38UL, 0xDBFC821CUL, 0x2997011FUL, + 0x3AC7F2EBUL, 0xC8AC71E8UL, 0x1C661503UL, 0xEE0D9600UL, 0xFD5D65F4UL, + 0x0F36E6F7UL, 0x61C69362UL, 0x93AD1061UL, 0x80FDE395UL, 0x72966096UL, + 0xA65C047DUL, 0x5437877EUL, 0x4767748AUL, 0xB50CF789UL, 0xEB1FCBADUL, + 0x197448AEUL, 0x0A24BB5AUL, 0xF84F3859UL, 0x2C855CB2UL, 0xDEEEDFB1UL, + 0xCDBE2C45UL, 0x3FD5AF46UL, 0x7198540DUL, 0x83F3D70EUL, 0x90A324FAUL, + 0x62C8A7F9UL, 0xB602C312UL, 0x44694011UL, 0x5739B3E5UL, 0xA55230E6UL, + 0xFB410CC2UL, 0x092A8FC1UL, 0x1A7A7C35UL, 0xE811FF36UL, 0x3CDB9BDDUL, + 0xCEB018DEUL, 0xDDE0EB2AUL, 0x2F8B6829UL, 0x82F63B78UL, 0x709DB87BUL, + 0x63CD4B8FUL, 0x91A6C88CUL, 0x456CAC67UL, 0xB7072F64UL, 0xA457DC90UL, + 0x563C5F93UL, 0x082F63B7UL, 0xFA44E0B4UL, 0xE9141340UL, 0x1B7F9043UL, + 0xCFB5F4A8UL, 0x3DDE77ABUL, 0x2E8E845FUL, 0xDCE5075CUL, 0x92A8FC17UL, + 0x60C37F14UL, 0x73938CE0UL, 0x81F80FE3UL, 0x55326B08UL, 0xA759E80BUL, + 0xB4091BFFUL, 0x466298FCUL, 0x1871A4D8UL, 0xEA1A27DBUL, 0xF94AD42FUL, + 0x0B21572CUL, 0xDFEB33C7UL, 0x2D80B0C4UL, 0x3ED04330UL, 0xCCBBC033UL, + 0xA24BB5A6UL, 0x502036A5UL, 0x4370C551UL, 0xB11B4652UL, 0x65D122B9UL, + 0x97BAA1BAUL, 0x84EA524EUL, 0x7681D14DUL, 0x2892ED69UL, 0xDAF96E6AUL, + 0xC9A99D9EUL, 0x3BC21E9DUL, 0xEF087A76UL, 0x1D63F975UL, 0x0E330A81UL, + 0xFC588982UL, 0xB21572C9UL, 0x407EF1CAUL, 0x532E023EUL, 0xA145813DUL, + 0x758FE5D6UL, 0x87E466D5UL, 0x94B49521UL, 0x66DF1622UL, 0x38CC2A06UL, + 0xCAA7A905UL, 0xD9F75AF1UL, 0x2B9CD9F2UL, 0xFF56BD19UL, 0x0D3D3E1AUL, + 0x1E6DCDEEUL, 0xEC064EEDUL, 0xC38D26C4UL, 0x31E6A5C7UL, 0x22B65633UL, + 0xD0DDD530UL, 0x0417B1DBUL, 0xF67C32D8UL, 0xE52CC12CUL, 0x1747422FUL, + 0x49547E0BUL, 0xBB3FFD08UL, 0xA86F0EFCUL, 0x5A048DFFUL, 0x8ECEE914UL, + 0x7CA56A17UL, 0x6FF599E3UL, 0x9D9E1AE0UL, 0xD3D3E1ABUL, 0x21B862A8UL, + 0x32E8915CUL, 0xC083125FUL, 0x144976B4UL, 0xE622F5B7UL, 0xF5720643UL, + 0x07198540UL, 0x590AB964UL, 0xAB613A67UL, 0xB831C993UL, 0x4A5A4A90UL, + 0x9E902E7BUL, 0x6CFBAD78UL, 0x7FAB5E8CUL, 0x8DC0DD8FUL, 0xE330A81AUL, + 0x115B2B19UL, 0x020BD8EDUL, 0xF0605BEEUL, 0x24AA3F05UL, 0xD6C1BC06UL, + 0xC5914FF2UL, 0x37FACCF1UL, 0x69E9F0D5UL, 0x9B8273D6UL, 0x88D28022UL, + 0x7AB90321UL, 0xAE7367CAUL, 0x5C18E4C9UL, 0x4F48173DUL, 0xBD23943EUL, + 0xF36E6F75UL, 0x0105EC76UL, 0x12551F82UL, 0xE03E9C81UL, 0x34F4F86AUL, + 0xC69F7B69UL, 0xD5CF889DUL, 0x27A40B9EUL, 0x79B737BAUL, 0x8BDCB4B9UL, + 0x988C474DUL, 0x6AE7C44EUL, 0xBE2DA0A5UL, 0x4C4623A6UL, 0x5F16D052UL, + 0xAD7D5351UL +}; diff --git a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp index e28ec2ffb31..eb6c909c0b3 100644 --- a/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/stubRoutines_sparc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -56,6 +56,7 @@ class Sparc { // masks and table for CRC32 static uint64_t _crc_by128_masks[]; static juint _crc_table[]; + static juint _crc32c_table[]; public: // test assembler stop routine by setting registers diff --git a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp index 008fcee7a6a..f96b3e440a5 100644 --- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp @@ -557,17 +557,12 @@ void TemplateInterpreterGenerator::lock_method() { // get synchronization object to O0 { Label done; - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); __ btst(JVM_ACC_STATIC, O0); __ br( Assembler::zero, true, Assembler::pt, done); __ delayed()->ld_ptr(Llocals, Interpreter::local_offset_in_bytes(0), O0); // get receiver for not-static case - __ ld_ptr( Lmethod, in_bytes(Method::const_offset()), O0); - __ ld_ptr( O0, in_bytes(ConstMethod::constants_offset()), O0); - __ ld_ptr( O0, ConstantPool::pool_holder_offset_in_bytes(), O0); - // lock the mirror, not the Klass* - __ ld_ptr( O0, mirror_offset, O0); + __ load_mirror(O0, Lmethod); #ifdef ASSERT __ tst(O0); @@ -881,6 +876,10 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { __ add(Lbcp, in_bytes(ConstMethod::codes_offset()), Lbcp); } __ mov( G5_method, Lmethod); // set Lmethod + // Get mirror and store it in the frame as GC root for this Method* + Register mirror = LcpoolCache; + __ load_mirror(mirror, Lmethod); + __ st_ptr(mirror, FP, (frame::interpreter_frame_mirror_offset * wordSize) + STACK_BIAS); __ get_constant_pool_cache( LcpoolCache ); // set LcpoolCache __ sub(FP, rounded_vm_local_words * BytesPerWord, Lmonitors ); // set Lmonitors #ifdef _LP64 @@ -1082,8 +1081,56 @@ address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractI return NULL; } -// Not supported +/** + * Method entry for intrinsic-candidate (non-native) methods: + * int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end) + * int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long buf, int off, int end) + * Unlike CRC32, CRC32C does not have any methods marked as native + * CRC32C also uses an "end" variable instead of the length variable CRC32 uses + */ address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { + + if (UseCRC32CIntrinsics) { + address entry = __ pc(); + + // Load parameters from the stack + const Register crc = O0; // initial crc + const Register buf = O1; // source java byte array address + const Register offset = O2; // offset + const Register end = O3; // index of last element to process + const Register len = O2; // len argument to the kernel + const Register table = O3; // crc32c lookup table address + + // Arguments are reversed on java expression stack + // Calculate address of start element + if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) { + __ lduw(Gargs, 0, end); + __ lduw(Gargs, 8, offset); + __ ldx( Gargs, 16, buf); + __ lduw(Gargs, 32, crc); + __ add(buf, offset, buf); + __ sub(end, offset, len); + } else { + __ lduw(Gargs, 0, end); + __ lduw(Gargs, 8, offset); + __ ldx( Gargs, 16, buf); + __ lduw(Gargs, 24, crc); + __ add(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE), buf); // account for the header size + __ add(buf, offset, buf); + __ sub(end, offset, len); + } + + // Call the crc32c kernel + __ MacroAssembler::save_thread(L7_thread_cache); + __ kernel_crc32c(crc, buf, len, table); + __ MacroAssembler::restore_thread(L7_thread_cache); + + // result in O0 + __ retl(); + __ delayed()->nop(); + + return entry; + } return NULL; } @@ -1297,12 +1344,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // get native function entry point(O0 is a good temp until the very end) __ delayed()->ld_ptr(Lmethod, in_bytes(Method::native_function_offset()), O0); // for static methods insert the mirror argument - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); - - __ ld_ptr(Lmethod, Method:: const_offset(), O1); - __ ld_ptr(O1, ConstMethod::constants_offset(), O1); - __ ld_ptr(O1, ConstantPool::pool_holder_offset_in_bytes(), O1); - __ ld_ptr(O1, mirror_offset, O1); + __ load_mirror(O1, Lmethod); #ifdef ASSERT if (!PrintSignatureHandlers) // do not dirty the output with this { Label L; diff --git a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp index 93c8d40891e..88ac31e096d 100644 --- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp @@ -49,9 +49,11 @@ void VM_Version::initialize() { AllocatePrefetchDistance = allocate_prefetch_distance(); AllocatePrefetchStyle = allocate_prefetch_style(); - if (AllocatePrefetchStyle == 3 && !has_blk_init()) { - warning("BIS instructions are not available on this CPU"); - FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1); + if (!has_blk_init() || cache_line_size <= 0) { + if (AllocatePrefetchInstr == 1) { + warning("BIS instructions required for AllocatePrefetchInstr 1 unavailable"); + FLAG_SET_DEFAULT(AllocatePrefetchInstr, 0); + } } UseSSE = 0; // Only on x86 and x64 @@ -85,14 +87,16 @@ void VM_Version::initialize() { FLAG_SET_DEFAULT(InteriorEntryAlignment, 4); } if (is_niagara_plus()) { - if (has_blk_init() && UseTLAB && + if (has_blk_init() && (cache_line_size > 0) && UseTLAB && FLAG_IS_DEFAULT(AllocatePrefetchInstr)) { // Use BIS instruction for TLAB allocation prefetch. - FLAG_SET_ERGO(intx, AllocatePrefetchInstr, 1); - if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) { - FLAG_SET_ERGO(intx, AllocatePrefetchStyle, 3); - } - if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) { + FLAG_SET_DEFAULT(AllocatePrefetchInstr, 1); + } + if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) { + if (AllocatePrefetchInstr == 0) { + // Use different prefetch distance without BIS + FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256); + } else { // Use smaller prefetch distance with BIS FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64); } @@ -107,22 +111,14 @@ void VM_Version::initialize() { FLAG_SET_ERGO(intx, AllocateInstancePrefetchLines, AllocateInstancePrefetchLines*2); } } - if (AllocatePrefetchStyle != 3 && FLAG_IS_DEFAULT(AllocatePrefetchDistance)) { - // Use different prefetch distance without BIS - FLAG_SET_DEFAULT(AllocatePrefetchDistance, 256); - } - if (AllocatePrefetchInstr == 1) { - // Need a space at the end of TLAB for BIS since it - // will fault when accessing memory outside of heap. - - // +1 for rounding up to next cache line, +1 to be safe - int lines = AllocatePrefetchLines + 2; - int step_size = AllocatePrefetchStepSize; - int distance = AllocatePrefetchDistance; - _reserve_for_allocation_prefetch = (distance + step_size*lines)/(int)HeapWordSize; - } } -#endif + + if (AllocatePrefetchInstr == 1) { + // Use allocation prefetch style 3 because BIS instructions + // require aligned memory addresses. + FLAG_SET_DEFAULT(AllocatePrefetchStyle, 3); + } +#endif /* COMPILER2 */ } // Use hardware population count instruction if available. diff --git a/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp b/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp index ed991d5c1b8..5a1f37f26a7 100644 --- a/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp +++ b/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -113,6 +113,8 @@ void AbstractInterpreter::layout_activation(Method* method, } *interpreter_frame->interpreter_frame_cache_addr() = method->constants()->cache(); + *interpreter_frame->interpreter_frame_mirror_addr() = + method->method_holder()->java_mirror(); } #ifndef _LP64 diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index e30a0289b32..d65577ffca5 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -1240,6 +1240,7 @@ void Assembler::addr_nop_8() { void Assembler::addsd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_int8((unsigned char)(0xC0 | encode)); @@ -1250,6 +1251,7 @@ void Assembler::addsd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_operand(dst, src); @@ -1599,6 +1601,7 @@ void Assembler::comisd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false);; attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x2F); emit_operand(dst, src); @@ -1607,6 +1610,7 @@ void Assembler::comisd(XMMRegister dst, Address src) { void Assembler::comisd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x2F); emit_int8((unsigned char)(0xC0 | encode)); @@ -1733,6 +1737,7 @@ void Assembler::cvtdq2ps(XMMRegister dst, XMMRegister src) { void Assembler::cvtsd2ss(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5A); emit_int8((unsigned char)(0xC0 | encode)); @@ -1743,6 +1748,7 @@ void Assembler::cvtsd2ss(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5A); emit_operand(dst, src); @@ -1827,6 +1833,15 @@ void Assembler::cvttss2sil(Register dst, XMMRegister src) { emit_int8((unsigned char)(0xC0 | encode)); } +void Assembler::cvttpd2dq(XMMRegister dst, XMMRegister src) { + NOT_LP64(assert(VM_Version::supports_sse2(), "")); + int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0xE6); + emit_int8((unsigned char)(0xC0 | encode)); +} + void Assembler::decl(Address dst) { // Don't use it directly. Use MacroAssembler::decrement() instead. InstructionMark im(this); @@ -1840,6 +1855,7 @@ void Assembler::divsd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_operand(dst, src); @@ -1848,6 +1864,7 @@ void Assembler::divsd(XMMRegister dst, Address src) { void Assembler::divsd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_int8((unsigned char)(0xC0 | encode)); @@ -2122,6 +2139,7 @@ void Assembler::movapd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x28); emit_int8((unsigned char)(0xC0 | encode)); @@ -2156,6 +2174,7 @@ void Assembler::movddup(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse3(), "")); int vector_len = VM_Version::supports_avx512novl() ? AVX_512bit : AVX_128bit; InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x12); emit_int8(0xC0 | encode); @@ -2193,6 +2212,15 @@ void Assembler::kmovwl(Register dst, KRegister src) { emit_int8((unsigned char)(0xC0 | encode)); } +void Assembler::kmovwl(KRegister dst, Address src) { + assert(VM_Version::supports_evex(), ""); + InstructionMark im(this); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + vex_prefix(src, 0, dst->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0x90); + emit_operand((Register)dst, src); +} + void Assembler::kmovdl(KRegister dst, Register src) { assert(VM_Version::supports_avx512bw(), ""); InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); @@ -2251,6 +2279,14 @@ void Assembler::kmovql(Register dst, KRegister src) { emit_int8((unsigned char)(0xC0 | encode)); } +void Assembler::knotwl(KRegister dst, KRegister src) { + assert(VM_Version::supports_evex(), ""); + InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0x44); + emit_int8((unsigned char)(0xC0 | encode)); +} + // This instruction produces ZF or CF flags void Assembler::kortestbl(KRegister src1, KRegister src2) { assert(VM_Version::supports_avx512dq(), ""); @@ -2287,6 +2323,31 @@ void Assembler::kortestql(KRegister src1, KRegister src2) { emit_int8((unsigned char)(0xC0 | encode)); } +// This instruction produces ZF or CF flags +void Assembler::ktestql(KRegister src1, KRegister src2) { + assert(VM_Version::supports_avx512bw(), ""); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(src1->encoding(), 0, src2->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0x99); + emit_int8((unsigned char)(0xC0 | encode)); +} + +void Assembler::ktestq(KRegister src1, KRegister src2) { + assert(VM_Version::supports_avx512bw(), ""); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(src1->encoding(), 0, src2->encoding(), VEX_SIMD_NONE, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0x99); + emit_int8((unsigned char)(0xC0 | encode)); +} + +void Assembler::ktestd(KRegister src1, KRegister src2) { + assert(VM_Version::supports_avx512bw(), ""); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(src1->encoding(), 0, src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8((unsigned char)0x99); + emit_int8((unsigned char)(0xC0 | encode)); +} + void Assembler::movb(Address dst, int imm8) { InstructionMark im(this); prefix(dst); @@ -2423,6 +2484,7 @@ void Assembler::vmovdqu(Address dst, XMMRegister src) { void Assembler::evmovdqub(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int prefix = (_legacy_mode_bw) ? VEX_SIMD_F2 : VEX_SIMD_F3; int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), (Assembler::VexSimdPrefix)prefix, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); @@ -2435,6 +2497,7 @@ void Assembler::evmovdqub(XMMRegister dst, Address src, int vector_len) { InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int prefix = (_legacy_mode_bw) ? VEX_SIMD_F2 : VEX_SIMD_F3; attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); vex_prefix(src, 0, dst->encoding(), (Assembler::VexSimdPrefix)prefix, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); emit_operand(dst, src); @@ -2447,18 +2510,23 @@ void Assembler::evmovdqub(Address dst, XMMRegister src, int vector_len) { InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); int prefix = (_legacy_mode_bw) ? VEX_SIMD_F2 : VEX_SIMD_F3; attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), (Assembler::VexSimdPrefix)prefix, VEX_OPCODE_0F, &attributes); emit_int8(0x7F); emit_operand(src, dst); } -void Assembler::evmovdquw(XMMRegister dst, XMMRegister src, int vector_len) { - assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); - int prefix = (_legacy_mode_bw) ? VEX_SIMD_F2 : VEX_SIMD_F3; - int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), (Assembler::VexSimdPrefix)prefix, VEX_OPCODE_0F, &attributes); +void Assembler::evmovdqub(XMMRegister dst, KRegister mask, Address src, int vector_len) { + assert(VM_Version::supports_avx512vlbw(), ""); + assert(is_vector_masking(), ""); // For stub code use only + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); - emit_int8((unsigned char)(0xC0 | encode)); + emit_operand(dst, src); } void Assembler::evmovdquw(XMMRegister dst, Address src, int vector_len) { @@ -2466,24 +2534,52 @@ void Assembler::evmovdquw(XMMRegister dst, Address src, int vector_len) { InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); int prefix = (_legacy_mode_bw) ? VEX_SIMD_F2 : VEX_SIMD_F3; vex_prefix(src, 0, dst->encoding(), (Assembler::VexSimdPrefix)prefix, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); emit_operand(dst, src); } +void Assembler::evmovdquw(XMMRegister dst, KRegister mask, Address src, int vector_len) { + assert(is_vector_masking(), ""); + assert(VM_Version::supports_avx512vlbw(), ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); + emit_int8(0x6F); + emit_operand(dst, src); +} + void Assembler::evmovdquw(Address dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); assert(src != xnoreg, "sanity"); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); int prefix = (_legacy_mode_bw) ? VEX_SIMD_F2 : VEX_SIMD_F3; vex_prefix(dst, 0, src->encoding(), (Assembler::VexSimdPrefix)prefix, VEX_OPCODE_0F, &attributes); emit_int8(0x7F); emit_operand(src, dst); } +void Assembler::evmovdquw(Address dst, KRegister mask, XMMRegister src, int vector_len) { + assert(VM_Version::supports_avx512vlbw(), ""); + assert(src != xnoreg, "sanity"); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); + emit_int8(0x7F); + emit_operand(src, dst); +} + void Assembler::evmovdqul(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); @@ -2509,8 +2605,8 @@ void Assembler::evmovdqul(Address dst, XMMRegister src, int vector_len) { assert(src != xnoreg, "sanity"); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); - attributes.set_is_evex_instruction(); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x7F); emit_operand(src, dst); @@ -2529,8 +2625,8 @@ void Assembler::evmovdquq(XMMRegister dst, Address src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); - attributes.set_is_evex_instruction(); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x6F); emit_operand(dst, src); @@ -2541,8 +2637,8 @@ void Assembler::evmovdquq(Address dst, XMMRegister src, int vector_len) { assert(src != xnoreg, "sanity"); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); - attributes.set_is_evex_instruction(); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x7F); emit_operand(src, dst); @@ -2591,7 +2687,8 @@ void Assembler::movlpd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); - attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_32bit); + attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x12); emit_operand(dst, src); @@ -2622,6 +2719,7 @@ void Assembler::movq(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, xnoreg, src, VEX_SIMD_F3, VEX_OPCODE_0F, &attributes); emit_int8(0x7E); emit_operand(dst, src); @@ -2632,6 +2730,7 @@ void Assembler::movq(Address dst, XMMRegister src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(src, xnoreg, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD6); emit_operand(src, dst); @@ -2656,6 +2755,7 @@ void Assembler::movsbl(Register dst, Register src) { // movsxb void Assembler::movsd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x10); emit_int8((unsigned char)(0xC0 | encode)); @@ -2666,6 +2766,7 @@ void Assembler::movsd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, xnoreg, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x10); emit_operand(dst, src); @@ -2676,6 +2777,7 @@ void Assembler::movsd(Address dst, XMMRegister src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(src, xnoreg, dst, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x11); emit_operand(src, dst); @@ -2799,6 +2901,7 @@ void Assembler::mulsd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_operand(dst, src); @@ -2807,6 +2910,7 @@ void Assembler::mulsd(XMMRegister dst, Address src) { void Assembler::mulsd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); @@ -3161,6 +3265,16 @@ void Assembler::vpermq(XMMRegister dst, XMMRegister src, int imm8, int vector_le emit_int8(imm8); } +void Assembler::vperm2i128(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8) { + assert(VM_Version::supports_avx2(), ""); + InstructionAttr attributes(AVX_256bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int8(0x46); + emit_int8(0xC0 | encode); + emit_int8(imm8); +} + + void Assembler::pause() { emit_int8((unsigned char)0xF3); emit_int8((unsigned char)0x90); @@ -3213,10 +3327,71 @@ void Assembler::evpcmpeqb(KRegister kdst, XMMRegister nds, XMMRegister src, int emit_int8((unsigned char)(0xC0 | encode)); } +void Assembler::evpcmpgtb(KRegister kdst, XMMRegister nds, Address src, int vector_len) { + assert(VM_Version::supports_avx512vlbw(), ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); + int dst_enc = kdst->encoding(); + vex_prefix(src, nds->encoding(), dst_enc, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8(0x64); + emit_operand(as_Register(dst_enc), src); +} + +void Assembler::evpcmpgtb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len) { + assert(is_vector_masking(), ""); + assert(VM_Version::supports_avx512vlbw(), ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + int dst_enc = kdst->encoding(); + vex_prefix(src, nds->encoding(), dst_enc, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8(0x64); + emit_operand(as_Register(dst_enc), src); +} + +void Assembler::evpcmpuw(KRegister kdst, XMMRegister nds, XMMRegister src, ComparisonPredicate vcc, int vector_len) { + assert(VM_Version::supports_avx512vlbw(), ""); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_is_evex_instruction(); + int encode = vex_prefix_and_encode(kdst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int8(0x3E); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(vcc); +} + +void Assembler::evpcmpuw(KRegister kdst, KRegister mask, XMMRegister nds, XMMRegister src, ComparisonPredicate vcc, int vector_len) { + assert(is_vector_masking(), ""); + assert(VM_Version::supports_avx512vlbw(), ""); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + int encode = vex_prefix_and_encode(kdst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int8(0x3E); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(vcc); +} + +void Assembler::evpcmpuw(KRegister kdst, XMMRegister nds, Address src, ComparisonPredicate vcc, int vector_len) { + assert(VM_Version::supports_avx512vlbw(), ""); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); + int dst_enc = kdst->encoding(); + vex_prefix(src, nds->encoding(), kdst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int8(0x3E); + emit_operand(as_Register(dst_enc), src); + emit_int8(vcc); +} + void Assembler::evpcmpeqb(KRegister kdst, XMMRegister nds, Address src, int vector_len) { assert(VM_Version::supports_avx512bw(), ""); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); attributes.set_is_evex_instruction(); attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); int dst_enc = kdst->encoding(); @@ -3225,6 +3400,19 @@ void Assembler::evpcmpeqb(KRegister kdst, XMMRegister nds, Address src, int vect emit_operand(as_Register(dst_enc), src); } +void Assembler::evpcmpeqb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len) { + assert(VM_Version::supports_avx512vlbw(), ""); + assert(is_vector_masking(), ""); // For stub code use only + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_reg_mask */ false, /* uses_vl */ false); + attributes.set_address_attributes(/* tuple_type */ EVEX_FVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + vex_prefix(src, nds->encoding(), kdst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8(0x74); + emit_operand(as_Register(kdst->encoding()), src); +} + // In this context, the dst vector contains the components that are equal, non equal components are zeroed in dst void Assembler::pcmpeqw(XMMRegister dst, XMMRegister src) { assert(VM_Version::supports_sse2(), ""); @@ -3525,6 +3713,46 @@ void Assembler::vpmovzxbw(XMMRegister dst, Address src, int vector_len) { emit_operand(dst, src); } +void Assembler::evpmovzxbw(XMMRegister dst, KRegister mask, Address src, int vector_len) { + assert(is_vector_masking(), ""); + assert(VM_Version::supports_avx512vlbw(), ""); + assert(dst != xnoreg, "sanity"); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int8(0x30); + emit_operand(dst, src); +} + +void Assembler::evpmovwb(Address dst, XMMRegister src, int vector_len) { + assert(VM_Version::supports_avx512vlbw(), ""); + assert(src != xnoreg, "sanity"); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_is_evex_instruction(); + vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F_38, &attributes); + emit_int8(0x30); + emit_operand(src, dst); +} + +void Assembler::evpmovwb(Address dst, KRegister mask, XMMRegister src, int vector_len) { + assert(is_vector_masking(), ""); + assert(VM_Version::supports_avx512vlbw(), ""); + assert(src != xnoreg, "sanity"); + InstructionMark im(this); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_address_attributes(/* tuple_type */ EVEX_HVM, /* input_size_in_bits */ EVEX_NObit); + attributes.set_embedded_opmask_register_specifier(mask); + attributes.set_is_evex_instruction(); + vex_prefix(dst, 0, src->encoding(), VEX_SIMD_F3, VEX_OPCODE_0F_38, &attributes); + emit_int8(0x30); + emit_operand(src, dst); +} + // generic void Assembler::pop(Register dst) { int encode = prefix_and_encode(dst->encoding()); @@ -3629,6 +3857,16 @@ void Assembler::pshufb(XMMRegister dst, XMMRegister src) { emit_int8((unsigned char)(0xC0 | encode)); } +void Assembler::vpshufb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { + assert(vector_len == AVX_128bit? VM_Version::supports_avx() : + vector_len == AVX_256bit? VM_Version::supports_avx2() : + 0, ""); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); + int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int8(0x00); + emit_int8((unsigned char)(0xC0 | encode)); +} + void Assembler::pshufb(XMMRegister dst, Address src) { assert(VM_Version::supports_ssse3(), ""); InstructionMark im(this); @@ -3650,6 +3888,18 @@ void Assembler::pshufd(XMMRegister dst, XMMRegister src, int mode) { emit_int8(mode & 0xFF); } +void Assembler::vpshufd(XMMRegister dst, XMMRegister src, int mode, int vector_len) { + assert(vector_len == AVX_128bit? VM_Version::supports_avx() : + vector_len == AVX_256bit? VM_Version::supports_avx2() : + 0, ""); + NOT_LP64(assert(VM_Version::supports_sse2(), "")); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); + emit_int8(0x70); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(mode & 0xFF); +} + void Assembler::pshufd(XMMRegister dst, Address src, int mode) { assert(isByte(mode), "invalid value"); NOT_LP64(assert(VM_Version::supports_sse2(), "")); @@ -3690,7 +3940,6 @@ void Assembler::psrldq(XMMRegister dst, int shift) { // Shift left 128 bit value in dst XMMRegister by shift number of bytes. NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ false); - // XMM3 is for /3 encoding: 66 0F 73 /3 ib int encode = simd_prefix_and_encode(xmm3, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x73); emit_int8((unsigned char)(0xC0 | encode)); @@ -3786,6 +4035,7 @@ void Assembler::punpckldq(XMMRegister dst, XMMRegister src) { void Assembler::punpcklqdq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x6C); emit_int8((unsigned char)(0xC0 | encode)); @@ -3972,6 +4222,17 @@ void Assembler::palignr(XMMRegister dst, XMMRegister src, int imm8) { emit_int8(imm8); } +void Assembler::vpalignr(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8, int vector_len) { + assert(vector_len == AVX_128bit? VM_Version::supports_avx() : + vector_len == AVX_256bit? VM_Version::supports_avx2() : + 0, ""); + InstructionAttr attributes(vector_len, /* rex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ false, /* uses_vl */ true); + int encode = simd_prefix_and_encode(dst, nds, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int8((unsigned char)0x0F); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(imm8); +} + void Assembler::pblendw(XMMRegister dst, XMMRegister src, int imm8) { assert(VM_Version::supports_sse4_1(), ""); InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); @@ -4081,6 +4342,7 @@ void Assembler::smovl() { void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x51); emit_int8((unsigned char)(0xC0 | encode)); @@ -4091,6 +4353,7 @@ void Assembler::sqrtsd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x51); emit_operand(dst, src); @@ -4166,6 +4429,7 @@ void Assembler::subl(Register dst, Register src) { void Assembler::subsd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_int8((unsigned char)(0xC0 | encode)); @@ -4176,6 +4440,7 @@ void Assembler::subsd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_operand(dst, src); @@ -4263,6 +4528,7 @@ void Assembler::ucomisd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x2E); emit_operand(dst, src); @@ -4271,6 +4537,7 @@ void Assembler::ucomisd(XMMRegister dst, Address src) { void Assembler::ucomisd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x2E); emit_int8((unsigned char)(0xC0 | encode)); @@ -4382,6 +4649,7 @@ void Assembler::vaddsd(XMMRegister dst, XMMRegister nds, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_operand(dst, src); @@ -4390,6 +4658,7 @@ void Assembler::vaddsd(XMMRegister dst, XMMRegister nds, Address src) { void Assembler::vaddsd(XMMRegister dst, XMMRegister nds, XMMRegister src) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_int8((unsigned char)(0xC0 | encode)); @@ -4418,6 +4687,7 @@ void Assembler::vdivsd(XMMRegister dst, XMMRegister nds, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_operand(dst, src); @@ -4426,6 +4696,7 @@ void Assembler::vdivsd(XMMRegister dst, XMMRegister nds, Address src) { void Assembler::vdivsd(XMMRegister dst, XMMRegister nds, XMMRegister src) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_int8((unsigned char)(0xC0 | encode)); @@ -4454,6 +4725,7 @@ void Assembler::vmulsd(XMMRegister dst, XMMRegister nds, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_operand(dst, src); @@ -4462,6 +4734,7 @@ void Assembler::vmulsd(XMMRegister dst, XMMRegister nds, Address src) { void Assembler::vmulsd(XMMRegister dst, XMMRegister nds, XMMRegister src) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); @@ -4490,6 +4763,7 @@ void Assembler::vsubsd(XMMRegister dst, XMMRegister nds, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_operand(dst, src); @@ -4498,6 +4772,7 @@ void Assembler::vsubsd(XMMRegister dst, XMMRegister nds, Address src) { void Assembler::vsubsd(XMMRegister dst, XMMRegister nds, XMMRegister src) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_int8((unsigned char)(0xC0 | encode)); @@ -4528,6 +4803,7 @@ void Assembler::vsubss(XMMRegister dst, XMMRegister nds, XMMRegister src) { void Assembler::addpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_int8((unsigned char)(0xC0 | encode)); @@ -4537,6 +4813,7 @@ void Assembler::addpd(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x58); @@ -4555,6 +4832,7 @@ void Assembler::addps(XMMRegister dst, XMMRegister src) { void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_int8((unsigned char)(0xC0 | encode)); @@ -4573,6 +4851,7 @@ void Assembler::vaddpd(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x58); emit_operand(dst, src); @@ -4591,6 +4870,7 @@ void Assembler::vaddps(XMMRegister dst, XMMRegister nds, Address src, int vector void Assembler::subpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_int8((unsigned char)(0xC0 | encode)); @@ -4607,6 +4887,7 @@ void Assembler::subps(XMMRegister dst, XMMRegister src) { void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_int8((unsigned char)(0xC0 | encode)); @@ -4625,6 +4906,7 @@ void Assembler::vsubpd(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5C); emit_operand(dst, src); @@ -4643,6 +4925,7 @@ void Assembler::vsubps(XMMRegister dst, XMMRegister nds, Address src, int vector void Assembler::mulpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); @@ -4653,6 +4936,7 @@ void Assembler::mulpd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_operand(dst, src); @@ -4669,6 +4953,7 @@ void Assembler::mulps(XMMRegister dst, XMMRegister src) { void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); @@ -4687,6 +4972,7 @@ void Assembler::vmulpd(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x59); emit_operand(dst, src); @@ -4705,6 +4991,7 @@ void Assembler::vmulps(XMMRegister dst, XMMRegister nds, Address src, int vector void Assembler::divpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_int8((unsigned char)(0xC0 | encode)); @@ -4721,6 +5008,7 @@ void Assembler::divps(XMMRegister dst, XMMRegister src) { void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_int8((unsigned char)(0xC0 | encode)); @@ -4739,6 +5027,7 @@ void Assembler::vdivpd(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x5E); emit_operand(dst, src); @@ -4757,6 +5046,7 @@ void Assembler::vdivps(XMMRegister dst, XMMRegister nds, Address src, int vector void Assembler::vsqrtpd(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x51); emit_int8((unsigned char)(0xC0 | encode)); @@ -4767,6 +5057,7 @@ void Assembler::vsqrtpd(XMMRegister dst, Address src, int vector_len) { InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x51); emit_operand(dst, src); @@ -4775,6 +5066,7 @@ void Assembler::vsqrtpd(XMMRegister dst, Address src, int vector_len) { void Assembler::andpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x54); emit_int8((unsigned char)(0xC0 | encode)); @@ -4803,6 +5095,7 @@ void Assembler::andpd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x54); emit_operand(dst, src); @@ -4811,6 +5104,7 @@ void Assembler::andpd(XMMRegister dst, Address src) { void Assembler::vandpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x54); emit_int8((unsigned char)(0xC0 | encode)); @@ -4829,6 +5123,7 @@ void Assembler::vandpd(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x54); emit_operand(dst, src); @@ -4847,6 +5142,7 @@ void Assembler::vandps(XMMRegister dst, XMMRegister nds, Address src, int vector void Assembler::unpckhpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x15); emit_int8((unsigned char)(0xC0 | encode)); @@ -4855,6 +5151,7 @@ void Assembler::unpckhpd(XMMRegister dst, XMMRegister src) { void Assembler::unpcklpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x14); emit_int8((unsigned char)(0xC0 | encode)); @@ -4863,6 +5160,7 @@ void Assembler::unpcklpd(XMMRegister dst, XMMRegister src) { void Assembler::xorpd(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x57); emit_int8((unsigned char)(0xC0 | encode)); @@ -4881,6 +5179,7 @@ void Assembler::xorpd(XMMRegister dst, Address src) { InstructionMark im(this); InstructionAttr attributes(AVX_128bit, /* rex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x57); emit_operand(dst, src); @@ -4899,6 +5198,7 @@ void Assembler::xorps(XMMRegister dst, Address src) { void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx(), ""); InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x57); emit_int8((unsigned char)(0xC0 | encode)); @@ -4917,6 +5217,7 @@ void Assembler::vxorpd(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x57); emit_operand(dst, src); @@ -4987,13 +5288,14 @@ void Assembler::paddd(XMMRegister dst, Address src) { void Assembler::paddq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD4); emit_int8((unsigned char)(0xC0 | encode)); } void Assembler::phaddw(XMMRegister dst, XMMRegister src) { - NOT_LP64(assert(VM_Version::supports_sse3(), "")); + assert(VM_Version::supports_sse3(), ""); InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x01); @@ -5001,7 +5303,7 @@ void Assembler::phaddw(XMMRegister dst, XMMRegister src) { } void Assembler::phaddd(XMMRegister dst, XMMRegister src) { - NOT_LP64(assert(VM_Version::supports_sse3(), "")); + assert(VM_Version::supports_sse3(), ""); InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x02); @@ -5035,6 +5337,7 @@ void Assembler::vpaddd(XMMRegister dst, XMMRegister nds, XMMRegister src, int ve void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD4); emit_int8((unsigned char)(0xC0 | encode)); @@ -5075,6 +5378,7 @@ void Assembler::vpaddq(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD4); emit_operand(dst, src); @@ -5106,6 +5410,7 @@ void Assembler::psubd(XMMRegister dst, XMMRegister src) { void Assembler::psubq(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFB); emit_int8((unsigned char)(0xC0 | encode)); @@ -5138,6 +5443,7 @@ void Assembler::vpsubd(XMMRegister dst, XMMRegister nds, XMMRegister src, int ve void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionAttr attributes(vector_len, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFB); emit_int8((unsigned char)(0xC0 | encode)); @@ -5178,6 +5484,7 @@ void Assembler::vpsubq(XMMRegister dst, XMMRegister nds, Address src, int vector InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xFB); emit_operand(dst, src); @@ -5216,8 +5523,9 @@ void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, XMMRegister src, int v } void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len) { - assert(UseAVX > 2, "requires some form of AVX"); - InstructionAttr attributes(vector_len, /* rex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + assert(UseAVX > 2, "requires some form of EVEX"); + InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x40); emit_int8((unsigned char)(0xC0 | encode)); @@ -5244,10 +5552,11 @@ void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, Address src, int vecto } void Assembler::vpmullq(XMMRegister dst, XMMRegister nds, Address src, int vector_len) { - assert(UseAVX > 0, "requires some form of AVX"); + assert(UseAVX > 2, "requires some form of EVEX"); InstructionMark im(this); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ _legacy_mode_dq, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_FV, /* input_size_in_bits */ EVEX_64bit); + attributes.set_is_evex_instruction(); vex_prefix(src, nds->encoding(), dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x40); emit_operand(dst, src); @@ -5303,6 +5612,7 @@ void Assembler::pslld(XMMRegister dst, XMMRegister shift) { void Assembler::psllq(XMMRegister dst, XMMRegister shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xF3); emit_int8((unsigned char)(0xC0 | encode)); @@ -5332,6 +5642,7 @@ void Assembler::vpslld(XMMRegister dst, XMMRegister src, int shift, int vector_l void Assembler::vpsllq(XMMRegister dst, XMMRegister src, int shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); // XMM6 is for /6 encoding: 66 0F 73 /6 ib int encode = vex_prefix_and_encode(xmm6->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x73); @@ -5358,6 +5669,7 @@ void Assembler::vpslld(XMMRegister dst, XMMRegister src, XMMRegister shift, int void Assembler::vpsllq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xF3); emit_int8((unsigned char)(0xC0 | encode)); @@ -5389,6 +5701,7 @@ void Assembler::psrlq(XMMRegister dst, int shift) { // shifts 128 bit value in xmm register by number of bytes. NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); // XMM2 is for /2 encoding: 66 0F 73 /2 ib int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x73); @@ -5415,6 +5728,7 @@ void Assembler::psrld(XMMRegister dst, XMMRegister shift) { void Assembler::psrlq(XMMRegister dst, XMMRegister shift) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, shift, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD3); emit_int8((unsigned char)(0xC0 | encode)); @@ -5443,6 +5757,7 @@ void Assembler::vpsrld(XMMRegister dst, XMMRegister src, int shift, int vector_l void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, int shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); // XMM2 is for /2 encoding: 66 0F 73 /2 ib int encode = vex_prefix_and_encode(xmm2->encoding(), dst->encoding(), src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8(0x73); @@ -5469,6 +5784,7 @@ void Assembler::vpsrld(XMMRegister dst, XMMRegister src, XMMRegister shift, int void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, XMMRegister shift, int vector_len) { assert(UseAVX > 0, "requires some form of AVX"); InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), shift->encoding(), VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xD3); emit_int8((unsigned char)(0xC0 | encode)); @@ -5578,6 +5894,7 @@ void Assembler::vpand(XMMRegister dst, XMMRegister nds, Address src, int vector_ void Assembler::pandn(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); InstructionAttr attributes(AVX_128bit, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F, &attributes); emit_int8((unsigned char)0xDF); emit_int8((unsigned char)(0xC0 | encode)); @@ -5867,9 +6184,9 @@ void Assembler::vextracti32x4(Address dst, XMMRegister src, uint8_t imm8) { } void Assembler::vextracti64x2(XMMRegister dst, XMMRegister src, uint8_t imm8) { - assert(VM_Version::supports_evex(), ""); + assert(VM_Version::supports_avx512dq(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x39); emit_int8((unsigned char)(0xC0 | encode)); @@ -5957,9 +6274,9 @@ void Assembler::vextractf32x4(Address dst, XMMRegister src, uint8_t imm8) { } void Assembler::vextractf64x2(XMMRegister dst, XMMRegister src, uint8_t imm8) { - assert(VM_Version::supports_evex(), ""); + assert(VM_Version::supports_avx512dq(), ""); assert(imm8 <= 0x03, "imm8: %u", imm8); - InstructionAttr attributes(AVX_512bit, /* vex_w */ !_legacy_mode_dq, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); + InstructionAttr attributes(AVX_512bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ false); int encode = vex_prefix_and_encode(src->encoding(), 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); emit_int8(0x19); emit_int8((unsigned char)(0xC0 | encode)); @@ -6084,7 +6401,8 @@ void Assembler::evpbroadcastd(XMMRegister dst, Address src, int vector_len) { // duplicate 8-byte integer data from src into programmed locations in dest : requires AVX512VL void Assembler::evpbroadcastq(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x59); emit_int8((unsigned char)(0xC0 | encode)); @@ -6094,7 +6412,8 @@ void Assembler::evpbroadcastq(XMMRegister dst, Address src, int vector_len) { assert(VM_Version::supports_evex(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); // swap src<->dst for encoding vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); @@ -6129,7 +6448,8 @@ void Assembler::evpbroadcastss(XMMRegister dst, Address src, int vector_len) { // duplicate double precision data from src into programmed locations in dest : requires AVX512VL void Assembler::evpbroadcastsd(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_evex(), ""); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_rex_vex_w_reverted(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x19); emit_int8((unsigned char)(0xC0 | encode)); @@ -6139,8 +6459,9 @@ void Assembler::evpbroadcastsd(XMMRegister dst, Address src, int vector_len) { assert(VM_Version::supports_evex(), ""); assert(dst != xnoreg, "sanity"); InstructionMark im(this); - InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + InstructionAttr attributes(vector_len, /* vex_w */ VM_Version::supports_evex(), /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); attributes.set_address_attributes(/* tuple_type */ EVEX_T1S, /* input_size_in_bits */ EVEX_64bit); + attributes.set_rex_vex_w_reverted(); // swap src<->dst for encoding vex_prefix(src, 0, dst->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); emit_int8(0x19); @@ -6154,12 +6475,9 @@ void Assembler::evpbroadcastsd(XMMRegister dst, Address src, int vector_len) { void Assembler::evpbroadcastb(XMMRegister dst, Register src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); - if (attributes.is_evex_instruction()) { - emit_int8(0x7A); - } else { - emit_int8(0x78); - } + emit_int8(0x7A); emit_int8((unsigned char)(0xC0 | encode)); } @@ -6167,12 +6485,9 @@ void Assembler::evpbroadcastb(XMMRegister dst, Register src, int vector_len) { void Assembler::evpbroadcastw(XMMRegister dst, Register src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ _legacy_mode_bw, /* no_mask_reg */ true, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); - if (attributes.is_evex_instruction()) { - emit_int8(0x7B); - } else { - emit_int8(0x79); - } + emit_int8(0x7B); emit_int8((unsigned char)(0xC0 | encode)); } @@ -6180,12 +6495,9 @@ void Assembler::evpbroadcastw(XMMRegister dst, Register src, int vector_len) { void Assembler::evpbroadcastd(XMMRegister dst, Register src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionAttr attributes(vector_len, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); - if (attributes.is_evex_instruction()) { - emit_int8(0x7C); - } else { - emit_int8(0x58); - } + emit_int8(0x7C); emit_int8((unsigned char)(0xC0 | encode)); } @@ -6193,12 +6505,9 @@ void Assembler::evpbroadcastd(XMMRegister dst, Register src, int vector_len) { void Assembler::evpbroadcastq(XMMRegister dst, Register src, int vector_len) { assert(VM_Version::supports_evex(), ""); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ false, /* uses_vl */ true); + attributes.set_is_evex_instruction(); int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); - if (attributes.is_evex_instruction()) { - emit_int8(0x7C); - } else { - emit_int8(0x59); - } + emit_int8(0x7C); emit_int8((unsigned char)(0xC0 | encode)); } @@ -6230,7 +6539,6 @@ void Assembler::vzeroupper() { emit_int8(0x77); } - #ifndef _LP64 // 32bit only pieces of the assembler @@ -6797,7 +7105,10 @@ void Assembler::evex_prefix(bool vex_r, bool vex_b, bool vex_x, bool evex_r, boo emit_int8(byte3); // P2: byte 4 as zL'Lbv'aaa - int byte4 = (_attributes->is_no_reg_mask()) ? 0 : 1; // kregs are implemented in the low 3 bits as aaa (hard code k1, it will be initialized for now) + // kregs are implemented in the low 3 bits as aaa (hard code k1, it will be initialized for now) + int byte4 = (_attributes->is_no_reg_mask()) ? + 0 : + _attributes->get_embedded_opmask_register_specifier(); // EVEX.v` for extending EVEX.vvvv or VIDX byte4 |= (evex_v ? 0: EVEX_V); // third EXEC.b for broadcast actions @@ -6853,6 +7164,9 @@ void Assembler::vex_prefix(Address adr, int nds_enc, int xreg_enc, VexSimdPrefix attributes->set_is_evex_instruction(); evex_prefix(vex_r, vex_b, vex_x, evex_r, evex_v, nds_enc, pre, opc); } else { + if (UseAVX > 2 && attributes->is_rex_vex_w_reverted()) { + attributes->set_rex_vex_w(false); + } vex_prefix(vex_r, vex_b, vex_x, nds_enc, pre, opc); } } @@ -6912,6 +7226,9 @@ int Assembler::vex_prefix_and_encode(int dst_enc, int nds_enc, int src_enc, VexS attributes->set_is_evex_instruction(); evex_prefix(vex_r, vex_b, vex_x, evex_r, evex_v, nds_enc, pre, opc); } else { + if (UseAVX > 2 && attributes->is_rex_vex_w_reverted()) { + attributes->set_rex_vex_w(false); + } vex_prefix(vex_r, vex_b, vex_x, nds_enc, pre, opc); } @@ -6966,6 +7283,21 @@ void Assembler::vpblendd(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMM emit_int8((unsigned char)(0xF0 & src2_enc<<4)); } +void Assembler::shlxl(Register dst, Register src1, Register src2) { + assert(VM_Version::supports_bmi2(), ""); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), src2->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xC0 | encode)); +} + +void Assembler::shlxq(Register dst, Register src1, Register src2) { + assert(VM_Version::supports_bmi2(), ""); + InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), src2->encoding(), src1->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int8((unsigned char)0xF7); + emit_int8((unsigned char)(0xC0 | encode)); +} #ifndef _LP64 @@ -8185,6 +8517,15 @@ void Assembler::rorxq(Register dst, Register src, int imm8) { emit_int8(imm8); } +void Assembler::rorxd(Register dst, Register src, int imm8) { + assert(VM_Version::supports_bmi2(), "bit manipulation instructions not supported"); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ true, /* no_mask_reg */ false, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), 0, src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F_3A, &attributes); + emit_int8((unsigned char)0xF0); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(imm8); +} + void Assembler::sarq(Register dst, int imm8) { assert(isShiftCount(imm8 >> 1), "illegal shift count"); int encode = prefixq_and_encode(dst->encoding()); diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index fd3053d1e6f..56165382936 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -587,6 +587,16 @@ class Assembler : public AbstractAssembler { #endif }; + enum ComparisonPredicate { + eq = 0, + lt = 1, + le = 2, + _false = 3, + neq = 4, + nlt = 5, + nle = 6, + _true = 7 + }; // NOTE: The general philopsophy of the declarations here is that 64bit versions @@ -606,6 +616,7 @@ private: bool _legacy_mode_vl; bool _legacy_mode_vlbw; bool _is_managed; + bool _vector_masking; // For stub code use only class InstructionAttr *_attributes; @@ -813,6 +824,7 @@ private: _legacy_mode_vl = (VM_Version::supports_avx512vl() == false); _legacy_mode_vlbw = (VM_Version::supports_avx512vlbw() == false); _is_managed = false; + _vector_masking = false; _attributes = NULL; } @@ -823,6 +835,11 @@ private: void clear_managed(void) { _is_managed = false; } bool is_managed(void) { return _is_managed; } + // Following functions are for stub code use only + void set_vector_masking(void) { _vector_masking = true; } + void clear_vector_masking(void) { _vector_masking = false; } + bool is_vector_masking(void) { return _vector_masking; } + void lea(Register dst, Address src); void mov(Register dst, Register src); @@ -1048,6 +1065,8 @@ private: void cvttss2sil(Register dst, XMMRegister src); void cvttss2siq(Register dst, XMMRegister src); + void cvttpd2dq(XMMRegister dst, XMMRegister src); + // Divide Scalar Double-Precision Floating-Point Values void divsd(XMMRegister dst, Address src); void divsd(XMMRegister dst, XMMRegister src); @@ -1335,6 +1354,7 @@ private: void kmovbl(KRegister dst, Register src); void kmovbl(Register dst, KRegister src); void kmovwl(KRegister dst, Register src); + void kmovwl(KRegister dst, Address src); void kmovwl(Register dst, KRegister src); void kmovdl(KRegister dst, Register src); void kmovdl(Register dst, KRegister src); @@ -1344,11 +1364,18 @@ private: void kmovql(KRegister dst, Register src); void kmovql(Register dst, KRegister src); + void knotwl(KRegister dst, KRegister src); + void kortestbl(KRegister dst, KRegister src); void kortestwl(KRegister dst, KRegister src); void kortestdl(KRegister dst, KRegister src); void kortestql(KRegister dst, KRegister src); + void ktestq(KRegister src1, KRegister src2); + void ktestd(KRegister src1, KRegister src2); + + void ktestql(KRegister dst, KRegister src); + void movdl(XMMRegister dst, Register src); void movdl(Register dst, XMMRegister src); void movdl(XMMRegister dst, Address src); @@ -1376,9 +1403,11 @@ private: void evmovdqub(Address dst, XMMRegister src, int vector_len); void evmovdqub(XMMRegister dst, Address src, int vector_len); void evmovdqub(XMMRegister dst, XMMRegister src, int vector_len); + void evmovdqub(XMMRegister dst, KRegister mask, Address src, int vector_len); void evmovdquw(Address dst, XMMRegister src, int vector_len); + void evmovdquw(Address dst, KRegister mask, XMMRegister src, int vector_len); void evmovdquw(XMMRegister dst, Address src, int vector_len); - void evmovdquw(XMMRegister dst, XMMRegister src, int vector_len); + void evmovdquw(XMMRegister dst, KRegister mask, Address src, int vector_len); void evmovdqul(Address dst, XMMRegister src, int vector_len); void evmovdqul(XMMRegister dst, Address src, int vector_len); void evmovdqul(XMMRegister dst, XMMRegister src, int vector_len); @@ -1517,6 +1546,7 @@ private: // Pemutation of 64bit words void vpermq(XMMRegister dst, XMMRegister src, int imm8, int vector_len); void vpermq(XMMRegister dst, XMMRegister src, int imm8); + void vperm2i128(XMMRegister dst, XMMRegister nds, XMMRegister src, int imm8); void pause(); @@ -1528,6 +1558,14 @@ private: void vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); void evpcmpeqb(KRegister kdst, XMMRegister nds, XMMRegister src, int vector_len); void evpcmpeqb(KRegister kdst, XMMRegister nds, Address src, int vector_len); + void evpcmpeqb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len); + + void evpcmpgtb(KRegister kdst, XMMRegister nds, Address src, int vector_len); + void evpcmpgtb(KRegister kdst, KRegister mask, XMMRegister nds, Address src, int vector_len); + + void evpcmpuw(KRegister kdst, XMMRegister nds, XMMRegister src, ComparisonPredicate vcc, int vector_len); + void evpcmpuw(KRegister kdst, KRegister mask, XMMRegister nds, XMMRegister src, ComparisonPredicate of, int vector_len); + void evpcmpuw(KRegister kdst, XMMRegister nds, Address src, ComparisonPredicate vcc, int vector_len); void pcmpeqw(XMMRegister dst, XMMRegister src); void vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); @@ -1571,7 +1609,11 @@ private: void pmovzxbw(XMMRegister dst, XMMRegister src); void pmovzxbw(XMMRegister dst, Address src); - void vpmovzxbw(XMMRegister dst, Address src, int vector_len); + void vpmovzxbw( XMMRegister dst, Address src, int vector_len); + void evpmovzxbw(XMMRegister dst, KRegister mask, Address src, int vector_len); + + void evpmovwb(Address dst, XMMRegister src, int vector_len); + void evpmovwb(Address dst, KRegister mask, XMMRegister src, int vector_len); #ifndef _LP64 // no 32bit push/pop on amd64 void popl(Address dst); @@ -1601,10 +1643,12 @@ private: // Shuffle Bytes void pshufb(XMMRegister dst, XMMRegister src); void pshufb(XMMRegister dst, Address src); + void vpshufb(XMMRegister dst, XMMRegister nds, XMMRegister src, int vector_len); // Shuffle Packed Doublewords void pshufd(XMMRegister dst, XMMRegister src, int mode); void pshufd(XMMRegister dst, Address src, int mode); + void vpshufd(XMMRegister dst, XMMRegister src, int mode, int vector_len); // Shuffle Packed Low Words void pshuflw(XMMRegister dst, XMMRegister src, int mode); @@ -1656,6 +1700,7 @@ private: #ifdef _LP64 void rorq(Register dst, int imm8); void rorxq(Register dst, Register src, int imm8); + void rorxd(Register dst, Register src, int imm8); #endif void sahf(); @@ -1679,6 +1724,8 @@ private: void setb(Condition cc, Register dst); void palignr(XMMRegister dst, XMMRegister src, int imm8); + void vpalignr(XMMRegister dst, XMMRegister src1, XMMRegister src2, int imm8, int vector_len); + void pblendw(XMMRegister dst, XMMRegister src, int imm8); void sha1rnds4(XMMRegister dst, XMMRegister src, int imm8); @@ -1816,6 +1863,8 @@ private: void vsubss(XMMRegister dst, XMMRegister nds, Address src); void vsubss(XMMRegister dst, XMMRegister nds, XMMRegister src); + void shlxl(Register dst, Register src1, Register src2); + void shlxq(Register dst, Register src1, Register src2); //====================VECTOR ARITHMETIC===================================== @@ -2050,7 +2099,6 @@ private: void cmppd(XMMRegister dst, XMMRegister nds, XMMRegister src, int cop, int vector_len); void vpblendd(XMMRegister dst, XMMRegister nds, XMMRegister src1, XMMRegister src2, int vector_len); - protected: // Next instructions require address alignment 16 bytes SSE mode. // They should be called only from corresponding MacroAssembler instructions. @@ -2075,6 +2123,7 @@ public: : _avx_vector_len(vector_len), _rex_vex_w(rex_vex_w), + _rex_vex_w_reverted(false), _legacy_mode(legacy_mode), _no_reg_mask(no_reg_mask), _uses_vl(uses_vl), @@ -2084,7 +2133,8 @@ public: _evex_encoding(0), _is_clear_context(false), _is_extended_context(false), - _current_assembler(NULL) { + _current_assembler(NULL), + _embedded_opmask_register_specifier(1) { // hard code k1, it will be initialized for now if (UseAVX < 3) _legacy_mode = true; } @@ -2098,6 +2148,7 @@ public: private: int _avx_vector_len; bool _rex_vex_w; + bool _rex_vex_w_reverted; bool _legacy_mode; bool _no_reg_mask; bool _uses_vl; @@ -2107,6 +2158,7 @@ private: int _evex_encoding; bool _is_clear_context; bool _is_extended_context; + int _embedded_opmask_register_specifier; Assembler *_current_assembler; @@ -2114,6 +2166,7 @@ public: // query functions for field accessors int get_vector_len(void) const { return _avx_vector_len; } bool is_rex_vex_w(void) const { return _rex_vex_w; } + bool is_rex_vex_w_reverted(void) { return _rex_vex_w_reverted; } bool is_legacy_mode(void) const { return _legacy_mode; } bool is_no_reg_mask(void) const { return _no_reg_mask; } bool uses_vl(void) const { return _uses_vl; } @@ -2123,10 +2176,17 @@ public: int get_evex_encoding(void) const { return _evex_encoding; } bool is_clear_context(void) const { return _is_clear_context; } bool is_extended_context(void) const { return _is_extended_context; } + int get_embedded_opmask_register_specifier(void) const { return _embedded_opmask_register_specifier; } // Set the vector len manually void set_vector_len(int vector_len) { _avx_vector_len = vector_len; } + // Set revert rex_vex_w for avx encoding + void set_rex_vex_w_reverted(void) { _rex_vex_w_reverted = true; } + + // Set rex_vex_w based on state + void set_rex_vex_w(bool state) { _rex_vex_w = state; } + // Set the instruction to be encoded in AVX mode void set_is_legacy_mode(void) { _legacy_mode = true; } @@ -2150,6 +2210,11 @@ public: } } + // Set embedded opmask register specifier. + void set_embedded_opmask_register_specifier(KRegister mask) { + _embedded_opmask_register_specifier = (*mask).encoding() & 0x7; + } + }; #endif // CPU_X86_VM_ASSEMBLER_X86_HPP diff --git a/hotspot/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp b/hotspot/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp index 3fbd57c5ca3..6d91d1948e9 100644 --- a/hotspot/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_FpuStackSim_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -169,18 +169,18 @@ void FpuStackSim::clear() { intArray* FpuStackSim::write_state() { intArray* res = new intArray(1 + FrameMap::nof_fpu_regs); - (*res)[0] = stack_size(); + res->append(stack_size()); for (int i = 0; i < FrameMap::nof_fpu_regs; i++) { - (*res)[1 + i] = regs_at(i); + res->append(regs_at(i)); } return res; } void FpuStackSim::read_state(intArray* fpu_stack_state) { - _stack_size = (*fpu_stack_state)[0]; + _stack_size = fpu_stack_state->at(0); for (int i = 0; i < FrameMap::nof_fpu_regs; i++) { - set_regs_at(i, (*fpu_stack_state)[1 + i]); + set_regs_at(i, fpu_stack_state->at(1 + i)); } } diff --git a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp index c23ebaad86f..3a9bf0a6d2f 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp @@ -2365,13 +2365,8 @@ void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr unused, L } else if (value->is_double_fpu()) { assert(value->fpu_regnrLo() == 0 && dest->fpu_regnrLo() == 0, "both must be on TOS"); switch(code) { - case lir_log10 : __ flog10() ; break; case lir_abs : __ fabs() ; break; case lir_sqrt : __ fsqrt(); break; - case lir_tan : - // Should consider not saving rbx, if not necessary - __ trigfunc('t', op->as_Op2()->fpu_stack_size()); - break; default : ShouldNotReachHere(); } } else { @@ -3886,6 +3881,10 @@ void LIR_Assembler::membar_storeload() { __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad)); } +void LIR_Assembler::on_spin_wait() { + __ pause (); +} + void LIR_Assembler::get_thread(LIR_Opr result_reg) { assert(result_reg->is_register(), "check"); #ifdef _LP64 diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp index 20c19325463..26488c92dc0 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -813,7 +813,8 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { if (x->id() == vmIntrinsics::_dexp || x->id() == vmIntrinsics::_dlog || x->id() == vmIntrinsics::_dpow || x->id() == vmIntrinsics::_dcos || - x->id() == vmIntrinsics::_dsin) { + x->id() == vmIntrinsics::_dsin || x->id() == vmIntrinsics::_dtan || + x->id() == vmIntrinsics::_dlog10) { do_LibmIntrinsic(x); return; } @@ -821,58 +822,17 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { LIRItem value(x->argument_at(0), this); bool use_fpu = false; - if (UseSSE >= 2) { - switch(x->id()) { - case vmIntrinsics::_dtan: - case vmIntrinsics::_dlog10: - use_fpu = true; - break; - } - } else { + if (UseSSE < 2) { value.set_destroys_register(); } - value.load_item(); LIR_Opr calc_input = value.result(); - LIR_Opr calc_input2 = NULL; - if (x->id() == vmIntrinsics::_dpow) { - LIRItem extra_arg(x->argument_at(1), this); - if (UseSSE < 2) { - extra_arg.set_destroys_register(); - } - extra_arg.load_item(); - calc_input2 = extra_arg.result(); - } LIR_Opr calc_result = rlock_result(x); - // sin, cos, pow and exp need two free fpu stack slots, so register - // two temporary operands - LIR_Opr tmp1 = FrameMap::caller_save_fpu_reg_at(0); - LIR_Opr tmp2 = FrameMap::caller_save_fpu_reg_at(1); - - if (use_fpu) { - LIR_Opr tmp = FrameMap::fpu0_double_opr; - int tmp_start = 1; - if (calc_input2 != NULL) { - __ move(calc_input2, tmp); - tmp_start = 2; - calc_input2 = tmp; - } - __ move(calc_input, tmp); - - calc_input = tmp; - calc_result = tmp; - - tmp1 = FrameMap::caller_save_fpu_reg_at(tmp_start); - tmp2 = FrameMap::caller_save_fpu_reg_at(tmp_start + 1); - } - switch(x->id()) { case vmIntrinsics::_dabs: __ abs (calc_input, calc_result, LIR_OprFact::illegalOpr); break; case vmIntrinsics::_dsqrt: __ sqrt (calc_input, calc_result, LIR_OprFact::illegalOpr); break; - case vmIntrinsics::_dtan: __ tan (calc_input, calc_result, tmp1, tmp2); break; - case vmIntrinsics::_dlog10: __ log10(calc_input, calc_result, tmp1); break; default: ShouldNotReachHere(); } @@ -913,21 +873,28 @@ void LIRGenerator::do_LibmIntrinsic(Intrinsic* x) { result_reg = tmp; switch(x->id()) { case vmIntrinsics::_dexp: - if (VM_Version::supports_sse2()) { + if (StubRoutines::dexp() != NULL) { __ call_runtime_leaf(StubRoutines::dexp(), getThreadTemp(), result_reg, cc->args()); } else { __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dexp), getThreadTemp(), result_reg, cc->args()); } break; case vmIntrinsics::_dlog: - if (VM_Version::supports_sse2()) { + if (StubRoutines::dlog() != NULL) { __ call_runtime_leaf(StubRoutines::dlog(), getThreadTemp(), result_reg, cc->args()); } else { __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog), getThreadTemp(), result_reg, cc->args()); } break; + case vmIntrinsics::_dlog10: + if (StubRoutines::dlog10() != NULL) { + __ call_runtime_leaf(StubRoutines::dlog10(), getThreadTemp(), result_reg, cc->args()); + } else { + __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10), getThreadTemp(), result_reg, cc->args()); + } + break; case vmIntrinsics::_dpow: - if (VM_Version::supports_sse2()) { + if (StubRoutines::dpow() != NULL) { __ call_runtime_leaf(StubRoutines::dpow(), getThreadTemp(), result_reg, cc->args()); } else { __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dpow), getThreadTemp(), result_reg, cc->args()); @@ -947,18 +914,44 @@ void LIRGenerator::do_LibmIntrinsic(Intrinsic* x) { __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dcos), getThreadTemp(), result_reg, cc->args()); } break; + case vmIntrinsics::_dtan: + if (StubRoutines::dtan() != NULL) { + __ call_runtime_leaf(StubRoutines::dtan(), getThreadTemp(), result_reg, cc->args()); + } else { + __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtan), getThreadTemp(), result_reg, cc->args()); + } + break; default: ShouldNotReachHere(); } #else switch (x->id()) { case vmIntrinsics::_dexp: - __ call_runtime_leaf(StubRoutines::dexp(), getThreadTemp(), result_reg, cc->args()); + if (StubRoutines::dexp() != NULL) { + __ call_runtime_leaf(StubRoutines::dexp(), getThreadTemp(), result_reg, cc->args()); + } else { + __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dexp), getThreadTemp(), result_reg, cc->args()); + } break; case vmIntrinsics::_dlog: + if (StubRoutines::dlog() != NULL) { __ call_runtime_leaf(StubRoutines::dlog(), getThreadTemp(), result_reg, cc->args()); + } else { + __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog), getThreadTemp(), result_reg, cc->args()); + } + break; + case vmIntrinsics::_dlog10: + if (StubRoutines::dlog10() != NULL) { + __ call_runtime_leaf(StubRoutines::dlog10(), getThreadTemp(), result_reg, cc->args()); + } else { + __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10), getThreadTemp(), result_reg, cc->args()); + } break; case vmIntrinsics::_dpow: + if (StubRoutines::dpow() != NULL) { __ call_runtime_leaf(StubRoutines::dpow(), getThreadTemp(), result_reg, cc->args()); + } else { + __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dpow), getThreadTemp(), result_reg, cc->args()); + } break; case vmIntrinsics::_dsin: if (StubRoutines::dsin() != NULL) { @@ -974,6 +967,13 @@ void LIRGenerator::do_LibmIntrinsic(Intrinsic* x) { __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dcos), getThreadTemp(), result_reg, cc->args()); } break; + case vmIntrinsics::_dtan: + if (StubRoutines::dtan() != NULL) { + __ call_runtime_leaf(StubRoutines::dtan(), getThreadTemp(), result_reg, cc->args()); + } else { + __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtan), getThreadTemp(), result_reg, cc->args()); + } + break; default: ShouldNotReachHere(); } #endif // _LP64 @@ -1109,6 +1109,87 @@ void LIRGenerator::do_update_CRC32(Intrinsic* x) { } } +void LIRGenerator::do_update_CRC32C(Intrinsic* x) { + Unimplemented(); +} + +void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) { + assert(UseVectorizedMismatchIntrinsic, "need AVX instruction support"); + + // Make all state_for calls early since they can emit code + LIR_Opr result = rlock_result(x); + + LIRItem a(x->argument_at(0), this); // Object + LIRItem aOffset(x->argument_at(1), this); // long + LIRItem b(x->argument_at(2), this); // Object + LIRItem bOffset(x->argument_at(3), this); // long + LIRItem length(x->argument_at(4), this); // int + LIRItem log2ArrayIndexScale(x->argument_at(5), this); // int + + a.load_item(); + aOffset.load_nonconstant(); + b.load_item(); + bOffset.load_nonconstant(); + + long constant_aOffset = 0; + LIR_Opr result_aOffset = aOffset.result(); + if (result_aOffset->is_constant()) { + constant_aOffset = result_aOffset->as_jlong(); + result_aOffset = LIR_OprFact::illegalOpr; + } + LIR_Opr result_a = a.result(); + + long constant_bOffset = 0; + LIR_Opr result_bOffset = bOffset.result(); + if (result_bOffset->is_constant()) { + constant_bOffset = result_bOffset->as_jlong(); + result_bOffset = LIR_OprFact::illegalOpr; + } + LIR_Opr result_b = b.result(); + +#ifndef _LP64 + result_a = new_register(T_INT); + __ convert(Bytecodes::_l2i, a.result(), result_a); + result_b = new_register(T_INT); + __ convert(Bytecodes::_l2i, b.result(), result_b); +#endif + + + LIR_Address* addr_a = new LIR_Address(result_a, + result_aOffset, + LIR_Address::times_1, + constant_aOffset, + T_BYTE); + + LIR_Address* addr_b = new LIR_Address(result_b, + result_bOffset, + LIR_Address::times_1, + constant_bOffset, + T_BYTE); + + BasicTypeList signature(4); + signature.append(T_ADDRESS); + signature.append(T_ADDRESS); + signature.append(T_INT); + signature.append(T_INT); + CallingConvention* cc = frame_map()->c_calling_convention(&signature); + const LIR_Opr result_reg = result_register_for(x->type()); + + LIR_Opr ptr_addr_a = new_pointer_register(); + __ leal(LIR_OprFact::address(addr_a), ptr_addr_a); + + LIR_Opr ptr_addr_b = new_pointer_register(); + __ leal(LIR_OprFact::address(addr_b), ptr_addr_b); + + __ move(ptr_addr_a, cc->at(0)); + __ move(ptr_addr_b, cc->at(1)); + length.load_item_force(cc->at(2)); + log2ArrayIndexScale.load_item_force(cc->at(3)); + + __ call_runtime_leaf(StubRoutines::vectorizedMismatch(), getThreadTemp(), result_reg, cc->args()); + __ move(result_reg, result); +} + // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f // _i2b, _i2c, _i2s LIR_Opr fixed_register_for(BasicType type) { @@ -1261,7 +1342,7 @@ void LIRGenerator::do_NewObjectArray(NewObjectArray* x) { void LIRGenerator::do_NewMultiArray(NewMultiArray* x) { Values* dims = x->dims(); int i = dims->length(); - LIRItemList* items = new LIRItemList(dims->length(), NULL); + LIRItemList* items = new LIRItemList(i, i, NULL); while (i-- > 0) { LIRItem* size = new LIRItem(dims->at(i), this); items->at_put(i, size); diff --git a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp index c3108727fec..5c411814df7 100644 --- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp @@ -67,7 +67,7 @@ void LinearScan::allocate_fpu_stack() { // register information would be incorrect. if (b->number_of_preds() > 1) { int id = b->first_lir_instruction_id(); - BitMap regs(FrameMap::nof_fpu_regs); + ResourceBitMap regs(FrameMap::nof_fpu_regs); regs.clear(); iw.walk_to(id); // walk after the first instruction (always a label) of the block @@ -786,58 +786,6 @@ void FpuStackAllocator::handle_op2(LIR_Op2* op2) { break; } - case lir_log10: { - // log and log10 need one temporary fpu stack slot, so - // there is one temporary registers stored in temp of the - // operation. the stack allocator must guarantee that the stack - // slots are really free, otherwise there might be a stack - // overflow. - assert(right->is_illegal(), "must be"); - assert(left->is_fpu_register(), "must be"); - assert(res->is_fpu_register(), "must be"); - assert(op2->tmp1_opr()->is_fpu_register(), "must be"); - - insert_free_if_dead(op2->tmp1_opr()); - insert_free_if_dead(res, left); - insert_exchange(left); - do_rename(left, res); - - new_left = to_fpu_stack_top(res); - new_res = new_left; - - op2->set_fpu_stack_size(sim()->stack_size()); - assert(sim()->stack_size() <= 7, "at least one stack slot must be free"); - break; - } - - - case lir_tan: { - // sin, cos and exp need two temporary fpu stack slots, so there are two temporary - // registers (stored in right and temp of the operation). - // the stack allocator must guarantee that the stack slots are really free, - // otherwise there might be a stack overflow. - assert(left->is_fpu_register(), "must be"); - assert(res->is_fpu_register(), "must be"); - // assert(left->is_last_use(), "old value gets destroyed"); - assert(right->is_fpu_register(), "right is used as the first temporary register"); - assert(op2->tmp1_opr()->is_fpu_register(), "temp is used as the second temporary register"); - assert(fpu_num(left) != fpu_num(right) && fpu_num(right) != fpu_num(op2->tmp1_opr()) && fpu_num(op2->tmp1_opr()) != fpu_num(res), "need distinct temp registers"); - - insert_free_if_dead(right); - insert_free_if_dead(op2->tmp1_opr()); - - insert_free_if_dead(res, left); - insert_exchange(left); - do_rename(left, res); - - new_left = to_fpu_stack_top(res); - new_res = new_left; - - op2->set_fpu_stack_size(sim()->stack_size()); - assert(sim()->stack_size() <= 6, "at least two stack slots must be free"); - break; - } - default: { assert(false, "missed a fpu-operation"); } @@ -1121,7 +1069,7 @@ bool FpuStackAllocator::merge_fpu_stack_with_successors(BlockBegin* block) { // clean up stack first so that there are no dead values on the stack if (ComputeExactFPURegisterUsage) { FpuStackSim* cur_sim = sim(); - BitMap live_fpu_regs = block->sux_at(0)->fpu_register_usage(); + ResourceBitMap live_fpu_regs = block->sux_at(0)->fpu_register_usage(); assert(live_fpu_regs.size() == FrameMap::nof_fpu_regs, "missing register usage"); merge_cleanup_fpu_stack(instrs, cur_sim, live_fpu_regs); diff --git a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp index 865e149331c..6d4c06f19ff 100644 --- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp +++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -31,22 +31,6 @@ #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" -// Release the CompiledICHolder* associated with this call site is there is one. -void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - if (is_icholder_entry(call->destination())) { - NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); - InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); - } -} - -bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - return is_icholder_entry(call->destination()); -} - // ---------------------------------------------------------------------------- #define __ _masm. diff --git a/hotspot/src/cpu/x86/vm/frame_x86.cpp b/hotspot/src/cpu/x86/vm/frame_x86.cpp index d61ae16729c..ae8628c05d2 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -95,7 +95,7 @@ bool frame::safe_for_sender(JavaThread *thread) { // ok. adapter blobs never have a frame complete and are never ok. if (!_cb->is_frame_complete_at(_pc)) { - if (_cb->is_nmethod() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) { + if (_cb->is_compiled() || _cb->is_adapter_blob() || _cb->is_runtime_stub()) { return false; } } @@ -220,13 +220,11 @@ bool frame::safe_for_sender(JavaThread *thread) { return jcw_safe; } - if (sender_blob->is_nmethod()) { - nmethod* nm = sender_blob->as_nmethod_or_null(); - if (nm != NULL) { - if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) || - nm->method()->is_method_handle_intrinsic()) { - return false; - } + CompiledMethod* nm = sender_blob->as_compiled_method_or_null(); + if (nm != NULL) { + if (nm->is_deopt_mh_entry(sender_pc) || nm->is_deopt_entry(sender_pc) || + nm->method()->is_method_handle_intrinsic()) { + return false; } } @@ -234,7 +232,7 @@ bool frame::safe_for_sender(JavaThread *thread) { // because the return address counts against the callee's frame. if (sender_blob->frame_size() <= 0) { - assert(!sender_blob->is_nmethod(), "should count return address at least"); + assert(!sender_blob->is_compiled(), "should count return address at least"); return false; } @@ -243,7 +241,7 @@ bool frame::safe_for_sender(JavaThread *thread) { // should not be anything but the call stub (already covered), the interpreter (already covered) // or an nmethod. - if (!sender_blob->is_nmethod()) { + if (!sender_blob->is_compiled()) { return false; } @@ -286,7 +284,7 @@ void frame::patch_pc(Thread* thread, address pc) { assert(_pc == *pc_addr || pc == *pc_addr, "must be"); *pc_addr = pc; _cb = CodeCache::find_blob(pc); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { assert(original_pc == _pc, "expected original PC to be stored before patching"); _deopt_state = is_deoptimized; @@ -372,7 +370,7 @@ frame frame::sender_for_entry_frame(RegisterMap* map) const { // Verifies the calculated original PC of a deoptimization PC for the // given unextended SP. #ifdef ASSERT -void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) { +void frame::verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp) { frame fr; // This is ugly but it's better than to change {get,set}_original_pc @@ -381,7 +379,7 @@ void frame::verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp) { fr._unextended_sp = unextended_sp; address original_pc = nm->get_original_pc(&fr); - assert(nm->insts_contains(original_pc), "original PC must be in nmethod"); + assert(nm->insts_contains(original_pc), "original PC must be in CompiledMethod"); } #endif @@ -392,12 +390,14 @@ void frame::adjust_unextended_sp() { // as any other call site. Therefore, no special action is needed when we are // returning to any of these call sites. - nmethod* sender_nm = (_cb == NULL) ? NULL : _cb->as_nmethod_or_null(); - if (sender_nm != NULL) { - // If the sender PC is a deoptimization point, get the original PC. - if (sender_nm->is_deopt_entry(_pc) || - sender_nm->is_deopt_mh_entry(_pc)) { - DEBUG_ONLY(verify_deopt_original_pc(sender_nm, _unextended_sp)); + if (_cb != NULL) { + CompiledMethod* sender_cm = _cb->as_compiled_method_or_null(); + if (sender_cm != NULL) { + // If the sender PC is a deoptimization point, get the original PC. + if (sender_cm->is_deopt_entry(_pc) || + sender_cm->is_deopt_mh_entry(_pc)) { + DEBUG_ONLY(verify_deopt_original_pc(sender_cm, _unextended_sp)); + } } } } @@ -640,6 +640,7 @@ void frame::describe_pd(FrameValues& values, int frame_no) { DESCRIBE_FP_OFFSET(interpreter_frame_sender_sp); DESCRIBE_FP_OFFSET(interpreter_frame_last_sp); DESCRIBE_FP_OFFSET(interpreter_frame_method); + DESCRIBE_FP_OFFSET(interpreter_frame_mirror); DESCRIBE_FP_OFFSET(interpreter_frame_mdp); DESCRIBE_FP_OFFSET(interpreter_frame_cache); DESCRIBE_FP_OFFSET(interpreter_frame_locals); diff --git a/hotspot/src/cpu/x86/vm/frame_x86.hpp b/hotspot/src/cpu/x86/vm/frame_x86.hpp index b10f9ce37e6..dbfcaf70dc3 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.hpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.hpp @@ -70,7 +70,8 @@ // outgoing sp before a call to an invoked method interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1, interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1, - interpreter_frame_mdp_offset = interpreter_frame_method_offset - 1, + interpreter_frame_mirror_offset = interpreter_frame_method_offset - 1, + interpreter_frame_mdp_offset = interpreter_frame_mirror_offset - 1, interpreter_frame_cache_offset = interpreter_frame_mdp_offset - 1, interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1, interpreter_frame_bcp_offset = interpreter_frame_locals_offset - 1, @@ -124,7 +125,7 @@ #ifdef ASSERT // Used in frame::sender_for_{interpreter,compiled}_frame - static void verify_deopt_original_pc(nmethod* nm, intptr_t* unextended_sp); + static void verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp); #endif public: diff --git a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp index 374d83ca5cd..0c968ce80cf 100644 --- a/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp +++ b/hotspot/src/cpu/x86/vm/frame_x86.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -50,7 +50,7 @@ inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) { _cb = CodeCache::find_blob(pc); adjust_unextended_sp(); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; _deopt_state = is_deoptimized; @@ -72,10 +72,10 @@ inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address _cb = CodeCache::find_blob(pc); adjust_unextended_sp(); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; - assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod"); + assert(((CompiledMethod*)_cb)->insts_contains(_pc), "original PC must be in CompiledMethod"); _deopt_state = is_deoptimized; } else { if (_cb->is_deoptimization_stub()) { @@ -106,7 +106,7 @@ inline frame::frame(intptr_t* sp, intptr_t* fp) { _cb = CodeCache::find_blob(_pc); adjust_unextended_sp(); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; _deopt_state = is_deoptimized; @@ -184,6 +184,12 @@ inline Method** frame::interpreter_frame_method_addr() const { return (Method**)addr_at(interpreter_frame_method_offset); } +// Mirror + +inline oop* frame::interpreter_frame_mirror_addr() const { + return (oop*)addr_at(interpreter_frame_mirror_offset); +} + // top of expression stack inline intptr_t* frame::interpreter_frame_tos_address() const { intptr_t* last_sp = interpreter_frame_last_sp(); diff --git a/hotspot/src/cpu/x86/vm/globals_x86.hpp b/hotspot/src/cpu/x86/vm/globals_x86.hpp index a8d36092b58..93aea2a18d7 100644 --- a/hotspot/src/cpu/x86/vm/globals_x86.hpp +++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp @@ -99,7 +99,14 @@ define_pd_global(bool, PreserveFramePointer, false); define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); -#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint) \ +#define ARCH_FLAGS(develop, \ + product, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ develop(bool, IEEEPrecision, true, \ "Enables IEEE precision (for INTEL only)") \ @@ -194,9 +201,6 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong); product(bool, UseBMI2Instructions, false, \ "Use BMI2 instructions") \ \ - diagnostic(bool, UseLibmSinIntrinsic, true, \ - "Use Libm Sin Intrinsic") \ - \ - diagnostic(bool, UseLibmCosIntrinsic, true, \ - "Use Libm Cos Intrinsic") + diagnostic(bool, UseLibmIntrinsic, true, \ + "Use Libm Intrinsics") #endif // CPU_X86_VM_GLOBALS_X86_HPP diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp b/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp index f8578f9f420..15cf1f751a7 100644 --- a/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp @@ -26,12 +26,12 @@ #include "interp_masm_x86.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" +#include "logging/log.hpp" #include "oops/arrayOop.hpp" #include "oops/markOop.hpp" #include "oops/methodData.hpp" #include "oops/method.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "runtime/basicLock.hpp" #include "runtime/biasedLocking.hpp" @@ -1953,7 +1953,7 @@ void InterpreterMacroAssembler::notify_method_entry() { } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { NOT_LP64(get_thread(rthread);) get_method(rarg); call_VM_leaf( diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_libm_x86_32.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_libm_x86_32.cpp deleted file mode 100644 index 923e8fc39b5..00000000000 --- a/hotspot/src/cpu/x86/vm/macroAssembler_libm_x86_32.cpp +++ /dev/null @@ -1,4571 +0,0 @@ -/* - * Copyright (c) 2015, Intel Corporation. - * Intel Math Library (LIBM) Source Code - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "asm/assembler.hpp" -#include "asm/assembler.inline.hpp" -#include "runtime/stubRoutines.hpp" -#include "macroAssembler_x86.hpp" - -#ifdef _MSC_VER -#define ALIGNED_(x) __declspec(align(x)) -#else -#define ALIGNED_(x) __attribute__ ((aligned(x))) -#endif - -// The 32 bit code is at most SSE2 compliant - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - EXP() -// --------------------- -// -// Description: -// Let K = 64 (table size). -// x x/log(2) n -// e = 2 = 2 * T[j] * (1 + P(y)) -// where -// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K] -// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2] -// j/K -// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]). -// -// P(y) is a minimax polynomial approximation of exp(x)-1 -// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V). -// -// To avoid problems with arithmetic overflow and underflow, -// n n1 n2 -// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2] -// where BIAS is a value of exponent bias. -// -// Special cases: -// exp(NaN) = NaN -// exp(+INF) = +INF -// exp(-INF) = 0 -// exp(x) = 1 for subnormals -// for finite argument, only exp(0)=1 is exact -// For IEEE double -// if x > 709.782712893383973096 then exp(x) overflow -// if x < -745.133219101941108420 then exp(x) underflow -// -/******************************************************************************/ - -ALIGNED_(16) juint _static_const_table[] = -{ - 0x00000000UL, 0xfff00000UL, 0x00000000UL, 0xfff00000UL, 0xffffffc0UL, - 0x00000000UL, 0xffffffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL, - 0x0000ffc0UL, 0x00000000UL, 0x00000000UL, 0x43380000UL, 0x00000000UL, - 0x43380000UL, 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL, - 0xfefa0000UL, 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL, 0xbc9e3b3aUL, - 0x3d1cf79aUL, 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xfffffffeUL, 0x3fdfffffUL, - 0xfffffffeUL, 0x3fdfffffUL, 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, - 0x3fa55555UL, 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL, - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x0e03754dUL, - 0x3cad7bbfUL, 0x3e778060UL, 0x00002c9aUL, 0x3567f613UL, 0x3c8cd252UL, - 0xd3158574UL, 0x000059b0UL, 0x61e6c861UL, 0x3c60f74eUL, 0x18759bc8UL, - 0x00008745UL, 0x5d837b6cUL, 0x3c979aa6UL, 0x6cf9890fUL, 0x0000b558UL, - 0x702f9cd1UL, 0x3c3ebe3dUL, 0x32d3d1a2UL, 0x0000e3ecUL, 0x1e63bcd8UL, - 0x3ca3516eUL, 0xd0125b50UL, 0x00011301UL, 0x26f0387bUL, 0x3ca4c554UL, - 0xaea92ddfUL, 0x0001429aUL, 0x62523fb6UL, 0x3ca95153UL, 0x3c7d517aUL, - 0x000172b8UL, 0x3f1353bfUL, 0x3c8b898cUL, 0xeb6fcb75UL, 0x0001a35bUL, - 0x3e3a2f5fUL, 0x3c9aecf7UL, 0x3168b9aaUL, 0x0001d487UL, 0x44a6c38dUL, - 0x3c8a6f41UL, 0x88628cd6UL, 0x0002063bUL, 0xe3a8a894UL, 0x3c968efdUL, - 0x6e756238UL, 0x0002387aUL, 0x981fe7f2UL, 0x3c80472bUL, 0x65e27cddUL, - 0x00026b45UL, 0x6d09ab31UL, 0x3c82f7e1UL, 0xf51fdee1UL, 0x00029e9dUL, - 0x720c0ab3UL, 0x3c8b3782UL, 0xa6e4030bUL, 0x0002d285UL, 0x4db0abb6UL, - 0x3c834d75UL, 0x0a31b715UL, 0x000306feUL, 0x5dd3f84aUL, 0x3c8fdd39UL, - 0xb26416ffUL, 0x00033c08UL, 0xcc187d29UL, 0x3ca12f8cUL, 0x373aa9caUL, - 0x000371a7UL, 0x738b5e8bUL, 0x3ca7d229UL, 0x34e59ff6UL, 0x0003a7dbUL, - 0xa72a4c6dUL, 0x3c859f48UL, 0x4c123422UL, 0x0003dea6UL, 0x259d9205UL, - 0x3ca8b846UL, 0x21f72e29UL, 0x0004160aUL, 0x60c2ac12UL, 0x3c4363edUL, - 0x6061892dUL, 0x00044e08UL, 0xdaa10379UL, 0x3c6ecce1UL, 0xb5c13cd0UL, - 0x000486a2UL, 0xbb7aafb0UL, 0x3c7690ceUL, 0xd5362a27UL, 0x0004bfdaUL, - 0x9b282a09UL, 0x3ca083ccUL, 0x769d2ca6UL, 0x0004f9b2UL, 0xc1aae707UL, - 0x3ca509b0UL, 0x569d4f81UL, 0x0005342bUL, 0x18fdd78eUL, 0x3c933505UL, - 0x36b527daUL, 0x00056f47UL, 0xe21c5409UL, 0x3c9063e1UL, 0xdd485429UL, - 0x0005ab07UL, 0x2b64c035UL, 0x3c9432e6UL, 0x15ad2148UL, 0x0005e76fUL, - 0x99f08c0aUL, 0x3ca01284UL, 0xb03a5584UL, 0x0006247eUL, 0x0073dc06UL, - 0x3c99f087UL, 0x82552224UL, 0x00066238UL, 0x0da05571UL, 0x3c998d4dUL, - 0x667f3bccUL, 0x0006a09eUL, 0x86ce4786UL, 0x3ca52bb9UL, 0x3c651a2eUL, - 0x0006dfb2UL, 0x206f0dabUL, 0x3ca32092UL, 0xe8ec5f73UL, 0x00071f75UL, - 0x8e17a7a6UL, 0x3ca06122UL, 0x564267c8UL, 0x00075febUL, 0x461e9f86UL, - 0x3ca244acUL, 0x73eb0186UL, 0x0007a114UL, 0xabd66c55UL, 0x3c65ebe1UL, - 0x36cf4e62UL, 0x0007e2f3UL, 0xbbff67d0UL, 0x3c96fe9fUL, 0x994cce12UL, - 0x00082589UL, 0x14c801dfUL, 0x3c951f14UL, 0x9b4492ecUL, 0x000868d9UL, - 0xc1f0eab4UL, 0x3c8db72fUL, 0x422aa0dbUL, 0x0008ace5UL, 0x59f35f44UL, - 0x3c7bf683UL, 0x99157736UL, 0x0008f1aeUL, 0x9c06283cUL, 0x3ca360baUL, - 0xb0cdc5e4UL, 0x00093737UL, 0x20f962aaUL, 0x3c95e8d1UL, 0x9fde4e4fUL, - 0x00097d82UL, 0x2b91ce27UL, 0x3c71affcUL, 0x82a3f090UL, 0x0009c491UL, - 0x589a2ebdUL, 0x3c9b6d34UL, 0x7b5de564UL, 0x000a0c66UL, 0x9ab89880UL, - 0x3c95277cUL, 0xb23e255cUL, 0x000a5503UL, 0x6e735ab3UL, 0x3c846984UL, - 0x5579fdbfUL, 0x000a9e6bUL, 0x92cb3387UL, 0x3c8c1a77UL, 0x995ad3adUL, - 0x000ae89fUL, 0xdc2d1d96UL, 0x3ca22466UL, 0xb84f15faUL, 0x000b33a2UL, - 0xb19505aeUL, 0x3ca1112eUL, 0xf2fb5e46UL, 0x000b7f76UL, 0x0a5fddcdUL, - 0x3c74ffd7UL, 0x904bc1d2UL, 0x000bcc1eUL, 0x30af0cb3UL, 0x3c736eaeUL, - 0xdd85529cUL, 0x000c199bUL, 0xd10959acUL, 0x3c84e08fUL, 0x2e57d14bUL, - 0x000c67f1UL, 0x6c921968UL, 0x3c676b2cUL, 0xdcef9069UL, 0x000cb720UL, - 0x36df99b3UL, 0x3c937009UL, 0x4a07897bUL, 0x000d072dUL, 0xa63d07a7UL, - 0x3c74a385UL, 0xdcfba487UL, 0x000d5818UL, 0xd5c192acUL, 0x3c8e5a50UL, - 0x03db3285UL, 0x000da9e6UL, 0x1c4a9792UL, 0x3c98bb73UL, 0x337b9b5eUL, - 0x000dfc97UL, 0x603a88d3UL, 0x3c74b604UL, 0xe78b3ff6UL, 0x000e502eUL, - 0x92094926UL, 0x3c916f27UL, 0xa2a490d9UL, 0x000ea4afUL, 0x41aa2008UL, - 0x3c8ec3bcUL, 0xee615a27UL, 0x000efa1bUL, 0x31d185eeUL, 0x3c8a64a9UL, - 0x5b6e4540UL, 0x000f5076UL, 0x4d91cd9dUL, 0x3c77893bUL, 0x819e90d8UL, - 0x000fa7c1UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x7ff00000UL, - 0x00000000UL, 0x00000000UL, 0xffffffffUL, 0x7fefffffUL, 0x00000000UL, - 0x00100000UL -}; - -//registers, -// input: (rbp + 8) -// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 -// rax, rdx, rcx, rbx (tmp) - -// Code generated by Intel C compiler for LIBM library - -void MacroAssembler::fast_exp(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; - - assert_different_registers(tmp, eax, ecx, edx); - jmp(start); - address static_const_table = (address)_static_const_table; - - bind(start); - subl(rsp, 120); - movl(Address(rsp, 64), tmp); - lea(tmp, ExternalAddress(static_const_table)); - movdqu(xmm0, Address(rsp, 128)); - unpcklpd(xmm0, xmm0); - movdqu(xmm1, Address(tmp, 64)); // 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL - movdqu(xmm6, Address(tmp, 48)); // 0x00000000UL, 0x43380000UL, 0x00000000UL, 0x43380000UL - movdqu(xmm2, Address(tmp, 80)); // 0xfefa0000UL, 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL - movdqu(xmm3, Address(tmp, 96)); // 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xbc9e3b3aUL, 0x3d1cf79aUL - pextrw(eax, xmm0, 3); - andl(eax, 32767); - movl(edx, 16527); - subl(edx, eax); - subl(eax, 15504); - orl(edx, eax); - cmpl(edx, INT_MIN); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); - mulpd(xmm1, xmm0); - addpd(xmm1, xmm6); - movapd(xmm7, xmm1); - subpd(xmm1, xmm6); - mulpd(xmm2, xmm1); - movdqu(xmm4, Address(tmp, 128)); // 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, 0x3fa55555UL - mulpd(xmm3, xmm1); - movdqu(xmm5, Address(tmp, 144)); // 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL - subpd(xmm0, xmm2); - movdl(eax, xmm7); - movl(ecx, eax); - andl(ecx, 63); - shll(ecx, 4); - sarl(eax, 6); - movl(edx, eax); - movdqu(xmm6, Address(tmp, 16)); // 0xffffffc0UL, 0x00000000UL, 0xffffffc0UL, 0x00000000UL - pand(xmm7, xmm6); - movdqu(xmm6, Address(tmp, 32)); // 0x0000ffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL - paddq(xmm7, xmm6); - psllq(xmm7, 46); - subpd(xmm0, xmm3); - movdqu(xmm2, Address(tmp, ecx, Address::times_1, 160)); - mulpd(xmm4, xmm0); - movapd(xmm6, xmm0); - movapd(xmm1, xmm0); - mulpd(xmm6, xmm6); - mulpd(xmm0, xmm6); - addpd(xmm5, xmm4); - mulsd(xmm0, xmm6); - mulpd(xmm6, Address(tmp, 112)); // 0xfffffffeUL, 0x3fdfffffUL, 0xfffffffeUL, 0x3fdfffffUL - addsd(xmm1, xmm2); - unpckhpd(xmm2, xmm2); - mulpd(xmm0, xmm5); - addsd(xmm1, xmm0); - por(xmm2, xmm7); - unpckhpd(xmm0, xmm0); - addsd(xmm0, xmm1); - addsd(xmm0, xmm6); - addl(edx, 894); - cmpl(edx, 1916); - jcc (Assembler::above, L_2TAG_PACKET_1_0_2); - mulsd(xmm0, xmm2); - addsd(xmm0, xmm2); - jmp(L_2TAG_PACKET_2_0_2); - - bind(L_2TAG_PACKET_1_0_2); - fnstcw(Address(rsp, 24)); - movzwl(edx, Address(rsp, 24)); - orl(edx, 768); - movw(Address(rsp, 28), edx); - fldcw(Address(rsp, 28)); - movl(edx, eax); - sarl(eax, 1); - subl(edx, eax); - movdqu(xmm6, Address(tmp, 0)); // 0x00000000UL, 0xfff00000UL, 0x00000000UL, 0xfff00000UL - pandn(xmm6, xmm2); - addl(eax, 1023); - movdl(xmm3, eax); - psllq(xmm3, 52); - por(xmm6, xmm3); - addl(edx, 1023); - movdl(xmm4, edx); - psllq(xmm4, 52); - movsd(Address(rsp, 8), xmm0); - fld_d(Address(rsp, 8)); - movsd(Address(rsp, 16), xmm6); - fld_d(Address(rsp, 16)); - fmula(1); - faddp(1); - movsd(Address(rsp, 8), xmm4); - fld_d(Address(rsp, 8)); - fmulp(1); - fstp_d(Address(rsp, 8)); - movsd(xmm0,Address(rsp, 8)); - fldcw(Address(rsp, 24)); - pextrw(ecx, xmm0, 3); - andl(ecx, 32752); - cmpl(ecx, 32752); - jcc(Assembler::greaterEqual, L_2TAG_PACKET_3_0_2); - cmpl(ecx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_4_0_2); - jmp(L_2TAG_PACKET_2_0_2); - cmpl(ecx, INT_MIN); - jcc(Assembler::less, L_2TAG_PACKET_3_0_2); - cmpl(ecx, -1064950997); - jcc(Assembler::less, L_2TAG_PACKET_2_0_2); - jcc(Assembler::greater, L_2TAG_PACKET_4_0_2); - movl(edx, Address(rsp, 128)); - cmpl(edx ,-17155601); - jcc(Assembler::less, L_2TAG_PACKET_2_0_2); - jmp(L_2TAG_PACKET_4_0_2); - - bind(L_2TAG_PACKET_3_0_2); - movl(edx, 14); - jmp(L_2TAG_PACKET_5_0_2); - - bind(L_2TAG_PACKET_4_0_2); - movl(edx, 15); - - bind(L_2TAG_PACKET_5_0_2); - movsd(Address(rsp, 0), xmm0); - movsd(xmm0, Address(rsp, 128)); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_7_0_2); - cmpl(eax, 2146435072); - jcc(Assembler::greaterEqual, L_2TAG_PACKET_8_0_2); - movl(eax, Address(rsp, 132)); - cmpl(eax, INT_MIN); - jcc(Assembler::greaterEqual, L_2TAG_PACKET_9_0_2); - movsd(xmm0, Address(tmp, 1208)); // 0xffffffffUL, 0x7fefffffUL - mulsd(xmm0, xmm0); - movl(edx, 14); - jmp(L_2TAG_PACKET_5_0_2); - - bind(L_2TAG_PACKET_9_0_2); - movsd(xmm0, Address(tmp, 1216)); - mulsd(xmm0, xmm0); - movl(edx, 15); - jmp(L_2TAG_PACKET_5_0_2); - - bind(L_2TAG_PACKET_8_0_2); - movl(edx, Address(rsp, 128)); - cmpl(eax, 2146435072); - jcc(Assembler::above, L_2TAG_PACKET_10_0_2); - cmpl(edx, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_10_0_2); - movl(eax, Address(rsp, 132)); - cmpl(eax, 2146435072); - jcc(Assembler::notEqual, L_2TAG_PACKET_11_0_2); - movsd(xmm0, Address(tmp, 1192)); // 0x00000000UL, 0x7ff00000UL - jmp(L_2TAG_PACKET_2_0_2); - - bind(L_2TAG_PACKET_11_0_2); - movsd(xmm0, Address(tmp, 1200)); // 0x00000000UL, 0x00000000UL - jmp(L_2TAG_PACKET_2_0_2); - - bind(L_2TAG_PACKET_10_0_2); - movsd(xmm0, Address(rsp, 128)); - addsd(xmm0, xmm0); - jmp(L_2TAG_PACKET_2_0_2); - - bind(L_2TAG_PACKET_0_0_2); - movl(eax, Address(rsp, 132)); - andl(eax, 2147483647); - cmpl(eax, 1083179008); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_7_0_2); - movsd(xmm0, Address(rsp, 128)); - addsd(xmm0, Address(tmp, 1184)); // 0x00000000UL, 0x3ff00000UL - jmp(L_2TAG_PACKET_2_0_2); - - bind(L_2TAG_PACKET_2_0_2); - movsd(Address(rsp, 48), xmm0); - fld_d(Address(rsp, 48)); - - bind(L_2TAG_PACKET_6_0_2); - movl(tmp, Address(rsp, 64)); -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - LOG() -// --------------------- -// -// x=2^k * mx, mx in [1,2) -// -// Get B~1/mx based on the output of rcpss instruction (B0) -// B = int((B0*2^7+0.5))/2^7 -// -// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts) -// -// Result: k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6) and -// p(r) is a degree 7 polynomial -// -log(B) read from data table (high, low parts) -// Result is formed from high and low parts -// -// Special cases: -// log(NaN) = quiet NaN, and raise invalid exception -// log(+INF) = that INF -// log(0) = -INF with divide-by-zero exception raised -// log(1) = +0 -// log(x) = NaN with invalid exception raised if x < -0, including -INF -// -/******************************************************************************/ - -ALIGNED_(16) juint _static_const_table_log[] = -{ - 0xfefa3800UL, 0x3fe62e42UL, 0x93c76730UL, 0x3d2ef357UL, 0xaa241800UL, - 0x3fe5ee82UL, 0x0cda46beUL, 0x3d220238UL, 0x5c364800UL, 0x3fe5af40UL, - 0xac10c9fbUL, 0x3d2dfa63UL, 0x26bb8c00UL, 0x3fe5707aUL, 0xff3303ddUL, - 0x3d09980bUL, 0x26867800UL, 0x3fe5322eUL, 0x5d257531UL, 0x3d05ccc4UL, - 0x835a5000UL, 0x3fe4f45aUL, 0x6d93b8fbUL, 0xbd2e6c51UL, 0x6f970c00UL, - 0x3fe4b6fdUL, 0xed4c541cUL, 0x3cef7115UL, 0x27e8a400UL, 0x3fe47a15UL, - 0xf94d60aaUL, 0xbd22cb6aUL, 0xf2f92400UL, 0x3fe43d9fUL, 0x481051f7UL, - 0xbcfd984fUL, 0x2125cc00UL, 0x3fe4019cUL, 0x30f0c74cUL, 0xbd26ce79UL, - 0x0c36c000UL, 0x3fe3c608UL, 0x7cfe13c2UL, 0xbd02b736UL, 0x17197800UL, - 0x3fe38ae2UL, 0xbb5569a4UL, 0xbd218b7aUL, 0xad9d8c00UL, 0x3fe35028UL, - 0x9527e6acUL, 0x3d10b83fUL, 0x44340800UL, 0x3fe315daUL, 0xc5a0ed9cUL, - 0xbd274e93UL, 0x57b0e000UL, 0x3fe2dbf5UL, 0x07b9dc11UL, 0xbd17a6e5UL, - 0x6d0ec000UL, 0x3fe2a278UL, 0xe797882dUL, 0x3d206d2bUL, 0x1134dc00UL, - 0x3fe26962UL, 0x05226250UL, 0xbd0b61f1UL, 0xd8bebc00UL, 0x3fe230b0UL, - 0x6e48667bUL, 0x3d12fc06UL, 0x5fc61800UL, 0x3fe1f863UL, 0xc9fe81d3UL, - 0xbd2a7242UL, 0x49ae6000UL, 0x3fe1c078UL, 0xed70e667UL, 0x3cccacdeUL, - 0x40f23c00UL, 0x3fe188eeUL, 0xf8ab4650UL, 0x3d14cc4eUL, 0xf6f29800UL, - 0x3fe151c3UL, 0xa293ae49UL, 0xbd2edd97UL, 0x23c75c00UL, 0x3fe11af8UL, - 0xbb9ddcb2UL, 0xbd258647UL, 0x8611cc00UL, 0x3fe0e489UL, 0x07801742UL, - 0x3d1c2998UL, 0xe2d05400UL, 0x3fe0ae76UL, 0x887e7e27UL, 0x3d1f486bUL, - 0x0533c400UL, 0x3fe078bfUL, 0x41edf5fdUL, 0x3d268122UL, 0xbe760400UL, - 0x3fe04360UL, 0xe79539e0UL, 0xbd04c45fUL, 0xe5b20800UL, 0x3fe00e5aUL, - 0xb1727b1cUL, 0xbd053ba3UL, 0xaf7a4800UL, 0x3fdfb358UL, 0x3c164935UL, - 0x3d0085faUL, 0xee031800UL, 0x3fdf4aa7UL, 0x6f014a8bUL, 0x3d12cde5UL, - 0x56b41000UL, 0x3fdee2a1UL, 0x5a470251UL, 0x3d2f27f4UL, 0xc3ddb000UL, - 0x3fde7b42UL, 0x5372bd08UL, 0xbd246550UL, 0x1a272800UL, 0x3fde148aUL, - 0x07322938UL, 0xbd1326b2UL, 0x484c9800UL, 0x3fddae75UL, 0x60dc616aUL, - 0xbd1ea42dUL, 0x46def800UL, 0x3fdd4902UL, 0xe9a767a8UL, 0x3d235bafUL, - 0x18064800UL, 0x3fdce42fUL, 0x3ec7a6b0UL, 0xbd0797c3UL, 0xc7455800UL, - 0x3fdc7ff9UL, 0xc15249aeUL, 0xbd29b6ddUL, 0x693fa000UL, 0x3fdc1c60UL, - 0x7fe8e180UL, 0x3d2cec80UL, 0x1b80e000UL, 0x3fdbb961UL, 0xf40a666dUL, - 0x3d27d85bUL, 0x04462800UL, 0x3fdb56faUL, 0x2d841995UL, 0x3d109525UL, - 0x5248d000UL, 0x3fdaf529UL, 0x52774458UL, 0xbd217cc5UL, 0x3c8ad800UL, - 0x3fda93edUL, 0xbea77a5dUL, 0x3d1e36f2UL, 0x0224f800UL, 0x3fda3344UL, - 0x7f9d79f5UL, 0x3d23c645UL, 0xea15f000UL, 0x3fd9d32bUL, 0x10d0c0b0UL, - 0xbd26279eUL, 0x43135800UL, 0x3fd973a3UL, 0xa502d9f0UL, 0xbd152313UL, - 0x635bf800UL, 0x3fd914a8UL, 0x2ee6307dUL, 0xbd1766b5UL, 0xa88b3000UL, - 0x3fd8b639UL, 0xe5e70470UL, 0xbd205ae1UL, 0x776dc800UL, 0x3fd85855UL, - 0x3333778aUL, 0x3d2fd56fUL, 0x3bd81800UL, 0x3fd7fafaUL, 0xc812566aUL, - 0xbd272090UL, 0x687cf800UL, 0x3fd79e26UL, 0x2efd1778UL, 0x3d29ec7dUL, - 0x76c67800UL, 0x3fd741d8UL, 0x49dc60b3UL, 0x3d2d8b09UL, 0xe6af1800UL, - 0x3fd6e60eUL, 0x7c222d87UL, 0x3d172165UL, 0x3e9c6800UL, 0x3fd68ac8UL, - 0x2756eba0UL, 0x3d20a0d3UL, 0x0b3ab000UL, 0x3fd63003UL, 0xe731ae00UL, - 0xbd2db623UL, 0xdf596000UL, 0x3fd5d5bdUL, 0x08a465dcUL, 0xbd0a0b2aUL, - 0x53c8d000UL, 0x3fd57bf7UL, 0xee5d40efUL, 0x3d1fadedUL, 0x0738a000UL, - 0x3fd522aeUL, 0x8164c759UL, 0x3d2ebe70UL, 0x9e173000UL, 0x3fd4c9e0UL, - 0x1b0ad8a4UL, 0xbd2e2089UL, 0xc271c800UL, 0x3fd4718dUL, 0x0967d675UL, - 0xbd2f27ceUL, 0x23d5e800UL, 0x3fd419b4UL, 0xec90e09dUL, 0x3d08e436UL, - 0x77333000UL, 0x3fd3c252UL, 0xb606bd5cUL, 0x3d183b54UL, 0x76be1000UL, - 0x3fd36b67UL, 0xb0f177c8UL, 0x3d116ecdUL, 0xe1d36000UL, 0x3fd314f1UL, - 0xd3213cb8UL, 0xbd28e27aUL, 0x7cdc9000UL, 0x3fd2bef0UL, 0x4a5004f4UL, - 0x3d2a9cfaUL, 0x1134d800UL, 0x3fd26962UL, 0xdf5bb3b6UL, 0x3d2c93c1UL, - 0x6d0eb800UL, 0x3fd21445UL, 0xba46baeaUL, 0x3d0a87deUL, 0x635a6800UL, - 0x3fd1bf99UL, 0x5147bdb7UL, 0x3d2ca6edUL, 0xcbacf800UL, 0x3fd16b5cUL, - 0xf7a51681UL, 0x3d2b9acdUL, 0x8227e800UL, 0x3fd1178eUL, 0x63a5f01cUL, - 0xbd2c210eUL, 0x67616000UL, 0x3fd0c42dUL, 0x163ceae9UL, 0x3d27188bUL, - 0x604d5800UL, 0x3fd07138UL, 0x16ed4e91UL, 0x3cf89cdbUL, 0x5626c800UL, - 0x3fd01eaeUL, 0x1485e94aUL, 0xbd16f08cUL, 0x6cb3b000UL, 0x3fcf991cUL, - 0xca0cdf30UL, 0x3d1bcbecUL, 0xe4dd0000UL, 0x3fcef5adUL, 0x65bb8e11UL, - 0xbcca2115UL, 0xffe71000UL, 0x3fce530eUL, 0x6041f430UL, 0x3cc21227UL, - 0xb0d49000UL, 0x3fcdb13dUL, 0xf715b035UL, 0xbd2aff2aUL, 0xf2656000UL, - 0x3fcd1037UL, 0x75b6f6e4UL, 0xbd084a7eUL, 0xc6f01000UL, 0x3fcc6ffbUL, - 0xc5962bd2UL, 0xbcf1ec72UL, 0x383be000UL, 0x3fcbd087UL, 0x595412b6UL, - 0xbd2d4bc4UL, 0x575bd000UL, 0x3fcb31d8UL, 0x4eace1aaUL, 0xbd0c358dUL, - 0x3c8ae000UL, 0x3fca93edUL, 0x50562169UL, 0xbd287243UL, 0x07089000UL, - 0x3fc9f6c4UL, 0x6865817aUL, 0x3d29904dUL, 0xdcf70000UL, 0x3fc95a5aUL, - 0x58a0ff6fUL, 0x3d07f228UL, 0xeb390000UL, 0x3fc8beafUL, 0xaae92cd1UL, - 0xbd073d54UL, 0x6551a000UL, 0x3fc823c1UL, 0x9a631e83UL, 0x3d1e0ddbUL, - 0x85445000UL, 0x3fc7898dUL, 0x70914305UL, 0xbd1c6610UL, 0x8b757000UL, - 0x3fc6f012UL, 0xe59c21e1UL, 0xbd25118dUL, 0xbe8c1000UL, 0x3fc6574eUL, - 0x2c3c2e78UL, 0x3d19cf8bUL, 0x6b544000UL, 0x3fc5bf40UL, 0xeb68981cUL, - 0xbd127023UL, 0xe4a1b000UL, 0x3fc527e5UL, 0xe5697dc7UL, 0x3d2633e8UL, - 0x8333b000UL, 0x3fc4913dUL, 0x54fdb678UL, 0x3d258379UL, 0xa5993000UL, - 0x3fc3fb45UL, 0x7e6a354dUL, 0xbd2cd1d8UL, 0xb0159000UL, 0x3fc365fcUL, - 0x234b7289UL, 0x3cc62fa8UL, 0x0c868000UL, 0x3fc2d161UL, 0xcb81b4a1UL, - 0x3d039d6cUL, 0x2a49c000UL, 0x3fc23d71UL, 0x8fd3df5cUL, 0x3d100d23UL, - 0x7e23f000UL, 0x3fc1aa2bUL, 0x44389934UL, 0x3d2ca78eUL, 0x8227e000UL, - 0x3fc1178eUL, 0xce2d07f2UL, 0x3d21ef78UL, 0xb59e4000UL, 0x3fc08598UL, - 0x7009902cUL, 0xbd27e5ddUL, 0x39dbe000UL, 0x3fbfe891UL, 0x4fa10afdUL, - 0xbd2534d6UL, 0x830a2000UL, 0x3fbec739UL, 0xafe645e0UL, 0xbd2dc068UL, - 0x63844000UL, 0x3fbda727UL, 0x1fa71733UL, 0x3d1a8940UL, 0x01bc4000UL, - 0x3fbc8858UL, 0xc65aacd3UL, 0x3d2646d1UL, 0x8dad6000UL, 0x3fbb6ac8UL, - 0x2bf768e5UL, 0xbd139080UL, 0x40b1c000UL, 0x3fba4e76UL, 0xb94407c8UL, - 0xbd0e42b6UL, 0x5d594000UL, 0x3fb9335eUL, 0x3abd47daUL, 0x3d23115cUL, - 0x2f40e000UL, 0x3fb8197eUL, 0xf96ffdf7UL, 0x3d0f80dcUL, 0x0aeac000UL, - 0x3fb700d3UL, 0xa99ded32UL, 0x3cec1e8dUL, 0x4d97a000UL, 0x3fb5e95aUL, - 0x3c5d1d1eUL, 0xbd2c6906UL, 0x5d208000UL, 0x3fb4d311UL, 0x82f4e1efUL, - 0xbcf53a25UL, 0xa7d1e000UL, 0x3fb3bdf5UL, 0xa5db4ed7UL, 0x3d2cc85eUL, - 0xa4472000UL, 0x3fb2aa04UL, 0xae9c697dUL, 0xbd20b6e8UL, 0xd1466000UL, - 0x3fb1973bUL, 0x560d9e9bUL, 0xbd25325dUL, 0xb59e4000UL, 0x3fb08598UL, - 0x7009902cUL, 0xbd17e5ddUL, 0xc006c000UL, 0x3faeea31UL, 0x4fc93b7bUL, - 0xbd0e113eUL, 0xcdddc000UL, 0x3faccb73UL, 0x47d82807UL, 0xbd1a68f2UL, - 0xd0fb0000UL, 0x3faaaef2UL, 0x353bb42eUL, 0x3d20fc1aUL, 0x149fc000UL, - 0x3fa894aaUL, 0xd05a267dUL, 0xbd197995UL, 0xf2d4c000UL, 0x3fa67c94UL, - 0xec19afa2UL, 0xbd029efbUL, 0xd42e0000UL, 0x3fa466aeUL, 0x75bdfd28UL, - 0xbd2c1673UL, 0x2f8d0000UL, 0x3fa252f3UL, 0xe021b67bUL, 0x3d283e9aUL, - 0x89e74000UL, 0x3fa0415dUL, 0x5cf1d753UL, 0x3d0111c0UL, 0xec148000UL, - 0x3f9c63d2UL, 0x3f9eb2f3UL, 0x3d2578c6UL, 0x28c90000UL, 0x3f984925UL, - 0x325a0c34UL, 0xbd2aa0baUL, 0x25980000UL, 0x3f9432a9UL, 0x928637feUL, - 0x3d098139UL, 0x58938000UL, 0x3f902056UL, 0x06e2f7d2UL, 0xbd23dc5bUL, - 0xa3890000UL, 0x3f882448UL, 0xda74f640UL, 0xbd275577UL, 0x75890000UL, - 0x3f801015UL, 0x999d2be8UL, 0xbd10c76bUL, 0x59580000UL, 0x3f700805UL, - 0xcb31c67bUL, 0x3d2166afUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x80000000UL, 0xfefa3800UL, 0x3fa62e42UL, 0x93c76730UL, 0x3ceef357UL, - 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL, 0x3d6fb175UL, - 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL, 0x9999999aUL, 0x3fc99999UL, - 0x00000000UL, 0xbfe00000UL, 0x00000000UL, 0xffffe000UL, 0x00000000UL, - 0xffffe000UL -}; -//registers, -// input: xmm0 -// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 -// rax, rdx, rcx, rbx (tmp) - -void MacroAssembler::fast_log(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2; - Label L_2TAG_PACKET_10_0_2, start; - - assert_different_registers(tmp, eax, ecx, edx); - jmp(start); - address static_const_table = (address)_static_const_table_log; - - bind(start); - subl(rsp, 104); - movl(Address(rsp, 40), tmp); - lea(tmp, ExternalAddress(static_const_table)); - xorpd(xmm2, xmm2); - movl(eax, 16368); - pinsrw(xmm2, eax, 3); - xorpd(xmm3, xmm3); - movl(edx, 30704); - pinsrw(xmm3, edx, 3); - movsd(xmm0, Address(rsp, 112)); - movapd(xmm1, xmm0); - movl(ecx, 32768); - movdl(xmm4, ecx); - movsd(xmm5, Address(tmp, 2128)); // 0x00000000UL, 0xffffe000UL - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - psllq(xmm0, 5); - movl(ecx, 16352); - psrlq(xmm0, 34); - rcpss(xmm0, xmm0); - psllq(xmm1, 12); - pshufd(xmm6, xmm5, 228); - psrlq(xmm1, 12); - subl(eax, 16); - cmpl(eax, 32736); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); - - bind(L_2TAG_PACKET_1_0_2); - paddd(xmm0, xmm4); - por(xmm1, xmm3); - movdl(edx, xmm0); - psllq(xmm0, 29); - pand(xmm5, xmm1); - pand(xmm0, xmm6); - subsd(xmm1, xmm5); - mulpd(xmm5, xmm0); - andl(eax, 32752); - subl(eax, ecx); - cvtsi2sdl(xmm7, eax); - mulsd(xmm1, xmm0); - movsd(xmm6, Address(tmp, 2064)); // 0xfefa3800UL, 0x3fa62e42UL - movdqu(xmm3, Address(tmp, 2080)); // 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL - subsd(xmm5, xmm2); - andl(edx, 16711680); - shrl(edx, 12); - movdqu(xmm0, Address(tmp, edx)); - movdqu(xmm4, Address(tmp, 2096)); // 0x3d6fb175UL, 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL - addsd(xmm1, xmm5); - movdqu(xmm2, Address(tmp, 2112)); // 0x9999999aUL, 0x3fc99999UL, 0x00000000UL, 0xbfe00000UL - mulsd(xmm6, xmm7); - pshufd(xmm5, xmm1, 68); - mulsd(xmm7, Address(tmp, 2072)); // 0x93c76730UL, 0x3ceef357UL, 0x92492492UL, 0x3fc24924UL - mulsd(xmm3, xmm1); - addsd(xmm0, xmm6); - mulpd(xmm4, xmm5); - mulpd(xmm5, xmm5); - pshufd(xmm6, xmm0, 228); - addsd(xmm0, xmm1); - addpd(xmm4, xmm2); - mulpd(xmm3, xmm5); - subsd(xmm6, xmm0); - mulsd(xmm4, xmm1); - pshufd(xmm2, xmm0, 238); - addsd(xmm1, xmm6); - mulsd(xmm5, xmm5); - addsd(xmm7, xmm2); - addpd(xmm4, xmm3); - addsd(xmm1, xmm7); - mulpd(xmm4, xmm5); - addsd(xmm1, xmm4); - pshufd(xmm5, xmm4, 238); - addsd(xmm1, xmm5); - addsd(xmm0, xmm1); - jmp(L_2TAG_PACKET_2_0_2); - - bind(L_2TAG_PACKET_0_0_2); - movsd(xmm0, Address(rsp, 112)); - movdqu(xmm1, xmm0); - addl(eax, 16); - cmpl(eax, 32768); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_3_0_2); - cmpl(eax, 16); - jcc(Assembler::below, L_2TAG_PACKET_4_0_2); - - bind(L_2TAG_PACKET_5_0_2); - addsd(xmm0, xmm0); - jmp(L_2TAG_PACKET_2_0_2); - - bind(L_2TAG_PACKET_6_0_2); - jcc(Assembler::above, L_2TAG_PACKET_5_0_2); - cmpl(edx, 0); - jcc(Assembler::above, L_2TAG_PACKET_5_0_2); - jmp(L_2TAG_PACKET_7_0_2); - - bind(L_2TAG_PACKET_3_0_2); - movdl(edx, xmm1); - psrlq(xmm1, 32); - movdl(ecx, xmm1); - addl(ecx, ecx); - cmpl(ecx, -2097152); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_6_0_2); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); - - bind(L_2TAG_PACKET_7_0_2); - xorpd(xmm1, xmm1); - xorpd(xmm0, xmm0); - movl(eax, 32752); - pinsrw(xmm1, eax, 3); - movl(edx, 3); - mulsd(xmm0, xmm1); - - bind(L_2TAG_PACKET_9_0_2); - movsd(Address(rsp, 0), xmm0); - movsd(xmm0, Address(rsp, 112)); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_10_0_2); - - bind(L_2TAG_PACKET_8_0_2); - xorpd(xmm1, xmm1); - xorpd(xmm0, xmm0); - movl(eax, 49136); - pinsrw(xmm0, eax, 3); - divsd(xmm0, xmm1); - movl(edx, 2); - jmp(L_2TAG_PACKET_9_0_2); - - bind(L_2TAG_PACKET_4_0_2); - movdl(edx, xmm1); - psrlq(xmm1, 32); - movdl(ecx, xmm1); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); - xorpd(xmm1, xmm1); - movl(eax, 18416); - pinsrw(xmm1, eax, 3); - mulsd(xmm0, xmm1); - movapd(xmm1, xmm0); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - psllq(xmm0, 5); - movl(ecx, 18416); - psrlq(xmm0, 34); - rcpss(xmm0, xmm0); - psllq(xmm1, 12); - pshufd(xmm6, xmm5, 228); - psrlq(xmm1, 12); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_2_0_2); - movsd(Address(rsp, 24), xmm0); - fld_d(Address(rsp, 24)); - - bind(L_2TAG_PACKET_10_0_2); - movl(tmp, Address(rsp, 40)); -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - POW() -// --------------------- -// -// Let x=2^k * mx, mx in [1,2) -// -// log2(x) calculation: -// -// Get B~1/mx based on the output of rcpps instruction (B0) -// B = int((B0*LH*2^9+0.5))/2^9 -// LH is a short approximation for log2(e) -// -// Reduced argument, scaled by LH: -// r=B*mx-LH (computed accurately in high and low parts) -// -// log2(x) result: k - log2(B) + p(r) -// p(r) is a degree 8 polynomial -// -log2(B) read from data table (high, low parts) -// log2(x) is formed from high and low parts -// For |x| in [1-1/32, 1+1/16), a slower but more accurate computation -// based om the same table design is performed. -// -// Main path is taken if | floor(log2(|log2(|x|)|) + floor(log2|y|) | < 8, -// to filter out all potential OF/UF cases. -// exp2(y*log2(x)) is computed using an 8-bit index table and a degree 5 -// polynomial -// -// Special cases: -// pow(-0,y) = -INF and raises the divide-by-zero exception for y an odd -// integer < 0. -// pow(-0,y) = +INF and raises the divide-by-zero exception for y < 0 and -// not an odd integer. -// pow(-0,y) = -0 for y an odd integer > 0. -// pow(-0,y) = +0 for y > 0 and not an odd integer. -// pow(-1,-INF) = NaN. -// pow(+1,y) = NaN for any y, even a NaN. -// pow(x,-0) = 1 for any x, even a NaN. -// pow(x,y) = a NaN and raises the invalid exception for finite x < 0 and -// finite non-integer y. -// pow(x,-INF) = +INF for |x|<1. -// pow(x,-INF) = +0 for |x|>1. -// pow(x,+INF) = +0 for |x|<1. -// pow(x,+INF) = +INF for |x|>1. -// pow(-INF,y) = -0 for y an odd integer < 0. -// pow(-INF,y) = +0 for y < 0 and not an odd integer. -// pow(-INF,y) = -INF for y an odd integer > 0. -// pow(-INF,y) = +INF for y > 0 and not an odd integer. -// pow(+INF,y) = +0 for y <0. -// pow(+INF,y) = +INF for y >0. -// -/******************************************************************************/ - -ALIGNED_(16) juint _static_const_table_pow[] = -{ - 0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL, 0xf8000000UL, - 0xffffffffUL, 0x00000000UL, 0xfffff800UL, 0x00000000UL, 0x3ff00000UL, - 0x00000000UL, 0x00000000UL, 0x20000000UL, 0x3feff00aUL, 0x96621f95UL, - 0x3e5b1856UL, 0xe0000000UL, 0x3fefe019UL, 0xe5916f9eUL, 0xbe325278UL, - 0x00000000UL, 0x3fefd02fUL, 0x859a1062UL, 0x3e595fb7UL, 0xc0000000UL, - 0x3fefc049UL, 0xb245f18fUL, 0xbe529c38UL, 0xe0000000UL, 0x3fefb069UL, - 0xad2880a7UL, 0xbe501230UL, 0x60000000UL, 0x3fefa08fUL, 0xc8e72420UL, - 0x3e597bd1UL, 0x80000000UL, 0x3fef90baUL, 0xc30c4500UL, 0xbe5d6c75UL, - 0xe0000000UL, 0x3fef80eaUL, 0x02c63f43UL, 0x3e2e1318UL, 0xc0000000UL, - 0x3fef7120UL, 0xb3d4ccccUL, 0xbe44c52aUL, 0x00000000UL, 0x3fef615cUL, - 0xdbd91397UL, 0xbe4e7d6cUL, 0xa0000000UL, 0x3fef519cUL, 0x65c5cd68UL, - 0xbe522dc8UL, 0xa0000000UL, 0x3fef41e2UL, 0x46d1306cUL, 0xbe5a840eUL, - 0xe0000000UL, 0x3fef322dUL, 0xd2980e94UL, 0x3e5071afUL, 0xa0000000UL, - 0x3fef227eUL, 0x773abadeUL, 0xbe5891e5UL, 0xa0000000UL, 0x3fef12d4UL, - 0xdc6bf46bUL, 0xbe5cccbeUL, 0xe0000000UL, 0x3fef032fUL, 0xbc7247faUL, - 0xbe2bab83UL, 0x80000000UL, 0x3feef390UL, 0xbcaa1e46UL, 0xbe53bb3bUL, - 0x60000000UL, 0x3feee3f6UL, 0x5f6c682dUL, 0xbe54c619UL, 0x80000000UL, - 0x3feed461UL, 0x5141e368UL, 0xbe4b6d86UL, 0xe0000000UL, 0x3feec4d1UL, - 0xec678f76UL, 0xbe369af6UL, 0x80000000UL, 0x3feeb547UL, 0x41301f55UL, - 0xbe2d4312UL, 0x60000000UL, 0x3feea5c2UL, 0x676da6bdUL, 0xbe4d8dd0UL, - 0x60000000UL, 0x3fee9642UL, 0x57a891c4UL, 0x3e51f991UL, 0xa0000000UL, - 0x3fee86c7UL, 0xe4eb491eUL, 0x3e579bf9UL, 0x20000000UL, 0x3fee7752UL, - 0xfddc4a2cUL, 0xbe3356e6UL, 0xc0000000UL, 0x3fee67e1UL, 0xd75b5bf1UL, - 0xbe449531UL, 0x80000000UL, 0x3fee5876UL, 0xbd423b8eUL, 0x3df54fe4UL, - 0x60000000UL, 0x3fee4910UL, 0x330e51b9UL, 0x3e54289cUL, 0x80000000UL, - 0x3fee39afUL, 0x8651a95fUL, 0xbe55aad6UL, 0xa0000000UL, 0x3fee2a53UL, - 0x5e98c708UL, 0xbe2fc4a9UL, 0xe0000000UL, 0x3fee1afcUL, 0x0989328dUL, - 0x3e23958cUL, 0x40000000UL, 0x3fee0babUL, 0xee642abdUL, 0xbe425dd8UL, - 0xa0000000UL, 0x3fedfc5eUL, 0xc394d236UL, 0x3e526362UL, 0x20000000UL, - 0x3feded17UL, 0xe104aa8eUL, 0x3e4ce247UL, 0xc0000000UL, 0x3fedddd4UL, - 0x265a9be4UL, 0xbe5bb77aUL, 0x40000000UL, 0x3fedce97UL, 0x0ecac52fUL, - 0x3e4a7cb1UL, 0xe0000000UL, 0x3fedbf5eUL, 0x124cb3b8UL, 0x3e257024UL, - 0x80000000UL, 0x3fedb02bUL, 0xe6d4febeUL, 0xbe2033eeUL, 0x20000000UL, - 0x3feda0fdUL, 0x39cca00eUL, 0xbe3ddabcUL, 0xc0000000UL, 0x3fed91d3UL, - 0xef8a552aUL, 0xbe543390UL, 0x40000000UL, 0x3fed82afUL, 0xb8e85204UL, - 0x3e513850UL, 0xe0000000UL, 0x3fed738fUL, 0x3d59fe08UL, 0xbe5db728UL, - 0x40000000UL, 0x3fed6475UL, 0x3aa7ead1UL, 0x3e58804bUL, 0xc0000000UL, - 0x3fed555fUL, 0xf8a35ba9UL, 0xbe5298b0UL, 0x00000000UL, 0x3fed464fUL, - 0x9a88dd15UL, 0x3e5a8cdbUL, 0x40000000UL, 0x3fed3743UL, 0xb0b0a190UL, - 0x3e598635UL, 0x80000000UL, 0x3fed283cUL, 0xe2113295UL, 0xbe5c1119UL, - 0x80000000UL, 0x3fed193aUL, 0xafbf1728UL, 0xbe492e9cUL, 0x60000000UL, - 0x3fed0a3dUL, 0xe4a4ccf3UL, 0x3e19b90eUL, 0x20000000UL, 0x3fecfb45UL, - 0xba3cbeb8UL, 0x3e406b50UL, 0xc0000000UL, 0x3fecec51UL, 0x110f7dddUL, - 0x3e0d6806UL, 0x40000000UL, 0x3fecdd63UL, 0x7dd7d508UL, 0xbe5a8943UL, - 0x80000000UL, 0x3fecce79UL, 0x9b60f271UL, 0xbe50676aUL, 0x80000000UL, - 0x3fecbf94UL, 0x0b9ad660UL, 0x3e59174fUL, 0x60000000UL, 0x3fecb0b4UL, - 0x00823d9cUL, 0x3e5bbf72UL, 0x20000000UL, 0x3feca1d9UL, 0x38a6ec89UL, - 0xbe4d38f9UL, 0x80000000UL, 0x3fec9302UL, 0x3a0b7d8eUL, 0x3e53dbfdUL, - 0xc0000000UL, 0x3fec8430UL, 0xc6826b34UL, 0xbe27c5c9UL, 0xc0000000UL, - 0x3fec7563UL, 0x0c706381UL, 0xbe593653UL, 0x60000000UL, 0x3fec669bUL, - 0x7df34ec7UL, 0x3e461ab5UL, 0xe0000000UL, 0x3fec57d7UL, 0x40e5e7e8UL, - 0xbe5c3daeUL, 0x00000000UL, 0x3fec4919UL, 0x5602770fUL, 0xbe55219dUL, - 0xc0000000UL, 0x3fec3a5eUL, 0xec7911ebUL, 0x3e5a5d25UL, 0x60000000UL, - 0x3fec2ba9UL, 0xb39ea225UL, 0xbe53c00bUL, 0x80000000UL, 0x3fec1cf8UL, - 0x967a212eUL, 0x3e5a8ddfUL, 0x60000000UL, 0x3fec0e4cUL, 0x580798bdUL, - 0x3e5f53abUL, 0x00000000UL, 0x3febffa5UL, 0xb8282df6UL, 0xbe46b874UL, - 0x20000000UL, 0x3febf102UL, 0xe33a6729UL, 0x3e54963fUL, 0x00000000UL, - 0x3febe264UL, 0x3b53e88aUL, 0xbe3adce1UL, 0x60000000UL, 0x3febd3caUL, - 0xc2585084UL, 0x3e5cde9fUL, 0x80000000UL, 0x3febc535UL, 0xa335c5eeUL, - 0xbe39fd9cUL, 0x20000000UL, 0x3febb6a5UL, 0x7325b04dUL, 0x3e42ba15UL, - 0x60000000UL, 0x3feba819UL, 0x1564540fUL, 0x3e3a9f35UL, 0x40000000UL, - 0x3feb9992UL, 0x83fff592UL, 0xbe5465ceUL, 0xa0000000UL, 0x3feb8b0fUL, - 0xb9da63d3UL, 0xbe4b1a0aUL, 0x80000000UL, 0x3feb7c91UL, 0x6d6f1ea4UL, - 0x3e557657UL, 0x00000000UL, 0x3feb6e18UL, 0x5e80a1bfUL, 0x3e4ddbb6UL, - 0x00000000UL, 0x3feb5fa3UL, 0x1c9eacb5UL, 0x3e592877UL, 0xa0000000UL, - 0x3feb5132UL, 0x6d40beb3UL, 0xbe51858cUL, 0xa0000000UL, 0x3feb42c6UL, - 0xd740c67bUL, 0x3e427ad2UL, 0x40000000UL, 0x3feb345fUL, 0xa3e0cceeUL, - 0xbe5c2fc4UL, 0x40000000UL, 0x3feb25fcUL, 0x8e752b50UL, 0xbe3da3c2UL, - 0xc0000000UL, 0x3feb179dUL, 0xa892e7deUL, 0x3e1fb481UL, 0xc0000000UL, - 0x3feb0943UL, 0x21ed71e9UL, 0xbe365206UL, 0x20000000UL, 0x3feafaeeUL, - 0x0e1380a3UL, 0x3e5c5b7bUL, 0x20000000UL, 0x3feaec9dUL, 0x3c3d640eUL, - 0xbe5dbbd0UL, 0x60000000UL, 0x3feade50UL, 0x8f97a715UL, 0x3e3a8ec5UL, - 0x20000000UL, 0x3fead008UL, 0x23ab2839UL, 0x3e2fe98aUL, 0x40000000UL, - 0x3feac1c4UL, 0xf4bbd50fUL, 0x3e54d8f6UL, 0xe0000000UL, 0x3feab384UL, - 0x14757c4dUL, 0xbe48774cUL, 0xc0000000UL, 0x3feaa549UL, 0x7c7b0eeaUL, - 0x3e5b51bbUL, 0x20000000UL, 0x3fea9713UL, 0xf56f7013UL, 0x3e386200UL, - 0xe0000000UL, 0x3fea88e0UL, 0xbe428ebeUL, 0xbe514af5UL, 0xe0000000UL, - 0x3fea7ab2UL, 0x8d0e4496UL, 0x3e4f9165UL, 0x60000000UL, 0x3fea6c89UL, - 0xdbacc5d5UL, 0xbe5c063bUL, 0x20000000UL, 0x3fea5e64UL, 0x3f19d970UL, - 0xbe5a0c8cUL, 0x20000000UL, 0x3fea5043UL, 0x09ea3e6bUL, 0x3e5065dcUL, - 0x80000000UL, 0x3fea4226UL, 0x78df246cUL, 0x3e5e05f6UL, 0x40000000UL, - 0x3fea340eUL, 0x4057d4a0UL, 0x3e431b2bUL, 0x40000000UL, 0x3fea25faUL, - 0x82867bb5UL, 0x3e4b76beUL, 0xa0000000UL, 0x3fea17eaUL, 0x9436f40aUL, - 0xbe5aad39UL, 0x20000000UL, 0x3fea09dfUL, 0x4b5253b3UL, 0x3e46380bUL, - 0x00000000UL, 0x3fe9fbd8UL, 0x8fc52466UL, 0xbe386f9bUL, 0x20000000UL, - 0x3fe9edd5UL, 0x22d3f344UL, 0xbe538347UL, 0x60000000UL, 0x3fe9dfd6UL, - 0x1ac33522UL, 0x3e5dbc53UL, 0x00000000UL, 0x3fe9d1dcUL, 0xeabdff1dUL, - 0x3e40fc0cUL, 0xe0000000UL, 0x3fe9c3e5UL, 0xafd30e73UL, 0xbe585e63UL, - 0xe0000000UL, 0x3fe9b5f3UL, 0xa52f226aUL, 0xbe43e8f9UL, 0x20000000UL, - 0x3fe9a806UL, 0xecb8698dUL, 0xbe515b36UL, 0x80000000UL, 0x3fe99a1cUL, - 0xf2b4e89dUL, 0x3e48b62bUL, 0x20000000UL, 0x3fe98c37UL, 0x7c9a88fbUL, - 0x3e44414cUL, 0x00000000UL, 0x3fe97e56UL, 0xda015741UL, 0xbe5d13baUL, - 0xe0000000UL, 0x3fe97078UL, 0x5fdace06UL, 0x3e51b947UL, 0x00000000UL, - 0x3fe962a0UL, 0x956ca094UL, 0x3e518785UL, 0x40000000UL, 0x3fe954cbUL, - 0x01164c1dUL, 0x3e5d5b57UL, 0xc0000000UL, 0x3fe946faUL, 0xe63b3767UL, - 0xbe4f84e7UL, 0x40000000UL, 0x3fe9392eUL, 0xe57cc2a9UL, 0x3e34eda3UL, - 0xe0000000UL, 0x3fe92b65UL, 0x8c75b544UL, 0x3e5766a0UL, 0xc0000000UL, - 0x3fe91da1UL, 0x37d1d087UL, 0xbe5e2ab1UL, 0x80000000UL, 0x3fe90fe1UL, - 0xa953dc20UL, 0x3e5fa1f3UL, 0x80000000UL, 0x3fe90225UL, 0xdbd3f369UL, - 0x3e47d6dbUL, 0xa0000000UL, 0x3fe8f46dUL, 0x1c9be989UL, 0xbe5e2b0aUL, - 0xa0000000UL, 0x3fe8e6b9UL, 0x3c93d76aUL, 0x3e5c8618UL, 0xe0000000UL, - 0x3fe8d909UL, 0x2182fc9aUL, 0xbe41aa9eUL, 0x20000000UL, 0x3fe8cb5eUL, - 0xe6b3539dUL, 0xbe530d19UL, 0x60000000UL, 0x3fe8bdb6UL, 0x49e58cc3UL, - 0xbe3bb374UL, 0xa0000000UL, 0x3fe8b012UL, 0xa7cfeb8fUL, 0x3e56c412UL, - 0x00000000UL, 0x3fe8a273UL, 0x8d52bc19UL, 0x3e1429b8UL, 0x60000000UL, - 0x3fe894d7UL, 0x4dc32c6cUL, 0xbe48604cUL, 0xc0000000UL, 0x3fe8873fUL, - 0x0c868e56UL, 0xbe564ee5UL, 0x00000000UL, 0x3fe879acUL, 0x56aee828UL, - 0x3e5e2fd8UL, 0x60000000UL, 0x3fe86c1cUL, 0x7ceab8ecUL, 0x3e493365UL, - 0xc0000000UL, 0x3fe85e90UL, 0x78d4dadcUL, 0xbe4f7f25UL, 0x00000000UL, - 0x3fe85109UL, 0x0ccd8280UL, 0x3e31e7a2UL, 0x40000000UL, 0x3fe84385UL, - 0x34ba4e15UL, 0x3e328077UL, 0x80000000UL, 0x3fe83605UL, 0xa670975aUL, - 0xbe53eee5UL, 0xa0000000UL, 0x3fe82889UL, 0xf61b77b2UL, 0xbe43a20aUL, - 0xa0000000UL, 0x3fe81b11UL, 0x13e6643bUL, 0x3e5e5fe5UL, 0xc0000000UL, - 0x3fe80d9dUL, 0x82cc94e8UL, 0xbe5ff1f9UL, 0xa0000000UL, 0x3fe8002dUL, - 0x8a0c9c5dUL, 0xbe42b0e7UL, 0x60000000UL, 0x3fe7f2c1UL, 0x22a16f01UL, - 0x3e5d9ea0UL, 0x20000000UL, 0x3fe7e559UL, 0xc38cd451UL, 0x3e506963UL, - 0xc0000000UL, 0x3fe7d7f4UL, 0x9902bc71UL, 0x3e4503d7UL, 0x40000000UL, - 0x3fe7ca94UL, 0xdef2a3c0UL, 0x3e3d98edUL, 0xa0000000UL, 0x3fe7bd37UL, - 0xed49abb0UL, 0x3e24c1ffUL, 0xe0000000UL, 0x3fe7afdeUL, 0xe3b0be70UL, - 0xbe40c467UL, 0x00000000UL, 0x3fe7a28aUL, 0xaf9f193cUL, 0xbe5dff6cUL, - 0xe0000000UL, 0x3fe79538UL, 0xb74cf6b6UL, 0xbe258ed0UL, 0xa0000000UL, - 0x3fe787ebUL, 0x1d9127c7UL, 0x3e345fb0UL, 0x40000000UL, 0x3fe77aa2UL, - 0x1028c21dUL, 0xbe4619bdUL, 0xa0000000UL, 0x3fe76d5cUL, 0x7cb0b5e4UL, - 0x3e40f1a2UL, 0xe0000000UL, 0x3fe7601aUL, 0x2b1bc4adUL, 0xbe32e8bbUL, - 0xe0000000UL, 0x3fe752dcUL, 0x6839f64eUL, 0x3e41f57bUL, 0xc0000000UL, - 0x3fe745a2UL, 0xc4121f7eUL, 0xbe52c40aUL, 0x60000000UL, 0x3fe7386cUL, - 0xd6852d72UL, 0xbe5c4e6bUL, 0xc0000000UL, 0x3fe72b39UL, 0x91d690f7UL, - 0xbe57f88fUL, 0xe0000000UL, 0x3fe71e0aUL, 0x627a2159UL, 0xbe4425d5UL, - 0xc0000000UL, 0x3fe710dfUL, 0x50a54033UL, 0x3e422b7eUL, 0x60000000UL, - 0x3fe703b8UL, 0x3b0b5f91UL, 0x3e5d3857UL, 0xe0000000UL, 0x3fe6f694UL, - 0x84d628a2UL, 0xbe51f090UL, 0x00000000UL, 0x3fe6e975UL, 0x306d8894UL, - 0xbe414d83UL, 0xe0000000UL, 0x3fe6dc58UL, 0x30bf24aaUL, 0xbe4650caUL, - 0x80000000UL, 0x3fe6cf40UL, 0xd4628d69UL, 0xbe5db007UL, 0xc0000000UL, - 0x3fe6c22bUL, 0xa2aae57bUL, 0xbe31d279UL, 0xc0000000UL, 0x3fe6b51aUL, - 0x860edf7eUL, 0xbe2d4c4aUL, 0x80000000UL, 0x3fe6a80dUL, 0xf3559341UL, - 0xbe5f7e98UL, 0xe0000000UL, 0x3fe69b03UL, 0xa885899eUL, 0xbe5c2011UL, - 0xe0000000UL, 0x3fe68dfdUL, 0x2bdc6d37UL, 0x3e224a82UL, 0xa0000000UL, - 0x3fe680fbUL, 0xc12ad1b9UL, 0xbe40cf56UL, 0x00000000UL, 0x3fe673fdUL, - 0x1bcdf659UL, 0xbdf52f2dUL, 0x00000000UL, 0x3fe66702UL, 0x5df10408UL, - 0x3e5663e0UL, 0xc0000000UL, 0x3fe65a0aUL, 0xa4070568UL, 0xbe40b12fUL, - 0x00000000UL, 0x3fe64d17UL, 0x71c54c47UL, 0x3e5f5e8bUL, 0x00000000UL, - 0x3fe64027UL, 0xbd4b7e83UL, 0x3e42ead6UL, 0xa0000000UL, 0x3fe6333aUL, - 0x61598bd2UL, 0xbe4c48d4UL, 0xc0000000UL, 0x3fe62651UL, 0x6f538d61UL, - 0x3e548401UL, 0xa0000000UL, 0x3fe6196cUL, 0x14344120UL, 0xbe529af6UL, - 0x00000000UL, 0x3fe60c8bUL, 0x5982c587UL, 0xbe3e1e4fUL, 0x00000000UL, - 0x3fe5ffadUL, 0xfe51d4eaUL, 0xbe4c897aUL, 0x80000000UL, 0x3fe5f2d2UL, - 0xfd46ebe1UL, 0x3e552e00UL, 0xa0000000UL, 0x3fe5e5fbUL, 0xa4695699UL, - 0x3e5ed471UL, 0x60000000UL, 0x3fe5d928UL, 0x80d118aeUL, 0x3e456b61UL, - 0xa0000000UL, 0x3fe5cc58UL, 0x304c330bUL, 0x3e54dc29UL, 0x80000000UL, - 0x3fe5bf8cUL, 0x0af2dedfUL, 0xbe3aa9bdUL, 0xe0000000UL, 0x3fe5b2c3UL, - 0x15fc9258UL, 0xbe479a37UL, 0xc0000000UL, 0x3fe5a5feUL, 0x9292c7eaUL, - 0x3e188650UL, 0x20000000UL, 0x3fe5993dUL, 0x33b4d380UL, 0x3e5d6d93UL, - 0x20000000UL, 0x3fe58c7fUL, 0x02fd16c7UL, 0x3e2fe961UL, 0xa0000000UL, - 0x3fe57fc4UL, 0x4a05edb6UL, 0xbe4d55b4UL, 0xa0000000UL, 0x3fe5730dUL, - 0x3d443abbUL, 0xbe5e6954UL, 0x00000000UL, 0x3fe5665aUL, 0x024acfeaUL, - 0x3e50e61bUL, 0x00000000UL, 0x3fe559aaUL, 0xcc9edd09UL, 0xbe325403UL, - 0x60000000UL, 0x3fe54cfdUL, 0x1fe26950UL, 0x3e5d500eUL, 0x60000000UL, - 0x3fe54054UL, 0x6c5ae164UL, 0xbe4a79b4UL, 0xc0000000UL, 0x3fe533aeUL, - 0x154b0287UL, 0xbe401571UL, 0xa0000000UL, 0x3fe5270cUL, 0x0673f401UL, - 0xbe56e56bUL, 0xe0000000UL, 0x3fe51a6dUL, 0x751b639cUL, 0x3e235269UL, - 0xa0000000UL, 0x3fe50dd2UL, 0x7c7b2bedUL, 0x3ddec887UL, 0xc0000000UL, - 0x3fe5013aUL, 0xafab4e17UL, 0x3e5e7575UL, 0x60000000UL, 0x3fe4f4a6UL, - 0x2e308668UL, 0x3e59aed6UL, 0x80000000UL, 0x3fe4e815UL, 0xf33e2a76UL, - 0xbe51f184UL, 0xe0000000UL, 0x3fe4db87UL, 0x839f3e3eUL, 0x3e57db01UL, - 0xc0000000UL, 0x3fe4cefdUL, 0xa9eda7bbUL, 0x3e535e0fUL, 0x00000000UL, - 0x3fe4c277UL, 0x2a8f66a5UL, 0x3e5ce451UL, 0xc0000000UL, 0x3fe4b5f3UL, - 0x05192456UL, 0xbe4e8518UL, 0xc0000000UL, 0x3fe4a973UL, 0x4aa7cd1dUL, - 0x3e46784aUL, 0x40000000UL, 0x3fe49cf7UL, 0x8e23025eUL, 0xbe5749f2UL, - 0x00000000UL, 0x3fe4907eUL, 0x18d30215UL, 0x3e360f39UL, 0x20000000UL, - 0x3fe48408UL, 0x63dcf2f3UL, 0x3e5e00feUL, 0xc0000000UL, 0x3fe47795UL, - 0x46182d09UL, 0xbe5173d9UL, 0xa0000000UL, 0x3fe46b26UL, 0x8f0e62aaUL, - 0xbe48f281UL, 0xe0000000UL, 0x3fe45ebaUL, 0x5775c40cUL, 0xbe56aad4UL, - 0x60000000UL, 0x3fe45252UL, 0x0fe25f69UL, 0x3e48bd71UL, 0x40000000UL, - 0x3fe445edUL, 0xe9989ec5UL, 0x3e590d97UL, 0x80000000UL, 0x3fe4398bUL, - 0xb3d9ffe3UL, 0x3e479dbcUL, 0x20000000UL, 0x3fe42d2dUL, 0x388e4d2eUL, - 0xbe5eed80UL, 0xe0000000UL, 0x3fe420d1UL, 0x6f797c18UL, 0x3e554b4cUL, - 0x20000000UL, 0x3fe4147aUL, 0x31048bb4UL, 0xbe5b1112UL, 0x80000000UL, - 0x3fe40825UL, 0x2efba4f9UL, 0x3e48ebc7UL, 0x40000000UL, 0x3fe3fbd4UL, - 0x50201119UL, 0x3e40b701UL, 0x40000000UL, 0x3fe3ef86UL, 0x0a4db32cUL, - 0x3e551de8UL, 0xa0000000UL, 0x3fe3e33bUL, 0x0c9c148bUL, 0xbe50c1f6UL, - 0x20000000UL, 0x3fe3d6f4UL, 0xc9129447UL, 0x3e533fa0UL, 0x00000000UL, - 0x3fe3cab0UL, 0xaae5b5a0UL, 0xbe22b68eUL, 0x20000000UL, 0x3fe3be6fUL, - 0x02305e8aUL, 0xbe54fc08UL, 0x60000000UL, 0x3fe3b231UL, 0x7f908258UL, - 0x3e57dc05UL, 0x00000000UL, 0x3fe3a5f7UL, 0x1a09af78UL, 0x3e08038bUL, - 0xe0000000UL, 0x3fe399bfUL, 0x490643c1UL, 0xbe5dbe42UL, 0xe0000000UL, - 0x3fe38d8bUL, 0x5e8ad724UL, 0xbe3c2b72UL, 0x20000000UL, 0x3fe3815bUL, - 0xc67196b6UL, 0x3e1713cfUL, 0xa0000000UL, 0x3fe3752dUL, 0x6182e429UL, - 0xbe3ec14cUL, 0x40000000UL, 0x3fe36903UL, 0xab6eb1aeUL, 0x3e5a2cc5UL, - 0x40000000UL, 0x3fe35cdcUL, 0xfe5dc064UL, 0xbe5c5878UL, 0x40000000UL, - 0x3fe350b8UL, 0x0ba6b9e4UL, 0x3e51619bUL, 0x80000000UL, 0x3fe34497UL, - 0x857761aaUL, 0x3e5fff53UL, 0x00000000UL, 0x3fe3387aUL, 0xf872d68cUL, - 0x3e484f4dUL, 0xa0000000UL, 0x3fe32c5fUL, 0x087e97c2UL, 0x3e52842eUL, - 0x80000000UL, 0x3fe32048UL, 0x73d6d0c0UL, 0xbe503edfUL, 0x80000000UL, - 0x3fe31434UL, 0x0c1456a1UL, 0xbe5f72adUL, 0xa0000000UL, 0x3fe30823UL, - 0x83a1a4d5UL, 0xbe5e65ccUL, 0xe0000000UL, 0x3fe2fc15UL, 0x855a7390UL, - 0xbe506438UL, 0x40000000UL, 0x3fe2f00bUL, 0xa2898287UL, 0x3e3d22a2UL, - 0xe0000000UL, 0x3fe2e403UL, 0x8b56f66fUL, 0xbe5aa5fdUL, 0x80000000UL, - 0x3fe2d7ffUL, 0x52db119aUL, 0x3e3a2e3dUL, 0x60000000UL, 0x3fe2cbfeUL, - 0xe2ddd4c0UL, 0xbe586469UL, 0x40000000UL, 0x3fe2c000UL, 0x6b01bf10UL, - 0x3e352b9dUL, 0x40000000UL, 0x3fe2b405UL, 0xb07a1cdfUL, 0x3e5c5cdaUL, - 0x80000000UL, 0x3fe2a80dUL, 0xc7b5f868UL, 0xbe5668b3UL, 0xc0000000UL, - 0x3fe29c18UL, 0x185edf62UL, 0xbe563d66UL, 0x00000000UL, 0x3fe29027UL, - 0xf729e1ccUL, 0x3e59a9a0UL, 0x80000000UL, 0x3fe28438UL, 0x6433c727UL, - 0xbe43cc89UL, 0x00000000UL, 0x3fe2784dUL, 0x41782631UL, 0xbe30750cUL, - 0xa0000000UL, 0x3fe26c64UL, 0x914911b7UL, 0xbe58290eUL, 0x40000000UL, - 0x3fe2607fUL, 0x3dcc73e1UL, 0xbe4269cdUL, 0x00000000UL, 0x3fe2549dUL, - 0x2751bf70UL, 0xbe5a6998UL, 0xc0000000UL, 0x3fe248bdUL, 0x4248b9fbUL, - 0xbe4ddb00UL, 0x80000000UL, 0x3fe23ce1UL, 0xf35cf82fUL, 0x3e561b71UL, - 0x60000000UL, 0x3fe23108UL, 0x8e481a2dUL, 0x3e518fb9UL, 0x60000000UL, - 0x3fe22532UL, 0x5ab96edcUL, 0xbe5fafc5UL, 0x40000000UL, 0x3fe2195fUL, - 0x80943911UL, 0xbe07f819UL, 0x40000000UL, 0x3fe20d8fUL, 0x386f2d6cUL, - 0xbe54ba8bUL, 0x40000000UL, 0x3fe201c2UL, 0xf29664acUL, 0xbe5eb815UL, - 0x20000000UL, 0x3fe1f5f8UL, 0x64f03390UL, 0x3e5e320cUL, 0x20000000UL, - 0x3fe1ea31UL, 0x747ff696UL, 0x3e5ef0a5UL, 0x40000000UL, 0x3fe1de6dUL, - 0x3e9ceb51UL, 0xbe5f8d27UL, 0x20000000UL, 0x3fe1d2acUL, 0x4ae0b55eUL, - 0x3e5faa21UL, 0x20000000UL, 0x3fe1c6eeUL, 0x28569a5eUL, 0x3e598a4fUL, - 0x20000000UL, 0x3fe1bb33UL, 0x54b33e07UL, 0x3e46130aUL, 0x20000000UL, - 0x3fe1af7bUL, 0x024f1078UL, 0xbe4dbf93UL, 0x00000000UL, 0x3fe1a3c6UL, - 0xb0783bfaUL, 0x3e419248UL, 0xe0000000UL, 0x3fe19813UL, 0x2f02b836UL, - 0x3e4e02b7UL, 0xc0000000UL, 0x3fe18c64UL, 0x28dec9d4UL, 0x3e09064fUL, - 0x80000000UL, 0x3fe180b8UL, 0x45cbf406UL, 0x3e5b1f46UL, 0x40000000UL, - 0x3fe1750fUL, 0x03d9964cUL, 0x3e5b0a79UL, 0x00000000UL, 0x3fe16969UL, - 0x8b5b882bUL, 0xbe238086UL, 0xa0000000UL, 0x3fe15dc5UL, 0x73bad6f8UL, - 0xbdf1fca4UL, 0x20000000UL, 0x3fe15225UL, 0x5385769cUL, 0x3e5e8d76UL, - 0xa0000000UL, 0x3fe14687UL, 0x1676dc6bUL, 0x3e571d08UL, 0x20000000UL, - 0x3fe13aedUL, 0xa8c41c7fUL, 0xbe598a25UL, 0x60000000UL, 0x3fe12f55UL, - 0xc4e1aaf0UL, 0x3e435277UL, 0xa0000000UL, 0x3fe123c0UL, 0x403638e1UL, - 0xbe21aa7cUL, 0xc0000000UL, 0x3fe1182eUL, 0x557a092bUL, 0xbdd0116bUL, - 0xc0000000UL, 0x3fe10c9fUL, 0x7d779f66UL, 0x3e4a61baUL, 0xc0000000UL, - 0x3fe10113UL, 0x2b09c645UL, 0xbe5d586eUL, 0x20000000UL, 0x3fe0ea04UL, - 0xea2cad46UL, 0x3e5aa97cUL, 0x20000000UL, 0x3fe0d300UL, 0x23190e54UL, - 0x3e50f1a7UL, 0xa0000000UL, 0x3fe0bc07UL, 0x1379a5a6UL, 0xbe51619dUL, - 0x60000000UL, 0x3fe0a51aUL, 0x926a3d4aUL, 0x3e5cf019UL, 0xa0000000UL, - 0x3fe08e38UL, 0xa8c24358UL, 0x3e35241eUL, 0x20000000UL, 0x3fe07762UL, - 0x24317e7aUL, 0x3e512cfaUL, 0x00000000UL, 0x3fe06097UL, 0xfd9cf274UL, - 0xbe55bef3UL, 0x00000000UL, 0x3fe049d7UL, 0x3689b49dUL, 0xbe36d26dUL, - 0x40000000UL, 0x3fe03322UL, 0xf72ef6c4UL, 0xbe54cd08UL, 0xa0000000UL, - 0x3fe01c78UL, 0x23702d2dUL, 0xbe5900bfUL, 0x00000000UL, 0x3fe005daUL, - 0x3f59c14cUL, 0x3e57d80bUL, 0x40000000UL, 0x3fdfde8dUL, 0xad67766dUL, - 0xbe57fad4UL, 0x40000000UL, 0x3fdfb17cUL, 0x644f4ae7UL, 0x3e1ee43bUL, - 0x40000000UL, 0x3fdf8481UL, 0x903234d2UL, 0x3e501a86UL, 0x40000000UL, - 0x3fdf579cUL, 0xafe9e509UL, 0xbe267c3eUL, 0x00000000UL, 0x3fdf2acdUL, - 0xb7dfda0bUL, 0xbe48149bUL, 0x40000000UL, 0x3fdefe13UL, 0x3b94305eUL, - 0x3e5f4ea7UL, 0x80000000UL, 0x3fded16fUL, 0x5d95da61UL, 0xbe55c198UL, - 0x00000000UL, 0x3fdea4e1UL, 0x406960c9UL, 0xbdd99a19UL, 0x00000000UL, - 0x3fde7868UL, 0xd22f3539UL, 0x3e470c78UL, 0x80000000UL, 0x3fde4c04UL, - 0x83eec535UL, 0xbe3e1232UL, 0x40000000UL, 0x3fde1fb6UL, 0x3dfbffcbUL, - 0xbe4b7d71UL, 0x40000000UL, 0x3fddf37dUL, 0x7e1be4e0UL, 0xbe5b8f8fUL, - 0x40000000UL, 0x3fddc759UL, 0x46dae887UL, 0xbe350458UL, 0x80000000UL, - 0x3fdd9b4aUL, 0xed6ecc49UL, 0xbe5f0045UL, 0x80000000UL, 0x3fdd6f50UL, - 0x2e9e883cUL, 0x3e2915daUL, 0x80000000UL, 0x3fdd436bUL, 0xf0bccb32UL, - 0x3e4a68c9UL, 0x80000000UL, 0x3fdd179bUL, 0x9bbfc779UL, 0xbe54a26aUL, - 0x00000000UL, 0x3fdcebe0UL, 0x7cea33abUL, 0x3e43c6b7UL, 0x40000000UL, - 0x3fdcc039UL, 0xe740fd06UL, 0x3e5526c2UL, 0x40000000UL, 0x3fdc94a7UL, - 0x9eadeb1aUL, 0xbe396d8dUL, 0xc0000000UL, 0x3fdc6929UL, 0xf0a8f95aUL, - 0xbe5c0ab2UL, 0x80000000UL, 0x3fdc3dc0UL, 0x6ee2693bUL, 0x3e0992e6UL, - 0xc0000000UL, 0x3fdc126bUL, 0x5ac6b581UL, 0xbe2834b6UL, 0x40000000UL, - 0x3fdbe72bUL, 0x8cc226ffUL, 0x3e3596a6UL, 0x00000000UL, 0x3fdbbbffUL, - 0xf92a74bbUL, 0x3e3c5813UL, 0x00000000UL, 0x3fdb90e7UL, 0x479664c0UL, - 0xbe50d644UL, 0x00000000UL, 0x3fdb65e3UL, 0x5004975bUL, 0xbe55258fUL, - 0x00000000UL, 0x3fdb3af3UL, 0xe4b23194UL, 0xbe588407UL, 0xc0000000UL, - 0x3fdb1016UL, 0xe65d4d0aUL, 0x3e527c26UL, 0x80000000UL, 0x3fdae54eUL, - 0x814fddd6UL, 0x3e5962a2UL, 0x40000000UL, 0x3fdaba9aUL, 0xe19d0913UL, - 0xbe562f4eUL, 0x80000000UL, 0x3fda8ff9UL, 0x43cfd006UL, 0xbe4cfdebUL, - 0x40000000UL, 0x3fda656cUL, 0x686f0a4eUL, 0x3e5e47a8UL, 0xc0000000UL, - 0x3fda3af2UL, 0x7200d410UL, 0x3e5e1199UL, 0xc0000000UL, 0x3fda108cUL, - 0xabd2266eUL, 0x3e5ee4d1UL, 0x40000000UL, 0x3fd9e63aUL, 0x396f8f2cUL, - 0x3e4dbffbUL, 0x00000000UL, 0x3fd9bbfbUL, 0xe32b25ddUL, 0x3e5c3a54UL, - 0x40000000UL, 0x3fd991cfUL, 0x431e4035UL, 0xbe457925UL, 0x80000000UL, - 0x3fd967b6UL, 0x7bed3dd3UL, 0x3e40c61dUL, 0x00000000UL, 0x3fd93db1UL, - 0xd7449365UL, 0x3e306419UL, 0x80000000UL, 0x3fd913beUL, 0x1746e791UL, - 0x3e56fcfcUL, 0x40000000UL, 0x3fd8e9dfUL, 0xf3a9028bUL, 0xbe5041b9UL, - 0xc0000000UL, 0x3fd8c012UL, 0x56840c50UL, 0xbe26e20aUL, 0x40000000UL, - 0x3fd89659UL, 0x19763102UL, 0xbe51f466UL, 0x80000000UL, 0x3fd86cb2UL, - 0x7032de7cUL, 0xbe4d298aUL, 0x80000000UL, 0x3fd8431eUL, 0xdeb39fabUL, - 0xbe4361ebUL, 0x40000000UL, 0x3fd8199dUL, 0x5d01cbe0UL, 0xbe5425b3UL, - 0x80000000UL, 0x3fd7f02eUL, 0x3ce99aa9UL, 0x3e146fa8UL, 0x80000000UL, - 0x3fd7c6d2UL, 0xd1a262b9UL, 0xbe5a1a69UL, 0xc0000000UL, 0x3fd79d88UL, - 0x8606c236UL, 0x3e423a08UL, 0x80000000UL, 0x3fd77451UL, 0x8fd1e1b7UL, - 0x3e5a6a63UL, 0xc0000000UL, 0x3fd74b2cUL, 0xe491456aUL, 0x3e42c1caUL, - 0x40000000UL, 0x3fd7221aUL, 0x4499a6d7UL, 0x3e36a69aUL, 0x00000000UL, - 0x3fd6f91aUL, 0x5237df94UL, 0xbe0f8f02UL, 0x00000000UL, 0x3fd6d02cUL, - 0xb6482c6eUL, 0xbe5abcf7UL, 0x00000000UL, 0x3fd6a750UL, 0x1919fd61UL, - 0xbe57ade2UL, 0x00000000UL, 0x3fd67e86UL, 0xaa7a994dUL, 0xbe3f3fbdUL, - 0x00000000UL, 0x3fd655ceUL, 0x67db014cUL, 0x3e33c550UL, 0x00000000UL, - 0x3fd62d28UL, 0xa82856b7UL, 0xbe1409d1UL, 0xc0000000UL, 0x3fd60493UL, - 0x1e6a300dUL, 0x3e55d899UL, 0x80000000UL, 0x3fd5dc11UL, 0x1222bd5cUL, - 0xbe35bfc0UL, 0xc0000000UL, 0x3fd5b3a0UL, 0x6e8dc2d3UL, 0x3e5d4d79UL, - 0x00000000UL, 0x3fd58b42UL, 0xe0e4ace6UL, 0xbe517303UL, 0x80000000UL, - 0x3fd562f4UL, 0xb306e0a8UL, 0x3e5edf0fUL, 0xc0000000UL, 0x3fd53ab8UL, - 0x6574bc54UL, 0x3e5ee859UL, 0x80000000UL, 0x3fd5128eUL, 0xea902207UL, - 0x3e5f6188UL, 0xc0000000UL, 0x3fd4ea75UL, 0x9f911d79UL, 0x3e511735UL, - 0x80000000UL, 0x3fd4c26eUL, 0xf9c77397UL, 0xbe5b1643UL, 0x40000000UL, - 0x3fd49a78UL, 0x15fc9258UL, 0x3e479a37UL, 0x80000000UL, 0x3fd47293UL, - 0xd5a04dd9UL, 0xbe426e56UL, 0xc0000000UL, 0x3fd44abfUL, 0xe04042f5UL, - 0x3e56f7c6UL, 0x40000000UL, 0x3fd422fdUL, 0x1d8bf2c8UL, 0x3e5d8810UL, - 0x00000000UL, 0x3fd3fb4cUL, 0x88a8ddeeUL, 0xbe311454UL, 0xc0000000UL, - 0x3fd3d3abUL, 0x3e3b5e47UL, 0xbe5d1b72UL, 0x40000000UL, 0x3fd3ac1cUL, - 0xc2ab5d59UL, 0x3e31b02bUL, 0xc0000000UL, 0x3fd3849dUL, 0xd4e34b9eUL, - 0x3e51cb2fUL, 0x40000000UL, 0x3fd35d30UL, 0x177204fbUL, 0xbe2b8cd7UL, - 0x80000000UL, 0x3fd335d3UL, 0xfcd38c82UL, 0xbe4356e1UL, 0x80000000UL, - 0x3fd30e87UL, 0x64f54accUL, 0xbe4e6224UL, 0x00000000UL, 0x3fd2e74cUL, - 0xaa7975d9UL, 0x3e5dc0feUL, 0x80000000UL, 0x3fd2c021UL, 0x516dab3fUL, - 0xbe50ffa3UL, 0x40000000UL, 0x3fd29907UL, 0x2bfb7313UL, 0x3e5674a2UL, - 0xc0000000UL, 0x3fd271fdUL, 0x0549fc99UL, 0x3e385d29UL, 0xc0000000UL, - 0x3fd24b04UL, 0x55b63073UL, 0xbe500c6dUL, 0x00000000UL, 0x3fd2241cUL, - 0x3f91953aUL, 0x3e389977UL, 0xc0000000UL, 0x3fd1fd43UL, 0xa1543f71UL, - 0xbe3487abUL, 0xc0000000UL, 0x3fd1d67bUL, 0x4ec8867cUL, 0x3df6a2dcUL, - 0x00000000UL, 0x3fd1afc4UL, 0x4328e3bbUL, 0x3e41d9c0UL, 0x80000000UL, - 0x3fd1891cUL, 0x2e1cda84UL, 0x3e3bdd87UL, 0x40000000UL, 0x3fd16285UL, - 0x4b5331aeUL, 0xbe53128eUL, 0x00000000UL, 0x3fd13bfeUL, 0xb9aec164UL, - 0xbe52ac98UL, 0xc0000000UL, 0x3fd11586UL, 0xd91e1316UL, 0xbe350630UL, - 0x80000000UL, 0x3fd0ef1fUL, 0x7cacc12cUL, 0x3e3f5219UL, 0x40000000UL, - 0x3fd0c8c8UL, 0xbce277b7UL, 0x3e3d30c0UL, 0x00000000UL, 0x3fd0a281UL, - 0x2a63447dUL, 0xbe541377UL, 0x80000000UL, 0x3fd07c49UL, 0xfac483b5UL, - 0xbe5772ecUL, 0xc0000000UL, 0x3fd05621UL, 0x36b8a570UL, 0xbe4fd4bdUL, - 0xc0000000UL, 0x3fd03009UL, 0xbae505f7UL, 0xbe450388UL, 0x80000000UL, - 0x3fd00a01UL, 0x3e35aeadUL, 0xbe5430fcUL, 0x80000000UL, 0x3fcfc811UL, - 0x707475acUL, 0x3e38806eUL, 0x80000000UL, 0x3fcf7c3fUL, 0xc91817fcUL, - 0xbe40cceaUL, 0x80000000UL, 0x3fcf308cUL, 0xae05d5e9UL, 0xbe4919b8UL, - 0x80000000UL, 0x3fcee4f8UL, 0xae6cc9e6UL, 0xbe530b94UL, 0x00000000UL, - 0x3fce9983UL, 0x1efe3e8eUL, 0x3e57747eUL, 0x00000000UL, 0x3fce4e2dUL, - 0xda78d9bfUL, 0xbe59a608UL, 0x00000000UL, 0x3fce02f5UL, 0x8abe2c2eUL, - 0x3e4a35adUL, 0x00000000UL, 0x3fcdb7dcUL, 0x1495450dUL, 0xbe0872ccUL, - 0x80000000UL, 0x3fcd6ce1UL, 0x86ee0ba0UL, 0xbe4f59a0UL, 0x00000000UL, - 0x3fcd2205UL, 0xe81ca888UL, 0x3e5402c3UL, 0x00000000UL, 0x3fccd747UL, - 0x3b4424b9UL, 0x3e5dfdc3UL, 0x80000000UL, 0x3fcc8ca7UL, 0xd305b56cUL, - 0x3e202da6UL, 0x00000000UL, 0x3fcc4226UL, 0x399a6910UL, 0xbe482a1cUL, - 0x80000000UL, 0x3fcbf7c2UL, 0x747f7938UL, 0xbe587372UL, 0x80000000UL, - 0x3fcbad7cUL, 0x6fc246a0UL, 0x3e50d83dUL, 0x00000000UL, 0x3fcb6355UL, - 0xee9e9be5UL, 0xbe5c35bdUL, 0x80000000UL, 0x3fcb194aUL, 0x8416c0bcUL, - 0x3e546d4fUL, 0x00000000UL, 0x3fcacf5eUL, 0x49f7f08fUL, 0x3e56da76UL, - 0x00000000UL, 0x3fca858fUL, 0x5dc30de2UL, 0x3e5f390cUL, 0x00000000UL, - 0x3fca3bdeUL, 0x950583b6UL, 0xbe5e4169UL, 0x80000000UL, 0x3fc9f249UL, - 0x33631553UL, 0x3e52aeb1UL, 0x00000000UL, 0x3fc9a8d3UL, 0xde8795a6UL, - 0xbe59a504UL, 0x00000000UL, 0x3fc95f79UL, 0x076bf41eUL, 0x3e5122feUL, - 0x80000000UL, 0x3fc9163cUL, 0x2914c8e7UL, 0x3e3dd064UL, 0x00000000UL, - 0x3fc8cd1dUL, 0x3a30eca3UL, 0xbe21b4aaUL, 0x80000000UL, 0x3fc8841aUL, - 0xb2a96650UL, 0xbe575444UL, 0x80000000UL, 0x3fc83b34UL, 0x2376c0cbUL, - 0xbe2a74c7UL, 0x80000000UL, 0x3fc7f26bUL, 0xd8a0b653UL, 0xbe5181b6UL, - 0x00000000UL, 0x3fc7a9bfUL, 0x32257882UL, 0xbe4a78b4UL, 0x00000000UL, - 0x3fc7612fUL, 0x1eee8bd9UL, 0xbe1bfe9dUL, 0x80000000UL, 0x3fc718bbUL, - 0x0c603cc4UL, 0x3e36fdc9UL, 0x80000000UL, 0x3fc6d064UL, 0x3728b8cfUL, - 0xbe1e542eUL, 0x80000000UL, 0x3fc68829UL, 0xc79a4067UL, 0x3e5c380fUL, - 0x00000000UL, 0x3fc6400bUL, 0xf69eac69UL, 0x3e550a84UL, 0x80000000UL, - 0x3fc5f808UL, 0xb7a780a4UL, 0x3e5d9224UL, 0x80000000UL, 0x3fc5b022UL, - 0xad9dfb1eUL, 0xbe55242fUL, 0x00000000UL, 0x3fc56858UL, 0x659b18beUL, - 0xbe4bfda3UL, 0x80000000UL, 0x3fc520a9UL, 0x66ee3631UL, 0xbe57d769UL, - 0x80000000UL, 0x3fc4d916UL, 0x1ec62819UL, 0x3e2427f7UL, 0x80000000UL, - 0x3fc4919fUL, 0xdec25369UL, 0xbe435431UL, 0x00000000UL, 0x3fc44a44UL, - 0xa8acfc4bUL, 0xbe3c62e8UL, 0x00000000UL, 0x3fc40304UL, 0xcf1d3eabUL, - 0xbdfba29fUL, 0x80000000UL, 0x3fc3bbdfUL, 0x79aba3eaUL, 0xbdf1b7c8UL, - 0x80000000UL, 0x3fc374d6UL, 0xb8d186daUL, 0xbe5130cfUL, 0x80000000UL, - 0x3fc32de8UL, 0x9d74f152UL, 0x3e2285b6UL, 0x00000000UL, 0x3fc2e716UL, - 0x50ae7ca9UL, 0xbe503920UL, 0x80000000UL, 0x3fc2a05eUL, 0x6caed92eUL, - 0xbe533924UL, 0x00000000UL, 0x3fc259c2UL, 0x9cb5034eUL, 0xbe510e31UL, - 0x80000000UL, 0x3fc21340UL, 0x12c4d378UL, 0xbe540b43UL, 0x80000000UL, - 0x3fc1ccd9UL, 0xcc418706UL, 0x3e59887aUL, 0x00000000UL, 0x3fc1868eUL, - 0x921f4106UL, 0xbe528e67UL, 0x80000000UL, 0x3fc1405cUL, 0x3969441eUL, - 0x3e5d8051UL, 0x00000000UL, 0x3fc0fa46UL, 0xd941ef5bUL, 0x3e5f9079UL, - 0x80000000UL, 0x3fc0b44aUL, 0x5a3e81b2UL, 0xbe567691UL, 0x00000000UL, - 0x3fc06e69UL, 0x9d66afe7UL, 0xbe4d43fbUL, 0x00000000UL, 0x3fc028a2UL, - 0x0a92a162UL, 0xbe52f394UL, 0x00000000UL, 0x3fbfc5eaUL, 0x209897e5UL, - 0x3e529e37UL, 0x00000000UL, 0x3fbf3ac5UL, 0x8458bd7bUL, 0x3e582831UL, - 0x00000000UL, 0x3fbeafd5UL, 0xb8d8b4b8UL, 0xbe486b4aUL, 0x00000000UL, - 0x3fbe2518UL, 0xe0a3b7b6UL, 0x3e5bafd2UL, 0x00000000UL, 0x3fbd9a90UL, - 0x2bf2710eUL, 0x3e383b2bUL, 0x00000000UL, 0x3fbd103cUL, 0x73eb6ab7UL, - 0xbe56d78dUL, 0x00000000UL, 0x3fbc861bUL, 0x32ceaff5UL, 0xbe32dc5aUL, - 0x00000000UL, 0x3fbbfc2eUL, 0xbee04cb7UL, 0xbe4a71a4UL, 0x00000000UL, - 0x3fbb7274UL, 0x35ae9577UL, 0x3e38142fUL, 0x00000000UL, 0x3fbae8eeUL, - 0xcbaddab4UL, 0xbe5490f0UL, 0x00000000UL, 0x3fba5f9aUL, 0x95ce1114UL, - 0x3e597c71UL, 0x00000000UL, 0x3fb9d67aUL, 0x6d7c0f78UL, 0x3e3abc2dUL, - 0x00000000UL, 0x3fb94d8dUL, 0x2841a782UL, 0xbe566cbcUL, 0x00000000UL, - 0x3fb8c4d2UL, 0x6ed429c6UL, 0xbe3cfff9UL, 0x00000000UL, 0x3fb83c4aUL, - 0xe4a49fbbUL, 0xbe552964UL, 0x00000000UL, 0x3fb7b3f4UL, 0x2193d81eUL, - 0xbe42fa72UL, 0x00000000UL, 0x3fb72bd0UL, 0xdd70c122UL, 0x3e527a8cUL, - 0x00000000UL, 0x3fb6a3dfUL, 0x03108a54UL, 0xbe450393UL, 0x00000000UL, - 0x3fb61c1fUL, 0x30ff7954UL, 0x3e565840UL, 0x00000000UL, 0x3fb59492UL, - 0xdedd460cUL, 0xbe5422b5UL, 0x00000000UL, 0x3fb50d36UL, 0x950f9f45UL, - 0xbe5313f6UL, 0x00000000UL, 0x3fb4860bUL, 0x582cdcb1UL, 0x3e506d39UL, - 0x00000000UL, 0x3fb3ff12UL, 0x7216d3a6UL, 0x3e4aa719UL, 0x00000000UL, - 0x3fb3784aUL, 0x57a423fdUL, 0x3e5a9b9fUL, 0x00000000UL, 0x3fb2f1b4UL, - 0x7a138b41UL, 0xbe50b418UL, 0x00000000UL, 0x3fb26b4eUL, 0x2fbfd7eaUL, - 0x3e23a53eUL, 0x00000000UL, 0x3fb1e519UL, 0x18913ccbUL, 0x3e465fc1UL, - 0x00000000UL, 0x3fb15f15UL, 0x7ea24e21UL, 0x3e042843UL, 0x00000000UL, - 0x3fb0d941UL, 0x7c6d9c77UL, 0x3e59f61eUL, 0x00000000UL, 0x3fb0539eUL, - 0x114efd44UL, 0x3e4ccab7UL, 0x00000000UL, 0x3faf9c56UL, 0x1777f657UL, - 0x3e552f65UL, 0x00000000UL, 0x3fae91d2UL, 0xc317b86aUL, 0xbe5a61e0UL, - 0x00000000UL, 0x3fad87acUL, 0xb7664efbUL, 0xbe41f64eUL, 0x00000000UL, - 0x3fac7de6UL, 0x5d3d03a9UL, 0x3e0807a0UL, 0x00000000UL, 0x3fab7480UL, - 0x743c38ebUL, 0xbe3726e1UL, 0x00000000UL, 0x3faa6b78UL, 0x06a253f1UL, - 0x3e5ad636UL, 0x00000000UL, 0x3fa962d0UL, 0xa35f541bUL, 0x3e5a187aUL, - 0x00000000UL, 0x3fa85a88UL, 0x4b86e446UL, 0xbe508150UL, 0x00000000UL, - 0x3fa7529cUL, 0x2589cacfUL, 0x3e52938aUL, 0x00000000UL, 0x3fa64b10UL, - 0xaf6b11f2UL, 0xbe3454cdUL, 0x00000000UL, 0x3fa543e2UL, 0x97506fefUL, - 0xbe5fdec5UL, 0x00000000UL, 0x3fa43d10UL, 0xe75f7dd9UL, 0xbe388dd3UL, - 0x00000000UL, 0x3fa3369cUL, 0xa4139632UL, 0xbdea5177UL, 0x00000000UL, - 0x3fa23086UL, 0x352d6f1eUL, 0xbe565ad6UL, 0x00000000UL, 0x3fa12accUL, - 0x77449eb7UL, 0xbe50d5c7UL, 0x00000000UL, 0x3fa0256eUL, 0x7478da78UL, - 0x3e404724UL, 0x00000000UL, 0x3f9e40dcUL, 0xf59cef7fUL, 0xbe539d0aUL, - 0x00000000UL, 0x3f9c3790UL, 0x1511d43cUL, 0x3e53c2c8UL, 0x00000000UL, - 0x3f9a2f00UL, 0x9b8bff3cUL, 0xbe43b3e1UL, 0x00000000UL, 0x3f982724UL, - 0xad1e22a5UL, 0x3e46f0bdUL, 0x00000000UL, 0x3f962000UL, 0x130d9356UL, - 0x3e475ba0UL, 0x00000000UL, 0x3f941994UL, 0x8f86f883UL, 0xbe513d0bUL, - 0x00000000UL, 0x3f9213dcUL, 0x914d0dc8UL, 0xbe534335UL, 0x00000000UL, - 0x3f900ed8UL, 0x2d73e5e7UL, 0xbe22ba75UL, 0x00000000UL, 0x3f8c1510UL, - 0xc5b7d70eUL, 0x3e599c5dUL, 0x00000000UL, 0x3f880de0UL, 0x8a27857eUL, - 0xbe3d28c8UL, 0x00000000UL, 0x3f840810UL, 0xda767328UL, 0x3e531b3dUL, - 0x00000000UL, 0x3f8003b0UL, 0x77bacaf3UL, 0xbe5f04e3UL, 0x00000000UL, - 0x3f780150UL, 0xdf4b0720UL, 0x3e5a8bffUL, 0x00000000UL, 0x3f6ffc40UL, - 0x34c48e71UL, 0xbe3fcd99UL, 0x00000000UL, 0x3f5ff6c0UL, 0x1ad218afUL, - 0xbe4c78a7UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x80000000UL, - 0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL, 0x00000000UL, - 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL, 0x6dc96112UL, 0xbf836578UL, - 0xee241472UL, 0xbf9b0301UL, 0x9f95985aUL, 0xbfb528dbUL, 0xb3841d2aUL, - 0xbfd619b6UL, 0x518775e3UL, 0x3f9004f2UL, 0xac8349bbUL, 0x3fa76c9bUL, - 0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, 0xbf5dabe1UL, 0x9f95985aUL, - 0xbfb528dbUL, 0xf8b5787dUL, 0x3ef2531eUL, 0x486ececbUL, 0x3fc4635eUL, - 0x412055ccUL, 0xbdd61bb2UL, 0x00000000UL, 0xfffffff8UL, 0x00000000UL, - 0xffffffffUL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3b700000UL, - 0xfa5abcbfUL, 0x3ff00b1aUL, 0xa7609f71UL, 0xbc84f6b2UL, 0xa9fb3335UL, - 0x3ff0163dUL, 0x9ab8cdb7UL, 0x3c9b6129UL, 0x143b0281UL, 0x3ff02168UL, - 0x0fc54eb6UL, 0xbc82bf31UL, 0x3e778061UL, 0x3ff02c9aUL, 0x535b085dUL, - 0xbc719083UL, 0x2e11bbccUL, 0x3ff037d4UL, 0xeeade11aUL, 0x3c656811UL, - 0xe86e7f85UL, 0x3ff04315UL, 0x1977c96eUL, 0xbc90a31cUL, 0x72f654b1UL, - 0x3ff04e5fUL, 0x3aa0d08cUL, 0x3c84c379UL, 0xd3158574UL, 0x3ff059b0UL, - 0xa475b465UL, 0x3c8d73e2UL, 0x0e3c1f89UL, 0x3ff0650aUL, 0x5799c397UL, - 0xbc95cb7bUL, 0x29ddf6deUL, 0x3ff0706bUL, 0xe2b13c27UL, 0xbc8c91dfUL, - 0x2b72a836UL, 0x3ff07bd4UL, 0x54458700UL, 0x3c832334UL, 0x18759bc8UL, - 0x3ff08745UL, 0x4bb284ffUL, 0x3c6186beUL, 0xf66607e0UL, 0x3ff092bdUL, - 0x800a3fd1UL, 0xbc968063UL, 0xcac6f383UL, 0x3ff09e3eUL, 0x18316136UL, - 0x3c914878UL, 0x9b1f3919UL, 0x3ff0a9c7UL, 0x873d1d38UL, 0x3c85d16cUL, - 0x6cf9890fUL, 0x3ff0b558UL, 0x4adc610bUL, 0x3c98a62eUL, 0x45e46c85UL, - 0x3ff0c0f1UL, 0x06d21cefUL, 0x3c94f989UL, 0x2b7247f7UL, 0x3ff0cc92UL, - 0x16e24f71UL, 0x3c901edcUL, 0x23395decUL, 0x3ff0d83bUL, 0xe43f316aUL, - 0xbc9bc14dUL, 0x32d3d1a2UL, 0x3ff0e3ecUL, 0x27c57b52UL, 0x3c403a17UL, - 0x5fdfa9c5UL, 0x3ff0efa5UL, 0xbc54021bUL, 0xbc949db9UL, 0xaffed31bUL, - 0x3ff0fb66UL, 0xc44ebd7bUL, 0xbc6b9bedUL, 0x28d7233eUL, 0x3ff10730UL, - 0x1692fdd5UL, 0x3c8d46ebUL, 0xd0125b51UL, 0x3ff11301UL, 0x39449b3aUL, - 0xbc96c510UL, 0xab5e2ab6UL, 0x3ff11edbUL, 0xf703fb72UL, 0xbc9ca454UL, - 0xc06c31ccUL, 0x3ff12abdUL, 0xb36ca5c7UL, 0xbc51b514UL, 0x14f204abUL, - 0x3ff136a8UL, 0xba48dcf0UL, 0xbc67108fUL, 0xaea92de0UL, 0x3ff1429aUL, - 0x9af1369eUL, 0xbc932fbfUL, 0x934f312eUL, 0x3ff14e95UL, 0x39bf44abUL, - 0xbc8b91e8UL, 0xc8a58e51UL, 0x3ff15a98UL, 0xb9eeab0aUL, 0x3c82406aUL, - 0x5471c3c2UL, 0x3ff166a4UL, 0x82ea1a32UL, 0x3c58f23bUL, 0x3c7d517bUL, - 0x3ff172b8UL, 0xb9d78a76UL, 0xbc819041UL, 0x8695bbc0UL, 0x3ff17ed4UL, - 0xe2ac5a64UL, 0x3c709e3fUL, 0x388c8deaUL, 0x3ff18af9UL, 0xd1970f6cUL, - 0xbc911023UL, 0x58375d2fUL, 0x3ff19726UL, 0x85f17e08UL, 0x3c94aaddUL, - 0xeb6fcb75UL, 0x3ff1a35bUL, 0x7b4968e4UL, 0x3c8e5b4cUL, 0xf8138a1cUL, - 0x3ff1af99UL, 0xa4b69280UL, 0x3c97bf85UL, 0x84045cd4UL, 0x3ff1bbe0UL, - 0x352ef607UL, 0xbc995386UL, 0x95281c6bUL, 0x3ff1c82fUL, 0x8010f8c9UL, - 0x3c900977UL, 0x3168b9aaUL, 0x3ff1d487UL, 0x00a2643cUL, 0x3c9e016eUL, - 0x5eb44027UL, 0x3ff1e0e7UL, 0x088cb6deUL, 0xbc96fdd8UL, 0x22fcd91dUL, - 0x3ff1ed50UL, 0x027bb78cUL, 0xbc91df98UL, 0x8438ce4dUL, 0x3ff1f9c1UL, - 0xa097af5cUL, 0xbc9bf524UL, 0x88628cd6UL, 0x3ff2063bUL, 0x814a8495UL, - 0x3c8dc775UL, 0x3578a819UL, 0x3ff212beUL, 0x2cfcaac9UL, 0x3c93592dUL, - 0x917ddc96UL, 0x3ff21f49UL, 0x9494a5eeUL, 0x3c82a97eUL, 0xa27912d1UL, - 0x3ff22bddUL, 0x5577d69fUL, 0x3c8d34fbUL, 0x6e756238UL, 0x3ff2387aUL, - 0xb6c70573UL, 0x3c99b07eUL, 0xfb82140aUL, 0x3ff2451fUL, 0x911ca996UL, - 0x3c8acfccUL, 0x4fb2a63fUL, 0x3ff251ceUL, 0xbef4f4a4UL, 0x3c8ac155UL, - 0x711ece75UL, 0x3ff25e85UL, 0x4ac31b2cUL, 0x3c93e1a2UL, 0x65e27cddUL, - 0x3ff26b45UL, 0x9940e9d9UL, 0x3c82bd33UL, 0x341ddf29UL, 0x3ff2780eUL, - 0x05f9e76cUL, 0x3c9e067cUL, 0xe1f56381UL, 0x3ff284dfUL, 0x8c3f0d7eUL, - 0xbc9a4c3aUL, 0x7591bb70UL, 0x3ff291baUL, 0x28401cbdUL, 0xbc82cc72UL, - 0xf51fdee1UL, 0x3ff29e9dUL, 0xafad1255UL, 0x3c8612e8UL, 0x66d10f13UL, - 0x3ff2ab8aUL, 0x191690a7UL, 0xbc995743UL, 0xd0dad990UL, 0x3ff2b87fUL, - 0xd6381aa4UL, 0xbc410adcUL, 0x39771b2fUL, 0x3ff2c57eUL, 0xa6eb5124UL, - 0xbc950145UL, 0xa6e4030bUL, 0x3ff2d285UL, 0x54db41d5UL, 0x3c900247UL, - 0x1f641589UL, 0x3ff2df96UL, 0xfbbce198UL, 0x3c9d16cfUL, 0xa93e2f56UL, - 0x3ff2ecafUL, 0x45d52383UL, 0x3c71ca0fUL, 0x4abd886bUL, 0x3ff2f9d2UL, - 0x532bda93UL, 0xbc653c55UL, 0x0a31b715UL, 0x3ff306feUL, 0xd23182e4UL, - 0x3c86f46aUL, 0xedeeb2fdUL, 0x3ff31432UL, 0xf3f3fcd1UL, 0x3c8959a3UL, - 0xfc4cd831UL, 0x3ff32170UL, 0x8e18047cUL, 0x3c8a9ce7UL, 0x3ba8ea32UL, - 0x3ff32eb8UL, 0x3cb4f318UL, 0xbc9c45e8UL, 0xb26416ffUL, 0x3ff33c08UL, - 0x843659a6UL, 0x3c932721UL, 0x66e3fa2dUL, 0x3ff34962UL, 0x930881a4UL, - 0xbc835a75UL, 0x5f929ff1UL, 0x3ff356c5UL, 0x5c4e4628UL, 0xbc8b5ceeUL, - 0xa2de883bUL, 0x3ff36431UL, 0xa06cb85eUL, 0xbc8c3144UL, 0x373aa9cbUL, - 0x3ff371a7UL, 0xbf42eae2UL, 0xbc963aeaUL, 0x231e754aUL, 0x3ff37f26UL, - 0x9eceb23cUL, 0xbc99f5caUL, 0x6d05d866UL, 0x3ff38caeUL, 0x3c9904bdUL, - 0xbc9e958dUL, 0x1b7140efUL, 0x3ff39a40UL, 0xfc8e2934UL, 0xbc99a9a5UL, - 0x34e59ff7UL, 0x3ff3a7dbUL, 0xd661f5e3UL, 0xbc75e436UL, 0xbfec6cf4UL, - 0x3ff3b57fUL, 0xe26fff18UL, 0x3c954c66UL, 0xc313a8e5UL, 0x3ff3c32dUL, - 0x375d29c3UL, 0xbc9efff8UL, 0x44ede173UL, 0x3ff3d0e5UL, 0x8c284c71UL, - 0x3c7fe8d0UL, 0x4c123422UL, 0x3ff3dea6UL, 0x11f09ebcUL, 0x3c8ada09UL, - 0xdf1c5175UL, 0x3ff3ec70UL, 0x7b8c9bcaUL, 0xbc8af663UL, 0x04ac801cUL, - 0x3ff3fa45UL, 0xf956f9f3UL, 0xbc97d023UL, 0xc367a024UL, 0x3ff40822UL, - 0xb6f4d048UL, 0x3c8bddf8UL, 0x21f72e2aUL, 0x3ff4160aUL, 0x1c309278UL, - 0xbc5ef369UL, 0x2709468aUL, 0x3ff423fbUL, 0xc0b314ddUL, 0xbc98462dUL, - 0xd950a897UL, 0x3ff431f5UL, 0xe35f7999UL, 0xbc81c7ddUL, 0x3f84b9d4UL, - 0x3ff43ffaUL, 0x9704c003UL, 0x3c8880beUL, 0x6061892dUL, 0x3ff44e08UL, - 0x04ef80d0UL, 0x3c489b7aUL, 0x42a7d232UL, 0x3ff45c20UL, 0x82fb1f8eUL, - 0xbc686419UL, 0xed1d0057UL, 0x3ff46a41UL, 0xd1648a76UL, 0x3c9c944bUL, - 0x668b3237UL, 0x3ff4786dUL, 0xed445733UL, 0xbc9c20f0UL, 0xb5c13cd0UL, - 0x3ff486a2UL, 0xb69062f0UL, 0x3c73c1a3UL, 0xe192aed2UL, 0x3ff494e1UL, - 0x5e499ea0UL, 0xbc83b289UL, 0xf0d7d3deUL, 0x3ff4a32aUL, 0xf3d1be56UL, - 0x3c99cb62UL, 0xea6db7d7UL, 0x3ff4b17dUL, 0x7f2897f0UL, 0xbc8125b8UL, - 0xd5362a27UL, 0x3ff4bfdaUL, 0xafec42e2UL, 0x3c7d4397UL, 0xb817c114UL, - 0x3ff4ce41UL, 0x690abd5dUL, 0x3c905e29UL, 0x99fddd0dUL, 0x3ff4dcb2UL, - 0xbc6a7833UL, 0x3c98ecdbUL, 0x81d8abffUL, 0x3ff4eb2dUL, 0x2e5d7a52UL, - 0xbc95257dUL, 0x769d2ca7UL, 0x3ff4f9b2UL, 0xd25957e3UL, 0xbc94b309UL, - 0x7f4531eeUL, 0x3ff50841UL, 0x49b7465fUL, 0x3c7a249bUL, 0xa2cf6642UL, - 0x3ff516daUL, 0x69bd93efUL, 0xbc8f7685UL, 0xe83f4eefUL, 0x3ff5257dUL, - 0x43efef71UL, 0xbc7c998dUL, 0x569d4f82UL, 0x3ff5342bUL, 0x1db13cadUL, - 0xbc807abeUL, 0xf4f6ad27UL, 0x3ff542e2UL, 0x192d5f7eUL, 0x3c87926dUL, - 0xca5d920fUL, 0x3ff551a4UL, 0xefede59bUL, 0xbc8d689cUL, 0xdde910d2UL, - 0x3ff56070UL, 0x168eebf0UL, 0xbc90fb6eUL, 0x36b527daUL, 0x3ff56f47UL, - 0x011d93adUL, 0x3c99bb2cUL, 0xdbe2c4cfUL, 0x3ff57e27UL, 0x8a57b9c4UL, - 0xbc90b98cUL, 0xd497c7fdUL, 0x3ff58d12UL, 0x5b9a1de8UL, 0x3c8295e1UL, - 0x27ff07ccUL, 0x3ff59c08UL, 0xe467e60fUL, 0xbc97e2ceUL, 0xdd485429UL, - 0x3ff5ab07UL, 0x054647adUL, 0x3c96324cUL, 0xfba87a03UL, 0x3ff5ba11UL, - 0x4c233e1aUL, 0xbc9b77a1UL, 0x8a5946b7UL, 0x3ff5c926UL, 0x816986a2UL, - 0x3c3c4b1bUL, 0x90998b93UL, 0x3ff5d845UL, 0xa8b45643UL, 0xbc9cd6a7UL, - 0x15ad2148UL, 0x3ff5e76fUL, 0x3080e65eUL, 0x3c9ba6f9UL, 0x20dceb71UL, - 0x3ff5f6a3UL, 0xe3cdcf92UL, 0xbc89eaddUL, 0xb976dc09UL, 0x3ff605e1UL, - 0x9b56de47UL, 0xbc93e242UL, 0xe6cdf6f4UL, 0x3ff6152aUL, 0x4ab84c27UL, - 0x3c9e4b3eUL, 0xb03a5585UL, 0x3ff6247eUL, 0x7e40b497UL, 0xbc9383c1UL, - 0x1d1929fdUL, 0x3ff633ddUL, 0xbeb964e5UL, 0x3c984710UL, 0x34ccc320UL, - 0x3ff64346UL, 0x759d8933UL, 0xbc8c483cUL, 0xfebc8fb7UL, 0x3ff652b9UL, - 0xc9a73e09UL, 0xbc9ae3d5UL, 0x82552225UL, 0x3ff66238UL, 0x87591c34UL, - 0xbc9bb609UL, 0xc70833f6UL, 0x3ff671c1UL, 0x586c6134UL, 0xbc8e8732UL, - 0xd44ca973UL, 0x3ff68155UL, 0x44f73e65UL, 0x3c6038aeUL, 0xb19e9538UL, - 0x3ff690f4UL, 0x9aeb445dUL, 0x3c8804bdUL, 0x667f3bcdUL, 0x3ff6a09eUL, - 0x13b26456UL, 0xbc9bdd34UL, 0xfa75173eUL, 0x3ff6b052UL, 0x2c9a9d0eUL, - 0x3c7a38f5UL, 0x750bdabfUL, 0x3ff6c012UL, 0x67ff0b0dUL, 0xbc728956UL, - 0xddd47645UL, 0x3ff6cfdcUL, 0xb6f17309UL, 0x3c9c7aa9UL, 0x3c651a2fUL, - 0x3ff6dfb2UL, 0x683c88abUL, 0xbc6bbe3aUL, 0x98593ae5UL, 0x3ff6ef92UL, - 0x9e1ac8b2UL, 0xbc90b974UL, 0xf9519484UL, 0x3ff6ff7dUL, 0x25860ef6UL, - 0xbc883c0fUL, 0x66f42e87UL, 0x3ff70f74UL, 0xd45aa65fUL, 0x3c59d644UL, - 0xe8ec5f74UL, 0x3ff71f75UL, 0x86887a99UL, 0xbc816e47UL, 0x86ead08aUL, - 0x3ff72f82UL, 0x2cd62c72UL, 0xbc920aa0UL, 0x48a58174UL, 0x3ff73f9aUL, - 0x6c65d53cUL, 0xbc90a8d9UL, 0x35d7cbfdUL, 0x3ff74fbdUL, 0x618a6e1cUL, - 0x3c9047fdUL, 0x564267c9UL, 0x3ff75febUL, 0x57316dd3UL, 0xbc902459UL, - 0xb1ab6e09UL, 0x3ff77024UL, 0x169147f8UL, 0x3c9b7877UL, 0x4fde5d3fUL, - 0x3ff78069UL, 0x0a02162dUL, 0x3c9866b8UL, 0x38ac1cf6UL, 0x3ff790b9UL, - 0x62aadd3eUL, 0x3c9349a8UL, 0x73eb0187UL, 0x3ff7a114UL, 0xee04992fUL, - 0xbc841577UL, 0x0976cfdbUL, 0x3ff7b17bUL, 0x8468dc88UL, 0xbc9bebb5UL, - 0x0130c132UL, 0x3ff7c1edUL, 0xd1164dd6UL, 0x3c9f124cUL, 0x62ff86f0UL, - 0x3ff7d26aUL, 0xfb72b8b4UL, 0x3c91bddbUL, 0x36cf4e62UL, 0x3ff7e2f3UL, - 0xba15797eUL, 0x3c705d02UL, 0x8491c491UL, 0x3ff7f387UL, 0xcf9311aeUL, - 0xbc807f11UL, 0x543e1a12UL, 0x3ff80427UL, 0x626d972bUL, 0xbc927c86UL, - 0xadd106d9UL, 0x3ff814d2UL, 0x0d151d4dUL, 0x3c946437UL, 0x994cce13UL, - 0x3ff82589UL, 0xd41532d8UL, 0xbc9d4c1dUL, 0x1eb941f7UL, 0x3ff8364cUL, - 0x31df2bd5UL, 0x3c999b9aUL, 0x4623c7adUL, 0x3ff8471aUL, 0xa341cdfbUL, - 0xbc88d684UL, 0x179f5b21UL, 0x3ff857f4UL, 0xf8b216d0UL, 0xbc5ba748UL, - 0x9b4492edUL, 0x3ff868d9UL, 0x9bd4f6baUL, 0xbc9fc6f8UL, 0xd931a436UL, - 0x3ff879caUL, 0xd2db47bdUL, 0x3c85d2d7UL, 0xd98a6699UL, 0x3ff88ac7UL, - 0xf37cb53aUL, 0x3c9994c2UL, 0xa478580fUL, 0x3ff89bd0UL, 0x4475202aUL, - 0x3c9d5395UL, 0x422aa0dbUL, 0x3ff8ace5UL, 0x56864b27UL, 0x3c96e9f1UL, - 0xbad61778UL, 0x3ff8be05UL, 0xfc43446eUL, 0x3c9ecb5eUL, 0x16b5448cUL, - 0x3ff8cf32UL, 0x32e9e3aaUL, 0xbc70d55eUL, 0x5e0866d9UL, 0x3ff8e06aUL, - 0x6fc9b2e6UL, 0xbc97114aUL, 0x99157736UL, 0x3ff8f1aeUL, 0xa2e3976cUL, - 0x3c85cc13UL, 0xd0282c8aUL, 0x3ff902feUL, 0x85fe3fd2UL, 0x3c9592caUL, - 0x0b91ffc6UL, 0x3ff9145bUL, 0x2e582524UL, 0xbc9dd679UL, 0x53aa2fe2UL, - 0x3ff925c3UL, 0xa639db7fUL, 0xbc83455fUL, 0xb0cdc5e5UL, 0x3ff93737UL, - 0x81b57ebcUL, 0xbc675fc7UL, 0x2b5f98e5UL, 0x3ff948b8UL, 0x797d2d99UL, - 0xbc8dc3d6UL, 0xcbc8520fUL, 0x3ff95a44UL, 0x96a5f039UL, 0xbc764b7cUL, - 0x9a7670b3UL, 0x3ff96bddUL, 0x7f19c896UL, 0xbc5ba596UL, 0x9fde4e50UL, - 0x3ff97d82UL, 0x7c1b85d1UL, 0xbc9d185bUL, 0xe47a22a2UL, 0x3ff98f33UL, - 0xa24c78ecUL, 0x3c7cabdaUL, 0x70ca07baUL, 0x3ff9a0f1UL, 0x91cee632UL, - 0xbc9173bdUL, 0x4d53fe0dUL, 0x3ff9b2bbUL, 0x4df6d518UL, 0xbc9dd84eUL, - 0x82a3f090UL, 0x3ff9c491UL, 0xb071f2beUL, 0x3c7c7c46UL, 0x194bb8d5UL, - 0x3ff9d674UL, 0xa3dd8233UL, 0xbc9516beUL, 0x19e32323UL, 0x3ff9e863UL, - 0x78e64c6eUL, 0x3c7824caUL, 0x8d07f29eUL, 0x3ff9fa5eUL, 0xaaf1faceUL, - 0xbc84a9ceUL, 0x7b5de565UL, 0x3ffa0c66UL, 0x5d1cd533UL, 0xbc935949UL, - 0xed8eb8bbUL, 0x3ffa1e7aUL, 0xee8be70eUL, 0x3c9c6618UL, 0xec4a2d33UL, - 0x3ffa309bUL, 0x7ddc36abUL, 0x3c96305cUL, 0x80460ad8UL, 0x3ffa42c9UL, - 0x589fb120UL, 0xbc9aa780UL, 0xb23e255dUL, 0x3ffa5503UL, 0xdb8d41e1UL, - 0xbc9d2f6eUL, 0x8af46052UL, 0x3ffa674aUL, 0x30670366UL, 0x3c650f56UL, - 0x1330b358UL, 0x3ffa799eUL, 0xcac563c7UL, 0x3c9bcb7eUL, 0x53c12e59UL, - 0x3ffa8bfeUL, 0xb2ba15a9UL, 0xbc94f867UL, 0x5579fdbfUL, 0x3ffa9e6bUL, - 0x0ef7fd31UL, 0x3c90fac9UL, 0x21356ebaUL, 0x3ffab0e5UL, 0xdae94545UL, - 0x3c889c31UL, 0xbfd3f37aUL, 0x3ffac36bUL, 0xcae76cd0UL, 0xbc8f9234UL, - 0x3a3c2774UL, 0x3ffad5ffUL, 0xb6b1b8e5UL, 0x3c97ef3bUL, 0x995ad3adUL, - 0x3ffae89fUL, 0x345dcc81UL, 0x3c97a1cdUL, 0xe622f2ffUL, 0x3ffafb4cUL, - 0x0f315ecdUL, 0xbc94b2fcUL, 0x298db666UL, 0x3ffb0e07UL, 0x4c80e425UL, - 0xbc9bdef5UL, 0x6c9a8952UL, 0x3ffb20ceUL, 0x4a0756ccUL, 0x3c94dd02UL, - 0xb84f15fbUL, 0x3ffb33a2UL, 0x3084d708UL, 0xbc62805eUL, 0x15b749b1UL, - 0x3ffb4684UL, 0xe9df7c90UL, 0xbc7f763dUL, 0x8de5593aUL, 0x3ffb5972UL, - 0xbbba6de3UL, 0xbc9c71dfUL, 0x29f1c52aUL, 0x3ffb6c6eUL, 0x52883f6eUL, - 0x3c92a8f3UL, 0xf2fb5e47UL, 0x3ffb7f76UL, 0x7e54ac3bUL, 0xbc75584fUL, - 0xf22749e4UL, 0x3ffb928cUL, 0x54cb65c6UL, 0xbc9b7216UL, 0x30a1064aUL, - 0x3ffba5b0UL, 0x0e54292eUL, 0xbc9efcd3UL, 0xb79a6f1fUL, 0x3ffbb8e0UL, - 0xc9696205UL, 0xbc3f52d1UL, 0x904bc1d2UL, 0x3ffbcc1eUL, 0x7a2d9e84UL, - 0x3c823dd0UL, 0xc3f3a207UL, 0x3ffbdf69UL, 0x60ea5b53UL, 0xbc3c2623UL, - 0x5bd71e09UL, 0x3ffbf2c2UL, 0x3f6b9c73UL, 0xbc9efdcaUL, 0x6141b33dUL, - 0x3ffc0628UL, 0xa1fbca34UL, 0xbc8d8a5aUL, 0xdd85529cUL, 0x3ffc199bUL, - 0x895048ddUL, 0x3c811065UL, 0xd9fa652cUL, 0x3ffc2d1cUL, 0x17c8a5d7UL, - 0xbc96e516UL, 0x5fffd07aUL, 0x3ffc40abUL, 0xe083c60aUL, 0x3c9b4537UL, - 0x78fafb22UL, 0x3ffc5447UL, 0x2493b5afUL, 0x3c912f07UL, 0x2e57d14bUL, - 0x3ffc67f1UL, 0xff483cadUL, 0x3c92884dUL, 0x8988c933UL, 0x3ffc7ba8UL, - 0xbe255559UL, 0xbc8e76bbUL, 0x9406e7b5UL, 0x3ffc8f6dUL, 0x48805c44UL, - 0x3c71acbcUL, 0x5751c4dbUL, 0x3ffca340UL, 0xd10d08f5UL, 0xbc87f2beUL, - 0xdcef9069UL, 0x3ffcb720UL, 0xd1e949dbUL, 0x3c7503cbUL, 0x2e6d1675UL, - 0x3ffccb0fUL, 0x86009092UL, 0xbc7d220fUL, 0x555dc3faUL, 0x3ffcdf0bUL, - 0x53829d72UL, 0xbc8dd83bUL, 0x5b5bab74UL, 0x3ffcf315UL, 0xb86dff57UL, - 0xbc9a08e9UL, 0x4a07897cUL, 0x3ffd072dUL, 0x43797a9cUL, 0xbc9cbc37UL, - 0x2b08c968UL, 0x3ffd1b53UL, 0x219a36eeUL, 0x3c955636UL, 0x080d89f2UL, - 0x3ffd2f87UL, 0x719d8578UL, 0xbc9d487bUL, 0xeacaa1d6UL, 0x3ffd43c8UL, - 0xbf5a1614UL, 0x3c93db53UL, 0xdcfba487UL, 0x3ffd5818UL, 0xd75b3707UL, - 0x3c82ed02UL, 0xe862e6d3UL, 0x3ffd6c76UL, 0x4a8165a0UL, 0x3c5fe87aUL, - 0x16c98398UL, 0x3ffd80e3UL, 0x8beddfe8UL, 0xbc911ec1UL, 0x71ff6075UL, - 0x3ffd955dUL, 0xbb9af6beUL, 0x3c9a052dUL, 0x03db3285UL, 0x3ffda9e6UL, - 0x696db532UL, 0x3c9c2300UL, 0xd63a8315UL, 0x3ffdbe7cUL, 0x926b8be4UL, - 0xbc9b76f1UL, 0xf301b460UL, 0x3ffdd321UL, 0x78f018c3UL, 0x3c92da57UL, - 0x641c0658UL, 0x3ffde7d5UL, 0x8e79ba8fUL, 0xbc9ca552UL, 0x337b9b5fUL, - 0x3ffdfc97UL, 0x4f184b5cUL, 0xbc91a5cdUL, 0x6b197d17UL, 0x3ffe1167UL, - 0xbd5c7f44UL, 0xbc72b529UL, 0x14f5a129UL, 0x3ffe2646UL, 0x817a1496UL, - 0xbc97b627UL, 0x3b16ee12UL, 0x3ffe3b33UL, 0x31fdc68bUL, 0xbc99f4a4UL, - 0xe78b3ff6UL, 0x3ffe502eUL, 0x80a9cc8fUL, 0x3c839e89UL, 0x24676d76UL, - 0x3ffe6539UL, 0x7522b735UL, 0xbc863ff8UL, 0xfbc74c83UL, 0x3ffe7a51UL, - 0xca0c8de2UL, 0x3c92d522UL, 0x77cdb740UL, 0x3ffe8f79UL, 0x80b054b1UL, - 0xbc910894UL, 0xa2a490daUL, 0x3ffea4afUL, 0x179c2893UL, 0xbc9e9c23UL, - 0x867cca6eUL, 0x3ffeb9f4UL, 0x2293e4f2UL, 0x3c94832fUL, 0x2d8e67f1UL, - 0x3ffecf48UL, 0xb411ad8cUL, 0xbc9c93f3UL, 0xa2188510UL, 0x3ffee4aaUL, - 0xa487568dUL, 0x3c91c68dUL, 0xee615a27UL, 0x3ffefa1bUL, 0x86a4b6b0UL, - 0x3c9dc7f4UL, 0x1cb6412aUL, 0x3fff0f9cUL, 0x65181d45UL, 0xbc932200UL, - 0x376bba97UL, 0x3fff252bUL, 0xbf0d8e43UL, 0x3c93a1a5UL, 0x48dd7274UL, - 0x3fff3ac9UL, 0x3ed837deUL, 0xbc795a5aUL, 0x5b6e4540UL, 0x3fff5076UL, - 0x2dd8a18bUL, 0x3c99d3e1UL, 0x798844f8UL, 0x3fff6632UL, 0x3539343eUL, - 0x3c9fa37bUL, 0xad9cbe14UL, 0x3fff7bfdUL, 0xd006350aUL, 0xbc9dbb12UL, - 0x02243c89UL, 0x3fff91d8UL, 0xa779f689UL, 0xbc612ea8UL, 0x819e90d8UL, - 0x3fffa7c1UL, 0xf3a5931eUL, 0x3c874853UL, 0x3692d514UL, 0x3fffbdbaUL, - 0x15098eb6UL, 0xbc796773UL, 0x2b8f71f1UL, 0x3fffd3c2UL, 0x966579e7UL, - 0x3c62eb74UL, 0x6b2a23d9UL, 0x3fffe9d9UL, 0x7442fde3UL, 0x3c74a603UL, - 0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL, 0x6fba4e77UL, - 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL, 0xfefa39efUL, 0x3fe62e42UL, - 0x00000000UL, 0x00000000UL, 0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, - 0xbfe62e42UL, 0xf8000000UL, 0xffffffffUL, 0xf8000000UL, 0xffffffffUL, - 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x00000000UL - -}; - -//registers, -// input: xmm0, xmm1 -// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 -// eax, edx, ecx, ebx - -// Code generated by Intel C compiler for LIBM library - -void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, L_2TAG_PACKET_14_0_2, L_2TAG_PACKET_15_0_2; - Label L_2TAG_PACKET_16_0_2, L_2TAG_PACKET_17_0_2, L_2TAG_PACKET_18_0_2, L_2TAG_PACKET_19_0_2; - Label L_2TAG_PACKET_20_0_2, L_2TAG_PACKET_21_0_2, L_2TAG_PACKET_22_0_2, L_2TAG_PACKET_23_0_2; - Label L_2TAG_PACKET_24_0_2, L_2TAG_PACKET_25_0_2, L_2TAG_PACKET_26_0_2, L_2TAG_PACKET_27_0_2; - Label L_2TAG_PACKET_28_0_2, L_2TAG_PACKET_29_0_2, L_2TAG_PACKET_30_0_2, L_2TAG_PACKET_31_0_2; - Label L_2TAG_PACKET_32_0_2, L_2TAG_PACKET_33_0_2, L_2TAG_PACKET_34_0_2, L_2TAG_PACKET_35_0_2; - Label L_2TAG_PACKET_36_0_2, L_2TAG_PACKET_37_0_2, L_2TAG_PACKET_38_0_2, L_2TAG_PACKET_39_0_2; - Label L_2TAG_PACKET_40_0_2, L_2TAG_PACKET_41_0_2, L_2TAG_PACKET_42_0_2, L_2TAG_PACKET_43_0_2; - Label L_2TAG_PACKET_44_0_2, L_2TAG_PACKET_45_0_2, L_2TAG_PACKET_46_0_2, L_2TAG_PACKET_47_0_2; - Label L_2TAG_PACKET_48_0_2, L_2TAG_PACKET_49_0_2, L_2TAG_PACKET_50_0_2, L_2TAG_PACKET_51_0_2; - Label L_2TAG_PACKET_52_0_2, L_2TAG_PACKET_53_0_2, L_2TAG_PACKET_54_0_2, L_2TAG_PACKET_55_0_2; - Label L_2TAG_PACKET_56_0_2, L_2TAG_PACKET_57_0_2, L_2TAG_PACKET_58_0_2, start; - - assert_different_registers(tmp, eax, ecx, edx); - - address static_const_table_pow = (address)_static_const_table_pow; - - bind(start); - subl(rsp, 120); - movl(Address(rsp, 64), tmp); - lea(tmp, ExternalAddress(static_const_table_pow)); - movsd(xmm0, Address(rsp, 128)); - movsd(xmm1, Address(rsp, 136)); - xorpd(xmm2, xmm2); - movl(eax, 16368); - pinsrw(xmm2, eax, 3); - movl(ecx, 1069088768); - movdl(xmm7, ecx); - movsd(Address(rsp, 16), xmm1); - xorpd(xmm1, xmm1); - movl(edx, 30704); - pinsrw(xmm1, edx, 3); - movsd(Address(rsp, 8), xmm0); - movdqu(xmm3, xmm0); - movl(edx, 8192); - movdl(xmm4, edx); - movdqu(xmm6, Address(tmp, 8240)); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - psllq(xmm0, 5); - movsd(xmm2, Address(tmp, 8256)); - psrlq(xmm0, 34); - movl(edx, eax); - andl(edx, 32752); - subl(edx, 16368); - movl(ecx, edx); - sarl(edx, 31); - addl(ecx, edx); - xorl(ecx, edx); - rcpss(xmm0, xmm0); - psllq(xmm3, 12); - addl(ecx, 16); - bsrl(ecx, ecx); - psrlq(xmm3, 12); - movl(Address(rsp, 24), rsi); - subl(eax, 16); - cmpl(eax, 32736); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); - movl(rsi, 0); - - bind(L_2TAG_PACKET_1_0_2); - mulss(xmm0, xmm7); - movl(edx, -1); - subl(ecx, 4); - shll(edx); - movdl(xmm5, edx); - por(xmm3, xmm1); - subl(eax, 16351); - cmpl(eax, 1); - jcc(Assembler::belowEqual, L_2TAG_PACKET_2_0_2); - paddd(xmm0, xmm4); - psllq(xmm5, 32); - movdl(edx, xmm0); - psllq(xmm0, 29); - pand(xmm5, xmm3); - - bind(L_2TAG_PACKET_3_0_2); - pand(xmm0, xmm6); - subsd(xmm3, xmm5); - subl(eax, 1); - sarl(eax, 4); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - - bind(L_2TAG_PACKET_4_0_2); - mulsd(xmm3, xmm0); - movdqu(xmm1, Address(tmp, 8272)); - subsd(xmm5, xmm2); - movdqu(xmm4, Address(tmp, 8288)); - movl(ecx, eax); - sarl(eax, 31); - addl(ecx, eax); - xorl(eax, ecx); - addl(eax, 1); - bsrl(eax, eax); - unpcklpd(xmm5, xmm3); - movdqu(xmm6, Address(tmp, 8304)); - addsd(xmm3, xmm5); - andl(edx, 16760832); - shrl(edx, 10); - addpd(xmm5, Address(tmp, edx, Address::times_1, -3616)); - movdqu(xmm0, Address(tmp, 8320)); - pshufd(xmm2, xmm3, 68); - mulsd(xmm3, xmm3); - mulpd(xmm1, xmm2); - mulpd(xmm4, xmm2); - addsd(xmm5, xmm7); - mulsd(xmm2, xmm3); - addpd(xmm6, xmm1); - mulsd(xmm3, xmm3); - addpd(xmm0, xmm4); - movsd(xmm1, Address(rsp, 16)); - movzwl(ecx, Address(rsp, 22)); - pshufd(xmm7, xmm5, 238); - movsd(xmm4, Address(tmp, 8368)); - mulpd(xmm6, xmm2); - pshufd(xmm3, xmm3, 68); - mulpd(xmm0, xmm2); - shll(eax, 4); - subl(eax, 15872); - andl(ecx, 32752); - addl(eax, ecx); - mulpd(xmm3, xmm6); - cmpl(eax, 624); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_5_0_2); - xorpd(xmm6, xmm6); - movl(edx, 17080); - pinsrw(xmm6, edx, 3); - movdqu(xmm2, xmm1); - pand(xmm4, xmm1); - subsd(xmm1, xmm4); - mulsd(xmm4, xmm5); - addsd(xmm0, xmm7); - mulsd(xmm1, xmm5); - movdqu(xmm7, xmm6); - addsd(xmm6, xmm4); - addpd(xmm3, xmm0); - movdl(edx, xmm6); - subsd(xmm6, xmm7); - pshufd(xmm0, xmm3, 238); - subsd(xmm4, xmm6); - addsd(xmm0, xmm3); - movl(ecx, edx); - andl(edx, 255); - addl(edx, edx); - movdqu(xmm5, Address(tmp, edx, Address::times_8, 8384)); - addsd(xmm4, xmm1); - mulsd(xmm2, xmm0); - movdqu(xmm7, Address(tmp, 12480)); - movdqu(xmm3, Address(tmp, 12496)); - shll(ecx, 12); - xorl(ecx, rsi); - andl(ecx, -1048576); - movdl(xmm6, ecx); - addsd(xmm2, xmm4); - movsd(xmm1, Address(tmp, 12512)); - pshufd(xmm0, xmm2, 68); - pshufd(xmm4, xmm2, 68); - mulpd(xmm0, xmm0); - movl(rsi, Address(rsp, 24)); - mulpd(xmm7, xmm4); - pshufd(xmm6, xmm6, 17); - mulsd(xmm1, xmm2); - mulsd(xmm0, xmm0); - paddd(xmm5, xmm6); - addpd(xmm3, xmm7); - mulsd(xmm1, xmm5); - pshufd(xmm6, xmm5, 238); - mulpd(xmm0, xmm3); - addsd(xmm1, xmm6); - pshufd(xmm3, xmm0, 238); - mulsd(xmm0, xmm5); - mulsd(xmm3, xmm5); - addsd(xmm0, xmm1); - addsd(xmm0, xmm3); - addsd(xmm0, xmm5); - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_7_0_2); - movsd(xmm0, Address(rsp, 128)); - movsd(xmm1, Address(rsp, 136)); - mulsd(xmm0, xmm1); - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_0_0_2); - addl(eax, 16); - movl(edx, 32752); - andl(edx, eax); - cmpl(edx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); - testl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_9_0_2); - - bind(L_2TAG_PACKET_10_0_2); - movl(ecx, Address(rsp, 16)); - xorl(edx, edx); - testl(ecx, ecx); - movl(ecx, 1); - cmovl(Assembler::notEqual, edx, ecx); - orl(edx, Address(rsp, 20)); - cmpl(edx, 1072693248); - jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); - movsd(xmm0, Address(rsp, 8)); - movsd(xmm3, Address(rsp, 8)); - movdl(edx, xmm3); - psrlq(xmm3, 32); - movdl(ecx, xmm3); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_11_0_2); - xorpd(xmm3, xmm3); - movl(eax, 18416); - pinsrw(xmm3, eax, 3); - mulsd(xmm0, xmm3); - xorpd(xmm2, xmm2); - movl(eax, 16368); - pinsrw(xmm2, eax, 3); - movdqu(xmm3, xmm0); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - movl(ecx, 18416); - psllq(xmm0, 5); - movsd(xmm2, Address(tmp, 8256)); - psrlq(xmm0, 34); - rcpss(xmm0, xmm0); - psllq(xmm3, 12); - movdqu(xmm6, Address(tmp, 8240)); - psrlq(xmm3, 12); - mulss(xmm0, xmm7); - movl(edx, -1024); - movdl(xmm5, edx); - por(xmm3, xmm1); - paddd(xmm0, xmm4); - psllq(xmm5, 32); - movdl(edx, xmm0); - psllq(xmm0, 29); - pand(xmm5, xmm3); - movl(rsi, 0); - pand(xmm0, xmm6); - subsd(xmm3, xmm5); - andl(eax, 32752); - subl(eax, 18416); - sarl(eax, 4); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - jmp(L_2TAG_PACKET_4_0_2); - - bind(L_2TAG_PACKET_12_0_2); - movl(ecx, Address(rsp, 16)); - xorl(edx, edx); - testl(ecx, ecx); - movl(ecx, 1); - cmovl(Assembler::notEqual, edx, ecx); - orl(edx, Address(rsp, 20)); - cmpl(edx, 1072693248); - jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); - movsd(xmm0, Address(rsp, 8)); - movsd(xmm3, Address(rsp, 8)); - movdl(edx, xmm3); - psrlq(xmm3, 32); - movdl(ecx, xmm3); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_11_0_2); - xorpd(xmm3, xmm3); - movl(eax, 18416); - pinsrw(xmm3, eax, 3); - mulsd(xmm0, xmm3); - xorpd(xmm2, xmm2); - movl(eax, 16368); - pinsrw(xmm2, eax, 3); - movdqu(xmm3, xmm0); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - movl(ecx, 18416); - psllq(xmm0, 5); - movsd(xmm2, Address(tmp, 8256)); - psrlq(xmm0, 34); - rcpss(xmm0, xmm0); - psllq(xmm3, 12); - movdqu(xmm6, Address(tmp, 8240)); - psrlq(xmm3, 12); - mulss(xmm0, xmm7); - movl(edx, -1024); - movdl(xmm5, edx); - por(xmm3, xmm1); - paddd(xmm0, xmm4); - psllq(xmm5, 32); - movdl(edx, xmm0); - psllq(xmm0, 29); - pand(xmm5, xmm3); - movl(rsi, INT_MIN); - pand(xmm0, xmm6); - subsd(xmm3, xmm5); - andl(eax, 32752); - subl(eax, 18416); - sarl(eax, 4); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - jmp(L_2TAG_PACKET_4_0_2); - - bind(L_2TAG_PACKET_5_0_2); - cmpl(eax, 0); - jcc(Assembler::less, L_2TAG_PACKET_13_0_2); - cmpl(eax, 752); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_14_0_2); - - bind(L_2TAG_PACKET_15_0_2); - addsd(xmm0, xmm7); - movsd(xmm2, Address(tmp, 12544)); - addpd(xmm3, xmm0); - xorpd(xmm6, xmm6); - movl(eax, 17080); - pinsrw(xmm6, eax, 3); - pshufd(xmm0, xmm3, 238); - addsd(xmm0, xmm3); - movdqu(xmm3, xmm5); - addsd(xmm5, xmm0); - movdqu(xmm4, xmm2); - subsd(xmm3, xmm5); - movdqu(xmm7, xmm5); - pand(xmm5, xmm2); - movdqu(xmm2, xmm1); - pand(xmm4, xmm1); - subsd(xmm7, xmm5); - addsd(xmm0, xmm3); - subsd(xmm1, xmm4); - mulsd(xmm4, xmm5); - addsd(xmm0, xmm7); - mulsd(xmm2, xmm0); - movdqu(xmm7, xmm6); - mulsd(xmm1, xmm5); - addsd(xmm6, xmm4); - movdl(eax, xmm6); - subsd(xmm6, xmm7); - addsd(xmm2, xmm1); - movdqu(xmm7, Address(tmp, 12480)); - movdqu(xmm3, Address(tmp, 12496)); - subsd(xmm4, xmm6); - pextrw(edx, xmm6, 3); - movl(ecx, eax); - andl(eax, 255); - addl(eax, eax); - movdqu(xmm5, Address(tmp, eax, Address::times_8, 8384)); - addsd(xmm2, xmm4); - sarl(ecx, 8); - movl(eax, ecx); - sarl(ecx, 1); - subl(eax, ecx); - shll(ecx, 20); - xorl(ecx, rsi); - movdl(xmm6, ecx); - movsd(xmm1, Address(tmp, 12512)); - andl(edx, 32767); - cmpl(edx, 16529); - jcc(Assembler::above, L_2TAG_PACKET_14_0_2); - pshufd(xmm0, xmm2, 68); - pshufd(xmm4, xmm2, 68); - mulpd(xmm0, xmm0); - mulpd(xmm7, xmm4); - pshufd(xmm6, xmm6, 17); - mulsd(xmm1, xmm2); - mulsd(xmm0, xmm0); - paddd(xmm5, xmm6); - addpd(xmm3, xmm7); - mulsd(xmm1, xmm5); - pshufd(xmm6, xmm5, 238); - mulpd(xmm0, xmm3); - addsd(xmm1, xmm6); - pshufd(xmm3, xmm0, 238); - mulsd(xmm0, xmm5); - mulsd(xmm3, xmm5); - shll(eax, 4); - xorpd(xmm4, xmm4); - addl(eax, 16368); - pinsrw(xmm4, eax, 3); - addsd(xmm0, xmm1); - movl(rsi, Address(rsp, 24)); - addsd(xmm0, xmm3); - movdqu(xmm1, xmm0); - addsd(xmm0, xmm5); - mulsd(xmm0, xmm4); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_16_0_2); - cmpl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_18_0_2); - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_8_0_2); - movsd(xmm1, Address(rsp, 16)); - movsd(xmm0, Address(rsp, 8)); - movdqu(xmm2, xmm0); - movdl(eax, xmm2); - psrlq(xmm2, 20); - movdl(edx, xmm2); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_19_0_2); - addsd(xmm0, xmm0); - movdl(eax, xmm1); - psrlq(xmm1, 32); - movdl(edx, xmm1); - movl(ecx, edx); - addl(edx, edx); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_20_0_2); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_20_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - movl(edx, 29); - jmp(L_2TAG_PACKET_21_0_2); - - bind(L_2TAG_PACKET_22_0_2); - movsd(xmm0, Address(rsp, 16)); - addpd(xmm0, xmm0); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_19_0_2); - movdl(eax, xmm1); - movdqu(xmm2, xmm1); - psrlq(xmm1, 32); - movdl(edx, xmm1); - movl(ecx, edx); - addl(edx, edx); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_23_0_2); - pextrw(eax, xmm2, 3); - andl(eax, 32752); - cmpl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_24_0_2); - movdl(eax, xmm2); - psrlq(xmm2, 20); - movdl(edx, xmm2); - orl(eax, edx); - jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); - - bind(L_2TAG_PACKET_24_0_2); - pextrw(eax, xmm0, 3); - testl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_25_0_2); - testl(ecx, INT_MIN); - jcc(Assembler::notEqual, L_2TAG_PACKET_26_0_2); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_27_0_2); - movsd(xmm1, Address(rsp, 16)); - movdl(eax, xmm1); - testl(eax, 1); - jcc(Assembler::notEqual, L_2TAG_PACKET_28_0_2); - testl(eax, 2); - jcc(Assembler::notEqual, L_2TAG_PACKET_29_0_2); - jmp(L_2TAG_PACKET_28_0_2); - - bind(L_2TAG_PACKET_25_0_2); - shrl(ecx, 20); - andl(ecx, 2047); - cmpl(ecx, 1075); - jcc(Assembler::above, L_2TAG_PACKET_28_0_2); - jcc(Assembler::equal, L_2TAG_PACKET_30_0_2); - cmpl(ecx, 1074); - jcc(Assembler::above, L_2TAG_PACKET_27_0_2); - cmpl(ecx, 1023); - jcc(Assembler::below, L_2TAG_PACKET_28_0_2); - movsd(xmm1, Address(rsp, 16)); - movl(eax, 17208); - xorpd(xmm3, xmm3); - pinsrw(xmm3, eax, 3); - movdqu(xmm4, xmm3); - addsd(xmm3, xmm1); - subsd(xmm4, xmm3); - addsd(xmm1, xmm4); - pextrw(eax, xmm1, 3); - andl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_28_0_2); - movdl(eax, xmm3); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_28_0_2); - - bind(L_2TAG_PACKET_29_0_2); - movsd(xmm1, Address(rsp, 16)); - pextrw(eax, xmm1, 3); - andl(eax, 32768); - jcc(Assembler::equal, L_2TAG_PACKET_18_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32768); - pinsrw(xmm0, eax, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_28_0_2); - movsd(xmm1, Address(rsp, 16)); - pextrw(eax, xmm1, 3); - andl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_26_0_2); - - bind(L_2TAG_PACKET_31_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32752); - pinsrw(xmm0, eax, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_30_0_2); - movsd(xmm1, Address(rsp, 16)); - movdl(eax, xmm1); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_28_0_2); - jmp(L_2TAG_PACKET_29_0_2); - - bind(L_2TAG_PACKET_32_0_2); - movdl(eax, xmm1); - psrlq(xmm1, 20); - movdl(edx, xmm1); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_33_0_2); - movsd(xmm0, Address(rsp, 16)); - addsd(xmm0, xmm0); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_33_0_2); - movsd(xmm0, Address(rsp, 8)); - pextrw(eax, xmm0, 3); - cmpl(eax, 49136); - jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); - movdl(ecx, xmm0); - psrlq(xmm0, 20); - movdl(edx, xmm0); - orl(ecx, edx); - jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32760); - pinsrw(xmm0, eax, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_34_0_2); - movsd(xmm1, Address(rsp, 16)); - andl(eax, 32752); - subl(eax, 16368); - pextrw(edx, xmm1, 3); - xorpd(xmm0, xmm0); - xorl(eax, edx); - andl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); - movl(ecx, 32752); - pinsrw(xmm0, ecx, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_35_0_2); - movdl(eax, xmm1); - cmpl(edx, 17184); - jcc(Assembler::above, L_2TAG_PACKET_36_0_2); - testl(eax, 1); - jcc(Assembler::notEqual, L_2TAG_PACKET_37_0_2); - testl(eax, 2); - jcc(Assembler::equal, L_2TAG_PACKET_38_0_2); - jmp(L_2TAG_PACKET_39_0_2); - - bind(L_2TAG_PACKET_36_0_2); - testl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_38_0_2); - jmp(L_2TAG_PACKET_39_0_2); - - bind(L_2TAG_PACKET_9_0_2); - movsd(xmm2, Address(rsp, 8)); - movdl(eax, xmm2); - psrlq(xmm2, 31); - movdl(ecx, xmm2); - orl(eax, ecx); - jcc(Assembler::equal, L_2TAG_PACKET_11_0_2); - movsd(xmm1, Address(rsp, 16)); - pextrw(edx, xmm1, 3); - movdl(eax, xmm1); - movdqu(xmm2, xmm1); - psrlq(xmm2, 32); - movdl(ecx, xmm2); - addl(ecx, ecx); - orl(ecx, eax); - jcc(Assembler::equal, L_2TAG_PACKET_40_0_2); - andl(edx, 32752); - cmpl(edx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_32_0_2); - cmpl(edx, 17200); - jcc(Assembler::above, L_2TAG_PACKET_38_0_2); - cmpl(edx, 17184); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_35_0_2); - cmpl(edx, 16368); - jcc(Assembler::below, L_2TAG_PACKET_37_0_2); - movl(eax, 17208); - xorpd(xmm2, xmm2); - pinsrw(xmm2, eax, 3); - movdqu(xmm4, xmm2); - addsd(xmm2, xmm1); - subsd(xmm4, xmm2); - addsd(xmm1, xmm4); - pextrw(eax, xmm1, 3); - andl(eax, 32767); - jcc(Assembler::notEqual, L_2TAG_PACKET_37_0_2); - movdl(eax, xmm2); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_38_0_2); - - bind(L_2TAG_PACKET_39_0_2); - xorpd(xmm1, xmm1); - movl(edx, 30704); - pinsrw(xmm1, edx, 3); - movsd(xmm2, Address(tmp, 8256)); - movsd(xmm4, Address(rsp, 8)); - pextrw(eax, xmm4, 3); - movl(edx, 8192); - movdl(xmm4, edx); - andl(eax, 32767); - subl(eax, 16); - jcc(Assembler::less, L_2TAG_PACKET_12_0_2); - movl(edx, eax); - andl(edx, 32752); - subl(edx, 16368); - movl(ecx, edx); - sarl(edx, 31); - addl(ecx, edx); - xorl(ecx, edx); - addl(ecx, 16); - bsrl(ecx, ecx); - movl(rsi, INT_MIN); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_37_0_2); - xorpd(xmm1, xmm1); - movl(eax, 32752); - pinsrw(xmm1, eax, 3); - xorpd(xmm0, xmm0); - mulsd(xmm0, xmm1); - movl(edx, 28); - jmp(L_2TAG_PACKET_21_0_2); - - bind(L_2TAG_PACKET_38_0_2); - xorpd(xmm1, xmm1); - movl(edx, 30704); - pinsrw(xmm1, edx, 3); - movsd(xmm2, Address(tmp, 8256)); - movsd(xmm4, Address(rsp, 8)); - pextrw(eax, xmm4, 3); - movl(edx, 8192); - movdl(xmm4, edx); - andl(eax, 32767); - subl(eax, 16); - jcc(Assembler::less, L_2TAG_PACKET_10_0_2); - movl(edx, eax); - andl(edx, 32752); - subl(edx, 16368); - movl(ecx, edx); - sarl(edx, 31); - addl(ecx, edx); - xorl(ecx, edx); - addl(ecx, 16); - bsrl(ecx, ecx); - movl(rsi, 0); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_23_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_26_0_2); - xorpd(xmm0, xmm0); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_13_0_2); - addl(eax, 384); - cmpl(eax, 0); - jcc(Assembler::less, L_2TAG_PACKET_41_0_2); - mulsd(xmm5, xmm1); - addsd(xmm0, xmm7); - shrl(rsi, 31); - addpd(xmm3, xmm0); - pshufd(xmm0, xmm3, 238); - addsd(xmm3, xmm0); - movsd(xmm4, Address(tmp, rsi, Address::times_8, 12528)); - mulsd(xmm1, xmm3); - xorpd(xmm0, xmm0); - movl(eax, 16368); - shll(rsi, 15); - orl(eax, rsi); - pinsrw(xmm0, eax, 3); - addsd(xmm5, xmm1); - movl(rsi, Address(rsp, 24)); - mulsd(xmm5, xmm4); - addsd(xmm0, xmm5); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_41_0_2); - movl(rsi, Address(rsp, 24)); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_40_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_42_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - movl(edx, 26); - jmp(L_2TAG_PACKET_21_0_2); - - bind(L_2TAG_PACKET_11_0_2); - movsd(xmm1, Address(rsp, 16)); - movdqu(xmm2, xmm1); - pextrw(eax, xmm1, 3); - andl(eax, 32752); - cmpl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_43_0_2); - movdl(eax, xmm2); - psrlq(xmm2, 20); - movdl(edx, xmm2); - orl(eax, edx); - jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); - - bind(L_2TAG_PACKET_43_0_2); - movdl(eax, xmm1); - psrlq(xmm1, 32); - movdl(edx, xmm1); - movl(ecx, edx); - addl(edx, edx); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_42_0_2); - shrl(edx, 21); - cmpl(edx, 1075); - jcc(Assembler::above, L_2TAG_PACKET_44_0_2); - jcc(Assembler::equal, L_2TAG_PACKET_45_0_2); - cmpl(edx, 1023); - jcc(Assembler::below, L_2TAG_PACKET_44_0_2); - movsd(xmm1, Address(rsp, 16)); - movl(eax, 17208); - xorpd(xmm3, xmm3); - pinsrw(xmm3, eax, 3); - movdqu(xmm4, xmm3); - addsd(xmm3, xmm1); - subsd(xmm4, xmm3); - addsd(xmm1, xmm4); - pextrw(eax, xmm1, 3); - andl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_44_0_2); - movdl(eax, xmm3); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_44_0_2); - - bind(L_2TAG_PACKET_46_0_2); - movsd(xmm0, Address(rsp, 8)); - testl(ecx, INT_MIN); - jcc(Assembler::notEqual, L_2TAG_PACKET_47_0_2); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_45_0_2); - movsd(xmm1, Address(rsp, 16)); - movdl(eax, xmm1); - testl(eax, 1); - jcc(Assembler::notEqual, L_2TAG_PACKET_46_0_2); - - bind(L_2TAG_PACKET_44_0_2); - testl(ecx, INT_MIN); - jcc(Assembler::equal, L_2TAG_PACKET_26_0_2); - xorpd(xmm0, xmm0); - - bind(L_2TAG_PACKET_47_0_2); - movl(eax, 16368); - xorpd(xmm1, xmm1); - pinsrw(xmm1, eax, 3); - divsd(xmm1, xmm0); - movdqu(xmm0, xmm1); - movl(edx, 27); - jmp(L_2TAG_PACKET_21_0_2); - - bind(L_2TAG_PACKET_14_0_2); - movsd(xmm2, Address(rsp, 8)); - movsd(xmm6, Address(rsp, 16)); - pextrw(eax, xmm2, 3); - pextrw(edx, xmm6, 3); - movl(ecx, 32752); - andl(ecx, edx); - cmpl(ecx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_48_0_2); - andl(eax, 32752); - subl(eax, 16368); - xorl(edx, eax); - testl(edx, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_49_0_2); - - bind(L_2TAG_PACKET_50_0_2); - movl(eax, 32736); - pinsrw(xmm0, eax, 3); - shrl(rsi, 16); - orl(eax, rsi); - pinsrw(xmm1, eax, 3); - movl(rsi, Address(rsp, 24)); - mulsd(xmm0, xmm1); - - bind(L_2TAG_PACKET_17_0_2); - movl(edx, 24); - - bind(L_2TAG_PACKET_21_0_2); - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_49_0_2); - movl(eax, 16); - pinsrw(xmm0, eax, 3); - mulsd(xmm0, xmm0); - testl(rsi, INT_MIN); - jcc(Assembler::equal, L_2TAG_PACKET_51_0_2); - movsd(xmm2, Address(tmp, 12560)); - xorpd(xmm0, xmm2); - - bind(L_2TAG_PACKET_51_0_2); - movl(rsi, Address(rsp, 24)); - movl(edx, 25); - jmp(L_2TAG_PACKET_21_0_2); - - bind(L_2TAG_PACKET_16_0_2); - pextrw(ecx, xmm5, 3); - pextrw(edx, xmm4, 3); - movl(eax, -1); - andl(ecx, 32752); - subl(ecx, 16368); - andl(edx, 32752); - addl(edx, ecx); - movl(ecx, -31); - sarl(edx, 4); - subl(ecx, edx); - jcc(Assembler::lessEqual, L_2TAG_PACKET_52_0_2); - cmpl(ecx, 20); - jcc(Assembler::above, L_2TAG_PACKET_53_0_2); - shll(eax); - - bind(L_2TAG_PACKET_52_0_2); - movdl(xmm0, eax); - psllq(xmm0, 32); - pand(xmm0, xmm5); - subsd(xmm5, xmm0); - addsd(xmm5, xmm1); - mulsd(xmm0, xmm4); - mulsd(xmm5, xmm4); - addsd(xmm0, xmm5); - - bind(L_2TAG_PACKET_53_0_2); - movl(edx, 25); - jmp(L_2TAG_PACKET_21_0_2); - - bind(L_2TAG_PACKET_2_0_2); - movzwl(ecx, Address(rsp, 22)); - movl(edx, INT_MIN); - movdl(xmm1, edx); - xorpd(xmm7, xmm7); - paddd(xmm0, xmm4); - psllq(xmm5, 32); - movdl(edx, xmm0); - psllq(xmm0, 29); - paddq(xmm1, xmm3); - pand(xmm5, xmm1); - andl(ecx, 32752); - cmpl(ecx, 16560); - jcc(Assembler::below, L_2TAG_PACKET_3_0_2); - pand(xmm0, xmm6); - subsd(xmm3, xmm5); - addl(eax, 16351); - shrl(eax, 4); - subl(eax, 1022); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - movsd(xmm4, Address(tmp, 0)); - mulsd(xmm3, xmm0); - movsd(xmm6, Address(tmp, 0)); - subsd(xmm5, xmm2); - movsd(xmm1, Address(tmp, 8)); - pshufd(xmm2, xmm3, 68); - unpcklpd(xmm5, xmm3); - addsd(xmm3, xmm5); - movsd(xmm0, Address(tmp, 8)); - andl(edx, 16760832); - shrl(edx, 10); - addpd(xmm7, Address(tmp, edx, Address::times_1, -3616)); - mulsd(xmm4, xmm5); - mulsd(xmm0, xmm5); - mulsd(xmm6, xmm2); - mulsd(xmm1, xmm2); - movdqu(xmm2, xmm5); - mulsd(xmm4, xmm5); - addsd(xmm5, xmm0); - movdqu(xmm0, xmm7); - addsd(xmm2, xmm3); - addsd(xmm7, xmm5); - mulsd(xmm6, xmm2); - subsd(xmm0, xmm7); - movdqu(xmm2, xmm7); - addsd(xmm7, xmm4); - addsd(xmm0, xmm5); - subsd(xmm2, xmm7); - addsd(xmm4, xmm2); - pshufd(xmm2, xmm5, 238); - movdqu(xmm5, xmm7); - addsd(xmm7, xmm2); - addsd(xmm4, xmm0); - movdqu(xmm0, Address(tmp, 8272)); - subsd(xmm5, xmm7); - addsd(xmm6, xmm4); - movdqu(xmm4, xmm7); - addsd(xmm5, xmm2); - addsd(xmm7, xmm1); - movdqu(xmm2, Address(tmp, 8336)); - subsd(xmm4, xmm7); - addsd(xmm6, xmm5); - addsd(xmm4, xmm1); - pshufd(xmm5, xmm7, 238); - movdqu(xmm1, xmm7); - addsd(xmm7, xmm5); - subsd(xmm1, xmm7); - addsd(xmm1, xmm5); - movdqu(xmm5, Address(tmp, 8352)); - pshufd(xmm3, xmm3, 68); - addsd(xmm6, xmm4); - addsd(xmm6, xmm1); - movdqu(xmm1, Address(tmp, 8304)); - mulpd(xmm0, xmm3); - mulpd(xmm2, xmm3); - pshufd(xmm4, xmm3, 68); - mulpd(xmm3, xmm3); - addpd(xmm0, xmm1); - addpd(xmm5, xmm2); - mulsd(xmm4, xmm3); - movsd(xmm2, Address(tmp, 16)); - mulpd(xmm3, xmm3); - movsd(xmm1, Address(rsp, 16)); - movzwl(ecx, Address(rsp, 22)); - mulpd(xmm0, xmm4); - pextrw(eax, xmm7, 3); - mulpd(xmm5, xmm4); - mulpd(xmm0, xmm3); - movsd(xmm4, Address(tmp, 8376)); - pand(xmm2, xmm7); - addsd(xmm5, xmm6); - subsd(xmm7, xmm2); - addpd(xmm5, xmm0); - andl(eax, 32752); - subl(eax, 16368); - andl(ecx, 32752); - cmpl(ecx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_48_0_2); - addl(ecx, eax); - cmpl(ecx, 16576); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_54_0_2); - pshufd(xmm0, xmm5, 238); - pand(xmm4, xmm1); - movdqu(xmm3, xmm1); - addsd(xmm5, xmm0); - subsd(xmm1, xmm4); - xorpd(xmm6, xmm6); - movl(edx, 17080); - pinsrw(xmm6, edx, 3); - addsd(xmm7, xmm5); - mulsd(xmm4, xmm2); - mulsd(xmm1, xmm2); - movdqu(xmm5, xmm6); - mulsd(xmm3, xmm7); - addsd(xmm6, xmm4); - addsd(xmm1, xmm3); - movdqu(xmm7, Address(tmp, 12480)); - movdl(edx, xmm6); - subsd(xmm6, xmm5); - movdqu(xmm3, Address(tmp, 12496)); - movsd(xmm2, Address(tmp, 12512)); - subsd(xmm4, xmm6); - movl(ecx, edx); - andl(edx, 255); - addl(edx, edx); - movdqu(xmm5, Address(tmp, edx, Address::times_8, 8384)); - addsd(xmm4, xmm1); - pextrw(edx, xmm6, 3); - shrl(ecx, 8); - movl(eax, ecx); - shrl(ecx, 1); - subl(eax, ecx); - shll(ecx, 20); - movdl(xmm6, ecx); - pshufd(xmm0, xmm4, 68); - pshufd(xmm1, xmm4, 68); - mulpd(xmm0, xmm0); - mulpd(xmm7, xmm1); - pshufd(xmm6, xmm6, 17); - mulsd(xmm2, xmm4); - andl(edx, 32767); - cmpl(edx, 16529); - jcc(Assembler::above, L_2TAG_PACKET_14_0_2); - mulsd(xmm0, xmm0); - paddd(xmm5, xmm6); - addpd(xmm3, xmm7); - mulsd(xmm2, xmm5); - pshufd(xmm6, xmm5, 238); - mulpd(xmm0, xmm3); - addsd(xmm2, xmm6); - pshufd(xmm3, xmm0, 238); - addl(eax, 1023); - shll(eax, 20); - orl(eax, rsi); - movdl(xmm4, eax); - mulsd(xmm0, xmm5); - mulsd(xmm3, xmm5); - addsd(xmm0, xmm2); - psllq(xmm4, 32); - addsd(xmm0, xmm3); - movdqu(xmm1, xmm0); - addsd(xmm0, xmm5); - movl(rsi, Address(rsp, 24)); - mulsd(xmm0, xmm4); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_16_0_2); - cmpl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_55_0_2); - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_48_0_2); - movl(rsi, Address(rsp, 24)); - - bind(L_2TAG_PACKET_56_0_2); - movsd(xmm0, Address(rsp, 8)); - movsd(xmm1, Address(rsp, 16)); - addsd(xmm1, xmm1); - xorpd(xmm2, xmm2); - movl(eax, 49136); - pinsrw(xmm2, eax, 3); - addsd(xmm2, xmm0); - pextrw(eax, xmm2, 3); - cmpl(eax, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_57_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32760); - pinsrw(xmm0, eax, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_57_0_2); - movdl(edx, xmm1); - movdqu(xmm3, xmm1); - psrlq(xmm3, 20); - movdl(ecx, xmm3); - orl(ecx, edx); - jcc(Assembler::equal, L_2TAG_PACKET_58_0_2); - addsd(xmm1, xmm1); - movdqu(xmm0, xmm1); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_58_0_2); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - pextrw(edx, xmm1, 3); - xorpd(xmm0, xmm0); - subl(eax, 16368); - xorl(eax, edx); - testl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); - movl(edx, 32752); - pinsrw(xmm0, edx, 3); - jmp(L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_54_0_2); - pextrw(eax, xmm1, 3); - pextrw(ecx, xmm2, 3); - xorl(eax, ecx); - testl(eax, 32768); - jcc(Assembler::equal, L_2TAG_PACKET_50_0_2); - jmp(L_2TAG_PACKET_49_0_2); - - bind(L_2TAG_PACKET_6_0_2); - movl(tmp, Address(rsp, 64)); - -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - SIN() -// --------------------- -// -// 1. RANGE REDUCTION -// -// We perform an initial range reduction from X to r with -// -// X =~= N * pi/32 + r -// -// so that |r| <= pi/64 + epsilon. We restrict inputs to those -// where |N| <= 932560. Beyond this, the range reduction is -// insufficiently accurate. For extremely small inputs, -// denormalization can occur internally, impacting performance. -// This means that the main path is actually only taken for -// 2^-252 <= |X| < 90112. -// -// To avoid branches, we perform the range reduction to full -// accuracy each time. -// -// X - N * (P_1 + P_2 + P_3) -// -// where P_1 and P_2 are 32-bit numbers (so multiplication by N -// is exact) and P_3 is a 53-bit number. Together, these -// approximate pi well enough for all cases in the restricted -// range. -// -// The main reduction sequence is: -// -// y = 32/pi * x -// N = integer(y) -// (computed by adding and subtracting off SHIFTER) -// -// m_1 = N * P_1 -// m_2 = N * P_2 -// r_1 = x - m_1 -// r = r_1 - m_2 -// (this r can be used for most of the calculation) -// -// c_1 = r_1 - r -// m_3 = N * P_3 -// c_2 = c_1 - m_2 -// c = c_2 - m_3 -// -// 2. MAIN ALGORITHM -// -// The algorithm uses a table lookup based on B = M * pi / 32 -// where M = N mod 64. The stored values are: -// sigma closest power of 2 to cos(B) -// C_hl 53-bit cos(B) - sigma -// S_hi + S_lo 2 * 53-bit sin(B) -// -// The computation is organized as follows: -// -// sin(B + r + c) = [sin(B) + sigma * r] + -// r * (cos(B) - sigma) + -// sin(B) * [cos(r + c) - 1] + -// cos(B) * [sin(r + c) - r] -// -// which is approximately: -// -// [S_hi + sigma * r] + -// C_hl * r + -// S_lo + S_hi * [(cos(r) - 1) - r * c] + -// (C_hl + sigma) * [(sin(r) - r) + c] -// -// and this is what is actually computed. We separate this sum -// into four parts: -// -// hi + med + pols + corr -// -// where -// -// hi = S_hi + sigma r -// med = C_hl * r -// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r) -// corr = S_lo + c * ((C_hl + sigma) - S_hi * r) -// -// 3. POLYNOMIAL -// -// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) * -// (sin(r) - r) can be rearranged freely, since it is quite -// small, so we exploit parallelism to the fullest. -// -// psc4 = SC_4 * r_1 -// msc4 = psc4 * r -// r2 = r * r -// msc2 = SC_2 * r2 -// r4 = r2 * r2 -// psc3 = SC_3 + msc4 -// psc1 = SC_1 + msc2 -// msc3 = r4 * psc3 -// sincospols = psc1 + msc3 -// pols = sincospols * -// -// -// 4. CORRECTION TERM -// -// This is where the "c" component of the range reduction is -// taken into account; recall that just "r" is used for most of -// the calculation. -// -// -c = m_3 - c_2 -// -d = S_hi * r - (C_hl + sigma) -// corr = -c * -d + S_lo -// -// 5. COMPENSATED SUMMATIONS -// -// The two successive compensated summations add up the high -// and medium parts, leaving just the low parts to add up at -// the end. -// -// rs = sigma * r -// res_int = S_hi + rs -// k_0 = S_hi - res_int -// k_2 = k_0 + rs -// med = C_hl * r -// res_hi = res_int + med -// k_1 = res_int - res_hi -// k_3 = k_1 + med -// -// 6. FINAL SUMMATION -// -// We now add up all the small parts: -// -// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3 -// -// Now the overall result is just: -// -// res_hi + res_lo -// -// 7. SMALL ARGUMENTS -// -// If |x| < SNN (SNN meaning the smallest normal number), we -// simply perform 0.1111111 cdots 1111 * x. For SNN <= |x|, we -// do 2^-55 * (2^55 * x - x). -// -// Special cases: -// sin(NaN) = quiet NaN, and raise invalid exception -// sin(INF) = NaN and raise invalid exception -// sin(+/-0) = +/-0 -// -/******************************************************************************/ - -ALIGNED_(8) juint _zero_none[] = -{ - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL -}; - -ALIGNED_(4) juint __4onpi_d[] = -{ - 0x6dc9c883UL, 0x3ff45f30UL -}; - -ALIGNED_(4) juint _TWO_32H[] = -{ - 0x00000000UL, 0x41f80000UL -}; - -ALIGNED_(4) juint _pi04_3d[] = -{ - 0x54442d00UL, 0x3fe921fbUL, 0x98cc5180UL, 0x3ce84698UL, 0xcbb5bf6cUL, - 0xb9dfc8f8UL -}; - -ALIGNED_(4) juint _pi04_5d[] = -{ - 0x54400000UL, 0x3fe921fbUL, 0x1a600000UL, 0x3dc0b461UL, 0x2e000000UL, - 0x3b93198aUL, 0x25200000UL, 0x396b839aUL, 0x533e63a0UL, 0x37027044UL -}; - -ALIGNED_(4) juint _SCALE[] = -{ - 0x00000000UL, 0x32600000UL -}; - -ALIGNED_(4) juint _zeros[] = -{ - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x80000000UL -}; - -ALIGNED_(4) juint _pi04_2d[] = -{ - 0x54400000UL, 0x3fe921fbUL, 0x1a626331UL, 0x3dc0b461UL -}; - -ALIGNED_(4) juint _TWO_12H[] = -{ - 0x00000000UL, 0x40b80000UL -}; - -ALIGNED_(2) jushort __4onpi_31l[] = -{ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x836e, 0xa2f9, - 0x40d8, 0x0000, 0x0000, 0x0000, 0x2a50, 0x9c88, 0x40b7, 0x0000, 0x0000, 0x0000, - 0xabe8, 0xfe13, 0x4099, 0x0000, 0x0000, 0x0000, 0x6ee0, 0xfa9a, 0x4079, 0x0000, - 0x0000, 0x0000, 0x9580, 0xdb62, 0x4058, 0x0000, 0x0000, 0x0000, 0x1c82, 0xc9e2, - 0x403d, 0x0000, 0x0000, 0x0000, 0xb1c0, 0xff28, 0x4019, 0x0000, 0x0000, 0x0000, - 0xef14, 0xaf7a, 0x3ffe, 0x0000, 0x0000, 0x0000, 0x48dc, 0xc36e, 0x3fdf, 0x0000, - 0x0000, 0x0000, 0x3740, 0xe909, 0x3fbe, 0x0000, 0x0000, 0x0000, 0x924a, 0xb801, - 0x3fa2, 0x0000, 0x0000, 0x0000, 0x3a32, 0xdd41, 0x3f83, 0x0000, 0x0000, 0x0000, - 0x8778, 0x873f, 0x3f62, 0x0000, 0x0000, 0x0000, 0x1298, 0xb1cb, 0x3f44, 0x0000, - 0x0000, 0x0000, 0xa208, 0x9cfb, 0x3f26, 0x0000, 0x0000, 0x0000, 0xbaec, 0xd7d4, - 0x3f06, 0x0000, 0x0000, 0x0000, 0xd338, 0x8909, 0x3ee7, 0x0000, 0x0000, 0x0000, - 0x68b8, 0xe04d, 0x3ec7, 0x0000, 0x0000, 0x0000, 0x4e64, 0xdf90, 0x3eaa, 0x0000, - 0x0000, 0x0000, 0xc1a8, 0xeb1c, 0x3e89, 0x0000, 0x0000, 0x0000, 0x2720, 0xce7d, - 0x3e6a, 0x0000, 0x0000, 0x0000, 0x77b8, 0x8bf1, 0x3e4b, 0x0000, 0x0000, 0x0000, - 0xec7e, 0xe4a0, 0x3e2e, 0x0000, 0x0000, 0x0000, 0xffbc, 0xf12f, 0x3e0f, 0x0000, - 0x0000, 0x0000, 0xfdc0, 0xb301, 0x3deb, 0x0000, 0x0000, 0x0000, 0xc5ac, 0x9788, - 0x3dd1, 0x0000, 0x0000, 0x0000, 0x47da, 0x829b, 0x3db2, 0x0000, 0x0000, 0x0000, - 0xd9e4, 0xa6cf, 0x3d93, 0x0000, 0x0000, 0x0000, 0x36e8, 0xf961, 0x3d73, 0x0000, - 0x0000, 0x0000, 0xf668, 0xf463, 0x3d54, 0x0000, 0x0000, 0x0000, 0x5168, 0xf2ff, - 0x3d35, 0x0000, 0x0000, 0x0000, 0x758e, 0xea4f, 0x3d17, 0x0000, 0x0000, 0x0000, - 0xf17a, 0xebe5, 0x3cf8, 0x0000, 0x0000, 0x0000, 0x9cfa, 0x9e83, 0x3cd9, 0x0000, - 0x0000, 0x0000, 0xa4ba, 0xe294, 0x3cba, 0x0000, 0x0000, 0x0000, 0xd7ec, 0x9afe, - 0x3c9a, 0x0000, 0x0000, 0x0000, 0xae80, 0x8fc6, 0x3c79, 0x0000, 0x0000, 0x0000, - 0x3304, 0x8560, 0x3c5c, 0x0000, 0x0000, 0x0000, 0x6d70, 0xdf8f, 0x3c3b, 0x0000, - 0x0000, 0x0000, 0x3ef0, 0xafc3, 0x3c1e, 0x0000, 0x0000, 0x0000, 0xd0d8, 0x826b, - 0x3bfe, 0x0000, 0x0000, 0x0000, 0x1c80, 0xed4f, 0x3bdd, 0x0000, 0x0000, 0x0000, - 0x730c, 0xb0af, 0x3bc1, 0x0000, 0x0000, 0x0000, 0x6660, 0xc219, 0x3ba2, 0x0000, - 0x0000, 0x0000, 0x940c, 0xabe2, 0x3b83, 0x0000, 0x0000, 0x0000, 0xdffc, 0x8408, - 0x3b64, 0x0000, 0x0000, 0x0000, 0x6b98, 0xc402, 0x3b45, 0x0000, 0x0000, 0x0000, - 0x1818, 0x9cc4, 0x3b26, 0x0000, 0x0000, 0x0000, 0x5390, 0xaab6, 0x3b05, 0x0000, - 0x0000, 0x0000, 0xb070, 0xd464, 0x3ae9, 0x0000, 0x0000, 0x0000, 0x231a, 0x9ef0, - 0x3aca, 0x0000, 0x0000, 0x0000, 0x0670, 0xd1f1, 0x3aaa, 0x0000, 0x0000, 0x0000, - 0x7738, 0xd9f3, 0x3a8a, 0x0000, 0x0000, 0x0000, 0xa834, 0x8092, 0x3a6c, 0x0000, - 0x0000, 0x0000, 0xb45c, 0xce23, 0x3a4d, 0x0000, 0x0000, 0x0000, 0x36e8, 0xb0e5, - 0x3a2d, 0x0000, 0x0000, 0x0000, 0xd156, 0xaf44, 0x3a10, 0x0000, 0x0000, 0x0000, - 0x9f52, 0x8c82, 0x39f1, 0x0000, 0x0000, 0x0000, 0x829c, 0xff83, 0x39d1, 0x0000, - 0x0000, 0x0000, 0x7d06, 0xefc6, 0x39b3, 0x0000, 0x0000, 0x0000, 0x93e0, 0xb0b7, - 0x3992, 0x0000, 0x0000, 0x0000, 0xedde, 0xc193, 0x3975, 0x0000, 0x0000, 0x0000, - 0xbbc0, 0xcf49, 0x3952, 0x0000, 0x0000, 0x0000, 0xbdf0, 0xd63c, 0x3937, 0x0000, - 0x0000, 0x0000, 0x1f34, 0x9f3a, 0x3918, 0x0000, 0x0000, 0x0000, 0x3f8e, 0xe579, - 0x38f9, 0x0000, 0x0000, 0x0000, 0x90c8, 0xc3f8, 0x38d9, 0x0000, 0x0000, 0x0000, - 0x48c0, 0xf8f8, 0x38b7, 0x0000, 0x0000, 0x0000, 0xed56, 0xafa6, 0x389c, 0x0000, - 0x0000, 0x0000, 0x8218, 0xb969, 0x387d, 0x0000, 0x0000, 0x0000, 0x1852, 0xec57, - 0x385e, 0x0000, 0x0000, 0x0000, 0x670c, 0xd674, 0x383e, 0x0000, 0x0000, 0x0000, - 0xad40, 0xc2c4, 0x3820, 0x0000, 0x0000, 0x0000, 0x2e80, 0xa696, 0x3801, 0x0000, - 0x0000, 0x0000, 0xd800, 0xc467, 0x37dc, 0x0000, 0x0000, 0x0000, 0x3c72, 0xc5ae, - 0x37c3, 0x0000, 0x0000, 0x0000, 0xb006, 0xac69, 0x37a4, 0x0000, 0x0000, 0x0000, - 0x34a0, 0x8cdf, 0x3782, 0x0000, 0x0000, 0x0000, 0x9ed2, 0xd25e, 0x3766, 0x0000, - 0x0000, 0x0000, 0x6fec, 0xaaaa, 0x3747, 0x0000, 0x0000, 0x0000, 0x6040, 0xfb5c, - 0x3726, 0x0000, 0x0000, 0x0000, 0x764c, 0xa3fc, 0x3708, 0x0000, 0x0000, 0x0000, - 0xb254, 0x954e, 0x36e9, 0x0000, 0x0000, 0x0000, 0x3e1c, 0xf5dc, 0x36ca, 0x0000, - 0x0000, 0x0000, 0x7b06, 0xc635, 0x36ac, 0x0000, 0x0000, 0x0000, 0xa8ba, 0xd738, - 0x368d, 0x0000, 0x0000, 0x0000, 0x06cc, 0xb24e, 0x366d, 0x0000, 0x0000, 0x0000, - 0x7108, 0xac76, 0x364f, 0x0000, 0x0000, 0x0000, 0x2324, 0xa7cb, 0x3630, 0x0000, - 0x0000, 0x0000, 0xac40, 0xef15, 0x360f, 0x0000, 0x0000, 0x0000, 0xae46, 0xd516, - 0x35f2, 0x0000, 0x0000, 0x0000, 0x615e, 0xe003, 0x35d3, 0x0000, 0x0000, 0x0000, - 0x0cf0, 0xefe7, 0x35b1, 0x0000, 0x0000, 0x0000, 0xfb50, 0xf98c, 0x3595, 0x0000, - 0x0000, 0x0000, 0x0abc, 0xf333, 0x3575, 0x0000, 0x0000, 0x0000, 0xdd60, 0xca3f, - 0x3555, 0x0000, 0x0000, 0x0000, 0x7eb6, 0xd87f, 0x3538, 0x0000, 0x0000, 0x0000, - 0x44f4, 0xb291, 0x3519, 0x0000, 0x0000, 0x0000, 0xff80, 0xc982, 0x34f6, 0x0000, - 0x0000, 0x0000, 0x9de0, 0xd9b8, 0x34db, 0x0000, 0x0000, 0x0000, 0xcd42, 0x9366, - 0x34bc, 0x0000, 0x0000, 0x0000, 0xbef0, 0xfaee, 0x349d, 0x0000, 0x0000, 0x0000, - 0xdac4, 0xb6f1, 0x347d, 0x0000, 0x0000, 0x0000, 0xf140, 0x94de, 0x345d, 0x0000, - 0x0000, 0x0000, 0xa218, 0x8b4b, 0x343e, 0x0000, 0x0000, 0x0000, 0x6380, 0xa135, - 0x341e, 0x0000, 0x0000, 0x0000, 0xb184, 0x8cb2, 0x3402, 0x0000, 0x0000, 0x0000, - 0x196e, 0xdc61, 0x33e3, 0x0000, 0x0000, 0x0000, 0x0c00, 0xde05, 0x33c4, 0x0000, - 0x0000, 0x0000, 0xef9a, 0xbd38, 0x33a5, 0x0000, 0x0000, 0x0000, 0xc1a0, 0xdf00, - 0x3385, 0x0000, 0x0000, 0x0000, 0x1090, 0x9973, 0x3365, 0x0000, 0x0000, 0x0000, - 0x4882, 0x8301, 0x3348, 0x0000, 0x0000, 0x0000, 0x7abe, 0xadc7, 0x3329, 0x0000, - 0x0000, 0x0000, 0x7cba, 0xec2b, 0x330a, 0x0000, 0x0000, 0x0000, 0xa520, 0x8f21, - 0x32e9, 0x0000, 0x0000, 0x0000, 0x710c, 0x8d36, 0x32cc, 0x0000, 0x0000, 0x0000, - 0x5212, 0xc6ed, 0x32ad, 0x0000, 0x0000, 0x0000, 0x7308, 0xfd76, 0x328d, 0x0000, - 0x0000, 0x0000, 0x5014, 0xd548, 0x326f, 0x0000, 0x0000, 0x0000, 0xd3f2, 0xb499, - 0x3250, 0x0000, 0x0000, 0x0000, 0x7f74, 0xa606, 0x3230, 0x0000, 0x0000, 0x0000, - 0xf0a8, 0xd720, 0x3212, 0x0000, 0x0000, 0x0000, 0x185c, 0xe20f, 0x31f2, 0x0000, - 0x0000, 0x0000, 0xa5a8, 0x8738, 0x31d4, 0x0000, 0x0000, 0x0000, 0xdd74, 0xcafb, - 0x31b4, 0x0000, 0x0000, 0x0000, 0x98b6, 0xbd8e, 0x3196, 0x0000, 0x0000, 0x0000, - 0xe9de, 0x977f, 0x3177, 0x0000, 0x0000, 0x0000, 0x67c0, 0x818d, 0x3158, 0x0000, - 0x0000, 0x0000, 0xe52a, 0x9322, 0x3139, 0x0000, 0x0000, 0x0000, 0xe568, 0x9b6c, - 0x3119, 0x0000, 0x0000, 0x0000, 0x2358, 0xaa0a, 0x30fa, 0x0000, 0x0000, 0x0000, - 0xe480, 0xe13b, 0x30d9, 0x0000, 0x0000, 0x0000, 0x3024, 0x90a1, 0x30bd, 0x0000, - 0x0000, 0x0000, 0x9620, 0xda30, 0x309d, 0x0000, 0x0000, 0x0000, 0x898a, 0xb388, - 0x307f, 0x0000, 0x0000, 0x0000, 0xb24c, 0xc891, 0x3060, 0x0000, 0x0000, 0x0000, - 0x8056, 0xf98b, 0x3041, 0x0000, 0x0000, 0x0000, 0x72a4, 0xa1ea, 0x3021, 0x0000, - 0x0000, 0x0000, 0x6af8, 0x9488, 0x3001, 0x0000, 0x0000, 0x0000, 0xe00c, 0xdfcb, - 0x2fe4, 0x0000, 0x0000, 0x0000, 0xeeec, 0xc941, 0x2fc4, 0x0000, 0x0000, 0x0000, - 0x53e0, 0xe70f, 0x2fa4, 0x0000, 0x0000, 0x0000, 0x8f60, 0x9c07, 0x2f85, 0x0000, - 0x0000, 0x0000, 0xb328, 0xc3e7, 0x2f68, 0x0000, 0x0000, 0x0000, 0x9404, 0xf8c7, - 0x2f48, 0x0000, 0x0000, 0x0000, 0x38e0, 0xc99f, 0x2f29, 0x0000, 0x0000, 0x0000, - 0x9778, 0xd984, 0x2f09, 0x0000, 0x0000, 0x0000, 0xe700, 0xd142, 0x2eea, 0x0000, - 0x0000, 0x0000, 0xd904, 0x9443, 0x2ecd, 0x0000, 0x0000, 0x0000, 0xd4ba, 0xae7e, - 0x2eae, 0x0000, 0x0000, 0x0000, 0x8e5e, 0x8524, 0x2e8f, 0x0000, 0x0000, 0x0000, - 0xb550, 0xc9ed, 0x2e6e, 0x0000, 0x0000, 0x0000, 0x53b8, 0x8648, 0x2e51, 0x0000, - 0x0000, 0x0000, 0xdae4, 0x87f9, 0x2e32, 0x0000, 0x0000, 0x0000, 0x2942, 0xd966, - 0x2e13, 0x0000, 0x0000, 0x0000, 0x4f28, 0xcf3c, 0x2df3, 0x0000, 0x0000, 0x0000, - 0xfa40, 0xc4ef, 0x2dd1, 0x0000, 0x0000, 0x0000, 0x4424, 0xbca7, 0x2db5, 0x0000, - 0x0000, 0x0000, 0x2e62, 0xcdc5, 0x2d97, 0x0000, 0x0000, 0x0000, 0xed88, 0x996b, - 0x2d78, 0x0000, 0x0000, 0x0000, 0x7c30, 0xd97d, 0x2d56, 0x0000, 0x0000, 0x0000, - 0xed26, 0xbf6e, 0x2d3a, 0x0000, 0x0000, 0x0000, 0x2918, 0x921b, 0x2d1a, 0x0000, - 0x0000, 0x0000, 0x4e24, 0xe84e, 0x2cfb, 0x0000, 0x0000, 0x0000, 0x6dc0, 0x92ec, - 0x2cdd, 0x0000, 0x0000, 0x0000, 0x4f2c, 0xacf8, 0x2cbd, 0x0000, 0x0000, 0x0000, - 0xc634, 0xf094, 0x2c9e, 0x0000, 0x0000, 0x0000, 0xdc70, 0xe5d3, 0x2c7e, 0x0000, - 0x0000, 0x0000, 0x2180, 0xa600, 0x2c5b, 0x0000, 0x0000, 0x0000, 0x8480, 0xd680, - 0x2c3c, 0x0000, 0x0000, 0x0000, 0x8b24, 0xd63b, 0x2c22, 0x0000, 0x0000, 0x0000, - 0x02e0, 0xaa47, 0x2c00, 0x0000, 0x0000, 0x0000, 0x9ad0, 0xee84, 0x2be3, 0x0000, - 0x0000, 0x0000, 0xf7dc, 0xf699, 0x2bc6, 0x0000, 0x0000, 0x0000, 0xddde, 0xe490, - 0x2ba7, 0x0000, 0x0000, 0x0000, 0x34a0, 0xb4fd, 0x2b85, 0x0000, 0x0000, 0x0000, - 0x91b4, 0x8ef6, 0x2b68, 0x0000, 0x0000, 0x0000, 0xa3e0, 0xa2a7, 0x2b47, 0x0000, - 0x0000, 0x0000, 0xcce4, 0x82b3, 0x2b2a, 0x0000, 0x0000, 0x0000, 0xe4be, 0x8207, - 0x2b0c, 0x0000, 0x0000, 0x0000, 0x1d92, 0xab43, 0x2aed, 0x0000, 0x0000, 0x0000, - 0xe818, 0xf9f6, 0x2acd, 0x0000, 0x0000, 0x0000, 0xff12, 0xba80, 0x2aaf, 0x0000, - 0x0000, 0x0000, 0x5254, 0x8529, 0x2a90, 0x0000, 0x0000, 0x0000, 0x1b88, 0xe032, - 0x2a71, 0x0000, 0x0000, 0x0000, 0x3248, 0xd86d, 0x2a50, 0x0000, 0x0000, 0x0000, - 0x3140, 0xc9d5, 0x2a2e, 0x0000, 0x0000, 0x0000, 0x14e6, 0xbd47, 0x2a14, 0x0000, - 0x0000, 0x0000, 0x5c10, 0xe544, 0x29f4, 0x0000, 0x0000, 0x0000, 0x9f50, 0x90b6, - 0x29d4, 0x0000, 0x0000, 0x0000, 0x9850, 0xab55, 0x29b6, 0x0000, 0x0000, 0x0000, - 0x2750, 0x9d07, 0x2998, 0x0000, 0x0000, 0x0000, 0x6700, 0x8bbb, 0x2973, 0x0000, - 0x0000, 0x0000, 0x5dba, 0xed31, 0x295a, 0x0000, 0x0000, 0x0000, 0x61dc, 0x85fe, - 0x293a, 0x0000, 0x0000, 0x0000, 0x9ba2, 0xd6b4, 0x291c, 0x0000, 0x0000, 0x0000, - 0x2d30, 0xe3a5, 0x28fb, 0x0000, 0x0000, 0x0000, 0x6630, 0xb566, 0x28dd, 0x0000, - 0x0000, 0x0000, 0x5ad4, 0xa829, 0x28bf, 0x0000, 0x0000, 0x0000, 0x89d8, 0xe290, - 0x28a0, 0x0000, 0x0000, 0x0000, 0x3916, 0xc428, 0x2881, 0x0000, 0x0000, 0x0000, - 0x0490, 0xbea4, 0x2860, 0x0000, 0x0000, 0x0000, 0xee06, 0x80ee, 0x2843, 0x0000, - 0x0000, 0x0000, 0xfc00, 0xf327, 0x2820, 0x0000, 0x0000, 0x0000, 0xea40, 0xa871, - 0x2800, 0x0000, 0x0000, 0x0000, 0x63d8, 0x9c26, 0x27e4, 0x0000, 0x0000, 0x0000, - 0x07ba, 0xc0c9, 0x27c7, 0x0000, 0x0000, 0x0000, 0x3fa2, 0x9797, 0x27a8, 0x0000, - 0x0000, 0x0000, 0x21c6, 0xfeca, 0x2789, 0x0000, 0x0000, 0x0000, 0xde40, 0x860d, - 0x2768, 0x0000, 0x0000, 0x0000, 0x9cc8, 0x98ce, 0x2749, 0x0000, 0x0000, 0x0000, - 0x3778, 0xa31c, 0x272a, 0x0000, 0x0000, 0x0000, 0xe778, 0xf6e2, 0x270b, 0x0000, - 0x0000, 0x0000, 0x59b8, 0xf841, 0x26ed, 0x0000, 0x0000, 0x0000, 0x02e0, 0xad04, - 0x26cd, 0x0000, 0x0000, 0x0000, 0x5a92, 0x9380, 0x26b0, 0x0000, 0x0000, 0x0000, - 0xc740, 0x8886, 0x268d, 0x0000, 0x0000, 0x0000, 0x0680, 0xfaf8, 0x266c, 0x0000, - 0x0000, 0x0000, 0xfb60, 0x897f, 0x2653, 0x0000, 0x0000, 0x0000, 0x8760, 0xf903, - 0x2634, 0x0000, 0x0000, 0x0000, 0xad2a, 0xc2c8, 0x2615, 0x0000, 0x0000, 0x0000, - 0x2d86, 0x8aef, 0x25f6, 0x0000, 0x0000, 0x0000, 0x1ef4, 0xe627, 0x25d6, 0x0000, - 0x0000, 0x0000, 0x09e4, 0x8020, 0x25b7, 0x0000, 0x0000, 0x0000, 0x7548, 0xd227, - 0x2598, 0x0000, 0x0000, 0x0000, 0x75dc, 0xfb5b, 0x2579, 0x0000, 0x0000, 0x0000, - 0xea84, 0xc8b6, 0x255a, 0x0000, 0x0000, 0x0000, 0xe4d0, 0x8145, 0x253b, 0x0000, - 0x0000, 0x0000, 0x3640, 0x9768, 0x251c, 0x0000, 0x0000, 0x0000, 0x246a, 0xccec, - 0x24fe, 0x0000, 0x0000, 0x0000, 0x51d0, 0xa075, 0x24dd, 0x0000, 0x0000, 0x0000, - 0x4638, 0xa385, 0x24bf, 0x0000, 0x0000, 0x0000, 0xd788, 0xd776, 0x24a1, 0x0000, - 0x0000, 0x0000, 0x1370, 0x8997, 0x2482, 0x0000, 0x0000, 0x0000, 0x1e88, 0x9b67, - 0x2462, 0x0000, 0x0000, 0x0000, 0x6c08, 0xd975, 0x2444, 0x0000, 0x0000, 0x0000, - 0xfdb0, 0xcfc0, 0x2422, 0x0000, 0x0000, 0x0000, 0x3100, 0xc026, 0x2406, 0x0000, - 0x0000, 0x0000, 0xc5b4, 0xae64, 0x23e6, 0x0000, 0x0000, 0x0000, 0x2280, 0xf687, - 0x23c3, 0x0000, 0x0000, 0x0000, 0x2de0, 0x9006, 0x23a9, 0x0000, 0x0000, 0x0000, - 0x24bc, 0xf631, 0x238a, 0x0000, 0x0000, 0x0000, 0xb8d4, 0xa975, 0x236b, 0x0000, - 0x0000, 0x0000, 0xd9a4, 0xb949, 0x234b, 0x0000, 0x0000, 0x0000, 0xb54e, 0xbd39, - 0x232d, 0x0000, 0x0000, 0x0000, 0x4aac, 0x9a52, 0x230e, 0x0000, 0x0000, 0x0000, - 0xbbbc, 0xd085, 0x22ef, 0x0000, 0x0000, 0x0000, 0xdf18, 0xc633, 0x22cf, 0x0000, - 0x0000, 0x0000, 0x16d0, 0xeca5, 0x22af, 0x0000, 0x0000, 0x0000, 0xf2a0, 0xdf6f, - 0x228e, 0x0000, 0x0000, 0x0000, 0x8c44, 0xe86b, 0x2272, 0x0000, 0x0000, 0x0000, - 0x35c0, 0xbbf4, 0x2253, 0x0000, 0x0000, 0x0000, 0x0c40, 0xdafb, 0x2230, 0x0000, - 0x0000, 0x0000, 0x92dc, 0x9935, 0x2216, 0x0000, 0x0000, 0x0000, 0x0ca0, 0xbda6, - 0x21f3, 0x0000, 0x0000, 0x0000, 0x5958, 0xa6fd, 0x21d6, 0x0000, 0x0000, 0x0000, - 0xa3dc, 0x9d7f, 0x21b9, 0x0000, 0x0000, 0x0000, 0x79dc, 0xfcb5, 0x2199, 0x0000, - 0x0000, 0x0000, 0xf264, 0xcebb, 0x217b, 0x0000, 0x0000, 0x0000, 0x0abe, 0x8308, - 0x215c, 0x0000, 0x0000, 0x0000, 0x30ae, 0xb463, 0x213d, 0x0000, 0x0000, 0x0000, - 0x6228, 0xb040, 0x211c, 0x0000, 0x0000, 0x0000, 0xc9b2, 0xf43b, 0x20ff, 0x0000, - 0x0000, 0x0000, 0x3d8e, 0xa4b3, 0x20e0, 0x0000, 0x0000, 0x0000, 0x84e6, 0x8dab, - 0x20c1, 0x0000, 0x0000, 0x0000, 0xa124, 0x9b74, 0x20a1, 0x0000, 0x0000, 0x0000, - 0xc276, 0xd497, 0x2083, 0x0000, 0x0000, 0x0000, 0x6354, 0xa466, 0x2063, 0x0000, - 0x0000, 0x0000, 0x8654, 0xaf0a, 0x2044, 0x0000, 0x0000, 0x0000, 0x1d20, 0xfa5c, - 0x2024, 0x0000, 0x0000, 0x0000, 0xbcd0, 0xf3f0, 0x2004, 0x0000, 0x0000, 0x0000, - 0xedf0, 0xf0b6, 0x1fe7, 0x0000, 0x0000, 0x0000, 0x45bc, 0x9182, 0x1fc9, 0x0000, - 0x0000, 0x0000, 0xe254, 0xdc85, 0x1faa, 0x0000, 0x0000, 0x0000, 0xb898, 0xe9b1, - 0x1f8a, 0x0000, 0x0000, 0x0000, 0x0ebe, 0xe6f0, 0x1f6c, 0x0000, 0x0000, 0x0000, - 0xa9b8, 0xf584, 0x1f4c, 0x0000, 0x0000, 0x0000, 0x12e8, 0xdf6b, 0x1f2e, 0x0000, - 0x0000, 0x0000, 0x9f9e, 0xcd55, 0x1f0f, 0x0000, 0x0000, 0x0000, 0x05a0, 0xec3a, - 0x1eef, 0x0000, 0x0000, 0x0000, 0xd8e0, 0x96f8, 0x1ed1, 0x0000, 0x0000, 0x0000, - 0x3bd4, 0xccc6, 0x1eb1, 0x0000, 0x0000, 0x0000, 0x4910, 0xb87b, 0x1e93, 0x0000, - 0x0000, 0x0000, 0xbefc, 0xd40b, 0x1e73, 0x0000, 0x0000, 0x0000, 0x317e, 0xa406, - 0x1e55, 0x0000, 0x0000, 0x0000, 0x6bb2, 0xc2b2, 0x1e36, 0x0000, 0x0000, 0x0000, - 0xb87e, 0xbb78, 0x1e17, 0x0000, 0x0000, 0x0000, 0xa03c, 0xdbbd, 0x1df7, 0x0000, - 0x0000, 0x0000, 0x5b6c, 0xe3c8, 0x1dd9, 0x0000, 0x0000, 0x0000, 0x8968, 0xca8e, - 0x1dba, 0x0000, 0x0000, 0x0000, 0xc024, 0xe6ab, 0x1d9a, 0x0000, 0x0000, 0x0000, - 0x4110, 0xd4eb, 0x1d7a, 0x0000, 0x0000, 0x0000, 0xa168, 0xbdb5, 0x1d5d, 0x0000, - 0x0000, 0x0000, 0x012e, 0xa5fa, 0x1d3e, 0x0000, 0x0000, 0x0000, 0x6838, 0x9c1f, - 0x1d1e, 0x0000, 0x0000, 0x0000, 0xa158, 0xaa76, 0x1d00, 0x0000, 0x0000, 0x0000, - 0x090a, 0xbd95, 0x1ce1, 0x0000, 0x0000, 0x0000, 0xf73e, 0x8b6d, 0x1cc2, 0x0000, - 0x0000, 0x0000, 0x5fda, 0xbcbf, 0x1ca3, 0x0000, 0x0000, 0x0000, 0xdbe8, 0xb89f, - 0x1c84, 0x0000, 0x0000, 0x0000, 0x6e4c, 0x96c7, 0x1c64, 0x0000, 0x0000, 0x0000, - 0x19c2, 0xf2a4, 0x1c46, 0x0000, 0x0000, 0x0000, 0xb800, 0xf855, 0x1c1e, 0x0000, - 0x0000, 0x0000, 0x87fc, 0x85ff, 0x1c08, 0x0000, 0x0000, 0x0000, 0x1418, 0x839f, - 0x1be9, 0x0000, 0x0000, 0x0000, 0x6186, 0xd9d8, 0x1bca, 0x0000, 0x0000, 0x0000, - 0xf500, 0xabaa, 0x1ba6, 0x0000, 0x0000, 0x0000, 0x7b36, 0xdafe, 0x1b8c, 0x0000, - 0x0000, 0x0000, 0xf394, 0xe6d8, 0x1b6c, 0x0000, 0x0000, 0x0000, 0x6efc, 0x9e55, - 0x1b4e, 0x0000, 0x0000, 0x0000, 0x5e10, 0xc523, 0x1b2e, 0x0000, 0x0000, 0x0000, - 0x8210, 0xb6f9, 0x1b0d, 0x0000, 0x0000, 0x0000, 0x9ab0, 0x96e3, 0x1af1, 0x0000, - 0x0000, 0x0000, 0x3864, 0x92e7, 0x1ad1, 0x0000, 0x0000, 0x0000, 0x9878, 0xdc65, - 0x1ab1, 0x0000, 0x0000, 0x0000, 0xfa20, 0xd6cb, 0x1a94, 0x0000, 0x0000, 0x0000, - 0x6c00, 0xa4e4, 0x1a70, 0x0000, 0x0000, 0x0000, 0xab40, 0xb41b, 0x1a53, 0x0000, - 0x0000, 0x0000, 0x43a4, 0x8ede, 0x1a37, 0x0000, 0x0000, 0x0000, 0x22e0, 0x9314, - 0x1a15, 0x0000, 0x0000, 0x0000, 0x6170, 0xb949, 0x19f8, 0x0000, 0x0000, 0x0000, - 0x6b00, 0xe056, 0x19d8, 0x0000, 0x0000, 0x0000, 0x9ba8, 0xa94c, 0x19b9, 0x0000, - 0x0000, 0x0000, 0xfaa0, 0xaa16, 0x199b, 0x0000, 0x0000, 0x0000, 0x899a, 0xf627, - 0x197d, 0x0000, 0x0000, 0x0000, 0x9f20, 0xfb70, 0x195d, 0x0000, 0x0000, 0x0000, - 0xa4b8, 0xc176, 0x193e, 0x0000, 0x0000, 0x0000, 0xb21c, 0x85c3, 0x1920, 0x0000, - 0x0000, 0x0000, 0x50d2, 0x9b19, 0x1901, 0x0000, 0x0000, 0x0000, 0xd4b0, 0xb708, - 0x18e0, 0x0000, 0x0000, 0x0000, 0xfb88, 0xf510, 0x18c1, 0x0000, 0x0000, 0x0000, - 0x31ec, 0xdc8d, 0x18a3, 0x0000, 0x0000, 0x0000, 0x3c00, 0xbff9, 0x1885, 0x0000, - 0x0000, 0x0000, 0x5020, 0xc30b, 0x1862, 0x0000, 0x0000, 0x0000, 0xd4f0, 0xda0c, - 0x1844, 0x0000, 0x0000, 0x0000, 0x20d2, 0x99a5, 0x1828, 0x0000, 0x0000, 0x0000, - 0x852e, 0xd159, 0x1809, 0x0000, 0x0000, 0x0000, 0x7cd8, 0x97a1, 0x17e9, 0x0000, - 0x0000, 0x0000, 0x423a, 0x997b, 0x17cb, 0x0000, 0x0000, 0x0000, 0xc1c0, 0xbe7d, - 0x17a8, 0x0000, 0x0000, 0x0000, 0xe8bc, 0xdcdd, 0x178d, 0x0000, 0x0000, 0x0000, - 0x8b28, 0xae06, 0x176e, 0x0000, 0x0000, 0x0000, 0x102e, 0xb8d4, 0x174f, 0x0000, - 0x0000, 0x0000, 0xaa00, 0xaa5c, 0x172f, 0x0000, 0x0000, 0x0000, 0x51f0, 0x9fc0, - 0x170e, 0x0000, 0x0000, 0x0000, 0xf858, 0xe181, 0x16f2, 0x0000, 0x0000, 0x0000, - 0x91a8, 0x8162, 0x16d3, 0x0000, 0x0000, 0x0000, 0x5f40, 0xcb6f, 0x16b1, 0x0000, - 0x0000, 0x0000, 0xbb50, 0xe55f, 0x1693, 0x0000, 0x0000, 0x0000, 0xacd2, 0xd895, - 0x1676, 0x0000, 0x0000, 0x0000, 0xef30, 0x97bf, 0x1654, 0x0000, 0x0000, 0x0000, - 0xf700, 0xb3d7, 0x1633, 0x0000, 0x0000, 0x0000, 0x3454, 0xa7b5, 0x1619, 0x0000, - 0x0000, 0x0000, 0x6b00, 0xa929, 0x15f6, 0x0000, 0x0000, 0x0000, 0x9f04, 0x89f7, - 0x15db, 0x0000, 0x0000, 0x0000, 0xad78, 0xd985, 0x15bc, 0x0000, 0x0000, 0x0000, - 0xa46a, 0xae3f, 0x159d, 0x0000, 0x0000, 0x0000, 0x63a0, 0xd0da, 0x157c, 0x0000, - 0x0000, 0x0000, 0x5e90, 0x817d, 0x155e, 0x0000, 0x0000, 0x0000, 0x1494, 0xb13f, - 0x1540, 0x0000, 0x0000, 0x0000, 0x0090, 0x9c40, 0x1521, 0x0000, 0x0000, 0x0000, - 0xdd70, 0xcc86, 0x1500, 0x0000, 0x0000, 0x0000, 0x64f8, 0xdb6f, 0x14e1, 0x0000, - 0x0000, 0x0000, 0xe22c, 0xac17, 0x14c3, 0x0000, 0x0000, 0x0000, 0x60e0, 0xa9ad, - 0x14a3, 0x0000, 0x0000, 0x0000, 0x4640, 0xd658, 0x1481, 0x0000, 0x0000, 0x0000, - 0x6490, 0xa181, 0x1467, 0x0000, 0x0000, 0x0000, 0x1df4, 0xaaa2, 0x1447, 0x0000, - 0x0000, 0x0000, 0xb94a, 0x8f61, 0x1429, 0x0000, 0x0000, 0x0000, 0x5198, 0x9d83, - 0x1409, 0x0000, 0x0000, 0x0000, 0x0f7a, 0xa818, 0x13eb, 0x0000, 0x0000, 0x0000, - 0xc45e, 0xc06c, 0x13cc, 0x0000, 0x0000, 0x0000, 0x4ec0, 0xfa29, 0x13a8, 0x0000, - 0x0000, 0x0000, 0x6418, 0x8cad, 0x138c, 0x0000, 0x0000, 0x0000, 0xbcc8, 0xe7d1, - 0x136f, 0x0000, 0x0000, 0x0000, 0xc934, 0xf9b0, 0x134f, 0x0000, 0x0000, 0x0000, - 0x6ce0, 0x98df, 0x1331, 0x0000, 0x0000, 0x0000, 0x3516, 0xe5e9, 0x1312, 0x0000, - 0x0000, 0x0000, 0xc6c0, 0xef8b, 0x12ef, 0x0000, 0x0000, 0x0000, 0xaf02, 0x913d, - 0x12d4, 0x0000, 0x0000, 0x0000, 0xd230, 0xe1d5, 0x12b5, 0x0000, 0x0000, 0x0000, - 0xfba8, 0xc232, 0x1295, 0x0000, 0x0000, 0x0000, 0x7ba4, 0xabeb, 0x1277, 0x0000, - 0x0000, 0x0000, 0x6e5c, 0xc692, 0x1258, 0x0000, 0x0000, 0x0000, 0x76a2, 0x9756, - 0x1239, 0x0000, 0x0000, 0x0000, 0xe180, 0xe423, 0x1214, 0x0000, 0x0000, 0x0000, - 0x8c3c, 0x90f8, 0x11fb, 0x0000, 0x0000, 0x0000, 0x9f3c, 0x9fd2, 0x11dc, 0x0000, - 0x0000, 0x0000, 0x53e0, 0xb73e, 0x11bd, 0x0000, 0x0000, 0x0000, 0x45be, 0x88d6, - 0x119e, 0x0000, 0x0000, 0x0000, 0x111a, 0x8bc0, 0x117f, 0x0000, 0x0000, 0x0000, - 0xe26a, 0xd7ff, 0x1160, 0x0000, 0x0000, 0x0000, 0xfb60, 0xdd8d, 0x113f, 0x0000, - 0x0000, 0x0000, 0x9370, 0xc108, 0x1120, 0x0000, 0x0000, 0x0000, 0x9654, 0x8baf, - 0x1103, 0x0000, 0x0000, 0x0000, 0xd6ec, 0xd6b9, 0x10e4, 0x0000, 0x0000, 0x0000, - 0x23e4, 0xd7b7, 0x10c4, 0x0000, 0x0000, 0x0000, 0x1aa6, 0xa847, 0x10a6, 0x0000, - 0x0000, 0x0000, 0xbee6, 0x9fef, 0x1087, 0x0000, 0x0000, 0x0000, 0x26d0, 0xa6eb, - 0x1066, 0x0000, 0x0000, 0x0000, 0x5b86, 0xa880, 0x1049, 0x0000, 0x0000, 0x0000, - 0x125c, 0xd971, 0x1029, 0x0000, 0x0000, 0x0000, 0x1f78, 0x9d18, 0x100a, 0x0000, - 0x0000, 0x0000, 0x0e84, 0xb15b, 0x0feb, 0x0000, 0x0000, 0x0000, 0xd0c0, 0xc150, - 0x0fcc, 0x0000, 0x0000, 0x0000, 0xa330, 0xc40c, 0x0fad, 0x0000, 0x0000, 0x0000, - 0x5202, 0xfc2c, 0x0f8f, 0x0000, 0x0000, 0x0000, 0x3f7c, 0xecf5, 0x0f6f, 0x0000, - 0x0000, 0x0000, 0xef44, 0xfdfd, 0x0f50, 0x0000, 0x0000, 0x0000, 0x3f6c, 0xab1b, - 0x0f31, 0x0000, 0x0000, 0x0000, 0xf658, 0x89ec, 0x0f11, 0x0000, 0x0000, 0x0000, - 0xbfc8, 0x9ba8, 0x0ef4, 0x0000, 0x0000, 0x0000, 0x3d40, 0xbe21, 0x0ed5, 0x0000, - 0x0000, 0x0000, 0xbbc4, 0xc70d, 0x0eb6, 0x0000, 0x0000, 0x0000, 0x5158, 0xdb16, - 0x0e96, 0x0000, 0x0000, 0x0000, 0xb5a8, 0xa8d8, 0x0e78, 0x0000, 0x0000, 0x0000, - 0xcccc, 0xb40e, 0x0e58, 0x0000, 0x0000, 0x0000, 0x448c, 0xcb62, 0x0e3a, 0x0000, - 0x0000, 0x0000, 0xf12a, 0x8aed, 0x0e1b, 0x0000, 0x0000, 0x0000, 0x79d0, 0xc59c, - 0x0dfb, 0x0000, 0x0000, 0x0000, 0x06b4, 0xcdc9, 0x0ddd, 0x0000, 0x0000, 0x0000, - 0xae70, 0xa979, 0x0dbe, 0x0000, 0x0000, 0x0000, 0x317c, 0xa8fb, 0x0d9e, 0x0000, - 0x0000, 0x0000, 0x5fe0, 0x8a50, 0x0d7d, 0x0000, 0x0000, 0x0000, 0x70b6, 0xfdfa, - 0x0d61, 0x0000, 0x0000, 0x0000, 0x1640, 0x9dc7, 0x0d41, 0x0000, 0x0000, 0x0000, - 0x9a9c, 0xdc50, 0x0d23, 0x0000, 0x0000, 0x0000, 0x4fcc, 0x9a9b, 0x0d04, 0x0000, - 0x0000, 0x0000, 0x7e48, 0x8f77, 0x0ce5, 0x0000, 0x0000, 0x0000, 0x84e4, 0xd4b9, - 0x0cc6, 0x0000, 0x0000, 0x0000, 0x84e0, 0xbd10, 0x0ca6, 0x0000, 0x0000, 0x0000, - 0x1b0a, 0xc8d9, 0x0c88, 0x0000, 0x0000, 0x0000, 0x6a48, 0xfc81, 0x0c68, 0x0000, - 0x0000, 0x0000, 0x070a, 0xbef6, 0x0c4a, 0x0000, 0x0000, 0x0000, 0x8a70, 0xf096, - 0x0c2b, 0x0000, 0x0000, 0x0000, 0xecc2, 0xc994, 0x0c0c, 0x0000, 0x0000, 0x0000, - 0x1540, 0x9537, 0x0bea, 0x0000, 0x0000, 0x0000, 0x1b02, 0xab5b, 0x0bce, 0x0000, - 0x0000, 0x0000, 0x5dc0, 0xb0c8, 0x0bad, 0x0000, 0x0000, 0x0000, 0xc928, 0xe034, - 0x0b8f, 0x0000, 0x0000, 0x0000, 0x2d12, 0xb4b0, 0x0b71, 0x0000, 0x0000, 0x0000, - 0x8fc2, 0xbb94, 0x0b52, 0x0000, 0x0000, 0x0000, 0xe236, 0xe22f, 0x0b33, 0x0000, - 0x0000, 0x0000, 0xb97c, 0xbe9e, 0x0b13, 0x0000, 0x0000, 0x0000, 0xe1a6, 0xe16d, - 0x0af5, 0x0000, 0x0000, 0x0000, 0xd330, 0xbaf0, 0x0ad6, 0x0000, 0x0000, 0x0000, - 0xc0bc, 0xbbd0, 0x0ab7, 0x0000, 0x0000, 0x0000, 0x8e66, 0xdd9b, 0x0a98, 0x0000, - 0x0000, 0x0000, 0xc95c, 0xf799, 0x0a79, 0x0000, 0x0000, 0x0000, 0xdac0, 0xbe4c, - 0x0a55, 0x0000, 0x0000, 0x0000, 0xafc0, 0xc378, 0x0a37, 0x0000, 0x0000, 0x0000, - 0xa880, 0xe341, 0x0a19, 0x0000, 0x0000, 0x0000, 0xc242, 0x81f6, 0x09fd, 0x0000, - 0x0000, 0x0000, 0x7470, 0xc777, 0x09de, 0x0000, 0x0000, 0x0000, 0x62bc, 0xb684, - 0x09be, 0x0000, 0x0000, 0x0000, 0x43ac, 0x8c58, 0x099f, 0x0000, 0x0000, 0x0000, - 0xcc3c, 0xf9ac, 0x0981, 0x0000, 0x0000, 0x0000, 0x1526, 0xb670, 0x0962, 0x0000, - 0x0000, 0x0000, 0xc9fe, 0xdf50, 0x0943, 0x0000, 0x0000, 0x0000, 0x6ae6, 0xc065, - 0x0924, 0x0000, 0x0000, 0x0000, 0xb114, 0xcf29, 0x0905, 0x0000, 0x0000, 0x0000, - 0xd388, 0x922a, 0x08e4, 0x0000, 0x0000, 0x0000, 0xcf54, 0xb926, 0x08c7, 0x0000, - 0x0000, 0x0000, 0x3826, 0xe855, 0x08a8, 0x0000, 0x0000, 0x0000, 0xe7c8, 0x829b, - 0x0888, 0x0000, 0x0000, 0x0000, 0x546c, 0xa903, 0x086a, 0x0000, 0x0000, 0x0000, - 0x8768, 0x99cc, 0x0849, 0x0000, 0x0000, 0x0000, 0x00ac, 0xf529, 0x082b, 0x0000, - 0x0000, 0x0000, 0x2658, 0x9f0b, 0x080c, 0x0000, 0x0000, 0x0000, 0xfe5c, 0x9e21, - 0x07ee, 0x0000, 0x0000, 0x0000, 0x6da2, 0x9910, 0x07cf, 0x0000, 0x0000, 0x0000, - 0x9220, 0xf9b3, 0x07b0, 0x0000, 0x0000, 0x0000, 0x3d90, 0xa541, 0x0791, 0x0000, - 0x0000, 0x0000, 0x6e4c, 0xe7cc, 0x0771, 0x0000, 0x0000, 0x0000, 0xa8fa, 0xe80a, - 0x0753, 0x0000, 0x0000, 0x0000, 0x4e14, 0xc3a7, 0x0734, 0x0000, 0x0000, 0x0000, - 0xf7e0, 0xbad9, 0x0712, 0x0000, 0x0000, 0x0000, 0xfea0, 0xeff2, 0x06f5, 0x0000, - 0x0000, 0x0000, 0xcef6, 0xbd48, 0x06d7, 0x0000, 0x0000, 0x0000, 0x7544, 0xf559, - 0x06b7, 0x0000, 0x0000, 0x0000, 0x2388, 0xf655, 0x0698, 0x0000, 0x0000, 0x0000, - 0xe900, 0xad56, 0x0676, 0x0000, 0x0000, 0x0000, 0x2cc0, 0x8437, 0x0659, 0x0000, - 0x0000, 0x0000, 0x3068, 0xc544, 0x063b, 0x0000, 0x0000, 0x0000, 0xdc70, 0xe73c, - 0x061b, 0x0000, 0x0000, 0x0000, 0xee50, 0x9d49, 0x05fc, 0x0000, 0x0000, 0x0000, - 0x93d2, 0x81f6, 0x05df, 0x0000, 0x0000, 0x0000, 0x941c, 0xadff, 0x05bf, 0x0000, - 0x0000, 0x0000, 0x2ce2, 0x8e45, 0x05a1, 0x0000, 0x0000, 0x0000, 0x4a60, 0x95fd, - 0x0581, 0x0000, 0x0000, 0x0000, 0x79f8, 0xb83a, 0x0563, 0x0000, 0x0000, 0x0000, - 0xcb58, 0xa1f5, 0x0543, 0x0000, 0x0000, 0x0000, 0x2a3a, 0xdc36, 0x0525, 0x0000, - 0x0000, 0x0000, 0x14ee, 0x890e, 0x0506, 0x0000, 0x0000, 0x0000, 0x8f20, 0xc432, - 0x04e3, 0x0000, 0x0000, 0x0000, 0x8440, 0xb21d, 0x04c6, 0x0000, 0x0000, 0x0000, - 0x5430, 0xf698, 0x04a7, 0x0000, 0x0000, 0x0000, 0x04ae, 0x8b20, 0x048a, 0x0000, - 0x0000, 0x0000, 0x04d0, 0xe872, 0x046b, 0x0000, 0x0000, 0x0000, 0xc78e, 0x8893, - 0x044c, 0x0000, 0x0000, 0x0000, 0x0f78, 0x9895, 0x042b, 0x0000, 0x0000, 0x0000, - 0x11d4, 0xdf2e, 0x040d, 0x0000, 0x0000, 0x0000, 0xe84c, 0x89d5, 0x03ef, 0x0000, - 0x0000, 0x0000, 0xf7be, 0x8a67, 0x03d0, 0x0000, 0x0000, 0x0000, 0x95d0, 0xc906, - 0x03b1, 0x0000, 0x0000, 0x0000, 0x64ce, 0xd96c, 0x0392, 0x0000, 0x0000, 0x0000, - 0x97ba, 0xa16f, 0x0373, 0x0000, 0x0000, 0x0000, 0x463c, 0xc51a, 0x0354, 0x0000, - 0x0000, 0x0000, 0xef0a, 0xe93e, 0x0335, 0x0000, 0x0000, 0x0000, 0x526a, 0xa466, - 0x0316, 0x0000, 0x0000, 0x0000, 0x4140, 0xa94d, 0x02f5, 0x0000, 0x0000, 0x0000, - 0xb4ec, 0xce68, 0x02d8, 0x0000, 0x0000, 0x0000, 0x4fa2, 0x8490, 0x02b9, 0x0000, - 0x0000, 0x0000, 0x4e60, 0xca98, 0x0298, 0x0000, 0x0000, 0x0000, 0x08dc, 0xe09c, - 0x027a, 0x0000, 0x0000, 0x0000, 0x2b90, 0xc7e3, 0x025c, 0x0000, 0x0000, 0x0000, - 0x5a7c, 0xf8ef, 0x023c, 0x0000, 0x0000, 0x0000, 0x5022, 0x9d58, 0x021e, 0x0000, - 0x0000, 0x0000, 0x553a, 0xe242, 0x01ff, 0x0000, 0x0000, 0x0000, 0x7e6e, 0xb54d, - 0x01e0, 0x0000, 0x0000, 0x0000, 0xd2d4, 0xa88c, 0x01c1, 0x0000, 0x0000, 0x0000, - 0x75b6, 0xfe6d, 0x01a2, 0x0000, 0x0000, 0x0000, 0x3bb2, 0xf04c, 0x0183, 0x0000, - 0x0000, 0x0000, 0xc2d0, 0xc046, 0x0163, 0x0000, 0x0000, 0x0000, 0x250c, 0xf9d6, - 0x0145, 0x0000, 0x0000, 0x0000, 0xb7b4, 0x8a0d, 0x0126, 0x0000, 0x0000, 0x0000, - 0x1a72, 0xe4f5, 0x0107, 0x0000, 0x0000, 0x0000, 0x825c, 0xa9b8, 0x00e8, 0x0000, - 0x0000, 0x0000, 0x6c90, 0xc9ad, 0x00c6, 0x0000, 0x0000, 0x0000, 0x4d00, 0xd1bb, - 0x00aa, 0x0000, 0x0000, 0x0000, 0xa4a0, 0xee01, 0x0087, 0x0000, 0x0000, 0x0000, - 0x89a8, 0xbe9f, 0x006b, 0x0000, 0x0000, 0x0000, 0x038e, 0xc80c, 0x004d, 0x0000, - 0x0000, 0x0000, 0xfe26, 0x8384, 0x002e, 0x0000, 0x0000, 0x0000, 0xcd90, 0xca57, - 0x000e, 0x0000 -}; - -void MacroAssembler::libm_reduce_pi04l(Register eax, Register ecx, Register edx, Register ebx, Register esi, Register edi, Register ebp, Register esp) { - Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12; - Label B1_13, B1_14, B1_15; - - assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp); - - address zero_none = (address)_zero_none; - address _4onpi_d = (address)__4onpi_d; - address TWO_32H = (address)_TWO_32H; - address pi04_3d = (address)_pi04_3d; - address pi04_5d = (address)_pi04_5d; - address SCALE = (address)_SCALE; - address zeros = (address)_zeros; - address pi04_2d = (address)_pi04_2d; - address TWO_12H = (address)_TWO_12H; - address _4onpi_31l = (address)__4onpi_31l; - - bind(B1_1); - push(ebp); - movl(ebp, esp); - andl(esp, -16); - push(esi); - push(edi); - push(ebx); - subl(esp, 20); - movzwl(ebx, Address(ebp, 16)); - andl(ebx, 32767); - movl(eax, Address(ebp, 20)); - cmpl(ebx, 16413); - movl(esi, Address(ebp, 24)); - movl(Address(esp, 4), eax); - jcc(Assembler::greaterEqual, B1_8); - - bind(B1_2); - fld_x(Address(ebp, 8)); - fld_d(ExternalAddress(_4onpi_d)); //0x6dc9c883UL, 0x3ff45f30UL - fmul(1); - fstp_x(Address(esp, 8)); - movzwl(ecx, Address(esp, 16)); - negl(ecx); - addl(ecx, 30); - movl(eax, Address(esp, 12)); - shrl(eax); - cmpl(Address(esp, 4), 0); - jcc(Assembler::notEqual, B1_4); - - bind(B1_3); - lea(ecx, Address(eax, 1)); - andl(ecx, -2); - jmp(B1_5); - - bind(B1_4); - movl(ecx, eax); - addl(eax, Address(esp, 4)); - movl(edx, eax); - andl(edx, 1); - addl(ecx, edx); - - bind(B1_5); - fld_d(ExternalAddress(TWO_32H)); //0x00000000UL, 0x41f80000UL - cmpl(ebx, 16400); - movl(Address(esp, 0), ecx); - fild_s(Address(esp, 0)); - jcc(Assembler::greaterEqual, B1_7); - - bind(B1_6); - fld_d(ExternalAddress(pi04_3d)); //0x54442d00UL, 0x3fe921fbUL - fmul(1); - fsubp(3); - fxch(1); - fmul(2); - fld_s(2); - fadd(1); - fsubrp(1); - fld_s(0); - fxch(1); - fsuba(3); - fld_d(ExternalAddress(8 + pi04_3d)); //0x98cc5180UL, 0x3ce84698UL - fmul(3); - fsuba(2); - fxch(1); - fsub(2); - fsubrp(1); - faddp(3); - fld_d(ExternalAddress(16 + pi04_3d)); //0xcbb5bf6cUL, 0xb9dfc8f8UL - fmulp(2); - fld_s(1); - fsubr(1); - fsuba(1); - fxch(2); - fsubp(1); - faddp(2); - fxch(1); - jmp(B1_15); - - bind(B1_7); - fld_d(ExternalAddress(pi04_5d)); //0x54400000UL, 0x3fe921fbUL - fmul(1); - fsubp(3); - fxch(1); - fmul(2); - fld_s(2); - fadd(1); - fsubrp(1); - fld_s(0); - fxch(1); - fsuba(3); - fld_d(ExternalAddress(8 + pi04_5d)); //0x1a600000UL, 0x3dc0b461UL - fmul(3); - fsuba(2); - fxch(1); - fsub(2); - fsubrp(1); - faddp(3); - fld_d(ExternalAddress(16 + pi04_5d)); //0x2e000000UL, 0x3b93198aUL - fmul(2); - fld_s(0); - fsubr(2); - fsuba(2); - fxch(1); - fsubp(2); - fxch(1); - faddp(3); - fld_d(ExternalAddress(24 + pi04_5d)); //0x25200000UL, 0x396b839aUL - fmul(2); - fld_s(0); - fsubr(2); - fsuba(2); - fxch(1); - fsubp(2); - fxch(1); - faddp(3); - fld_d(ExternalAddress(32 + pi04_5d)); //0x533e63a0UL, 0x37027044UL - fmulp(2); - fld_s(1); - fsubr(1); - fsuba(1); - fxch(2); - fsubp(1); - faddp(2); - fxch(1); - jmp(B1_15); - - bind(B1_8); - fld_x(Address(ebp, 8)); - addl(ebx, -16417); - fmul_d(as_Address(ExternalAddress(SCALE))); //0x00000000UL, 0x32600000UL - movl(eax, -2078209981); - imull(ebx); - addl(edx, ebx); - movl(ecx, ebx); - sarl(edx, 4); - sarl(ecx, 31); - subl(edx, ecx); - movl(eax, edx); - shll(eax, 5); - fstp_x(Address(ebp, 8)); - fld_x(Address(ebp, 8)); - subl(eax, edx); - movl(Address(ebp, 8), 0); - subl(ebx, eax); - fld_x(Address(ebp, 8)); - cmpl(ebx, 17); - fsuba(1); - jcc(Assembler::less, B1_10); - - bind(B1_9); - lea(eax, Address(noreg, edx, Address::times_8)); - lea(ecx, Address(eax, edx, Address::times_4)); - incl(edx); - fld_x(Address(_4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); - fmul(2); - fld_x(Address(12 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); - fmul(2); - fld_s(0); - fadd(2); - fsuba(2); - fxch(1); - faddp(2); - fld_s(1); - fadd(1); - fstp_x(Address(esp, 8)); - andl(Address(esp, 8), -16777216); - fld_x(Address(esp, 8)); - fsubp(1); - jmp(B1_11); - - bind(B1_10); - fld_d(ExternalAddress(zeros)); //0x00000000UL, 0x00000000UL - fld_s(0); - - bind(B1_11); - fld_s(0); - lea(eax, Address(noreg, edx, Address::times_8)); - fld_s(3); - lea(edx, Address(eax, edx, Address::times_4)); - fld_x(Address(_4onpi_31l, RelocationHolder::none).plus_disp(edx, Address::times_1)); - fmul(6); - movl(Address(esp, 0), edx); - fadda(2); - fxch(2); - fsuba(3); - fxch(2); - faddp(3); - fxch(2); - faddp(3); - fld_x(Address(12 + _4onpi_31l, RelocationHolder::none).plus_disp(edx, Address::times_1)); - fmula(2); - fld_s(2); - fadd(2); - fld_s(0); - fxch(1); - fsubra(3); - fxch(3); - fchs(); - faddp(4); - fxch(3); - faddp(4); - fxch(2); - fadd(3); - fxch(2); - fmul(5); - fadda(2); - fld_s(4); - fld_x(Address(24 + _4onpi_31l, RelocationHolder::none).plus_disp(edx, Address::times_1)); - fmula(1); - fxch(1); - fadda(4); - fxch(4); - fstp_x(Address(esp, 8)); - movzwl(ebx, Address(esp, 16)); - andl(ebx, 32767); - cmpl(ebx, 16415); - jcc(Assembler::greaterEqual, B1_13); - - bind(B1_12); - negl(ebx); - addl(ebx, 30); - movl(ecx, ebx); - movl(eax, Address(esp, 12)); - shrl(eax); - shll(eax); - movl(Address(esp, 12), eax); - movl(Address(esp, 8), 0); - shrl(eax); - jmp(B1_14); - - bind(B1_13); - negl(ebx); - addl(ebx, 30); - movl(ecx, ebx); - movl(edx, Address(esp, 8)); - shrl(edx); - shll(edx); - negl(ecx); - movl(eax, Address(esp, 12)); - shll(eax); - movl(ecx, ebx); - movl(Address(esp, 8), edx); - shrl(edx); - orl(eax, edx); - - bind(B1_14); - fld_x(Address(esp, 8)); - addl(eax, Address(esp, 4)); - fsubp(3); - fmul(6); - fld_s(4); - movl(edx, eax); - andl(edx, 1); - fadd(3); - movl(ecx, Address(esp, 0)); - fsuba(3); - fxch(3); - faddp(5); - fld_s(1); - fxch(3); - fadd_d(Address(zero_none, RelocationHolder::none).plus_disp(edx, Address::times_8)); - fadda(3); - fsub(3); - faddp(2); - fxch(1); - faddp(4); - fld_s(2); - fadd(2); - fsuba(2); - fxch(3); - faddp(2); - fxch(1); - faddp(3); - fld_s(0); - fadd(2); - fsuba(2); - fxch(1); - faddp(2); - fxch(1); - faddp(2); - fld_s(2); - fld_x(Address(36 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); - fmula(1); - fld_s(1); - fadd(3); - fsuba(3); - fxch(2); - faddp(3); - fxch(2); - faddp(3); - fxch(1); - fmul(4); - fld_s(0); - fadd(2); - fsuba(2); - fxch(1); - faddp(2); - fxch(1); - faddp(2); - fld_s(2); - fld_x(Address(48 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); - fmula(1); - fld_s(1); - fadd(3); - fsuba(3); - fxch(2); - faddp(3); - fxch(2); - faddp(3); - fld_s(3); - fxch(2); - fmul(5); - fld_x(Address(60 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); - fmula(3); - fxch(3); - faddp(1); - fld_s(0); - fadd(2); - fsuba(2); - fxch(1); - faddp(2); - fxch(1); - faddp(3); - fld_s(3); - fxch(2); - fmul(5); - fld_x(Address(72 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); - fmula(3); - fxch(3); - faddp(1); - fld_s(0); - fadd(2); - fsuba(2); - fxch(1); - faddp(2); - fxch(1); - faddp(3); - fxch(1); - fmulp(4); - fld_x(Address(84 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); - fmulp(3); - fxch(2); - faddp(3); - fld_s(2); - fadd(2); - fld_d(ExternalAddress(TWO_32H)); //0x00000000UL, 0x41f80000UL - fmul(1); - fadda(1); - fsubp(1); - fsuba(2); - fxch(3); - faddp(2); - faddp(1); - fld_d(ExternalAddress(pi04_2d)); //0x54400000UL, 0x3fe921fbUL - fld_s(0); - fmul(2); - fxch(2); - fadd(3); - fxch(1); - fmulp(3); - fmul_d(as_Address(ExternalAddress(8 + pi04_2d))); //0x1a626331UL, 0x3dc0b461UL - faddp(1); - - bind(B1_15); - fld_d(ExternalAddress(TWO_12H)); //0x00000000UL, 0x40b80000UL - fld_s(2); - fadd(2); - fmula(1); - fstp_x(Address(esp, 8)); - fld_x(Address(esp, 8)); - fadd(1); - fsubrp(1); - fst_d(Address(esi, 0)); - fsubp(2); - faddp(1); - fstp_d(Address(esi, 8)); - addl(esp, 20); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); -} - -ALIGNED_(16) juint _L_2il0floatpacket_0[] = -{ - 0xffffffffUL, 0x7fffffffUL, 0x00000000UL, 0x00000000UL -}; - -ALIGNED_(16) juint _Pi4Inv[] = -{ - 0x6dc9c883UL, 0x3ff45f30UL -}; - -ALIGNED_(16) juint _Pi4x3[] = -{ - 0x54443000UL, 0xbfe921fbUL, 0x3b39a000UL, 0x3d373dcbUL, 0xe0e68948UL, - 0xba845c06UL -}; - -ALIGNED_(16) juint _Pi4x4[] = -{ - 0x54400000UL, 0xbfe921fbUL, 0x1a600000UL, 0xbdc0b461UL, 0x2e000000UL, - 0xbb93198aUL, 0x252049c1UL, 0xb96b839aUL -}; - -ALIGNED_(16) jushort _SP[] = -{ - 0xaaab, 0xaaaa, 0xaaaa, 0xaaaa, 0xbffc, 0x0000, 0x8887, 0x8888, 0x8888, 0x8888, - 0x3ff8, 0x0000, 0xc527, 0x0d00, 0x00d0, 0xd00d, 0xbff2, 0x0000, 0x45f6, 0xb616, - 0x1d2a, 0xb8ef, 0x3fec, 0x0000, 0x825b, 0x3997, 0x2b3f, 0xd732, 0xbfe5, 0x0000, - 0xbf33, 0x8bb4, 0x2fda, 0xb092, 0x3fde, 0x0000, 0x44a6, 0xed1a, 0x29ef, 0xd73e, - 0xbfd6, 0x0000, 0x8610, 0x307f, 0x62a1, 0xc921, 0x3fce, 0x0000 -}; - -ALIGNED_(16) jushort _CP[] = -{ - 0x0000, 0x0000, 0x0000, 0x8000, 0xbffe, 0x0000, 0xaaa5, 0xaaaa, 0xaaaa, 0xaaaa, - 0x3ffa, 0x0000, 0x9c2f, 0x0b60, 0x60b6, 0xb60b, 0xbff5, 0x0000, 0xf024, 0x0cac, - 0x00d0, 0xd00d, 0x3fef, 0x0000, 0x03fe, 0x3f65, 0x7dbb, 0x93f2, 0xbfe9, 0x0000, - 0xd84d, 0xadee, 0xc698, 0x8f76, 0x3fe2, 0x0000, 0xdaba, 0xfe79, 0xea36, 0xc9c9, - 0xbfda, 0x0000, 0x3ac6, 0x0ba0, 0x07ce, 0xd585, 0x3fd2, 0x0000 -}; - -ALIGNED_(16) juint _ones[] = -{ - 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xbff00000UL -}; - -void MacroAssembler::libm_sincos_huge(XMMRegister xmm0, XMMRegister xmm1, Register eax, Register ecx, Register edx, Register ebx, Register esi, Register edi, Register ebp, Register esp) { - Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12; - Label B1_13, B1_14, B1_15, B1_16, B1_17, B1_18, B1_19, B1_20, B1_21, B1_22, B1_23; - Label B1_24, B1_25, B1_26, B1_27, B1_28, B1_29, B1_30, B1_31, B1_32, B1_33, B1_34; - Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_44, B1_45, B1_46; - - assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp); - - address L_2il0floatpacket_0 = (address)_L_2il0floatpacket_0; - address Pi4Inv = (address)_Pi4Inv; - address Pi4x3 = (address)_Pi4x3; - address Pi4x4 = (address)_Pi4x4; - address ones = (address)_ones; - address CP = (address)_CP; - address SP = (address)_SP; - - bind(B1_1); - push(ebp); - movl(ebp, esp); - andl(esp, -64); - push(esi); - push(edi); - push(ebx); - subl(esp, 52); - movl(eax, Address(ebp, 16)); - movl(edx, Address(ebp, 20)); - movl(Address(esp, 32), eax); - movl(Address(esp, 36), edx); - - bind(B1_2); - fnstcw(Address(esp, 30)); - - bind(B1_3); - movsd(xmm1, Address(ebp, 8)); - movl(esi, Address(ebp, 12)); - movl(eax, esi); - andl(eax, 2147483647); - andps(xmm1, ExternalAddress(L_2il0floatpacket_0)); //0xffffffffUL, 0x7fffffffUL, 0x00000000UL, 0x00000000UL - shrl(esi, 31); - movl(Address(esp, 40), eax); - cmpl(eax, 1104150528); - movsd(Address(ebp, 8), xmm1); - jcc(Assembler::aboveEqual, B1_11); - - bind(B1_4); - movsd(xmm0, ExternalAddress(Pi4Inv)); //0x6dc9c883UL, 0x3ff45f30UL - mulsd(xmm0, xmm1); - movzwl(edx, Address(esp, 30)); - movl(eax, edx); - andl(eax, 768); - movsd(Address(esp, 0), xmm0); - cmpl(eax, 768); - jcc(Assembler::equal, B1_42); - - bind(B1_5); - orl(edx, -64768); - movw(Address(esp, 28), edx); - - bind(B1_6); - fldcw(Address(esp, 28)); - - bind(B1_7); - movsd(xmm1, Address(ebp, 8)); - movl(ebx, 1); - - bind(B1_8); - movl(Address(esp, 12), ebx); - movl(ebx, Address(esp, 4)); - movl(eax, ebx); - movl(Address(esp, 8), esi); - movl(esi, ebx); - shrl(esi, 20); - andl(eax, 1048575); - movl(ecx, esi); - orl(eax, 1048576); - negl(ecx); - movl(edx, eax); - addl(ecx, 19); - addl(esi, 13); - movl(Address(esp, 24), ecx); - shrl(edx); - movl(ecx, esi); - shll(eax); - movl(ecx, Address(esp, 24)); - movl(esi, Address(esp, 0)); - shrl(esi); - orl(eax, esi); - cmpl(ebx, 1094713344); - movsd(Address(esp, 16), xmm1); - fld_d(Address(esp, 16)); - cmov32(Assembler::below, eax, edx); - movl(esi, Address(esp, 8)); - lea(edx, Address(eax, 1)); - movl(ebx, edx); - andl(ebx, -2); - movl(Address(esp, 16), ebx); - fild_s(Address(esp, 16)); - movl(ebx, Address(esp, 12)); - cmpl(Address(esp, 40), 1094713344); - jcc(Assembler::aboveEqual, B1_10); - - bind(B1_9); - fld_d(ExternalAddress(Pi4x3)); //0x54443000UL, 0xbfe921fbUL - fmul(1); - faddp(2); - fld_d(ExternalAddress(8 + Pi4x3)); //0x3b39a000UL, 0x3d373dcbUL - fmul(1); - faddp(2); - fld_d(ExternalAddress(16 + Pi4x3)); //0xe0e68948UL, 0xba845c06UL - fmulp(1); - faddp(1); - jmp(B1_17); - - bind(B1_10); - fld_d(ExternalAddress(Pi4x4)); //0x54400000UL, 0xbfe921fbUL - fmul(1); - faddp(2); - fld_d(ExternalAddress(8 + Pi4x4)); //0x1a600000UL, 0xbdc0b461UL - fmul(1); - faddp(2); - fld_d(ExternalAddress(16 + Pi4x4)); //0x2e000000UL, 0xbb93198aUL - fmul(1); - faddp(2); - fld_d(ExternalAddress(24 + Pi4x4)); //0x252049c1UL, 0xb96b839aUL - fmulp(1); - faddp(1); - jmp(B1_17); - - bind(B1_11); - movzwl(edx, Address(esp, 30)); - movl(eax, edx); - andl(eax, 768); - cmpl(eax, 768); - jcc(Assembler::equal, B1_43); - bind(B1_12); - orl(edx, -64768); - movw(Address(esp, 28), edx); - - bind(B1_13); - fldcw(Address(esp, 28)); - - bind(B1_14); - movsd(xmm1, Address(ebp, 8)); - movl(ebx, 1); - - bind(B1_15); - movsd(Address(esp, 16), xmm1); - fld_d(Address(esp, 16)); - addl(esp, -32); - lea(eax, Address(esp, 32)); - fstp_x(Address(esp, 0)); - movl(Address(esp, 12), 0); - movl(Address(esp, 16), eax); - call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_reduce_pi04l()))); - - bind(B1_46); - addl(esp, 32); - - bind(B1_16); - fld_d(Address(esp, 0)); - lea(edx, Address(eax, 1)); - fld_d(Address(esp, 8)); - faddp(1); - - bind(B1_17); - movl(ecx, edx); - addl(eax, 3); - shrl(ecx, 2); - andl(ecx, 1); - shrl(eax, 2); - xorl(esi, ecx); - movl(ecx, Address(esp, 36)); - andl(eax, 1); - andl(ecx, 3); - cmpl(ecx, 3); - jcc(Assembler::notEqual, B1_25); - - bind(B1_18); - fld_x(ExternalAddress(84 + SP)); //0x8610, 0x307f, 0x62 - fld_s(1); - fmul((2)); - testb(edx, 2); - fmula((1)); - fld_x(ExternalAddress(72 + SP)); //0x44a6, 0xed1a, 0x29 - faddp(2); - fmula(1); - fld_x(ExternalAddress(60 + SP)); //0xbf33, 0x8bb4, 0x2f - faddp(2); - fmula(1); - fld_x(ExternalAddress(48 + SP)); //0x825b, 0x3997, 0x2b - faddp(2); - fmula(1); - fld_x(ExternalAddress(36 + SP)); //0x45f6, 0xb616, 0x1d - faddp(2); - fmula(1); - fld_x(ExternalAddress(24 + SP)); //0xc527, 0x0d00, 0x00 - faddp(2); - fmula(1); - fld_x(ExternalAddress(12 + SP)); //0x8887, 0x8888, 0x88 - faddp(2); - fmula(1); - fld_x(ExternalAddress(SP)); //0xaaab, 0xaaaa, 0xaa - faddp(2); - fmula(1); - fld_x(ExternalAddress(84 + CP)); //0x3ac6, 0x0ba0, 0x07 - fmul(1); - fld_x(ExternalAddress(72 + CP)); //0xdaba, 0xfe79, 0xea - faddp(1); - fmul(1); - fld_x(ExternalAddress(62 + CP)); //0xd84d, 0xadee, 0xc6 - faddp(1); - fmul(1); - fld_x(ExternalAddress(48 + CP)); //0x03fe, 0x3f65, 0x7d - faddp(1); - fmul(1); - fld_x(ExternalAddress(36 + CP)); //0xf024, 0x0cac, 0x00 - faddp(1); - fmul(1); - fld_x(ExternalAddress(24 + CP)); //0x9c2f, 0x0b60, 0x60 - faddp(1); - fmul(1); - fld_x(ExternalAddress(12 + CP)); //0xaaa5, 0xaaaa, 0xaa - faddp(1); - fmul(1); - fld_x(ExternalAddress(CP)); //0x0000, 0x0000, 0x00 - faddp(1); - fmulp(1); - fld_d(Address(ones, RelocationHolder::none).plus_disp(esi, Address::times_8)); - fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); - jcc(Assembler::equal, B1_22); - - bind(B1_19); - fmulp(4); - testl(ebx, ebx); - fxch(2); - fmul(3); - movl(eax, Address(esp, 2)); - faddp(3); - fxch(2); - fstp_d(Address(eax, 0)); - fmula(1); - faddp(1); - fstp_d(Address(eax, 8)); - jcc(Assembler::equal, B1_21); - - bind(B1_20); - fldcw(Address(esp, 30)); - - bind(B1_21); - addl(esp, 52); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); - - bind(B1_22); - fxch(1); - fmulp(4); - testl(ebx, ebx); - fxch(2); - fmul(3); - movl(eax, Address(esp, 32)); - faddp(3); - fxch(2); - fstp_d(Address(eax, 8)); - fmula(1); - faddp(1); - fstp_d(Address(eax, 0)); - jcc(Assembler::equal, B1_24); - - bind(B1_23); - fldcw(Address(esp, 30)); - - bind(B1_24); - addl(esp, 52); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); - - bind(B1_25); - testb(Address(esp, 36), 2); - jcc(Assembler::equal, B1_33); - - bind(B1_26); - fld_s(0); - testb(edx, 2); - fmul(1); - fld_s(0); - fmul(1); - jcc(Assembler::equal, B1_30); - - bind(B1_27); - fstp_d(2); - fld_x(ExternalAddress(84 + CP)); //0x3ac6, 0x0ba0, 0x07 - testl(ebx, ebx); - fmul(2); - fld_x(ExternalAddress(72 + CP)); //0xdaba, 0xfe79, 0xea - fmul(3); - fld_x(ExternalAddress(60 + CP)); //0xd84d, 0xadee, 0xc6 - movl(eax, Address(rsp, 32)); - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(48 + CP)); //0x03fe, 0x3f65, 0x7d - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(36 + CP)); //0xf024, 0x0cac, 0x00 - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(24 + CP)); //0x9c2f, 0x0b60, 0x60 - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(12 + CP)); //0xaaa5, 0xaaaa, 0xaa - faddp(2); - fxch(1); - fmulp(3); - fld_x(ExternalAddress(CP)); //0x0000, 0x0000, 0x00 - faddp(1); - fmulp(1); - faddp(1); - fld_d(Address(ones, RelocationHolder::none).plus_disp(rsi, Address::times_8)); - fmula(1); - faddp(1); - fstp_d(Address(eax, 8)); - jcc(Assembler::equal, B1_29); - - bind(B1_28); - fldcw(Address(esp, 30)); - - bind(B1_29); - addl(esp, 52); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); - - bind(B1_30); - fld_x(ExternalAddress(84 + SP)); //0x8610, 0x307f, 0x62 - testl(ebx, ebx); - fmul(1); - fld_x(ExternalAddress(72 + SP)); //0x44a6, 0xed1a, 0x29 - fmul(2); - fld_x(ExternalAddress(60 + SP)); //0xbf33, 0x8bb4, 0x2f - movl(eax, Address(rsp, 32)); - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(48 + SP)); //0x825b, 0x3997, 0x2b - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(36 + SP)); //0x45f6, 0xb616, 0x1d - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(24 + SP)); //0xc527, 0x0d00, 0x00 - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(12 + SP)); //0x8887, 0x8888, 0x88 - faddp(2); - fxch(1); - fmulp(2); - fld_x(ExternalAddress(SP)); //0xaaab, 0xaaaa, 0xaa - faddp(1); - fmulp(2); - faddp(1); - fld_d(Address(ones, RelocationHolder::none).plus_disp(rsi, Address::times_8)); - fmulp(2); - fmul(1); - faddp(1); - fstp_d(Address(eax, 8)); - jcc(Assembler::equal, B1_32); - - bind(B1_31); - fldcw(Address(esp, 30)); - - bind(B1_32); - addl(esp, 52); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); - - bind(B1_33); - testb(Address(esp, 36), 1); - jcc(Assembler::equal, B1_41); - - bind(B1_34); - fld_s(0); - testb(edx, 2); - fmul(1); - fld_s(0); - fmul(1); - jcc(Assembler::equal, B1_38); - - bind(B1_35); - fld_x(ExternalAddress(84 + SP)); //0x8610, 0x307f, 0x62 - testl(ebx, ebx); - fmul(1); - fld_x(ExternalAddress(72 + SP)); //0x44a6, 0xed1a, 0x29 - fmul(2); - fld_x(ExternalAddress(60 + SP)); //0xbf33, 0x8bb4, 0x2f - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(48 + SP)); //0x825b, 0x3997, 0x2b - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(36 + SP)); //0x45f6, 0xb616, 0x1d - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(24 + SP)); //0xc527, 0x0d00, 0x00 - faddp(2); - fxch(1); - fmul(2); - fld_x(ExternalAddress(12 + SP)); //0x8887, 0x8888, 0x88 - faddp(2); - fxch(1); - fmulp(2); - fld_x(ExternalAddress(SP)); //0xaaab, 0xaaaa, 0xaa - faddp(1); - fmulp(2); - faddp(1); - fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); - fmulp(2); - fmul(1); - movl(eax, Address(esp, 32)); - faddp(1); - fstp_d(Address(eax, 0)); - jcc(Assembler::equal, B1_37); - - bind(B1_36); - fldcw(Address(esp, 30)); - - bind(B1_37); - addl(esp, 52); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); - - bind(B1_38); - fstp_d(2); - fld_x(ExternalAddress(84 + CP)); //0x3ac6, 0x0ba0, 0x07 - testl(ebx, ebx); - fmul(2); - fld_x(ExternalAddress(72 + CP)); //0xdaba, 0xfe79, 0xea - fmul(3); - fld_x(ExternalAddress(60 + CP)); //0xd84d, 0xadee, 0xc6 - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(48 + CP)); //0x03fe, 0x3f65, 0x7d - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(36 + CP)); //0xf024, 0x0cac, 0x00 - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(24 + CP)); //0x9c2f, 0x0b60, 0x60 - faddp(2); - fxch(1); - fmul(3); - fld_x(ExternalAddress(12 + CP)); //0xaaa5, 0xaaaa, 0xaa - faddp(2); - fxch(1); - fmulp(3); - fld_x(ExternalAddress(CP)); //0x0000, 0x0000, 0x00 - faddp(1); - fmulp(1); - faddp(1); - fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); - fmula(1); - movl(eax, Address(esp, 32)); - faddp(1); - fstp_d(Address(eax, 0)); - jcc(Assembler::equal, B1_40); - - bind(B1_39); - fldcw(Address(esp, 30)); - bind(B1_40); - addl(esp, 52); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); - bind(B1_41); - fstp_d(0); - addl(esp, 52); - pop(ebx); - pop(edi); - pop(esi); - movl(esp, ebp); - pop(ebp); - ret(0); - bind(B1_42); - xorl(ebx, ebx); - jmp(B1_8); - bind(B1_43); - xorl(ebx, ebx); - jmp(B1_15); -} - -ALIGNED_(16) juint _static_const_table_sin[] = -{ - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, 0xbf73b92eUL, - 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, - 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, - 0xc0000000UL, 0xbc626d19UL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, - 0xbfa60beaUL, 0x2ed59f06UL, 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, - 0x00000000UL, 0x3ff00000UL, 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, - 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, 0x00000000UL, 0x3ff00000UL, - 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, 0x20000000UL, - 0x3c5e0d89UL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, 0xbfc59267UL, - 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, - 0x3ff00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, - 0x20000000UL, 0x3c68076aUL, 0x00000000UL, 0x3ff00000UL, 0x99fcef32UL, - 0x3fca8279UL, 0x667f3bcdUL, 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, - 0x00000000UL, 0x3fe00000UL, 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, - 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, 0x00000000UL, 0x3fe00000UL, - 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, 0xe0000000UL, - 0x3c39f630UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, 0xbf9d4a2cUL, - 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, - 0x3fe00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0x3fed906bUL, - 0x20000000UL, 0x3c7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x76acf82dUL, - 0x3fa4a031UL, 0x56c62ddaUL, 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, - 0x00000000UL, 0x3fd00000UL, 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, - 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, 0x00000000UL, 0x3fd00000UL, - 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, 0x40000000UL, - 0xbc887df6UL, 0x00000000UL, 0x3fc00000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, - 0x40000000UL, 0xbc887df6UL, 0x00000000UL, 0xbfc00000UL, 0x0e5967d5UL, - 0x3fac1d1fUL, 0xcff75cb0UL, 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, - 0x00000000UL, 0xbfd00000UL, 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, - 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, 0x00000000UL, 0xbfd00000UL, - 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, 0x3fed906bUL, 0x20000000UL, - 0x3c7457e6UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, 0x3f9d4a2cUL, - 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, - 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, - 0xe0000000UL, 0x3c39f630UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, - 0xbfc133ccUL, 0x6b151741UL, 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, - 0x00000000UL, 0xbfe00000UL, 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, - 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, 0x00000000UL, 0xbfe00000UL, - 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, 0x20000000UL, - 0x3c68076aUL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, 0x3fc59267UL, - 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, - 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, - 0x20000000UL, 0x3c5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, - 0x3fb37ca1UL, 0xa6aea963UL, 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, - 0x00000000UL, 0xbff00000UL, 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, - 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, 0x00000000UL, 0xbff00000UL, - 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, 0xc0000000UL, - 0xbc626d19UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, 0x3f73b92eUL, - 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, - 0xbff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, - 0x3f73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, - 0x00000000UL, 0xbff00000UL, 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, - 0xbfc8f8b8UL, 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0xbff00000UL, - 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, - 0x3c75d28dUL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, 0x3fb37ca1UL, - 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, 0x3c672cedUL, 0x00000000UL, - 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0xbfde2b5dUL, - 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, - 0x3fc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, - 0x00000000UL, 0xbff00000UL, 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, - 0xbfe44cf3UL, 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0xbff00000UL, - 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, - 0x3c8bdd34UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, 0xbfc133ccUL, - 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, 0x3c82c5e1UL, 0x00000000UL, - 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0xbfea9b66UL, - 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, - 0x3f9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, - 0x00000000UL, 0xbfe00000UL, 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, - 0xbfed906bUL, 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0xbfe00000UL, - 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, - 0xbc8760b1UL, 0x00000000UL, 0xbfd00000UL, 0x0e5967d5UL, 0x3fac1d1fUL, - 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, 0xbc756217UL, 0x00000000UL, - 0xbfd00000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0xbfefd88dUL, - 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0xbfc00000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, - 0xbfefd88dUL, 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0x3fc00000UL, - 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, - 0xbc756217UL, 0x00000000UL, 0x3fd00000UL, 0x76acf82dUL, 0x3fa4a031UL, - 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, 0xbc8760b1UL, 0x00000000UL, - 0x3fd00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0xbfed906bUL, - 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, - 0xbf9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, - 0x00000000UL, 0x3fe00000UL, 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, - 0xbfea9b66UL, 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0x3fe00000UL, - 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, - 0x3c82c5e1UL, 0x00000000UL, 0x3fe00000UL, 0x99fcef32UL, 0x3fca8279UL, - 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, 0x3c8bdd34UL, 0x00000000UL, - 0x3fe00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0xbfe44cf3UL, - 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, - 0xbfc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, - 0x00000000UL, 0x3ff00000UL, 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, - 0xbfde2b5dUL, 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0x3ff00000UL, - 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, - 0x3c672cedUL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, 0xbfa60beaUL, - 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, 0x3c75d28dUL, 0x00000000UL, - 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0xbfc8f8b8UL, - 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, - 0xbf73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, - 0x00000000UL, 0x3ff00000UL, 0x55555555UL, 0xbfc55555UL, 0x00000000UL, - 0xbfe00000UL, 0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL, - 0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL, 0xa556c734UL, - 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL, 0x1a600000UL, 0x3d90b461UL, - 0x1a600000UL, 0x3d90b461UL, 0x54400000UL, 0x3fb921fbUL, 0x00000000UL, - 0x00000000UL, 0x2e037073UL, 0x3b63198aUL, 0x00000000UL, 0x00000000UL, - 0x6dc9c883UL, 0x40245f30UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x43380000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x43600000UL, - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x3c800000UL, 0x00000000UL, - 0x00000000UL, 0xffffffffUL, 0x3fefffffUL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x80000000UL, 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x3fe00000UL, - 0x00000000UL, 0x3fe00000UL -}; - -void MacroAssembler::fast_sin(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ebx, Register edx) { - - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, start; - assert_different_registers(eax, ebx, edx); - address static_const_table_sin = (address)_static_const_table_sin; - - bind(start); - subl(rsp, 120); - movl(Address(rsp, 56), ebx); - lea(ebx, ExternalAddress(static_const_table_sin)); - movsd(xmm0, Address(rsp, 128)); - pextrw(eax, xmm0, 3); - andl(eax, 32767); - subl(eax, 12336); - cmpl(eax, 4293); - jcc(Assembler::above, L_2TAG_PACKET_0_0_2); - movsd(xmm1, Address(ebx, 2160)); - mulsd(xmm1, xmm0); - movsd(xmm5, Address(ebx, 2272)); - movdqu(xmm4, Address(ebx, 2256)); - pand(xmm4, xmm0); - por(xmm5, xmm4); - movsd(xmm3, Address(ebx, 2128)); - movdqu(xmm2, Address(ebx, 2112)); - addpd(xmm1, xmm5); - cvttsd2sil(edx, xmm1); - cvtsi2sdl(xmm1, edx); - mulsd(xmm3, xmm1); - unpcklpd(xmm1, xmm1); - addl(edx, 1865216); - movdqu(xmm4, xmm0); - andl(edx, 63); - movdqu(xmm5, Address(ebx, 2096)); - lea(eax, Address(ebx, 0)); - shll(edx, 5); - addl(eax, edx); - mulpd(xmm2, xmm1); - subsd(xmm0, xmm3); - mulsd(xmm1, Address(ebx, 2144)); - subsd(xmm4, xmm3); - movsd(xmm7, Address(eax, 8)); - unpcklpd(xmm0, xmm0); - movapd(xmm3, xmm4); - subsd(xmm4, xmm2); - mulpd(xmm5, xmm0); - subpd(xmm0, xmm2); - movdqu(xmm6, Address(ebx, 2064)); - mulsd(xmm7, xmm4); - subsd(xmm3, xmm4); - mulpd(xmm5, xmm0); - mulpd(xmm0, xmm0); - subsd(xmm3, xmm2); - movdqu(xmm2, Address(eax, 0)); - subsd(xmm1, xmm3); - movsd(xmm3, Address(eax, 24)); - addsd(xmm2, xmm3); - subsd(xmm7, xmm2); - mulsd(xmm2, xmm4); - mulpd(xmm6, xmm0); - mulsd(xmm3, xmm4); - mulpd(xmm2, xmm0); - mulpd(xmm0, xmm0); - addpd(xmm5, Address(ebx, 2080)); - mulsd(xmm4, Address(eax, 0)); - addpd(xmm6, Address(ebx, 2048)); - mulpd(xmm5, xmm0); - movapd(xmm0, xmm3); - addsd(xmm3, Address(eax, 8)); - mulpd(xmm1, xmm7); - movapd(xmm7, xmm4); - addsd(xmm4, xmm3); - addpd(xmm6, xmm5); - movsd(xmm5, Address(eax, 8)); - subsd(xmm5, xmm3); - subsd(xmm3, xmm4); - addsd(xmm1, Address(eax, 16)); - mulpd(xmm6, xmm2); - addsd(xmm5, xmm0); - addsd(xmm3, xmm7); - addsd(xmm1, xmm5); - addsd(xmm1, xmm3); - addsd(xmm1, xmm6); - unpckhpd(xmm6, xmm6); - addsd(xmm1, xmm6); - addsd(xmm4, xmm1); - movsd(Address(rsp, 0), xmm4); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_0_0_2); - jcc(Assembler::greater, L_2TAG_PACKET_2_0_2); - shrl(eax, 4); - cmpl(eax, 268434685); - jcc(Assembler::notEqual, L_2TAG_PACKET_3_0_2); - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_3_0_2); - movsd(xmm3, Address(ebx, 2192)); - mulsd(xmm3, xmm0); - subsd(xmm3, xmm0); - mulsd(xmm3, Address(ebx, 2208)); - movsd(Address(rsp, 0), xmm0); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_2_0_2); - movl(eax, Address(rsp, 132)); - andl(eax, 2146435072); - cmpl(eax, 2146435072); - jcc(Assembler::equal, L_2TAG_PACKET_4_0_2); - subl(rsp, 32); - movsd(Address(rsp, 0), xmm0); - lea(eax, Address(rsp, 40)); - movl(Address(rsp, 8), eax); - movl(eax, 2); - movl(Address(rsp, 12), eax); - call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_sin_cos_huge()))); - addl(rsp, 32); - fld_d(Address(rsp, 16)); - jmp(L_2TAG_PACKET_1_0_2); - bind(L_2TAG_PACKET_4_0_2); - fld_d(Address(rsp, 128)); - fmul_d(Address(ebx, 2240)); - bind(L_2TAG_PACKET_1_0_2); - movl(ebx, Address(rsp, 56)); -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - COS() -// --------------------- -// -// 1. RANGE REDUCTION -// -// We perform an initial range reduction from X to r with -// -// X =~= N * pi/32 + r -// -// so that |r| <= pi/64 + epsilon. We restrict inputs to those -// where |N| <= 932560. Beyond this, the range reduction is -// insufficiently accurate. For extremely small inputs, -// denormalization can occur internally, impacting performance. -// This means that the main path is actually only taken for -// 2^-252 <= |X| < 90112. -// -// To avoid branches, we perform the range reduction to full -// accuracy each time. -// -// X - N * (P_1 + P_2 + P_3) -// -// where P_1 and P_2 are 32-bit numbers (so multiplication by N -// is exact) and P_3 is a 53-bit number. Together, these -// approximate pi well enough for all cases in the restricted -// range. -// -// The main reduction sequence is: -// -// y = 32/pi * x -// N = integer(y) -// (computed by adding and subtracting off SHIFTER) -// -// m_1 = N * P_1 -// m_2 = N * P_2 -// r_1 = x - m_1 -// r = r_1 - m_2 -// (this r can be used for most of the calculation) -// -// c_1 = r_1 - r -// m_3 = N * P_3 -// c_2 = c_1 - m_2 -// c = c_2 - m_3 -// -// 2. MAIN ALGORITHM -// -// The algorithm uses a table lookup based on B = M * pi / 32 -// where M = N mod 64. The stored values are: -// sigma closest power of 2 to cos(B) -// C_hl 53-bit cos(B) - sigma -// S_hi + S_lo 2 * 53-bit sin(B) -// -// The computation is organized as follows: -// -// sin(B + r + c) = [sin(B) + sigma * r] + -// r * (cos(B) - sigma) + -// sin(B) * [cos(r + c) - 1] + -// cos(B) * [sin(r + c) - r] -// -// which is approximately: -// -// [S_hi + sigma * r] + -// C_hl * r + -// S_lo + S_hi * [(cos(r) - 1) - r * c] + -// (C_hl + sigma) * [(sin(r) - r) + c] -// -// and this is what is actually computed. We separate this sum -// into four parts: -// -// hi + med + pols + corr -// -// where -// -// hi = S_hi + sigma r -// med = C_hl * r -// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r) -// corr = S_lo + c * ((C_hl + sigma) - S_hi * r) -// -// 3. POLYNOMIAL -// -// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) * -// (sin(r) - r) can be rearranged freely, since it is quite -// small, so we exploit parallelism to the fullest. -// -// psc4 = SC_4 * r_1 -// msc4 = psc4 * r -// r2 = r * r -// msc2 = SC_2 * r2 -// r4 = r2 * r2 -// psc3 = SC_3 + msc4 -// psc1 = SC_1 + msc2 -// msc3 = r4 * psc3 -// sincospols = psc1 + msc3 -// pols = sincospols * -// -// -// 4. CORRECTION TERM -// -// This is where the "c" component of the range reduction is -// taken into account; recall that just "r" is used for most of -// the calculation. -// -// -c = m_3 - c_2 -// -d = S_hi * r - (C_hl + sigma) -// corr = -c * -d + S_lo -// -// 5. COMPENSATED SUMMATIONS -// -// The two successive compensated summations add up the high -// and medium parts, leaving just the low parts to add up at -// the end. -// -// rs = sigma * r -// res_int = S_hi + rs -// k_0 = S_hi - res_int -// k_2 = k_0 + rs -// med = C_hl * r -// res_hi = res_int + med -// k_1 = res_int - res_hi -// k_3 = k_1 + med -// -// 6. FINAL SUMMATION -// -// We now add up all the small parts: -// -// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3 -// -// Now the overall result is just: -// -// res_hi + res_lo -// -// 7. SMALL ARGUMENTS -// -// Inputs with |X| < 2^-252 are treated specially as -// 1 - |x|. -// -// Special cases: -// cos(NaN) = quiet NaN, and raise invalid exception -// cos(INF) = NaN and raise invalid exception -// cos(0) = 1 -// -/******************************************************************************/ - -ALIGNED_(16) juint _static_const_table_cos[] = -{ - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, 0xbf73b92eUL, - 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, - 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, - 0xc0000000UL, 0xbc626d19UL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, - 0xbfa60beaUL, 0x2ed59f06UL, 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, - 0x00000000UL, 0x3ff00000UL, 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, - 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, 0x00000000UL, 0x3ff00000UL, - 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, 0x20000000UL, - 0x3c5e0d89UL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, 0xbfc59267UL, - 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, - 0x3ff00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, - 0x20000000UL, 0x3c68076aUL, 0x00000000UL, 0x3ff00000UL, 0x99fcef32UL, - 0x3fca8279UL, 0x667f3bcdUL, 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, - 0x00000000UL, 0x3fe00000UL, 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, - 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, 0x00000000UL, 0x3fe00000UL, - 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, 0xe0000000UL, - 0x3c39f630UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, 0xbf9d4a2cUL, - 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, - 0x3fe00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0x3fed906bUL, - 0x20000000UL, 0x3c7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x76acf82dUL, - 0x3fa4a031UL, 0x56c62ddaUL, 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, - 0x00000000UL, 0x3fd00000UL, 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, - 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, 0x00000000UL, 0x3fd00000UL, - 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, 0x40000000UL, - 0xbc887df6UL, 0x00000000UL, 0x3fc00000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, - 0x40000000UL, 0xbc887df6UL, 0x00000000UL, 0xbfc00000UL, 0x0e5967d5UL, - 0x3fac1d1fUL, 0xcff75cb0UL, 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, - 0x00000000UL, 0xbfd00000UL, 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, - 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, 0x00000000UL, 0xbfd00000UL, - 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, 0x3fed906bUL, 0x20000000UL, - 0x3c7457e6UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, 0x3f9d4a2cUL, - 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, - 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, - 0xe0000000UL, 0x3c39f630UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, - 0xbfc133ccUL, 0x6b151741UL, 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, - 0x00000000UL, 0xbfe00000UL, 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, - 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, 0x00000000UL, 0xbfe00000UL, - 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, 0x20000000UL, - 0x3c68076aUL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, 0x3fc59267UL, - 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, - 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, - 0x20000000UL, 0x3c5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, - 0x3fb37ca1UL, 0xa6aea963UL, 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, - 0x00000000UL, 0xbff00000UL, 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, - 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, 0x00000000UL, 0xbff00000UL, - 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, 0xc0000000UL, - 0xbc626d19UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, 0x3f73b92eUL, - 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, - 0xbff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, - 0x3f73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, - 0x00000000UL, 0xbff00000UL, 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, - 0xbfc8f8b8UL, 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0xbff00000UL, - 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, - 0x3c75d28dUL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, 0x3fb37ca1UL, - 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, 0x3c672cedUL, 0x00000000UL, - 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0xbfde2b5dUL, - 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, - 0x3fc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, - 0x00000000UL, 0xbff00000UL, 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, - 0xbfe44cf3UL, 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0xbff00000UL, - 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, - 0x3c8bdd34UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, 0xbfc133ccUL, - 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, 0x3c82c5e1UL, 0x00000000UL, - 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0xbfea9b66UL, - 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, - 0x3f9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, - 0x00000000UL, 0xbfe00000UL, 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, - 0xbfed906bUL, 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0xbfe00000UL, - 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, - 0xbc8760b1UL, 0x00000000UL, 0xbfd00000UL, 0x0e5967d5UL, 0x3fac1d1fUL, - 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, 0xbc756217UL, 0x00000000UL, - 0xbfd00000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0xbfefd88dUL, - 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0xbfc00000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, - 0xbfefd88dUL, 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0x3fc00000UL, - 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, - 0xbc756217UL, 0x00000000UL, 0x3fd00000UL, 0x76acf82dUL, 0x3fa4a031UL, - 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, 0xbc8760b1UL, 0x00000000UL, - 0x3fd00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0xbfed906bUL, - 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, - 0xbf9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, - 0x00000000UL, 0x3fe00000UL, 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, - 0xbfea9b66UL, 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0x3fe00000UL, - 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, - 0x3c82c5e1UL, 0x00000000UL, 0x3fe00000UL, 0x99fcef32UL, 0x3fca8279UL, - 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, 0x3c8bdd34UL, 0x00000000UL, - 0x3fe00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0xbfe44cf3UL, - 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, - 0xbfc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, - 0x00000000UL, 0x3ff00000UL, 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, - 0xbfde2b5dUL, 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0x3ff00000UL, - 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, - 0x3c672cedUL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, 0xbfa60beaUL, - 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, 0x3c75d28dUL, 0x00000000UL, - 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0xbfc8f8b8UL, - 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, - 0xbf73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, - 0x00000000UL, 0x3ff00000UL, 0x55555555UL, 0xbfc55555UL, 0x00000000UL, - 0xbfe00000UL, 0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL, - 0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL, 0xa556c734UL, - 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL, 0x1a600000UL, 0x3d90b461UL, - 0x1a600000UL, 0x3d90b461UL, 0x54400000UL, 0x3fb921fbUL, 0x00000000UL, - 0x00000000UL, 0x2e037073UL, 0x3b63198aUL, 0x00000000UL, 0x00000000UL, - 0x6dc9c883UL, 0x40245f30UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x43380000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x3ff00000UL, - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x80000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL -}; - -//registers, -// input: (rbp + 8) -// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 -// rax, rdx, rcx, rbx (tmp) - -// Code generated by Intel C compiler for LIBM library - -void MacroAssembler::fast_cos(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; - - assert_different_registers(tmp, eax, ecx, edx); - - address static_const_table_cos = (address)_static_const_table_cos; - - bind(start); - subl(rsp, 120); - movl(Address(rsp, 56), tmp); - lea(tmp, ExternalAddress(static_const_table_cos)); - movsd(xmm0, Address(rsp, 128)); - pextrw(eax, xmm0, 3); - andl(eax, 32767); - subl(eax, 12336); - cmpl(eax, 4293); - jcc(Assembler::above, L_2TAG_PACKET_0_0_2); - movsd(xmm1, Address(tmp, 2160)); - mulsd(xmm1, xmm0); - movdqu(xmm5, Address(tmp, 2240)); - movsd(xmm4, Address(tmp, 2224)); - pand(xmm4, xmm0); - por(xmm5, xmm4); - movsd(xmm3, Address(tmp, 2128)); - movdqu(xmm2, Address(tmp, 2112)); - addpd(xmm1, xmm5); - cvttsd2sil(edx, xmm1); - cvtsi2sdl(xmm1, edx); - mulsd(xmm3, xmm1); - unpcklpd(xmm1, xmm1); - addl(edx, 1865232); - movdqu(xmm4, xmm0); - andl(edx, 63); - movdqu(xmm5, Address(tmp, 2096)); - lea(eax, Address(tmp, 0)); - shll(edx, 5); - addl(eax, edx); - mulpd(xmm2, xmm1); - subsd(xmm0, xmm3); - mulsd(xmm1, Address(tmp, 2144)); - subsd(xmm4, xmm3); - movsd(xmm7, Address(eax, 8)); - unpcklpd(xmm0, xmm0); - movapd(xmm3, xmm4); - subsd(xmm4, xmm2); - mulpd(xmm5, xmm0); - subpd(xmm0, xmm2); - movdqu(xmm6, Address(tmp, 2064)); - mulsd(xmm7, xmm4); - subsd(xmm3, xmm4); - mulpd(xmm5, xmm0); - mulpd(xmm0, xmm0); - subsd(xmm3, xmm2); - movdqu(xmm2, Address(eax, 0)); - subsd(xmm1, xmm3); - movsd(xmm3, Address(eax, 24)); - addsd(xmm2, xmm3); - subsd(xmm7, xmm2); - mulsd(xmm2, xmm4); - mulpd(xmm6, xmm0); - mulsd(xmm3, xmm4); - mulpd(xmm2, xmm0); - mulpd(xmm0, xmm0); - addpd(xmm5, Address(tmp, 2080)); - mulsd(xmm4, Address(eax, 0)); - addpd(xmm6, Address(tmp, 2048)); - mulpd(xmm5, xmm0); - movapd(xmm0, xmm3); - addsd(xmm3, Address(eax, 8)); - mulpd(xmm1, xmm7); - movapd(xmm7, xmm4); - addsd(xmm4, xmm3); - addpd(xmm6, xmm5); - movsd(xmm5, Address(eax, 8)); - subsd(xmm5, xmm3); - subsd(xmm3, xmm4); - addsd(xmm1, Address(eax, 16)); - mulpd(xmm6, xmm2); - addsd(xmm5, xmm0); - addsd(xmm3, xmm7); - addsd(xmm1, xmm5); - addsd(xmm1, xmm3); - addsd(xmm1, xmm6); - unpckhpd(xmm6, xmm6); - addsd(xmm1, xmm6); - addsd(xmm4, xmm1); - movsd(Address(rsp, 0), xmm4); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_0_0_2); - jcc(Assembler::greater, L_2TAG_PACKET_2_0_2); - pextrw(eax, xmm0, 3); - andl(eax, 32767); - pinsrw(xmm0, eax, 3); - movsd(xmm1, Address(tmp, 2192)); - subsd(xmm1, xmm0); - movsd(Address(rsp, 0), xmm1); - fld_d(Address(rsp, 0)); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_2_0_2); - movl(eax, Address(rsp, 132)); - andl(eax, 2146435072); - cmpl(eax, 2146435072); - jcc(Assembler::equal, L_2TAG_PACKET_3_0_2); - subl(rsp, 32); - movsd(Address(rsp, 0), xmm0); - lea(eax, Address(rsp, 40)); - movl(Address(rsp, 8), eax); - movl(eax, 1); - movl(Address(rsp, 12), eax); - call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_sin_cos_huge()))); - addl(rsp, 32); - fld_d(Address(rsp, 8)); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_3_0_2); - fld_d(Address(rsp, 128)); - fmul_d(Address(tmp, 2208)); - - bind(L_2TAG_PACKET_1_0_2); - movl(tmp, Address(rsp, 56)); -} - diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_libm_x86_64.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_libm_x86_64.cpp deleted file mode 100644 index f2f2211d88b..00000000000 --- a/hotspot/src/cpu/x86/vm/macroAssembler_libm_x86_64.cpp +++ /dev/null @@ -1,3945 +0,0 @@ -/* - * Copyright (c) 2015, Intel Corporation. - * Intel Math Library (LIBM) Source Code - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "asm/assembler.hpp" -#include "asm/assembler.inline.hpp" -#include "macroAssembler_x86.hpp" - -#ifdef _MSC_VER -#define ALIGNED_(x) __declspec(align(x)) -#else -#define ALIGNED_(x) __attribute__ ((aligned(x))) -#endif - -// The 64 bit code is at most SSE2 compliant - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - EXP() -// --------------------- -// -// Description: -// Let K = 64 (table size). -// x x/log(2) n -// e = 2 = 2 * T[j] * (1 + P(y)) -// where -// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K] -// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2] -// j/K -// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]). -// -// P(y) is a minimax polynomial approximation of exp(x)-1 -// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V). -// -// To avoid problems with arithmetic overflow and underflow, -// n n1 n2 -// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2] -// where BIAS is a value of exponent bias. -// -// Special cases: -// exp(NaN) = NaN -// exp(+INF) = +INF -// exp(-INF) = 0 -// exp(x) = 1 for subnormals -// for finite argument, only exp(0)=1 is exact -// For IEEE double -// if x > 709.782712893383973096 then exp(x) overflow -// if x < -745.133219101941108420 then exp(x) underflow -// -/******************************************************************************/ - -ALIGNED_(16) juint _cv[] = -{ - 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL, 0xfefa0000UL, - 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL, 0xbc9e3b3aUL, 0x3d1cf79aUL, - 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xfffffffeUL, 0x3fdfffffUL, 0xfffffffeUL, - 0x3fdfffffUL, 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, 0x3fa55555UL, - 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL -}; - -ALIGNED_(16) juint _shifter[] = -{ - 0x00000000UL, 0x43380000UL, 0x00000000UL, 0x43380000UL -}; - -ALIGNED_(16) juint _mmask[] = -{ - 0xffffffc0UL, 0x00000000UL, 0xffffffc0UL, 0x00000000UL -}; - -ALIGNED_(16) juint _bias[] = -{ - 0x0000ffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL -}; - -ALIGNED_(16) juint _Tbl_addr[] = -{ - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x0e03754dUL, - 0x3cad7bbfUL, 0x3e778060UL, 0x00002c9aUL, 0x3567f613UL, 0x3c8cd252UL, - 0xd3158574UL, 0x000059b0UL, 0x61e6c861UL, 0x3c60f74eUL, 0x18759bc8UL, - 0x00008745UL, 0x5d837b6cUL, 0x3c979aa6UL, 0x6cf9890fUL, 0x0000b558UL, - 0x702f9cd1UL, 0x3c3ebe3dUL, 0x32d3d1a2UL, 0x0000e3ecUL, 0x1e63bcd8UL, - 0x3ca3516eUL, 0xd0125b50UL, 0x00011301UL, 0x26f0387bUL, 0x3ca4c554UL, - 0xaea92ddfUL, 0x0001429aUL, 0x62523fb6UL, 0x3ca95153UL, 0x3c7d517aUL, - 0x000172b8UL, 0x3f1353bfUL, 0x3c8b898cUL, 0xeb6fcb75UL, 0x0001a35bUL, - 0x3e3a2f5fUL, 0x3c9aecf7UL, 0x3168b9aaUL, 0x0001d487UL, 0x44a6c38dUL, - 0x3c8a6f41UL, 0x88628cd6UL, 0x0002063bUL, 0xe3a8a894UL, 0x3c968efdUL, - 0x6e756238UL, 0x0002387aUL, 0x981fe7f2UL, 0x3c80472bUL, 0x65e27cddUL, - 0x00026b45UL, 0x6d09ab31UL, 0x3c82f7e1UL, 0xf51fdee1UL, 0x00029e9dUL, - 0x720c0ab3UL, 0x3c8b3782UL, 0xa6e4030bUL, 0x0002d285UL, 0x4db0abb6UL, - 0x3c834d75UL, 0x0a31b715UL, 0x000306feUL, 0x5dd3f84aUL, 0x3c8fdd39UL, - 0xb26416ffUL, 0x00033c08UL, 0xcc187d29UL, 0x3ca12f8cUL, 0x373aa9caUL, - 0x000371a7UL, 0x738b5e8bUL, 0x3ca7d229UL, 0x34e59ff6UL, 0x0003a7dbUL, - 0xa72a4c6dUL, 0x3c859f48UL, 0x4c123422UL, 0x0003dea6UL, 0x259d9205UL, - 0x3ca8b846UL, 0x21f72e29UL, 0x0004160aUL, 0x60c2ac12UL, 0x3c4363edUL, - 0x6061892dUL, 0x00044e08UL, 0xdaa10379UL, 0x3c6ecce1UL, 0xb5c13cd0UL, - 0x000486a2UL, 0xbb7aafb0UL, 0x3c7690ceUL, 0xd5362a27UL, 0x0004bfdaUL, - 0x9b282a09UL, 0x3ca083ccUL, 0x769d2ca6UL, 0x0004f9b2UL, 0xc1aae707UL, - 0x3ca509b0UL, 0x569d4f81UL, 0x0005342bUL, 0x18fdd78eUL, 0x3c933505UL, - 0x36b527daUL, 0x00056f47UL, 0xe21c5409UL, 0x3c9063e1UL, 0xdd485429UL, - 0x0005ab07UL, 0x2b64c035UL, 0x3c9432e6UL, 0x15ad2148UL, 0x0005e76fUL, - 0x99f08c0aUL, 0x3ca01284UL, 0xb03a5584UL, 0x0006247eUL, 0x0073dc06UL, - 0x3c99f087UL, 0x82552224UL, 0x00066238UL, 0x0da05571UL, 0x3c998d4dUL, - 0x667f3bccUL, 0x0006a09eUL, 0x86ce4786UL, 0x3ca52bb9UL, 0x3c651a2eUL, - 0x0006dfb2UL, 0x206f0dabUL, 0x3ca32092UL, 0xe8ec5f73UL, 0x00071f75UL, - 0x8e17a7a6UL, 0x3ca06122UL, 0x564267c8UL, 0x00075febUL, 0x461e9f86UL, - 0x3ca244acUL, 0x73eb0186UL, 0x0007a114UL, 0xabd66c55UL, 0x3c65ebe1UL, - 0x36cf4e62UL, 0x0007e2f3UL, 0xbbff67d0UL, 0x3c96fe9fUL, 0x994cce12UL, - 0x00082589UL, 0x14c801dfUL, 0x3c951f14UL, 0x9b4492ecUL, 0x000868d9UL, - 0xc1f0eab4UL, 0x3c8db72fUL, 0x422aa0dbUL, 0x0008ace5UL, 0x59f35f44UL, - 0x3c7bf683UL, 0x99157736UL, 0x0008f1aeUL, 0x9c06283cUL, 0x3ca360baUL, - 0xb0cdc5e4UL, 0x00093737UL, 0x20f962aaUL, 0x3c95e8d1UL, 0x9fde4e4fUL, - 0x00097d82UL, 0x2b91ce27UL, 0x3c71affcUL, 0x82a3f090UL, 0x0009c491UL, - 0x589a2ebdUL, 0x3c9b6d34UL, 0x7b5de564UL, 0x000a0c66UL, 0x9ab89880UL, - 0x3c95277cUL, 0xb23e255cUL, 0x000a5503UL, 0x6e735ab3UL, 0x3c846984UL, - 0x5579fdbfUL, 0x000a9e6bUL, 0x92cb3387UL, 0x3c8c1a77UL, 0x995ad3adUL, - 0x000ae89fUL, 0xdc2d1d96UL, 0x3ca22466UL, 0xb84f15faUL, 0x000b33a2UL, - 0xb19505aeUL, 0x3ca1112eUL, 0xf2fb5e46UL, 0x000b7f76UL, 0x0a5fddcdUL, - 0x3c74ffd7UL, 0x904bc1d2UL, 0x000bcc1eUL, 0x30af0cb3UL, 0x3c736eaeUL, - 0xdd85529cUL, 0x000c199bUL, 0xd10959acUL, 0x3c84e08fUL, 0x2e57d14bUL, - 0x000c67f1UL, 0x6c921968UL, 0x3c676b2cUL, 0xdcef9069UL, 0x000cb720UL, - 0x36df99b3UL, 0x3c937009UL, 0x4a07897bUL, 0x000d072dUL, 0xa63d07a7UL, - 0x3c74a385UL, 0xdcfba487UL, 0x000d5818UL, 0xd5c192acUL, 0x3c8e5a50UL, - 0x03db3285UL, 0x000da9e6UL, 0x1c4a9792UL, 0x3c98bb73UL, 0x337b9b5eUL, - 0x000dfc97UL, 0x603a88d3UL, 0x3c74b604UL, 0xe78b3ff6UL, 0x000e502eUL, - 0x92094926UL, 0x3c916f27UL, 0xa2a490d9UL, 0x000ea4afUL, 0x41aa2008UL, - 0x3c8ec3bcUL, 0xee615a27UL, 0x000efa1bUL, 0x31d185eeUL, 0x3c8a64a9UL, - 0x5b6e4540UL, 0x000f5076UL, 0x4d91cd9dUL, 0x3c77893bUL, 0x819e90d8UL, - 0x000fa7c1UL -}; - -ALIGNED_(16) juint _ALLONES[] = -{ - 0xffffffffUL, 0xffffffffUL, 0xffffffffUL, 0xffffffffUL -}; - -ALIGNED_(16) juint _ebias[] = -{ - 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3ff00000UL -}; - -ALIGNED_(4) juint _XMAX[] = -{ - 0xffffffffUL, 0x7fefffffUL -}; - -ALIGNED_(4) juint _XMIN[] = -{ - 0x00000000UL, 0x00100000UL -}; - -ALIGNED_(4) juint _INF[] = -{ - 0x00000000UL, 0x7ff00000UL -}; - -ALIGNED_(4) juint _ZERO[] = -{ - 0x00000000UL, 0x00000000UL -}; - -ALIGNED_(4) juint _ONE_val[] = -{ - 0x00000000UL, 0x3ff00000UL -}; - - -// Registers: -// input: xmm0 -// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 -// rax, rdx, rcx, tmp - r11 - -// Code generated by Intel C compiler for LIBM library - -void MacroAssembler::fast_exp(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, B1_3, B1_5, start; - - assert_different_registers(tmp, eax, ecx, edx); - jmp(start); - address cv = (address)_cv; - address Shifter = (address)_shifter; - address mmask = (address)_mmask; - address bias = (address)_bias; - address Tbl_addr = (address)_Tbl_addr; - address ALLONES = (address)_ALLONES; - address ebias = (address)_ebias; - address XMAX = (address)_XMAX; - address XMIN = (address)_XMIN; - address INF = (address)_INF; - address ZERO = (address)_ZERO; - address ONE_val = (address)_ONE_val; - - bind(start); - subq(rsp, 24); - movsd(Address(rsp, 8), xmm0); - unpcklpd(xmm0, xmm0); - movdqu(xmm1, ExternalAddress(cv)); // 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL - movdqu(xmm6, ExternalAddress(Shifter)); // 0x00000000UL, 0x43380000UL, 0x00000000UL, 0x43380000UL - movdqu(xmm2, ExternalAddress(16+cv)); // 0xfefa0000UL, 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL - movdqu(xmm3, ExternalAddress(32+cv)); // 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xbc9e3b3aUL, 0x3d1cf79aUL - pextrw(eax, xmm0, 3); - andl(eax, 32767); - movl(edx, 16527); - subl(edx, eax); - subl(eax, 15504); - orl(edx, eax); - cmpl(edx, INT_MIN); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); - mulpd(xmm1, xmm0); - addpd(xmm1, xmm6); - movapd(xmm7, xmm1); - subpd(xmm1, xmm6); - mulpd(xmm2, xmm1); - movdqu(xmm4, ExternalAddress(64+cv)); // 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, 0x3fa55555UL - mulpd(xmm3, xmm1); - movdqu(xmm5, ExternalAddress(80+cv)); // 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL - subpd(xmm0, xmm2); - movdl(eax, xmm7); - movl(ecx, eax); - andl(ecx, 63); - shll(ecx, 4); - sarl(eax, 6); - movl(edx, eax); - movdqu(xmm6, ExternalAddress(mmask)); // 0xffffffc0UL, 0x00000000UL, 0xffffffc0UL, 0x00000000UL - pand(xmm7, xmm6); - movdqu(xmm6, ExternalAddress(bias)); // 0x0000ffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL - paddq(xmm7, xmm6); - psllq(xmm7, 46); - subpd(xmm0, xmm3); - lea(tmp, ExternalAddress(Tbl_addr)); - movdqu(xmm2, Address(ecx,tmp)); - mulpd(xmm4, xmm0); - movapd(xmm6, xmm0); - movapd(xmm1, xmm0); - mulpd(xmm6, xmm6); - mulpd(xmm0, xmm6); - addpd(xmm5, xmm4); - mulsd(xmm0, xmm6); - mulpd(xmm6, ExternalAddress(48+cv)); // 0xfffffffeUL, 0x3fdfffffUL, 0xfffffffeUL, 0x3fdfffffUL - addsd(xmm1, xmm2); - unpckhpd(xmm2, xmm2); - mulpd(xmm0, xmm5); - addsd(xmm1, xmm0); - por(xmm2, xmm7); - unpckhpd(xmm0, xmm0); - addsd(xmm0, xmm1); - addsd(xmm0, xmm6); - addl(edx, 894); - cmpl(edx, 1916); - jcc (Assembler::above, L_2TAG_PACKET_1_0_2); - mulsd(xmm0, xmm2); - addsd(xmm0, xmm2); - jmp (B1_5); - - bind(L_2TAG_PACKET_1_0_2); - xorpd(xmm3, xmm3); - movdqu(xmm4, ExternalAddress(ALLONES)); // 0xffffffffUL, 0xffffffffUL, 0xffffffffUL, 0xffffffffUL - movl(edx, -1022); - subl(edx, eax); - movdl(xmm5, edx); - psllq(xmm4, xmm5); - movl(ecx, eax); - sarl(eax, 1); - pinsrw(xmm3, eax, 3); - movdqu(xmm6, ExternalAddress(ebias)); // 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3ff00000UL - psllq(xmm3, 4); - psubd(xmm2, xmm3); - mulsd(xmm0, xmm2); - cmpl(edx, 52); - jcc(Assembler::greater, L_2TAG_PACKET_2_0_2); - pand(xmm4, xmm2); - paddd(xmm3, xmm6); - subsd(xmm2, xmm4); - addsd(xmm0, xmm2); - cmpl(ecx, 1023); - jcc(Assembler::greaterEqual, L_2TAG_PACKET_3_0_2); - pextrw(ecx, xmm0, 3); - andl(ecx, 32768); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_4_0_2); - movapd(xmm6, xmm0); - addsd(xmm0, xmm4); - mulsd(xmm0, xmm3); - pextrw(ecx, xmm0, 3); - andl(ecx, 32752); - cmpl(ecx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_5_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_5_0_2); - mulsd(xmm6, xmm3); - mulsd(xmm4, xmm3); - movdqu(xmm0, xmm6); - pxor(xmm6, xmm4); - psrad(xmm6, 31); - pshufd(xmm6, xmm6, 85); - psllq(xmm0, 1); - psrlq(xmm0, 1); - pxor(xmm0, xmm6); - psrlq(xmm6, 63); - paddq(xmm0, xmm6); - paddq(xmm0, xmm4); - movl(Address(rsp,0), 15); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_4_0_2); - addsd(xmm0, xmm4); - mulsd(xmm0, xmm3); - jmp(B1_5); - - bind(L_2TAG_PACKET_3_0_2); - addsd(xmm0, xmm4); - mulsd(xmm0, xmm3); - pextrw(ecx, xmm0, 3); - andl(ecx, 32752); - cmpl(ecx, 32752); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_7_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_2_0_2); - paddd(xmm3, xmm6); - addpd(xmm0, xmm2); - mulsd(xmm0, xmm3); - movl(Address(rsp,0), 15); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_8_0_2); - cmpl(eax, 2146435072); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_9_0_2); - movl(eax, Address(rsp,12)); - cmpl(eax, INT_MIN); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_10_0_2); - movsd(xmm0, ExternalAddress(XMAX)); // 0xffffffffUL, 0x7fefffffUL - mulsd(xmm0, xmm0); - - bind(L_2TAG_PACKET_7_0_2); - movl(Address(rsp,0), 14); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_10_0_2); - movsd(xmm0, ExternalAddress(XMIN)); // 0x00000000UL, 0x00100000UL - mulsd(xmm0, xmm0); - movl(Address(rsp,0), 15); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_9_0_2); - movl(edx, Address(rsp,8)); - cmpl(eax, 2146435072); - jcc(Assembler::above, L_2TAG_PACKET_11_0_2); - cmpl(edx, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_11_0_2); - movl(eax, Address(rsp,12)); - cmpl(eax, 2146435072); - jcc(Assembler::notEqual, L_2TAG_PACKET_12_0_2); - movsd(xmm0, ExternalAddress(INF)); // 0x00000000UL, 0x7ff00000UL - jmp(B1_5); - - bind(L_2TAG_PACKET_12_0_2); - movsd(xmm0, ExternalAddress(ZERO)); // 0x00000000UL, 0x00000000UL - jmp(B1_5); - - bind(L_2TAG_PACKET_11_0_2); - movsd(xmm0, Address(rsp, 8)); - addsd(xmm0, xmm0); - jmp(B1_5); - - bind(L_2TAG_PACKET_0_0_2); - movl(eax, Address(rsp, 12)); - andl(eax, 2147483647); - cmpl(eax, 1083179008); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_8_0_2); - movsd(Address(rsp, 8), xmm0); - addsd(xmm0, ExternalAddress(ONE_val)); // 0x00000000UL, 0x3ff00000UL - jmp(B1_5); - - bind(L_2TAG_PACKET_6_0_2); - movq(Address(rsp, 16), xmm0); - - bind(B1_3); - movq(xmm0, Address(rsp, 16)); - - bind(B1_5); - addq(rsp, 24); -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - LOG() -// --------------------- -// -// x=2^k * mx, mx in [1,2) -// -// Get B~1/mx based on the output of rcpss instruction (B0) -// B = int((B0*2^7+0.5))/2^7 -// -// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts) -// -// Result: k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6) and -// p(r) is a degree 7 polynomial -// -log(B) read from data table (high, low parts) -// Result is formed from high and low parts -// -// Special cases: -// log(NaN) = quiet NaN, and raise invalid exception -// log(+INF) = that INF -// log(0) = -INF with divide-by-zero exception raised -// log(1) = +0 -// log(x) = NaN with invalid exception raised if x < -0, including -INF -// -/******************************************************************************/ - -ALIGNED_(16) juint _L_tbl[] = -{ - 0xfefa3800UL, 0x3fe62e42UL, 0x93c76730UL, 0x3d2ef357UL, 0xaa241800UL, - 0x3fe5ee82UL, 0x0cda46beUL, 0x3d220238UL, 0x5c364800UL, 0x3fe5af40UL, - 0xac10c9fbUL, 0x3d2dfa63UL, 0x26bb8c00UL, 0x3fe5707aUL, 0xff3303ddUL, - 0x3d09980bUL, 0x26867800UL, 0x3fe5322eUL, 0x5d257531UL, 0x3d05ccc4UL, - 0x835a5000UL, 0x3fe4f45aUL, 0x6d93b8fbUL, 0xbd2e6c51UL, 0x6f970c00UL, - 0x3fe4b6fdUL, 0xed4c541cUL, 0x3cef7115UL, 0x27e8a400UL, 0x3fe47a15UL, - 0xf94d60aaUL, 0xbd22cb6aUL, 0xf2f92400UL, 0x3fe43d9fUL, 0x481051f7UL, - 0xbcfd984fUL, 0x2125cc00UL, 0x3fe4019cUL, 0x30f0c74cUL, 0xbd26ce79UL, - 0x0c36c000UL, 0x3fe3c608UL, 0x7cfe13c2UL, 0xbd02b736UL, 0x17197800UL, - 0x3fe38ae2UL, 0xbb5569a4UL, 0xbd218b7aUL, 0xad9d8c00UL, 0x3fe35028UL, - 0x9527e6acUL, 0x3d10b83fUL, 0x44340800UL, 0x3fe315daUL, 0xc5a0ed9cUL, - 0xbd274e93UL, 0x57b0e000UL, 0x3fe2dbf5UL, 0x07b9dc11UL, 0xbd17a6e5UL, - 0x6d0ec000UL, 0x3fe2a278UL, 0xe797882dUL, 0x3d206d2bUL, 0x1134dc00UL, - 0x3fe26962UL, 0x05226250UL, 0xbd0b61f1UL, 0xd8bebc00UL, 0x3fe230b0UL, - 0x6e48667bUL, 0x3d12fc06UL, 0x5fc61800UL, 0x3fe1f863UL, 0xc9fe81d3UL, - 0xbd2a7242UL, 0x49ae6000UL, 0x3fe1c078UL, 0xed70e667UL, 0x3cccacdeUL, - 0x40f23c00UL, 0x3fe188eeUL, 0xf8ab4650UL, 0x3d14cc4eUL, 0xf6f29800UL, - 0x3fe151c3UL, 0xa293ae49UL, 0xbd2edd97UL, 0x23c75c00UL, 0x3fe11af8UL, - 0xbb9ddcb2UL, 0xbd258647UL, 0x8611cc00UL, 0x3fe0e489UL, 0x07801742UL, - 0x3d1c2998UL, 0xe2d05400UL, 0x3fe0ae76UL, 0x887e7e27UL, 0x3d1f486bUL, - 0x0533c400UL, 0x3fe078bfUL, 0x41edf5fdUL, 0x3d268122UL, 0xbe760400UL, - 0x3fe04360UL, 0xe79539e0UL, 0xbd04c45fUL, 0xe5b20800UL, 0x3fe00e5aUL, - 0xb1727b1cUL, 0xbd053ba3UL, 0xaf7a4800UL, 0x3fdfb358UL, 0x3c164935UL, - 0x3d0085faUL, 0xee031800UL, 0x3fdf4aa7UL, 0x6f014a8bUL, 0x3d12cde5UL, - 0x56b41000UL, 0x3fdee2a1UL, 0x5a470251UL, 0x3d2f27f4UL, 0xc3ddb000UL, - 0x3fde7b42UL, 0x5372bd08UL, 0xbd246550UL, 0x1a272800UL, 0x3fde148aUL, - 0x07322938UL, 0xbd1326b2UL, 0x484c9800UL, 0x3fddae75UL, 0x60dc616aUL, - 0xbd1ea42dUL, 0x46def800UL, 0x3fdd4902UL, 0xe9a767a8UL, 0x3d235bafUL, - 0x18064800UL, 0x3fdce42fUL, 0x3ec7a6b0UL, 0xbd0797c3UL, 0xc7455800UL, - 0x3fdc7ff9UL, 0xc15249aeUL, 0xbd29b6ddUL, 0x693fa000UL, 0x3fdc1c60UL, - 0x7fe8e180UL, 0x3d2cec80UL, 0x1b80e000UL, 0x3fdbb961UL, 0xf40a666dUL, - 0x3d27d85bUL, 0x04462800UL, 0x3fdb56faUL, 0x2d841995UL, 0x3d109525UL, - 0x5248d000UL, 0x3fdaf529UL, 0x52774458UL, 0xbd217cc5UL, 0x3c8ad800UL, - 0x3fda93edUL, 0xbea77a5dUL, 0x3d1e36f2UL, 0x0224f800UL, 0x3fda3344UL, - 0x7f9d79f5UL, 0x3d23c645UL, 0xea15f000UL, 0x3fd9d32bUL, 0x10d0c0b0UL, - 0xbd26279eUL, 0x43135800UL, 0x3fd973a3UL, 0xa502d9f0UL, 0xbd152313UL, - 0x635bf800UL, 0x3fd914a8UL, 0x2ee6307dUL, 0xbd1766b5UL, 0xa88b3000UL, - 0x3fd8b639UL, 0xe5e70470UL, 0xbd205ae1UL, 0x776dc800UL, 0x3fd85855UL, - 0x3333778aUL, 0x3d2fd56fUL, 0x3bd81800UL, 0x3fd7fafaUL, 0xc812566aUL, - 0xbd272090UL, 0x687cf800UL, 0x3fd79e26UL, 0x2efd1778UL, 0x3d29ec7dUL, - 0x76c67800UL, 0x3fd741d8UL, 0x49dc60b3UL, 0x3d2d8b09UL, 0xe6af1800UL, - 0x3fd6e60eUL, 0x7c222d87UL, 0x3d172165UL, 0x3e9c6800UL, 0x3fd68ac8UL, - 0x2756eba0UL, 0x3d20a0d3UL, 0x0b3ab000UL, 0x3fd63003UL, 0xe731ae00UL, - 0xbd2db623UL, 0xdf596000UL, 0x3fd5d5bdUL, 0x08a465dcUL, 0xbd0a0b2aUL, - 0x53c8d000UL, 0x3fd57bf7UL, 0xee5d40efUL, 0x3d1fadedUL, 0x0738a000UL, - 0x3fd522aeUL, 0x8164c759UL, 0x3d2ebe70UL, 0x9e173000UL, 0x3fd4c9e0UL, - 0x1b0ad8a4UL, 0xbd2e2089UL, 0xc271c800UL, 0x3fd4718dUL, 0x0967d675UL, - 0xbd2f27ceUL, 0x23d5e800UL, 0x3fd419b4UL, 0xec90e09dUL, 0x3d08e436UL, - 0x77333000UL, 0x3fd3c252UL, 0xb606bd5cUL, 0x3d183b54UL, 0x76be1000UL, - 0x3fd36b67UL, 0xb0f177c8UL, 0x3d116ecdUL, 0xe1d36000UL, 0x3fd314f1UL, - 0xd3213cb8UL, 0xbd28e27aUL, 0x7cdc9000UL, 0x3fd2bef0UL, 0x4a5004f4UL, - 0x3d2a9cfaUL, 0x1134d800UL, 0x3fd26962UL, 0xdf5bb3b6UL, 0x3d2c93c1UL, - 0x6d0eb800UL, 0x3fd21445UL, 0xba46baeaUL, 0x3d0a87deUL, 0x635a6800UL, - 0x3fd1bf99UL, 0x5147bdb7UL, 0x3d2ca6edUL, 0xcbacf800UL, 0x3fd16b5cUL, - 0xf7a51681UL, 0x3d2b9acdUL, 0x8227e800UL, 0x3fd1178eUL, 0x63a5f01cUL, - 0xbd2c210eUL, 0x67616000UL, 0x3fd0c42dUL, 0x163ceae9UL, 0x3d27188bUL, - 0x604d5800UL, 0x3fd07138UL, 0x16ed4e91UL, 0x3cf89cdbUL, 0x5626c800UL, - 0x3fd01eaeUL, 0x1485e94aUL, 0xbd16f08cUL, 0x6cb3b000UL, 0x3fcf991cUL, - 0xca0cdf30UL, 0x3d1bcbecUL, 0xe4dd0000UL, 0x3fcef5adUL, 0x65bb8e11UL, - 0xbcca2115UL, 0xffe71000UL, 0x3fce530eUL, 0x6041f430UL, 0x3cc21227UL, - 0xb0d49000UL, 0x3fcdb13dUL, 0xf715b035UL, 0xbd2aff2aUL, 0xf2656000UL, - 0x3fcd1037UL, 0x75b6f6e4UL, 0xbd084a7eUL, 0xc6f01000UL, 0x3fcc6ffbUL, - 0xc5962bd2UL, 0xbcf1ec72UL, 0x383be000UL, 0x3fcbd087UL, 0x595412b6UL, - 0xbd2d4bc4UL, 0x575bd000UL, 0x3fcb31d8UL, 0x4eace1aaUL, 0xbd0c358dUL, - 0x3c8ae000UL, 0x3fca93edUL, 0x50562169UL, 0xbd287243UL, 0x07089000UL, - 0x3fc9f6c4UL, 0x6865817aUL, 0x3d29904dUL, 0xdcf70000UL, 0x3fc95a5aUL, - 0x58a0ff6fUL, 0x3d07f228UL, 0xeb390000UL, 0x3fc8beafUL, 0xaae92cd1UL, - 0xbd073d54UL, 0x6551a000UL, 0x3fc823c1UL, 0x9a631e83UL, 0x3d1e0ddbUL, - 0x85445000UL, 0x3fc7898dUL, 0x70914305UL, 0xbd1c6610UL, 0x8b757000UL, - 0x3fc6f012UL, 0xe59c21e1UL, 0xbd25118dUL, 0xbe8c1000UL, 0x3fc6574eUL, - 0x2c3c2e78UL, 0x3d19cf8bUL, 0x6b544000UL, 0x3fc5bf40UL, 0xeb68981cUL, - 0xbd127023UL, 0xe4a1b000UL, 0x3fc527e5UL, 0xe5697dc7UL, 0x3d2633e8UL, - 0x8333b000UL, 0x3fc4913dUL, 0x54fdb678UL, 0x3d258379UL, 0xa5993000UL, - 0x3fc3fb45UL, 0x7e6a354dUL, 0xbd2cd1d8UL, 0xb0159000UL, 0x3fc365fcUL, - 0x234b7289UL, 0x3cc62fa8UL, 0x0c868000UL, 0x3fc2d161UL, 0xcb81b4a1UL, - 0x3d039d6cUL, 0x2a49c000UL, 0x3fc23d71UL, 0x8fd3df5cUL, 0x3d100d23UL, - 0x7e23f000UL, 0x3fc1aa2bUL, 0x44389934UL, 0x3d2ca78eUL, 0x8227e000UL, - 0x3fc1178eUL, 0xce2d07f2UL, 0x3d21ef78UL, 0xb59e4000UL, 0x3fc08598UL, - 0x7009902cUL, 0xbd27e5ddUL, 0x39dbe000UL, 0x3fbfe891UL, 0x4fa10afdUL, - 0xbd2534d6UL, 0x830a2000UL, 0x3fbec739UL, 0xafe645e0UL, 0xbd2dc068UL, - 0x63844000UL, 0x3fbda727UL, 0x1fa71733UL, 0x3d1a8940UL, 0x01bc4000UL, - 0x3fbc8858UL, 0xc65aacd3UL, 0x3d2646d1UL, 0x8dad6000UL, 0x3fbb6ac8UL, - 0x2bf768e5UL, 0xbd139080UL, 0x40b1c000UL, 0x3fba4e76UL, 0xb94407c8UL, - 0xbd0e42b6UL, 0x5d594000UL, 0x3fb9335eUL, 0x3abd47daUL, 0x3d23115cUL, - 0x2f40e000UL, 0x3fb8197eUL, 0xf96ffdf7UL, 0x3d0f80dcUL, 0x0aeac000UL, - 0x3fb700d3UL, 0xa99ded32UL, 0x3cec1e8dUL, 0x4d97a000UL, 0x3fb5e95aUL, - 0x3c5d1d1eUL, 0xbd2c6906UL, 0x5d208000UL, 0x3fb4d311UL, 0x82f4e1efUL, - 0xbcf53a25UL, 0xa7d1e000UL, 0x3fb3bdf5UL, 0xa5db4ed7UL, 0x3d2cc85eUL, - 0xa4472000UL, 0x3fb2aa04UL, 0xae9c697dUL, 0xbd20b6e8UL, 0xd1466000UL, - 0x3fb1973bUL, 0x560d9e9bUL, 0xbd25325dUL, 0xb59e4000UL, 0x3fb08598UL, - 0x7009902cUL, 0xbd17e5ddUL, 0xc006c000UL, 0x3faeea31UL, 0x4fc93b7bUL, - 0xbd0e113eUL, 0xcdddc000UL, 0x3faccb73UL, 0x47d82807UL, 0xbd1a68f2UL, - 0xd0fb0000UL, 0x3faaaef2UL, 0x353bb42eUL, 0x3d20fc1aUL, 0x149fc000UL, - 0x3fa894aaUL, 0xd05a267dUL, 0xbd197995UL, 0xf2d4c000UL, 0x3fa67c94UL, - 0xec19afa2UL, 0xbd029efbUL, 0xd42e0000UL, 0x3fa466aeUL, 0x75bdfd28UL, - 0xbd2c1673UL, 0x2f8d0000UL, 0x3fa252f3UL, 0xe021b67bUL, 0x3d283e9aUL, - 0x89e74000UL, 0x3fa0415dUL, 0x5cf1d753UL, 0x3d0111c0UL, 0xec148000UL, - 0x3f9c63d2UL, 0x3f9eb2f3UL, 0x3d2578c6UL, 0x28c90000UL, 0x3f984925UL, - 0x325a0c34UL, 0xbd2aa0baUL, 0x25980000UL, 0x3f9432a9UL, 0x928637feUL, - 0x3d098139UL, 0x58938000UL, 0x3f902056UL, 0x06e2f7d2UL, 0xbd23dc5bUL, - 0xa3890000UL, 0x3f882448UL, 0xda74f640UL, 0xbd275577UL, 0x75890000UL, - 0x3f801015UL, 0x999d2be8UL, 0xbd10c76bUL, 0x59580000UL, 0x3f700805UL, - 0xcb31c67bUL, 0x3d2166afUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x80000000UL -}; - -ALIGNED_(16) juint _log2[] = -{ - 0xfefa3800UL, 0x3fa62e42UL, 0x93c76730UL, 0x3ceef357UL -}; - -ALIGNED_(16) juint _coeff[] = -{ - 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL, 0x3d6fb175UL, - 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL, 0x9999999aUL, 0x3fc99999UL, - 0x00000000UL, 0xbfe00000UL -}; - -//registers, -// input: xmm0 -// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 -// rax, rdx, rcx, r8, r11 - -void MacroAssembler::fast_log(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp1, Register tmp2) { - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; - - assert_different_registers(tmp1, tmp2, eax, ecx, edx); - jmp(start); - address L_tbl = (address)_L_tbl; - address log2 = (address)_log2; - address coeff = (address)_coeff; - - bind(start); - subq(rsp, 24); - movsd(Address(rsp, 0), xmm0); - mov64(rax, 0x3ff0000000000000); - movdq(xmm2, rax); - mov64(rdx, 0x77f0000000000000); - movdq(xmm3, rdx); - movl(ecx, 32768); - movdl(xmm4, rcx); - mov64(tmp1, 0xffffe00000000000); - movdq(xmm5, tmp1); - movdqu(xmm1, xmm0); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - movl(ecx, 16352); - psrlq(xmm0, 27); - lea(tmp2, ExternalAddress(L_tbl)); - psrld(xmm0, 2); - rcpps(xmm0, xmm0); - psllq(xmm1, 12); - pshufd(xmm6, xmm5, 228); - psrlq(xmm1, 12); - subl(eax, 16); - cmpl(eax, 32736); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); - - bind(L_2TAG_PACKET_1_0_2); - paddd(xmm0, xmm4); - por(xmm1, xmm3); - movdl(edx, xmm0); - psllq(xmm0, 29); - pand(xmm5, xmm1); - pand(xmm0, xmm6); - subsd(xmm1, xmm5); - mulpd(xmm5, xmm0); - andl(eax, 32752); - subl(eax, ecx); - cvtsi2sdl(xmm7, eax); - mulsd(xmm1, xmm0); - movq(xmm6, ExternalAddress(log2)); // 0xfefa3800UL, 0x3fa62e42UL - movdqu(xmm3, ExternalAddress(coeff)); // 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL - subsd(xmm5, xmm2); - andl(edx, 16711680); - shrl(edx, 12); - movdqu(xmm0, Address(tmp2, edx)); - movdqu(xmm4, ExternalAddress(16 + coeff)); // 0x3d6fb175UL, 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL - addsd(xmm1, xmm5); - movdqu(xmm2, ExternalAddress(32 + coeff)); // 0x9999999aUL, 0x3fc99999UL, 0x00000000UL, 0xbfe00000UL - mulsd(xmm6, xmm7); - if (VM_Version::supports_sse3()) { - movddup(xmm5, xmm1); - } else { - movdqu(xmm5, xmm1); - movlhps(xmm5, xmm5); - } - mulsd(xmm7, ExternalAddress(8 + log2)); // 0x93c76730UL, 0x3ceef357UL - mulsd(xmm3, xmm1); - addsd(xmm0, xmm6); - mulpd(xmm4, xmm5); - mulpd(xmm5, xmm5); - if (VM_Version::supports_sse3()) { - movddup(xmm6, xmm0); - } else { - movdqu(xmm6, xmm0); - movlhps(xmm6, xmm6); - } - addsd(xmm0, xmm1); - addpd(xmm4, xmm2); - mulpd(xmm3, xmm5); - subsd(xmm6, xmm0); - mulsd(xmm4, xmm1); - pshufd(xmm2, xmm0, 238); - addsd(xmm1, xmm6); - mulsd(xmm5, xmm5); - addsd(xmm7, xmm2); - addpd(xmm4, xmm3); - addsd(xmm1, xmm7); - mulpd(xmm4, xmm5); - addsd(xmm1, xmm4); - pshufd(xmm5, xmm4, 238); - addsd(xmm1, xmm5); - addsd(xmm0, xmm1); - jmp(B1_5); - - bind(L_2TAG_PACKET_0_0_2); - movq(xmm0, Address(rsp, 0)); - movq(xmm1, Address(rsp, 0)); - addl(eax, 16); - cmpl(eax, 32768); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_2_0_2); - cmpl(eax, 16); - jcc(Assembler::below, L_2TAG_PACKET_3_0_2); - - bind(L_2TAG_PACKET_4_0_2); - addsd(xmm0, xmm0); - jmp(B1_5); - - bind(L_2TAG_PACKET_5_0_2); - jcc(Assembler::above, L_2TAG_PACKET_4_0_2); - cmpl(edx, 0); - jcc(Assembler::above, L_2TAG_PACKET_4_0_2); - jmp(L_2TAG_PACKET_6_0_2); - - bind(L_2TAG_PACKET_3_0_2); - xorpd(xmm1, xmm1); - addsd(xmm1, xmm0); - movdl(edx, xmm1); - psrlq(xmm1, 32); - movdl(ecx, xmm1); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); - xorpd(xmm1, xmm1); - movl(eax, 18416); - pinsrw(xmm1, eax, 3); - mulsd(xmm0, xmm1); - movdqu(xmm1, xmm0); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - psrlq(xmm0, 27); - movl(ecx, 18416); - psrld(xmm0, 2); - rcpps(xmm0, xmm0); - psllq(xmm1, 12); - pshufd(xmm6, xmm5, 228); - psrlq(xmm1, 12); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_2_0_2); - movdl(edx, xmm1); - psrlq(xmm1, 32); - movdl(ecx, xmm1); - addl(ecx, ecx); - cmpl(ecx, -2097152); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_5_0_2); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); - - bind(L_2TAG_PACKET_6_0_2); - xorpd(xmm1, xmm1); - xorpd(xmm0, xmm0); - movl(eax, 32752); - pinsrw(xmm1, eax, 3); - mulsd(xmm0, xmm1); - movl(Address(rsp, 16), 3); - jmp(L_2TAG_PACKET_8_0_2); - bind(L_2TAG_PACKET_7_0_2); - xorpd(xmm1, xmm1); - xorpd(xmm0, xmm0); - movl(eax, 49136); - pinsrw(xmm0, eax, 3); - divsd(xmm0, xmm1); - movl(Address(rsp, 16), 2); - - bind(L_2TAG_PACKET_8_0_2); - movq(Address(rsp, 8), xmm0); - - bind(B1_3); - movq(xmm0, Address(rsp, 8)); - - bind(B1_5); - addq(rsp, 24); -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - POW() -// --------------------- -// -// Let x=2^k * mx, mx in [1,2) -// -// log2(x) calculation: -// -// Get B~1/mx based on the output of rcpps instruction (B0) -// B = int((B0*LH*2^9+0.5))/2^9 -// LH is a short approximation for log2(e) -// -// Reduced argument, scaled by LH: -// r=B*mx-LH (computed accurately in high and low parts) -// -// log2(x) result: k - log2(B) + p(r) -// p(r) is a degree 8 polynomial -// -log2(B) read from data table (high, low parts) -// log2(x) is formed from high and low parts -// For |x| in [1-1/32, 1+1/16), a slower but more accurate computation -// based om the same table design is performed. -// -// Main path is taken if | floor(log2(|log2(|x|)|) + floor(log2|y|) | < 8, -// to filter out all potential OF/UF cases. -// exp2(y*log2(x)) is computed using an 8-bit index table and a degree 5 -// polynomial -// -// Special cases: -// pow(-0,y) = -INF and raises the divide-by-zero exception for y an odd -// integer < 0. -// pow(-0,y) = +INF and raises the divide-by-zero exception for y < 0 and -// not an odd integer. -// pow(-0,y) = -0 for y an odd integer > 0. -// pow(-0,y) = +0 for y > 0 and not an odd integer. -// pow(-1,-INF) = NaN. -// pow(+1,y) = NaN for any y, even a NaN. -// pow(x,-0) = 1 for any x, even a NaN. -// pow(x,y) = a NaN and raises the invalid exception for finite x < 0 and -// finite non-integer y. -// pow(x,-INF) = +INF for |x|<1. -// pow(x,-INF) = +0 for |x|>1. -// pow(x,+INF) = +0 for |x|<1. -// pow(x,+INF) = +INF for |x|>1. -// pow(-INF,y) = -0 for y an odd integer < 0. -// pow(-INF,y) = +0 for y < 0 and not an odd integer. -// pow(-INF,y) = -INF for y an odd integer > 0. -// pow(-INF,y) = +INF for y > 0 and not an odd integer. -// pow(+INF,y) = +0 for y <0. -// pow(+INF,y) = +INF for y >0. -// -/******************************************************************************/ - -ALIGNED_(16) juint _HIGHSIGMASK[] = -{ - 0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL -}; - -ALIGNED_(16) juint _LOG2_E[] = -{ - 0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL -}; - -ALIGNED_(16) juint _HIGHMASK_Y[] = -{ - 0x00000000UL, 0xfffffff8UL, 0x00000000UL, 0xffffffffUL -}; - -ALIGNED_(16) juint _T_exp[] = -{ - 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3b700000UL, 0xfa5abcbfUL, - 0x3ff00b1aUL, 0xa7609f71UL, 0xbc84f6b2UL, 0xa9fb3335UL, 0x3ff0163dUL, - 0x9ab8cdb7UL, 0x3c9b6129UL, 0x143b0281UL, 0x3ff02168UL, 0x0fc54eb6UL, - 0xbc82bf31UL, 0x3e778061UL, 0x3ff02c9aUL, 0x535b085dUL, 0xbc719083UL, - 0x2e11bbccUL, 0x3ff037d4UL, 0xeeade11aUL, 0x3c656811UL, 0xe86e7f85UL, - 0x3ff04315UL, 0x1977c96eUL, 0xbc90a31cUL, 0x72f654b1UL, 0x3ff04e5fUL, - 0x3aa0d08cUL, 0x3c84c379UL, 0xd3158574UL, 0x3ff059b0UL, 0xa475b465UL, - 0x3c8d73e2UL, 0x0e3c1f89UL, 0x3ff0650aUL, 0x5799c397UL, 0xbc95cb7bUL, - 0x29ddf6deUL, 0x3ff0706bUL, 0xe2b13c27UL, 0xbc8c91dfUL, 0x2b72a836UL, - 0x3ff07bd4UL, 0x54458700UL, 0x3c832334UL, 0x18759bc8UL, 0x3ff08745UL, - 0x4bb284ffUL, 0x3c6186beUL, 0xf66607e0UL, 0x3ff092bdUL, 0x800a3fd1UL, - 0xbc968063UL, 0xcac6f383UL, 0x3ff09e3eUL, 0x18316136UL, 0x3c914878UL, - 0x9b1f3919UL, 0x3ff0a9c7UL, 0x873d1d38UL, 0x3c85d16cUL, 0x6cf9890fUL, - 0x3ff0b558UL, 0x4adc610bUL, 0x3c98a62eUL, 0x45e46c85UL, 0x3ff0c0f1UL, - 0x06d21cefUL, 0x3c94f989UL, 0x2b7247f7UL, 0x3ff0cc92UL, 0x16e24f71UL, - 0x3c901edcUL, 0x23395decUL, 0x3ff0d83bUL, 0xe43f316aUL, 0xbc9bc14dUL, - 0x32d3d1a2UL, 0x3ff0e3ecUL, 0x27c57b52UL, 0x3c403a17UL, 0x5fdfa9c5UL, - 0x3ff0efa5UL, 0xbc54021bUL, 0xbc949db9UL, 0xaffed31bUL, 0x3ff0fb66UL, - 0xc44ebd7bUL, 0xbc6b9bedUL, 0x28d7233eUL, 0x3ff10730UL, 0x1692fdd5UL, - 0x3c8d46ebUL, 0xd0125b51UL, 0x3ff11301UL, 0x39449b3aUL, 0xbc96c510UL, - 0xab5e2ab6UL, 0x3ff11edbUL, 0xf703fb72UL, 0xbc9ca454UL, 0xc06c31ccUL, - 0x3ff12abdUL, 0xb36ca5c7UL, 0xbc51b514UL, 0x14f204abUL, 0x3ff136a8UL, - 0xba48dcf0UL, 0xbc67108fUL, 0xaea92de0UL, 0x3ff1429aUL, 0x9af1369eUL, - 0xbc932fbfUL, 0x934f312eUL, 0x3ff14e95UL, 0x39bf44abUL, 0xbc8b91e8UL, - 0xc8a58e51UL, 0x3ff15a98UL, 0xb9eeab0aUL, 0x3c82406aUL, 0x5471c3c2UL, - 0x3ff166a4UL, 0x82ea1a32UL, 0x3c58f23bUL, 0x3c7d517bUL, 0x3ff172b8UL, - 0xb9d78a76UL, 0xbc819041UL, 0x8695bbc0UL, 0x3ff17ed4UL, 0xe2ac5a64UL, - 0x3c709e3fUL, 0x388c8deaUL, 0x3ff18af9UL, 0xd1970f6cUL, 0xbc911023UL, - 0x58375d2fUL, 0x3ff19726UL, 0x85f17e08UL, 0x3c94aaddUL, 0xeb6fcb75UL, - 0x3ff1a35bUL, 0x7b4968e4UL, 0x3c8e5b4cUL, 0xf8138a1cUL, 0x3ff1af99UL, - 0xa4b69280UL, 0x3c97bf85UL, 0x84045cd4UL, 0x3ff1bbe0UL, 0x352ef607UL, - 0xbc995386UL, 0x95281c6bUL, 0x3ff1c82fUL, 0x8010f8c9UL, 0x3c900977UL, - 0x3168b9aaUL, 0x3ff1d487UL, 0x00a2643cUL, 0x3c9e016eUL, 0x5eb44027UL, - 0x3ff1e0e7UL, 0x088cb6deUL, 0xbc96fdd8UL, 0x22fcd91dUL, 0x3ff1ed50UL, - 0x027bb78cUL, 0xbc91df98UL, 0x8438ce4dUL, 0x3ff1f9c1UL, 0xa097af5cUL, - 0xbc9bf524UL, 0x88628cd6UL, 0x3ff2063bUL, 0x814a8495UL, 0x3c8dc775UL, - 0x3578a819UL, 0x3ff212beUL, 0x2cfcaac9UL, 0x3c93592dUL, 0x917ddc96UL, - 0x3ff21f49UL, 0x9494a5eeUL, 0x3c82a97eUL, 0xa27912d1UL, 0x3ff22bddUL, - 0x5577d69fUL, 0x3c8d34fbUL, 0x6e756238UL, 0x3ff2387aUL, 0xb6c70573UL, - 0x3c99b07eUL, 0xfb82140aUL, 0x3ff2451fUL, 0x911ca996UL, 0x3c8acfccUL, - 0x4fb2a63fUL, 0x3ff251ceUL, 0xbef4f4a4UL, 0x3c8ac155UL, 0x711ece75UL, - 0x3ff25e85UL, 0x4ac31b2cUL, 0x3c93e1a2UL, 0x65e27cddUL, 0x3ff26b45UL, - 0x9940e9d9UL, 0x3c82bd33UL, 0x341ddf29UL, 0x3ff2780eUL, 0x05f9e76cUL, - 0x3c9e067cUL, 0xe1f56381UL, 0x3ff284dfUL, 0x8c3f0d7eUL, 0xbc9a4c3aUL, - 0x7591bb70UL, 0x3ff291baUL, 0x28401cbdUL, 0xbc82cc72UL, 0xf51fdee1UL, - 0x3ff29e9dUL, 0xafad1255UL, 0x3c8612e8UL, 0x66d10f13UL, 0x3ff2ab8aUL, - 0x191690a7UL, 0xbc995743UL, 0xd0dad990UL, 0x3ff2b87fUL, 0xd6381aa4UL, - 0xbc410adcUL, 0x39771b2fUL, 0x3ff2c57eUL, 0xa6eb5124UL, 0xbc950145UL, - 0xa6e4030bUL, 0x3ff2d285UL, 0x54db41d5UL, 0x3c900247UL, 0x1f641589UL, - 0x3ff2df96UL, 0xfbbce198UL, 0x3c9d16cfUL, 0xa93e2f56UL, 0x3ff2ecafUL, - 0x45d52383UL, 0x3c71ca0fUL, 0x4abd886bUL, 0x3ff2f9d2UL, 0x532bda93UL, - 0xbc653c55UL, 0x0a31b715UL, 0x3ff306feUL, 0xd23182e4UL, 0x3c86f46aUL, - 0xedeeb2fdUL, 0x3ff31432UL, 0xf3f3fcd1UL, 0x3c8959a3UL, 0xfc4cd831UL, - 0x3ff32170UL, 0x8e18047cUL, 0x3c8a9ce7UL, 0x3ba8ea32UL, 0x3ff32eb8UL, - 0x3cb4f318UL, 0xbc9c45e8UL, 0xb26416ffUL, 0x3ff33c08UL, 0x843659a6UL, - 0x3c932721UL, 0x66e3fa2dUL, 0x3ff34962UL, 0x930881a4UL, 0xbc835a75UL, - 0x5f929ff1UL, 0x3ff356c5UL, 0x5c4e4628UL, 0xbc8b5ceeUL, 0xa2de883bUL, - 0x3ff36431UL, 0xa06cb85eUL, 0xbc8c3144UL, 0x373aa9cbUL, 0x3ff371a7UL, - 0xbf42eae2UL, 0xbc963aeaUL, 0x231e754aUL, 0x3ff37f26UL, 0x9eceb23cUL, - 0xbc99f5caUL, 0x6d05d866UL, 0x3ff38caeUL, 0x3c9904bdUL, 0xbc9e958dUL, - 0x1b7140efUL, 0x3ff39a40UL, 0xfc8e2934UL, 0xbc99a9a5UL, 0x34e59ff7UL, - 0x3ff3a7dbUL, 0xd661f5e3UL, 0xbc75e436UL, 0xbfec6cf4UL, 0x3ff3b57fUL, - 0xe26fff18UL, 0x3c954c66UL, 0xc313a8e5UL, 0x3ff3c32dUL, 0x375d29c3UL, - 0xbc9efff8UL, 0x44ede173UL, 0x3ff3d0e5UL, 0x8c284c71UL, 0x3c7fe8d0UL, - 0x4c123422UL, 0x3ff3dea6UL, 0x11f09ebcUL, 0x3c8ada09UL, 0xdf1c5175UL, - 0x3ff3ec70UL, 0x7b8c9bcaUL, 0xbc8af663UL, 0x04ac801cUL, 0x3ff3fa45UL, - 0xf956f9f3UL, 0xbc97d023UL, 0xc367a024UL, 0x3ff40822UL, 0xb6f4d048UL, - 0x3c8bddf8UL, 0x21f72e2aUL, 0x3ff4160aUL, 0x1c309278UL, 0xbc5ef369UL, - 0x2709468aUL, 0x3ff423fbUL, 0xc0b314ddUL, 0xbc98462dUL, 0xd950a897UL, - 0x3ff431f5UL, 0xe35f7999UL, 0xbc81c7ddUL, 0x3f84b9d4UL, 0x3ff43ffaUL, - 0x9704c003UL, 0x3c8880beUL, 0x6061892dUL, 0x3ff44e08UL, 0x04ef80d0UL, - 0x3c489b7aUL, 0x42a7d232UL, 0x3ff45c20UL, 0x82fb1f8eUL, 0xbc686419UL, - 0xed1d0057UL, 0x3ff46a41UL, 0xd1648a76UL, 0x3c9c944bUL, 0x668b3237UL, - 0x3ff4786dUL, 0xed445733UL, 0xbc9c20f0UL, 0xb5c13cd0UL, 0x3ff486a2UL, - 0xb69062f0UL, 0x3c73c1a3UL, 0xe192aed2UL, 0x3ff494e1UL, 0x5e499ea0UL, - 0xbc83b289UL, 0xf0d7d3deUL, 0x3ff4a32aUL, 0xf3d1be56UL, 0x3c99cb62UL, - 0xea6db7d7UL, 0x3ff4b17dUL, 0x7f2897f0UL, 0xbc8125b8UL, 0xd5362a27UL, - 0x3ff4bfdaUL, 0xafec42e2UL, 0x3c7d4397UL, 0xb817c114UL, 0x3ff4ce41UL, - 0x690abd5dUL, 0x3c905e29UL, 0x99fddd0dUL, 0x3ff4dcb2UL, 0xbc6a7833UL, - 0x3c98ecdbUL, 0x81d8abffUL, 0x3ff4eb2dUL, 0x2e5d7a52UL, 0xbc95257dUL, - 0x769d2ca7UL, 0x3ff4f9b2UL, 0xd25957e3UL, 0xbc94b309UL, 0x7f4531eeUL, - 0x3ff50841UL, 0x49b7465fUL, 0x3c7a249bUL, 0xa2cf6642UL, 0x3ff516daUL, - 0x69bd93efUL, 0xbc8f7685UL, 0xe83f4eefUL, 0x3ff5257dUL, 0x43efef71UL, - 0xbc7c998dUL, 0x569d4f82UL, 0x3ff5342bUL, 0x1db13cadUL, 0xbc807abeUL, - 0xf4f6ad27UL, 0x3ff542e2UL, 0x192d5f7eUL, 0x3c87926dUL, 0xca5d920fUL, - 0x3ff551a4UL, 0xefede59bUL, 0xbc8d689cUL, 0xdde910d2UL, 0x3ff56070UL, - 0x168eebf0UL, 0xbc90fb6eUL, 0x36b527daUL, 0x3ff56f47UL, 0x011d93adUL, - 0x3c99bb2cUL, 0xdbe2c4cfUL, 0x3ff57e27UL, 0x8a57b9c4UL, 0xbc90b98cUL, - 0xd497c7fdUL, 0x3ff58d12UL, 0x5b9a1de8UL, 0x3c8295e1UL, 0x27ff07ccUL, - 0x3ff59c08UL, 0xe467e60fUL, 0xbc97e2ceUL, 0xdd485429UL, 0x3ff5ab07UL, - 0x054647adUL, 0x3c96324cUL, 0xfba87a03UL, 0x3ff5ba11UL, 0x4c233e1aUL, - 0xbc9b77a1UL, 0x8a5946b7UL, 0x3ff5c926UL, 0x816986a2UL, 0x3c3c4b1bUL, - 0x90998b93UL, 0x3ff5d845UL, 0xa8b45643UL, 0xbc9cd6a7UL, 0x15ad2148UL, - 0x3ff5e76fUL, 0x3080e65eUL, 0x3c9ba6f9UL, 0x20dceb71UL, 0x3ff5f6a3UL, - 0xe3cdcf92UL, 0xbc89eaddUL, 0xb976dc09UL, 0x3ff605e1UL, 0x9b56de47UL, - 0xbc93e242UL, 0xe6cdf6f4UL, 0x3ff6152aUL, 0x4ab84c27UL, 0x3c9e4b3eUL, - 0xb03a5585UL, 0x3ff6247eUL, 0x7e40b497UL, 0xbc9383c1UL, 0x1d1929fdUL, - 0x3ff633ddUL, 0xbeb964e5UL, 0x3c984710UL, 0x34ccc320UL, 0x3ff64346UL, - 0x759d8933UL, 0xbc8c483cUL, 0xfebc8fb7UL, 0x3ff652b9UL, 0xc9a73e09UL, - 0xbc9ae3d5UL, 0x82552225UL, 0x3ff66238UL, 0x87591c34UL, 0xbc9bb609UL, - 0xc70833f6UL, 0x3ff671c1UL, 0x586c6134UL, 0xbc8e8732UL, 0xd44ca973UL, - 0x3ff68155UL, 0x44f73e65UL, 0x3c6038aeUL, 0xb19e9538UL, 0x3ff690f4UL, - 0x9aeb445dUL, 0x3c8804bdUL, 0x667f3bcdUL, 0x3ff6a09eUL, 0x13b26456UL, - 0xbc9bdd34UL, 0xfa75173eUL, 0x3ff6b052UL, 0x2c9a9d0eUL, 0x3c7a38f5UL, - 0x750bdabfUL, 0x3ff6c012UL, 0x67ff0b0dUL, 0xbc728956UL, 0xddd47645UL, - 0x3ff6cfdcUL, 0xb6f17309UL, 0x3c9c7aa9UL, 0x3c651a2fUL, 0x3ff6dfb2UL, - 0x683c88abUL, 0xbc6bbe3aUL, 0x98593ae5UL, 0x3ff6ef92UL, 0x9e1ac8b2UL, - 0xbc90b974UL, 0xf9519484UL, 0x3ff6ff7dUL, 0x25860ef6UL, 0xbc883c0fUL, - 0x66f42e87UL, 0x3ff70f74UL, 0xd45aa65fUL, 0x3c59d644UL, 0xe8ec5f74UL, - 0x3ff71f75UL, 0x86887a99UL, 0xbc816e47UL, 0x86ead08aUL, 0x3ff72f82UL, - 0x2cd62c72UL, 0xbc920aa0UL, 0x48a58174UL, 0x3ff73f9aUL, 0x6c65d53cUL, - 0xbc90a8d9UL, 0x35d7cbfdUL, 0x3ff74fbdUL, 0x618a6e1cUL, 0x3c9047fdUL, - 0x564267c9UL, 0x3ff75febUL, 0x57316dd3UL, 0xbc902459UL, 0xb1ab6e09UL, - 0x3ff77024UL, 0x169147f8UL, 0x3c9b7877UL, 0x4fde5d3fUL, 0x3ff78069UL, - 0x0a02162dUL, 0x3c9866b8UL, 0x38ac1cf6UL, 0x3ff790b9UL, 0x62aadd3eUL, - 0x3c9349a8UL, 0x73eb0187UL, 0x3ff7a114UL, 0xee04992fUL, 0xbc841577UL, - 0x0976cfdbUL, 0x3ff7b17bUL, 0x8468dc88UL, 0xbc9bebb5UL, 0x0130c132UL, - 0x3ff7c1edUL, 0xd1164dd6UL, 0x3c9f124cUL, 0x62ff86f0UL, 0x3ff7d26aUL, - 0xfb72b8b4UL, 0x3c91bddbUL, 0x36cf4e62UL, 0x3ff7e2f3UL, 0xba15797eUL, - 0x3c705d02UL, 0x8491c491UL, 0x3ff7f387UL, 0xcf9311aeUL, 0xbc807f11UL, - 0x543e1a12UL, 0x3ff80427UL, 0x626d972bUL, 0xbc927c86UL, 0xadd106d9UL, - 0x3ff814d2UL, 0x0d151d4dUL, 0x3c946437UL, 0x994cce13UL, 0x3ff82589UL, - 0xd41532d8UL, 0xbc9d4c1dUL, 0x1eb941f7UL, 0x3ff8364cUL, 0x31df2bd5UL, - 0x3c999b9aUL, 0x4623c7adUL, 0x3ff8471aUL, 0xa341cdfbUL, 0xbc88d684UL, - 0x179f5b21UL, 0x3ff857f4UL, 0xf8b216d0UL, 0xbc5ba748UL, 0x9b4492edUL, - 0x3ff868d9UL, 0x9bd4f6baUL, 0xbc9fc6f8UL, 0xd931a436UL, 0x3ff879caUL, - 0xd2db47bdUL, 0x3c85d2d7UL, 0xd98a6699UL, 0x3ff88ac7UL, 0xf37cb53aUL, - 0x3c9994c2UL, 0xa478580fUL, 0x3ff89bd0UL, 0x4475202aUL, 0x3c9d5395UL, - 0x422aa0dbUL, 0x3ff8ace5UL, 0x56864b27UL, 0x3c96e9f1UL, 0xbad61778UL, - 0x3ff8be05UL, 0xfc43446eUL, 0x3c9ecb5eUL, 0x16b5448cUL, 0x3ff8cf32UL, - 0x32e9e3aaUL, 0xbc70d55eUL, 0x5e0866d9UL, 0x3ff8e06aUL, 0x6fc9b2e6UL, - 0xbc97114aUL, 0x99157736UL, 0x3ff8f1aeUL, 0xa2e3976cUL, 0x3c85cc13UL, - 0xd0282c8aUL, 0x3ff902feUL, 0x85fe3fd2UL, 0x3c9592caUL, 0x0b91ffc6UL, - 0x3ff9145bUL, 0x2e582524UL, 0xbc9dd679UL, 0x53aa2fe2UL, 0x3ff925c3UL, - 0xa639db7fUL, 0xbc83455fUL, 0xb0cdc5e5UL, 0x3ff93737UL, 0x81b57ebcUL, - 0xbc675fc7UL, 0x2b5f98e5UL, 0x3ff948b8UL, 0x797d2d99UL, 0xbc8dc3d6UL, - 0xcbc8520fUL, 0x3ff95a44UL, 0x96a5f039UL, 0xbc764b7cUL, 0x9a7670b3UL, - 0x3ff96bddUL, 0x7f19c896UL, 0xbc5ba596UL, 0x9fde4e50UL, 0x3ff97d82UL, - 0x7c1b85d1UL, 0xbc9d185bUL, 0xe47a22a2UL, 0x3ff98f33UL, 0xa24c78ecUL, - 0x3c7cabdaUL, 0x70ca07baUL, 0x3ff9a0f1UL, 0x91cee632UL, 0xbc9173bdUL, - 0x4d53fe0dUL, 0x3ff9b2bbUL, 0x4df6d518UL, 0xbc9dd84eUL, 0x82a3f090UL, - 0x3ff9c491UL, 0xb071f2beUL, 0x3c7c7c46UL, 0x194bb8d5UL, 0x3ff9d674UL, - 0xa3dd8233UL, 0xbc9516beUL, 0x19e32323UL, 0x3ff9e863UL, 0x78e64c6eUL, - 0x3c7824caUL, 0x8d07f29eUL, 0x3ff9fa5eUL, 0xaaf1faceUL, 0xbc84a9ceUL, - 0x7b5de565UL, 0x3ffa0c66UL, 0x5d1cd533UL, 0xbc935949UL, 0xed8eb8bbUL, - 0x3ffa1e7aUL, 0xee8be70eUL, 0x3c9c6618UL, 0xec4a2d33UL, 0x3ffa309bUL, - 0x7ddc36abUL, 0x3c96305cUL, 0x80460ad8UL, 0x3ffa42c9UL, 0x589fb120UL, - 0xbc9aa780UL, 0xb23e255dUL, 0x3ffa5503UL, 0xdb8d41e1UL, 0xbc9d2f6eUL, - 0x8af46052UL, 0x3ffa674aUL, 0x30670366UL, 0x3c650f56UL, 0x1330b358UL, - 0x3ffa799eUL, 0xcac563c7UL, 0x3c9bcb7eUL, 0x53c12e59UL, 0x3ffa8bfeUL, - 0xb2ba15a9UL, 0xbc94f867UL, 0x5579fdbfUL, 0x3ffa9e6bUL, 0x0ef7fd31UL, - 0x3c90fac9UL, 0x21356ebaUL, 0x3ffab0e5UL, 0xdae94545UL, 0x3c889c31UL, - 0xbfd3f37aUL, 0x3ffac36bUL, 0xcae76cd0UL, 0xbc8f9234UL, 0x3a3c2774UL, - 0x3ffad5ffUL, 0xb6b1b8e5UL, 0x3c97ef3bUL, 0x995ad3adUL, 0x3ffae89fUL, - 0x345dcc81UL, 0x3c97a1cdUL, 0xe622f2ffUL, 0x3ffafb4cUL, 0x0f315ecdUL, - 0xbc94b2fcUL, 0x298db666UL, 0x3ffb0e07UL, 0x4c80e425UL, 0xbc9bdef5UL, - 0x6c9a8952UL, 0x3ffb20ceUL, 0x4a0756ccUL, 0x3c94dd02UL, 0xb84f15fbUL, - 0x3ffb33a2UL, 0x3084d708UL, 0xbc62805eUL, 0x15b749b1UL, 0x3ffb4684UL, - 0xe9df7c90UL, 0xbc7f763dUL, 0x8de5593aUL, 0x3ffb5972UL, 0xbbba6de3UL, - 0xbc9c71dfUL, 0x29f1c52aUL, 0x3ffb6c6eUL, 0x52883f6eUL, 0x3c92a8f3UL, - 0xf2fb5e47UL, 0x3ffb7f76UL, 0x7e54ac3bUL, 0xbc75584fUL, 0xf22749e4UL, - 0x3ffb928cUL, 0x54cb65c6UL, 0xbc9b7216UL, 0x30a1064aUL, 0x3ffba5b0UL, - 0x0e54292eUL, 0xbc9efcd3UL, 0xb79a6f1fUL, 0x3ffbb8e0UL, 0xc9696205UL, - 0xbc3f52d1UL, 0x904bc1d2UL, 0x3ffbcc1eUL, 0x7a2d9e84UL, 0x3c823dd0UL, - 0xc3f3a207UL, 0x3ffbdf69UL, 0x60ea5b53UL, 0xbc3c2623UL, 0x5bd71e09UL, - 0x3ffbf2c2UL, 0x3f6b9c73UL, 0xbc9efdcaUL, 0x6141b33dUL, 0x3ffc0628UL, - 0xa1fbca34UL, 0xbc8d8a5aUL, 0xdd85529cUL, 0x3ffc199bUL, 0x895048ddUL, - 0x3c811065UL, 0xd9fa652cUL, 0x3ffc2d1cUL, 0x17c8a5d7UL, 0xbc96e516UL, - 0x5fffd07aUL, 0x3ffc40abUL, 0xe083c60aUL, 0x3c9b4537UL, 0x78fafb22UL, - 0x3ffc5447UL, 0x2493b5afUL, 0x3c912f07UL, 0x2e57d14bUL, 0x3ffc67f1UL, - 0xff483cadUL, 0x3c92884dUL, 0x8988c933UL, 0x3ffc7ba8UL, 0xbe255559UL, - 0xbc8e76bbUL, 0x9406e7b5UL, 0x3ffc8f6dUL, 0x48805c44UL, 0x3c71acbcUL, - 0x5751c4dbUL, 0x3ffca340UL, 0xd10d08f5UL, 0xbc87f2beUL, 0xdcef9069UL, - 0x3ffcb720UL, 0xd1e949dbUL, 0x3c7503cbUL, 0x2e6d1675UL, 0x3ffccb0fUL, - 0x86009092UL, 0xbc7d220fUL, 0x555dc3faUL, 0x3ffcdf0bUL, 0x53829d72UL, - 0xbc8dd83bUL, 0x5b5bab74UL, 0x3ffcf315UL, 0xb86dff57UL, 0xbc9a08e9UL, - 0x4a07897cUL, 0x3ffd072dUL, 0x43797a9cUL, 0xbc9cbc37UL, 0x2b08c968UL, - 0x3ffd1b53UL, 0x219a36eeUL, 0x3c955636UL, 0x080d89f2UL, 0x3ffd2f87UL, - 0x719d8578UL, 0xbc9d487bUL, 0xeacaa1d6UL, 0x3ffd43c8UL, 0xbf5a1614UL, - 0x3c93db53UL, 0xdcfba487UL, 0x3ffd5818UL, 0xd75b3707UL, 0x3c82ed02UL, - 0xe862e6d3UL, 0x3ffd6c76UL, 0x4a8165a0UL, 0x3c5fe87aUL, 0x16c98398UL, - 0x3ffd80e3UL, 0x8beddfe8UL, 0xbc911ec1UL, 0x71ff6075UL, 0x3ffd955dUL, - 0xbb9af6beUL, 0x3c9a052dUL, 0x03db3285UL, 0x3ffda9e6UL, 0x696db532UL, - 0x3c9c2300UL, 0xd63a8315UL, 0x3ffdbe7cUL, 0x926b8be4UL, 0xbc9b76f1UL, - 0xf301b460UL, 0x3ffdd321UL, 0x78f018c3UL, 0x3c92da57UL, 0x641c0658UL, - 0x3ffde7d5UL, 0x8e79ba8fUL, 0xbc9ca552UL, 0x337b9b5fUL, 0x3ffdfc97UL, - 0x4f184b5cUL, 0xbc91a5cdUL, 0x6b197d17UL, 0x3ffe1167UL, 0xbd5c7f44UL, - 0xbc72b529UL, 0x14f5a129UL, 0x3ffe2646UL, 0x817a1496UL, 0xbc97b627UL, - 0x3b16ee12UL, 0x3ffe3b33UL, 0x31fdc68bUL, 0xbc99f4a4UL, 0xe78b3ff6UL, - 0x3ffe502eUL, 0x80a9cc8fUL, 0x3c839e89UL, 0x24676d76UL, 0x3ffe6539UL, - 0x7522b735UL, 0xbc863ff8UL, 0xfbc74c83UL, 0x3ffe7a51UL, 0xca0c8de2UL, - 0x3c92d522UL, 0x77cdb740UL, 0x3ffe8f79UL, 0x80b054b1UL, 0xbc910894UL, - 0xa2a490daUL, 0x3ffea4afUL, 0x179c2893UL, 0xbc9e9c23UL, 0x867cca6eUL, - 0x3ffeb9f4UL, 0x2293e4f2UL, 0x3c94832fUL, 0x2d8e67f1UL, 0x3ffecf48UL, - 0xb411ad8cUL, 0xbc9c93f3UL, 0xa2188510UL, 0x3ffee4aaUL, 0xa487568dUL, - 0x3c91c68dUL, 0xee615a27UL, 0x3ffefa1bUL, 0x86a4b6b0UL, 0x3c9dc7f4UL, - 0x1cb6412aUL, 0x3fff0f9cUL, 0x65181d45UL, 0xbc932200UL, 0x376bba97UL, - 0x3fff252bUL, 0xbf0d8e43UL, 0x3c93a1a5UL, 0x48dd7274UL, 0x3fff3ac9UL, - 0x3ed837deUL, 0xbc795a5aUL, 0x5b6e4540UL, 0x3fff5076UL, 0x2dd8a18bUL, - 0x3c99d3e1UL, 0x798844f8UL, 0x3fff6632UL, 0x3539343eUL, 0x3c9fa37bUL, - 0xad9cbe14UL, 0x3fff7bfdUL, 0xd006350aUL, 0xbc9dbb12UL, 0x02243c89UL, - 0x3fff91d8UL, 0xa779f689UL, 0xbc612ea8UL, 0x819e90d8UL, 0x3fffa7c1UL, - 0xf3a5931eUL, 0x3c874853UL, 0x3692d514UL, 0x3fffbdbaUL, 0x15098eb6UL, - 0xbc796773UL, 0x2b8f71f1UL, 0x3fffd3c2UL, 0x966579e7UL, 0x3c62eb74UL, - 0x6b2a23d9UL, 0x3fffe9d9UL, 0x7442fde3UL, 0x3c74a603UL -}; - -ALIGNED_(16) juint _e_coeff[] = -{ - 0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL, 0x6fba4e77UL, - 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL, 0xfefa39efUL, 0x3fe62e42UL, - 0x00000000UL, 0x00000000UL -}; - -ALIGNED_(16) juint _coeff_h[] = -{ - 0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL -}; - -ALIGNED_(16) juint _HIGHMASK_LOG_X[] = -{ - 0xf8000000UL, 0xffffffffUL, 0x00000000UL, 0xfffff800UL -}; - -ALIGNED_(8) juint _HALFMASK[] = -{ - 0xf8000000UL, 0xffffffffUL, 0xf8000000UL, 0xffffffffUL -}; - -ALIGNED_(16) juint _coeff_pow[] = -{ - 0x6dc96112UL, 0xbf836578UL, 0xee241472UL, 0xbf9b0301UL, 0x9f95985aUL, - 0xbfb528dbUL, 0xb3841d2aUL, 0xbfd619b6UL, 0x518775e3UL, 0x3f9004f2UL, - 0xac8349bbUL, 0x3fa76c9bUL, 0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, - 0xbf5dabe1UL, 0x9f95985aUL, 0xbfb528dbUL, 0xf8b5787dUL, 0x3ef2531eUL, - 0x486ececbUL, 0x3fc4635eUL, 0x412055ccUL, 0xbdd61bb2UL -}; - -ALIGNED_(16) juint _L_tbl_pow[] = -{ - 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x20000000UL, - 0x3feff00aUL, 0x96621f95UL, 0x3e5b1856UL, 0xe0000000UL, 0x3fefe019UL, - 0xe5916f9eUL, 0xbe325278UL, 0x00000000UL, 0x3fefd02fUL, 0x859a1062UL, - 0x3e595fb7UL, 0xc0000000UL, 0x3fefc049UL, 0xb245f18fUL, 0xbe529c38UL, - 0xe0000000UL, 0x3fefb069UL, 0xad2880a7UL, 0xbe501230UL, 0x60000000UL, - 0x3fefa08fUL, 0xc8e72420UL, 0x3e597bd1UL, 0x80000000UL, 0x3fef90baUL, - 0xc30c4500UL, 0xbe5d6c75UL, 0xe0000000UL, 0x3fef80eaUL, 0x02c63f43UL, - 0x3e2e1318UL, 0xc0000000UL, 0x3fef7120UL, 0xb3d4ccccUL, 0xbe44c52aUL, - 0x00000000UL, 0x3fef615cUL, 0xdbd91397UL, 0xbe4e7d6cUL, 0xa0000000UL, - 0x3fef519cUL, 0x65c5cd68UL, 0xbe522dc8UL, 0xa0000000UL, 0x3fef41e2UL, - 0x46d1306cUL, 0xbe5a840eUL, 0xe0000000UL, 0x3fef322dUL, 0xd2980e94UL, - 0x3e5071afUL, 0xa0000000UL, 0x3fef227eUL, 0x773abadeUL, 0xbe5891e5UL, - 0xa0000000UL, 0x3fef12d4UL, 0xdc6bf46bUL, 0xbe5cccbeUL, 0xe0000000UL, - 0x3fef032fUL, 0xbc7247faUL, 0xbe2bab83UL, 0x80000000UL, 0x3feef390UL, - 0xbcaa1e46UL, 0xbe53bb3bUL, 0x60000000UL, 0x3feee3f6UL, 0x5f6c682dUL, - 0xbe54c619UL, 0x80000000UL, 0x3feed461UL, 0x5141e368UL, 0xbe4b6d86UL, - 0xe0000000UL, 0x3feec4d1UL, 0xec678f76UL, 0xbe369af6UL, 0x80000000UL, - 0x3feeb547UL, 0x41301f55UL, 0xbe2d4312UL, 0x60000000UL, 0x3feea5c2UL, - 0x676da6bdUL, 0xbe4d8dd0UL, 0x60000000UL, 0x3fee9642UL, 0x57a891c4UL, - 0x3e51f991UL, 0xa0000000UL, 0x3fee86c7UL, 0xe4eb491eUL, 0x3e579bf9UL, - 0x20000000UL, 0x3fee7752UL, 0xfddc4a2cUL, 0xbe3356e6UL, 0xc0000000UL, - 0x3fee67e1UL, 0xd75b5bf1UL, 0xbe449531UL, 0x80000000UL, 0x3fee5876UL, - 0xbd423b8eUL, 0x3df54fe4UL, 0x60000000UL, 0x3fee4910UL, 0x330e51b9UL, - 0x3e54289cUL, 0x80000000UL, 0x3fee39afUL, 0x8651a95fUL, 0xbe55aad6UL, - 0xa0000000UL, 0x3fee2a53UL, 0x5e98c708UL, 0xbe2fc4a9UL, 0xe0000000UL, - 0x3fee1afcUL, 0x0989328dUL, 0x3e23958cUL, 0x40000000UL, 0x3fee0babUL, - 0xee642abdUL, 0xbe425dd8UL, 0xa0000000UL, 0x3fedfc5eUL, 0xc394d236UL, - 0x3e526362UL, 0x20000000UL, 0x3feded17UL, 0xe104aa8eUL, 0x3e4ce247UL, - 0xc0000000UL, 0x3fedddd4UL, 0x265a9be4UL, 0xbe5bb77aUL, 0x40000000UL, - 0x3fedce97UL, 0x0ecac52fUL, 0x3e4a7cb1UL, 0xe0000000UL, 0x3fedbf5eUL, - 0x124cb3b8UL, 0x3e257024UL, 0x80000000UL, 0x3fedb02bUL, 0xe6d4febeUL, - 0xbe2033eeUL, 0x20000000UL, 0x3feda0fdUL, 0x39cca00eUL, 0xbe3ddabcUL, - 0xc0000000UL, 0x3fed91d3UL, 0xef8a552aUL, 0xbe543390UL, 0x40000000UL, - 0x3fed82afUL, 0xb8e85204UL, 0x3e513850UL, 0xe0000000UL, 0x3fed738fUL, - 0x3d59fe08UL, 0xbe5db728UL, 0x40000000UL, 0x3fed6475UL, 0x3aa7ead1UL, - 0x3e58804bUL, 0xc0000000UL, 0x3fed555fUL, 0xf8a35ba9UL, 0xbe5298b0UL, - 0x00000000UL, 0x3fed464fUL, 0x9a88dd15UL, 0x3e5a8cdbUL, 0x40000000UL, - 0x3fed3743UL, 0xb0b0a190UL, 0x3e598635UL, 0x80000000UL, 0x3fed283cUL, - 0xe2113295UL, 0xbe5c1119UL, 0x80000000UL, 0x3fed193aUL, 0xafbf1728UL, - 0xbe492e9cUL, 0x60000000UL, 0x3fed0a3dUL, 0xe4a4ccf3UL, 0x3e19b90eUL, - 0x20000000UL, 0x3fecfb45UL, 0xba3cbeb8UL, 0x3e406b50UL, 0xc0000000UL, - 0x3fecec51UL, 0x110f7dddUL, 0x3e0d6806UL, 0x40000000UL, 0x3fecdd63UL, - 0x7dd7d508UL, 0xbe5a8943UL, 0x80000000UL, 0x3fecce79UL, 0x9b60f271UL, - 0xbe50676aUL, 0x80000000UL, 0x3fecbf94UL, 0x0b9ad660UL, 0x3e59174fUL, - 0x60000000UL, 0x3fecb0b4UL, 0x00823d9cUL, 0x3e5bbf72UL, 0x20000000UL, - 0x3feca1d9UL, 0x38a6ec89UL, 0xbe4d38f9UL, 0x80000000UL, 0x3fec9302UL, - 0x3a0b7d8eUL, 0x3e53dbfdUL, 0xc0000000UL, 0x3fec8430UL, 0xc6826b34UL, - 0xbe27c5c9UL, 0xc0000000UL, 0x3fec7563UL, 0x0c706381UL, 0xbe593653UL, - 0x60000000UL, 0x3fec669bUL, 0x7df34ec7UL, 0x3e461ab5UL, 0xe0000000UL, - 0x3fec57d7UL, 0x40e5e7e8UL, 0xbe5c3daeUL, 0x00000000UL, 0x3fec4919UL, - 0x5602770fUL, 0xbe55219dUL, 0xc0000000UL, 0x3fec3a5eUL, 0xec7911ebUL, - 0x3e5a5d25UL, 0x60000000UL, 0x3fec2ba9UL, 0xb39ea225UL, 0xbe53c00bUL, - 0x80000000UL, 0x3fec1cf8UL, 0x967a212eUL, 0x3e5a8ddfUL, 0x60000000UL, - 0x3fec0e4cUL, 0x580798bdUL, 0x3e5f53abUL, 0x00000000UL, 0x3febffa5UL, - 0xb8282df6UL, 0xbe46b874UL, 0x20000000UL, 0x3febf102UL, 0xe33a6729UL, - 0x3e54963fUL, 0x00000000UL, 0x3febe264UL, 0x3b53e88aUL, 0xbe3adce1UL, - 0x60000000UL, 0x3febd3caUL, 0xc2585084UL, 0x3e5cde9fUL, 0x80000000UL, - 0x3febc535UL, 0xa335c5eeUL, 0xbe39fd9cUL, 0x20000000UL, 0x3febb6a5UL, - 0x7325b04dUL, 0x3e42ba15UL, 0x60000000UL, 0x3feba819UL, 0x1564540fUL, - 0x3e3a9f35UL, 0x40000000UL, 0x3feb9992UL, 0x83fff592UL, 0xbe5465ceUL, - 0xa0000000UL, 0x3feb8b0fUL, 0xb9da63d3UL, 0xbe4b1a0aUL, 0x80000000UL, - 0x3feb7c91UL, 0x6d6f1ea4UL, 0x3e557657UL, 0x00000000UL, 0x3feb6e18UL, - 0x5e80a1bfUL, 0x3e4ddbb6UL, 0x00000000UL, 0x3feb5fa3UL, 0x1c9eacb5UL, - 0x3e592877UL, 0xa0000000UL, 0x3feb5132UL, 0x6d40beb3UL, 0xbe51858cUL, - 0xa0000000UL, 0x3feb42c6UL, 0xd740c67bUL, 0x3e427ad2UL, 0x40000000UL, - 0x3feb345fUL, 0xa3e0cceeUL, 0xbe5c2fc4UL, 0x40000000UL, 0x3feb25fcUL, - 0x8e752b50UL, 0xbe3da3c2UL, 0xc0000000UL, 0x3feb179dUL, 0xa892e7deUL, - 0x3e1fb481UL, 0xc0000000UL, 0x3feb0943UL, 0x21ed71e9UL, 0xbe365206UL, - 0x20000000UL, 0x3feafaeeUL, 0x0e1380a3UL, 0x3e5c5b7bUL, 0x20000000UL, - 0x3feaec9dUL, 0x3c3d640eUL, 0xbe5dbbd0UL, 0x60000000UL, 0x3feade50UL, - 0x8f97a715UL, 0x3e3a8ec5UL, 0x20000000UL, 0x3fead008UL, 0x23ab2839UL, - 0x3e2fe98aUL, 0x40000000UL, 0x3feac1c4UL, 0xf4bbd50fUL, 0x3e54d8f6UL, - 0xe0000000UL, 0x3feab384UL, 0x14757c4dUL, 0xbe48774cUL, 0xc0000000UL, - 0x3feaa549UL, 0x7c7b0eeaUL, 0x3e5b51bbUL, 0x20000000UL, 0x3fea9713UL, - 0xf56f7013UL, 0x3e386200UL, 0xe0000000UL, 0x3fea88e0UL, 0xbe428ebeUL, - 0xbe514af5UL, 0xe0000000UL, 0x3fea7ab2UL, 0x8d0e4496UL, 0x3e4f9165UL, - 0x60000000UL, 0x3fea6c89UL, 0xdbacc5d5UL, 0xbe5c063bUL, 0x20000000UL, - 0x3fea5e64UL, 0x3f19d970UL, 0xbe5a0c8cUL, 0x20000000UL, 0x3fea5043UL, - 0x09ea3e6bUL, 0x3e5065dcUL, 0x80000000UL, 0x3fea4226UL, 0x78df246cUL, - 0x3e5e05f6UL, 0x40000000UL, 0x3fea340eUL, 0x4057d4a0UL, 0x3e431b2bUL, - 0x40000000UL, 0x3fea25faUL, 0x82867bb5UL, 0x3e4b76beUL, 0xa0000000UL, - 0x3fea17eaUL, 0x9436f40aUL, 0xbe5aad39UL, 0x20000000UL, 0x3fea09dfUL, - 0x4b5253b3UL, 0x3e46380bUL, 0x00000000UL, 0x3fe9fbd8UL, 0x8fc52466UL, - 0xbe386f9bUL, 0x20000000UL, 0x3fe9edd5UL, 0x22d3f344UL, 0xbe538347UL, - 0x60000000UL, 0x3fe9dfd6UL, 0x1ac33522UL, 0x3e5dbc53UL, 0x00000000UL, - 0x3fe9d1dcUL, 0xeabdff1dUL, 0x3e40fc0cUL, 0xe0000000UL, 0x3fe9c3e5UL, - 0xafd30e73UL, 0xbe585e63UL, 0xe0000000UL, 0x3fe9b5f3UL, 0xa52f226aUL, - 0xbe43e8f9UL, 0x20000000UL, 0x3fe9a806UL, 0xecb8698dUL, 0xbe515b36UL, - 0x80000000UL, 0x3fe99a1cUL, 0xf2b4e89dUL, 0x3e48b62bUL, 0x20000000UL, - 0x3fe98c37UL, 0x7c9a88fbUL, 0x3e44414cUL, 0x00000000UL, 0x3fe97e56UL, - 0xda015741UL, 0xbe5d13baUL, 0xe0000000UL, 0x3fe97078UL, 0x5fdace06UL, - 0x3e51b947UL, 0x00000000UL, 0x3fe962a0UL, 0x956ca094UL, 0x3e518785UL, - 0x40000000UL, 0x3fe954cbUL, 0x01164c1dUL, 0x3e5d5b57UL, 0xc0000000UL, - 0x3fe946faUL, 0xe63b3767UL, 0xbe4f84e7UL, 0x40000000UL, 0x3fe9392eUL, - 0xe57cc2a9UL, 0x3e34eda3UL, 0xe0000000UL, 0x3fe92b65UL, 0x8c75b544UL, - 0x3e5766a0UL, 0xc0000000UL, 0x3fe91da1UL, 0x37d1d087UL, 0xbe5e2ab1UL, - 0x80000000UL, 0x3fe90fe1UL, 0xa953dc20UL, 0x3e5fa1f3UL, 0x80000000UL, - 0x3fe90225UL, 0xdbd3f369UL, 0x3e47d6dbUL, 0xa0000000UL, 0x3fe8f46dUL, - 0x1c9be989UL, 0xbe5e2b0aUL, 0xa0000000UL, 0x3fe8e6b9UL, 0x3c93d76aUL, - 0x3e5c8618UL, 0xe0000000UL, 0x3fe8d909UL, 0x2182fc9aUL, 0xbe41aa9eUL, - 0x20000000UL, 0x3fe8cb5eUL, 0xe6b3539dUL, 0xbe530d19UL, 0x60000000UL, - 0x3fe8bdb6UL, 0x49e58cc3UL, 0xbe3bb374UL, 0xa0000000UL, 0x3fe8b012UL, - 0xa7cfeb8fUL, 0x3e56c412UL, 0x00000000UL, 0x3fe8a273UL, 0x8d52bc19UL, - 0x3e1429b8UL, 0x60000000UL, 0x3fe894d7UL, 0x4dc32c6cUL, 0xbe48604cUL, - 0xc0000000UL, 0x3fe8873fUL, 0x0c868e56UL, 0xbe564ee5UL, 0x00000000UL, - 0x3fe879acUL, 0x56aee828UL, 0x3e5e2fd8UL, 0x60000000UL, 0x3fe86c1cUL, - 0x7ceab8ecUL, 0x3e493365UL, 0xc0000000UL, 0x3fe85e90UL, 0x78d4dadcUL, - 0xbe4f7f25UL, 0x00000000UL, 0x3fe85109UL, 0x0ccd8280UL, 0x3e31e7a2UL, - 0x40000000UL, 0x3fe84385UL, 0x34ba4e15UL, 0x3e328077UL, 0x80000000UL, - 0x3fe83605UL, 0xa670975aUL, 0xbe53eee5UL, 0xa0000000UL, 0x3fe82889UL, - 0xf61b77b2UL, 0xbe43a20aUL, 0xa0000000UL, 0x3fe81b11UL, 0x13e6643bUL, - 0x3e5e5fe5UL, 0xc0000000UL, 0x3fe80d9dUL, 0x82cc94e8UL, 0xbe5ff1f9UL, - 0xa0000000UL, 0x3fe8002dUL, 0x8a0c9c5dUL, 0xbe42b0e7UL, 0x60000000UL, - 0x3fe7f2c1UL, 0x22a16f01UL, 0x3e5d9ea0UL, 0x20000000UL, 0x3fe7e559UL, - 0xc38cd451UL, 0x3e506963UL, 0xc0000000UL, 0x3fe7d7f4UL, 0x9902bc71UL, - 0x3e4503d7UL, 0x40000000UL, 0x3fe7ca94UL, 0xdef2a3c0UL, 0x3e3d98edUL, - 0xa0000000UL, 0x3fe7bd37UL, 0xed49abb0UL, 0x3e24c1ffUL, 0xe0000000UL, - 0x3fe7afdeUL, 0xe3b0be70UL, 0xbe40c467UL, 0x00000000UL, 0x3fe7a28aUL, - 0xaf9f193cUL, 0xbe5dff6cUL, 0xe0000000UL, 0x3fe79538UL, 0xb74cf6b6UL, - 0xbe258ed0UL, 0xa0000000UL, 0x3fe787ebUL, 0x1d9127c7UL, 0x3e345fb0UL, - 0x40000000UL, 0x3fe77aa2UL, 0x1028c21dUL, 0xbe4619bdUL, 0xa0000000UL, - 0x3fe76d5cUL, 0x7cb0b5e4UL, 0x3e40f1a2UL, 0xe0000000UL, 0x3fe7601aUL, - 0x2b1bc4adUL, 0xbe32e8bbUL, 0xe0000000UL, 0x3fe752dcUL, 0x6839f64eUL, - 0x3e41f57bUL, 0xc0000000UL, 0x3fe745a2UL, 0xc4121f7eUL, 0xbe52c40aUL, - 0x60000000UL, 0x3fe7386cUL, 0xd6852d72UL, 0xbe5c4e6bUL, 0xc0000000UL, - 0x3fe72b39UL, 0x91d690f7UL, 0xbe57f88fUL, 0xe0000000UL, 0x3fe71e0aUL, - 0x627a2159UL, 0xbe4425d5UL, 0xc0000000UL, 0x3fe710dfUL, 0x50a54033UL, - 0x3e422b7eUL, 0x60000000UL, 0x3fe703b8UL, 0x3b0b5f91UL, 0x3e5d3857UL, - 0xe0000000UL, 0x3fe6f694UL, 0x84d628a2UL, 0xbe51f090UL, 0x00000000UL, - 0x3fe6e975UL, 0x306d8894UL, 0xbe414d83UL, 0xe0000000UL, 0x3fe6dc58UL, - 0x30bf24aaUL, 0xbe4650caUL, 0x80000000UL, 0x3fe6cf40UL, 0xd4628d69UL, - 0xbe5db007UL, 0xc0000000UL, 0x3fe6c22bUL, 0xa2aae57bUL, 0xbe31d279UL, - 0xc0000000UL, 0x3fe6b51aUL, 0x860edf7eUL, 0xbe2d4c4aUL, 0x80000000UL, - 0x3fe6a80dUL, 0xf3559341UL, 0xbe5f7e98UL, 0xe0000000UL, 0x3fe69b03UL, - 0xa885899eUL, 0xbe5c2011UL, 0xe0000000UL, 0x3fe68dfdUL, 0x2bdc6d37UL, - 0x3e224a82UL, 0xa0000000UL, 0x3fe680fbUL, 0xc12ad1b9UL, 0xbe40cf56UL, - 0x00000000UL, 0x3fe673fdUL, 0x1bcdf659UL, 0xbdf52f2dUL, 0x00000000UL, - 0x3fe66702UL, 0x5df10408UL, 0x3e5663e0UL, 0xc0000000UL, 0x3fe65a0aUL, - 0xa4070568UL, 0xbe40b12fUL, 0x00000000UL, 0x3fe64d17UL, 0x71c54c47UL, - 0x3e5f5e8bUL, 0x00000000UL, 0x3fe64027UL, 0xbd4b7e83UL, 0x3e42ead6UL, - 0xa0000000UL, 0x3fe6333aUL, 0x61598bd2UL, 0xbe4c48d4UL, 0xc0000000UL, - 0x3fe62651UL, 0x6f538d61UL, 0x3e548401UL, 0xa0000000UL, 0x3fe6196cUL, - 0x14344120UL, 0xbe529af6UL, 0x00000000UL, 0x3fe60c8bUL, 0x5982c587UL, - 0xbe3e1e4fUL, 0x00000000UL, 0x3fe5ffadUL, 0xfe51d4eaUL, 0xbe4c897aUL, - 0x80000000UL, 0x3fe5f2d2UL, 0xfd46ebe1UL, 0x3e552e00UL, 0xa0000000UL, - 0x3fe5e5fbUL, 0xa4695699UL, 0x3e5ed471UL, 0x60000000UL, 0x3fe5d928UL, - 0x80d118aeUL, 0x3e456b61UL, 0xa0000000UL, 0x3fe5cc58UL, 0x304c330bUL, - 0x3e54dc29UL, 0x80000000UL, 0x3fe5bf8cUL, 0x0af2dedfUL, 0xbe3aa9bdUL, - 0xe0000000UL, 0x3fe5b2c3UL, 0x15fc9258UL, 0xbe479a37UL, 0xc0000000UL, - 0x3fe5a5feUL, 0x9292c7eaUL, 0x3e188650UL, 0x20000000UL, 0x3fe5993dUL, - 0x33b4d380UL, 0x3e5d6d93UL, 0x20000000UL, 0x3fe58c7fUL, 0x02fd16c7UL, - 0x3e2fe961UL, 0xa0000000UL, 0x3fe57fc4UL, 0x4a05edb6UL, 0xbe4d55b4UL, - 0xa0000000UL, 0x3fe5730dUL, 0x3d443abbUL, 0xbe5e6954UL, 0x00000000UL, - 0x3fe5665aUL, 0x024acfeaUL, 0x3e50e61bUL, 0x00000000UL, 0x3fe559aaUL, - 0xcc9edd09UL, 0xbe325403UL, 0x60000000UL, 0x3fe54cfdUL, 0x1fe26950UL, - 0x3e5d500eUL, 0x60000000UL, 0x3fe54054UL, 0x6c5ae164UL, 0xbe4a79b4UL, - 0xc0000000UL, 0x3fe533aeUL, 0x154b0287UL, 0xbe401571UL, 0xa0000000UL, - 0x3fe5270cUL, 0x0673f401UL, 0xbe56e56bUL, 0xe0000000UL, 0x3fe51a6dUL, - 0x751b639cUL, 0x3e235269UL, 0xa0000000UL, 0x3fe50dd2UL, 0x7c7b2bedUL, - 0x3ddec887UL, 0xc0000000UL, 0x3fe5013aUL, 0xafab4e17UL, 0x3e5e7575UL, - 0x60000000UL, 0x3fe4f4a6UL, 0x2e308668UL, 0x3e59aed6UL, 0x80000000UL, - 0x3fe4e815UL, 0xf33e2a76UL, 0xbe51f184UL, 0xe0000000UL, 0x3fe4db87UL, - 0x839f3e3eUL, 0x3e57db01UL, 0xc0000000UL, 0x3fe4cefdUL, 0xa9eda7bbUL, - 0x3e535e0fUL, 0x00000000UL, 0x3fe4c277UL, 0x2a8f66a5UL, 0x3e5ce451UL, - 0xc0000000UL, 0x3fe4b5f3UL, 0x05192456UL, 0xbe4e8518UL, 0xc0000000UL, - 0x3fe4a973UL, 0x4aa7cd1dUL, 0x3e46784aUL, 0x40000000UL, 0x3fe49cf7UL, - 0x8e23025eUL, 0xbe5749f2UL, 0x00000000UL, 0x3fe4907eUL, 0x18d30215UL, - 0x3e360f39UL, 0x20000000UL, 0x3fe48408UL, 0x63dcf2f3UL, 0x3e5e00feUL, - 0xc0000000UL, 0x3fe47795UL, 0x46182d09UL, 0xbe5173d9UL, 0xa0000000UL, - 0x3fe46b26UL, 0x8f0e62aaUL, 0xbe48f281UL, 0xe0000000UL, 0x3fe45ebaUL, - 0x5775c40cUL, 0xbe56aad4UL, 0x60000000UL, 0x3fe45252UL, 0x0fe25f69UL, - 0x3e48bd71UL, 0x40000000UL, 0x3fe445edUL, 0xe9989ec5UL, 0x3e590d97UL, - 0x80000000UL, 0x3fe4398bUL, 0xb3d9ffe3UL, 0x3e479dbcUL, 0x20000000UL, - 0x3fe42d2dUL, 0x388e4d2eUL, 0xbe5eed80UL, 0xe0000000UL, 0x3fe420d1UL, - 0x6f797c18UL, 0x3e554b4cUL, 0x20000000UL, 0x3fe4147aUL, 0x31048bb4UL, - 0xbe5b1112UL, 0x80000000UL, 0x3fe40825UL, 0x2efba4f9UL, 0x3e48ebc7UL, - 0x40000000UL, 0x3fe3fbd4UL, 0x50201119UL, 0x3e40b701UL, 0x40000000UL, - 0x3fe3ef86UL, 0x0a4db32cUL, 0x3e551de8UL, 0xa0000000UL, 0x3fe3e33bUL, - 0x0c9c148bUL, 0xbe50c1f6UL, 0x20000000UL, 0x3fe3d6f4UL, 0xc9129447UL, - 0x3e533fa0UL, 0x00000000UL, 0x3fe3cab0UL, 0xaae5b5a0UL, 0xbe22b68eUL, - 0x20000000UL, 0x3fe3be6fUL, 0x02305e8aUL, 0xbe54fc08UL, 0x60000000UL, - 0x3fe3b231UL, 0x7f908258UL, 0x3e57dc05UL, 0x00000000UL, 0x3fe3a5f7UL, - 0x1a09af78UL, 0x3e08038bUL, 0xe0000000UL, 0x3fe399bfUL, 0x490643c1UL, - 0xbe5dbe42UL, 0xe0000000UL, 0x3fe38d8bUL, 0x5e8ad724UL, 0xbe3c2b72UL, - 0x20000000UL, 0x3fe3815bUL, 0xc67196b6UL, 0x3e1713cfUL, 0xa0000000UL, - 0x3fe3752dUL, 0x6182e429UL, 0xbe3ec14cUL, 0x40000000UL, 0x3fe36903UL, - 0xab6eb1aeUL, 0x3e5a2cc5UL, 0x40000000UL, 0x3fe35cdcUL, 0xfe5dc064UL, - 0xbe5c5878UL, 0x40000000UL, 0x3fe350b8UL, 0x0ba6b9e4UL, 0x3e51619bUL, - 0x80000000UL, 0x3fe34497UL, 0x857761aaUL, 0x3e5fff53UL, 0x00000000UL, - 0x3fe3387aUL, 0xf872d68cUL, 0x3e484f4dUL, 0xa0000000UL, 0x3fe32c5fUL, - 0x087e97c2UL, 0x3e52842eUL, 0x80000000UL, 0x3fe32048UL, 0x73d6d0c0UL, - 0xbe503edfUL, 0x80000000UL, 0x3fe31434UL, 0x0c1456a1UL, 0xbe5f72adUL, - 0xa0000000UL, 0x3fe30823UL, 0x83a1a4d5UL, 0xbe5e65ccUL, 0xe0000000UL, - 0x3fe2fc15UL, 0x855a7390UL, 0xbe506438UL, 0x40000000UL, 0x3fe2f00bUL, - 0xa2898287UL, 0x3e3d22a2UL, 0xe0000000UL, 0x3fe2e403UL, 0x8b56f66fUL, - 0xbe5aa5fdUL, 0x80000000UL, 0x3fe2d7ffUL, 0x52db119aUL, 0x3e3a2e3dUL, - 0x60000000UL, 0x3fe2cbfeUL, 0xe2ddd4c0UL, 0xbe586469UL, 0x40000000UL, - 0x3fe2c000UL, 0x6b01bf10UL, 0x3e352b9dUL, 0x40000000UL, 0x3fe2b405UL, - 0xb07a1cdfUL, 0x3e5c5cdaUL, 0x80000000UL, 0x3fe2a80dUL, 0xc7b5f868UL, - 0xbe5668b3UL, 0xc0000000UL, 0x3fe29c18UL, 0x185edf62UL, 0xbe563d66UL, - 0x00000000UL, 0x3fe29027UL, 0xf729e1ccUL, 0x3e59a9a0UL, 0x80000000UL, - 0x3fe28438UL, 0x6433c727UL, 0xbe43cc89UL, 0x00000000UL, 0x3fe2784dUL, - 0x41782631UL, 0xbe30750cUL, 0xa0000000UL, 0x3fe26c64UL, 0x914911b7UL, - 0xbe58290eUL, 0x40000000UL, 0x3fe2607fUL, 0x3dcc73e1UL, 0xbe4269cdUL, - 0x00000000UL, 0x3fe2549dUL, 0x2751bf70UL, 0xbe5a6998UL, 0xc0000000UL, - 0x3fe248bdUL, 0x4248b9fbUL, 0xbe4ddb00UL, 0x80000000UL, 0x3fe23ce1UL, - 0xf35cf82fUL, 0x3e561b71UL, 0x60000000UL, 0x3fe23108UL, 0x8e481a2dUL, - 0x3e518fb9UL, 0x60000000UL, 0x3fe22532UL, 0x5ab96edcUL, 0xbe5fafc5UL, - 0x40000000UL, 0x3fe2195fUL, 0x80943911UL, 0xbe07f819UL, 0x40000000UL, - 0x3fe20d8fUL, 0x386f2d6cUL, 0xbe54ba8bUL, 0x40000000UL, 0x3fe201c2UL, - 0xf29664acUL, 0xbe5eb815UL, 0x20000000UL, 0x3fe1f5f8UL, 0x64f03390UL, - 0x3e5e320cUL, 0x20000000UL, 0x3fe1ea31UL, 0x747ff696UL, 0x3e5ef0a5UL, - 0x40000000UL, 0x3fe1de6dUL, 0x3e9ceb51UL, 0xbe5f8d27UL, 0x20000000UL, - 0x3fe1d2acUL, 0x4ae0b55eUL, 0x3e5faa21UL, 0x20000000UL, 0x3fe1c6eeUL, - 0x28569a5eUL, 0x3e598a4fUL, 0x20000000UL, 0x3fe1bb33UL, 0x54b33e07UL, - 0x3e46130aUL, 0x20000000UL, 0x3fe1af7bUL, 0x024f1078UL, 0xbe4dbf93UL, - 0x00000000UL, 0x3fe1a3c6UL, 0xb0783bfaUL, 0x3e419248UL, 0xe0000000UL, - 0x3fe19813UL, 0x2f02b836UL, 0x3e4e02b7UL, 0xc0000000UL, 0x3fe18c64UL, - 0x28dec9d4UL, 0x3e09064fUL, 0x80000000UL, 0x3fe180b8UL, 0x45cbf406UL, - 0x3e5b1f46UL, 0x40000000UL, 0x3fe1750fUL, 0x03d9964cUL, 0x3e5b0a79UL, - 0x00000000UL, 0x3fe16969UL, 0x8b5b882bUL, 0xbe238086UL, 0xa0000000UL, - 0x3fe15dc5UL, 0x73bad6f8UL, 0xbdf1fca4UL, 0x20000000UL, 0x3fe15225UL, - 0x5385769cUL, 0x3e5e8d76UL, 0xa0000000UL, 0x3fe14687UL, 0x1676dc6bUL, - 0x3e571d08UL, 0x20000000UL, 0x3fe13aedUL, 0xa8c41c7fUL, 0xbe598a25UL, - 0x60000000UL, 0x3fe12f55UL, 0xc4e1aaf0UL, 0x3e435277UL, 0xa0000000UL, - 0x3fe123c0UL, 0x403638e1UL, 0xbe21aa7cUL, 0xc0000000UL, 0x3fe1182eUL, - 0x557a092bUL, 0xbdd0116bUL, 0xc0000000UL, 0x3fe10c9fUL, 0x7d779f66UL, - 0x3e4a61baUL, 0xc0000000UL, 0x3fe10113UL, 0x2b09c645UL, 0xbe5d586eUL, - 0x20000000UL, 0x3fe0ea04UL, 0xea2cad46UL, 0x3e5aa97cUL, 0x20000000UL, - 0x3fe0d300UL, 0x23190e54UL, 0x3e50f1a7UL, 0xa0000000UL, 0x3fe0bc07UL, - 0x1379a5a6UL, 0xbe51619dUL, 0x60000000UL, 0x3fe0a51aUL, 0x926a3d4aUL, - 0x3e5cf019UL, 0xa0000000UL, 0x3fe08e38UL, 0xa8c24358UL, 0x3e35241eUL, - 0x20000000UL, 0x3fe07762UL, 0x24317e7aUL, 0x3e512cfaUL, 0x00000000UL, - 0x3fe06097UL, 0xfd9cf274UL, 0xbe55bef3UL, 0x00000000UL, 0x3fe049d7UL, - 0x3689b49dUL, 0xbe36d26dUL, 0x40000000UL, 0x3fe03322UL, 0xf72ef6c4UL, - 0xbe54cd08UL, 0xa0000000UL, 0x3fe01c78UL, 0x23702d2dUL, 0xbe5900bfUL, - 0x00000000UL, 0x3fe005daUL, 0x3f59c14cUL, 0x3e57d80bUL, 0x40000000UL, - 0x3fdfde8dUL, 0xad67766dUL, 0xbe57fad4UL, 0x40000000UL, 0x3fdfb17cUL, - 0x644f4ae7UL, 0x3e1ee43bUL, 0x40000000UL, 0x3fdf8481UL, 0x903234d2UL, - 0x3e501a86UL, 0x40000000UL, 0x3fdf579cUL, 0xafe9e509UL, 0xbe267c3eUL, - 0x00000000UL, 0x3fdf2acdUL, 0xb7dfda0bUL, 0xbe48149bUL, 0x40000000UL, - 0x3fdefe13UL, 0x3b94305eUL, 0x3e5f4ea7UL, 0x80000000UL, 0x3fded16fUL, - 0x5d95da61UL, 0xbe55c198UL, 0x00000000UL, 0x3fdea4e1UL, 0x406960c9UL, - 0xbdd99a19UL, 0x00000000UL, 0x3fde7868UL, 0xd22f3539UL, 0x3e470c78UL, - 0x80000000UL, 0x3fde4c04UL, 0x83eec535UL, 0xbe3e1232UL, 0x40000000UL, - 0x3fde1fb6UL, 0x3dfbffcbUL, 0xbe4b7d71UL, 0x40000000UL, 0x3fddf37dUL, - 0x7e1be4e0UL, 0xbe5b8f8fUL, 0x40000000UL, 0x3fddc759UL, 0x46dae887UL, - 0xbe350458UL, 0x80000000UL, 0x3fdd9b4aUL, 0xed6ecc49UL, 0xbe5f0045UL, - 0x80000000UL, 0x3fdd6f50UL, 0x2e9e883cUL, 0x3e2915daUL, 0x80000000UL, - 0x3fdd436bUL, 0xf0bccb32UL, 0x3e4a68c9UL, 0x80000000UL, 0x3fdd179bUL, - 0x9bbfc779UL, 0xbe54a26aUL, 0x00000000UL, 0x3fdcebe0UL, 0x7cea33abUL, - 0x3e43c6b7UL, 0x40000000UL, 0x3fdcc039UL, 0xe740fd06UL, 0x3e5526c2UL, - 0x40000000UL, 0x3fdc94a7UL, 0x9eadeb1aUL, 0xbe396d8dUL, 0xc0000000UL, - 0x3fdc6929UL, 0xf0a8f95aUL, 0xbe5c0ab2UL, 0x80000000UL, 0x3fdc3dc0UL, - 0x6ee2693bUL, 0x3e0992e6UL, 0xc0000000UL, 0x3fdc126bUL, 0x5ac6b581UL, - 0xbe2834b6UL, 0x40000000UL, 0x3fdbe72bUL, 0x8cc226ffUL, 0x3e3596a6UL, - 0x00000000UL, 0x3fdbbbffUL, 0xf92a74bbUL, 0x3e3c5813UL, 0x00000000UL, - 0x3fdb90e7UL, 0x479664c0UL, 0xbe50d644UL, 0x00000000UL, 0x3fdb65e3UL, - 0x5004975bUL, 0xbe55258fUL, 0x00000000UL, 0x3fdb3af3UL, 0xe4b23194UL, - 0xbe588407UL, 0xc0000000UL, 0x3fdb1016UL, 0xe65d4d0aUL, 0x3e527c26UL, - 0x80000000UL, 0x3fdae54eUL, 0x814fddd6UL, 0x3e5962a2UL, 0x40000000UL, - 0x3fdaba9aUL, 0xe19d0913UL, 0xbe562f4eUL, 0x80000000UL, 0x3fda8ff9UL, - 0x43cfd006UL, 0xbe4cfdebUL, 0x40000000UL, 0x3fda656cUL, 0x686f0a4eUL, - 0x3e5e47a8UL, 0xc0000000UL, 0x3fda3af2UL, 0x7200d410UL, 0x3e5e1199UL, - 0xc0000000UL, 0x3fda108cUL, 0xabd2266eUL, 0x3e5ee4d1UL, 0x40000000UL, - 0x3fd9e63aUL, 0x396f8f2cUL, 0x3e4dbffbUL, 0x00000000UL, 0x3fd9bbfbUL, - 0xe32b25ddUL, 0x3e5c3a54UL, 0x40000000UL, 0x3fd991cfUL, 0x431e4035UL, - 0xbe457925UL, 0x80000000UL, 0x3fd967b6UL, 0x7bed3dd3UL, 0x3e40c61dUL, - 0x00000000UL, 0x3fd93db1UL, 0xd7449365UL, 0x3e306419UL, 0x80000000UL, - 0x3fd913beUL, 0x1746e791UL, 0x3e56fcfcUL, 0x40000000UL, 0x3fd8e9dfUL, - 0xf3a9028bUL, 0xbe5041b9UL, 0xc0000000UL, 0x3fd8c012UL, 0x56840c50UL, - 0xbe26e20aUL, 0x40000000UL, 0x3fd89659UL, 0x19763102UL, 0xbe51f466UL, - 0x80000000UL, 0x3fd86cb2UL, 0x7032de7cUL, 0xbe4d298aUL, 0x80000000UL, - 0x3fd8431eUL, 0xdeb39fabUL, 0xbe4361ebUL, 0x40000000UL, 0x3fd8199dUL, - 0x5d01cbe0UL, 0xbe5425b3UL, 0x80000000UL, 0x3fd7f02eUL, 0x3ce99aa9UL, - 0x3e146fa8UL, 0x80000000UL, 0x3fd7c6d2UL, 0xd1a262b9UL, 0xbe5a1a69UL, - 0xc0000000UL, 0x3fd79d88UL, 0x8606c236UL, 0x3e423a08UL, 0x80000000UL, - 0x3fd77451UL, 0x8fd1e1b7UL, 0x3e5a6a63UL, 0xc0000000UL, 0x3fd74b2cUL, - 0xe491456aUL, 0x3e42c1caUL, 0x40000000UL, 0x3fd7221aUL, 0x4499a6d7UL, - 0x3e36a69aUL, 0x00000000UL, 0x3fd6f91aUL, 0x5237df94UL, 0xbe0f8f02UL, - 0x00000000UL, 0x3fd6d02cUL, 0xb6482c6eUL, 0xbe5abcf7UL, 0x00000000UL, - 0x3fd6a750UL, 0x1919fd61UL, 0xbe57ade2UL, 0x00000000UL, 0x3fd67e86UL, - 0xaa7a994dUL, 0xbe3f3fbdUL, 0x00000000UL, 0x3fd655ceUL, 0x67db014cUL, - 0x3e33c550UL, 0x00000000UL, 0x3fd62d28UL, 0xa82856b7UL, 0xbe1409d1UL, - 0xc0000000UL, 0x3fd60493UL, 0x1e6a300dUL, 0x3e55d899UL, 0x80000000UL, - 0x3fd5dc11UL, 0x1222bd5cUL, 0xbe35bfc0UL, 0xc0000000UL, 0x3fd5b3a0UL, - 0x6e8dc2d3UL, 0x3e5d4d79UL, 0x00000000UL, 0x3fd58b42UL, 0xe0e4ace6UL, - 0xbe517303UL, 0x80000000UL, 0x3fd562f4UL, 0xb306e0a8UL, 0x3e5edf0fUL, - 0xc0000000UL, 0x3fd53ab8UL, 0x6574bc54UL, 0x3e5ee859UL, 0x80000000UL, - 0x3fd5128eUL, 0xea902207UL, 0x3e5f6188UL, 0xc0000000UL, 0x3fd4ea75UL, - 0x9f911d79UL, 0x3e511735UL, 0x80000000UL, 0x3fd4c26eUL, 0xf9c77397UL, - 0xbe5b1643UL, 0x40000000UL, 0x3fd49a78UL, 0x15fc9258UL, 0x3e479a37UL, - 0x80000000UL, 0x3fd47293UL, 0xd5a04dd9UL, 0xbe426e56UL, 0xc0000000UL, - 0x3fd44abfUL, 0xe04042f5UL, 0x3e56f7c6UL, 0x40000000UL, 0x3fd422fdUL, - 0x1d8bf2c8UL, 0x3e5d8810UL, 0x00000000UL, 0x3fd3fb4cUL, 0x88a8ddeeUL, - 0xbe311454UL, 0xc0000000UL, 0x3fd3d3abUL, 0x3e3b5e47UL, 0xbe5d1b72UL, - 0x40000000UL, 0x3fd3ac1cUL, 0xc2ab5d59UL, 0x3e31b02bUL, 0xc0000000UL, - 0x3fd3849dUL, 0xd4e34b9eUL, 0x3e51cb2fUL, 0x40000000UL, 0x3fd35d30UL, - 0x177204fbUL, 0xbe2b8cd7UL, 0x80000000UL, 0x3fd335d3UL, 0xfcd38c82UL, - 0xbe4356e1UL, 0x80000000UL, 0x3fd30e87UL, 0x64f54accUL, 0xbe4e6224UL, - 0x00000000UL, 0x3fd2e74cUL, 0xaa7975d9UL, 0x3e5dc0feUL, 0x80000000UL, - 0x3fd2c021UL, 0x516dab3fUL, 0xbe50ffa3UL, 0x40000000UL, 0x3fd29907UL, - 0x2bfb7313UL, 0x3e5674a2UL, 0xc0000000UL, 0x3fd271fdUL, 0x0549fc99UL, - 0x3e385d29UL, 0xc0000000UL, 0x3fd24b04UL, 0x55b63073UL, 0xbe500c6dUL, - 0x00000000UL, 0x3fd2241cUL, 0x3f91953aUL, 0x3e389977UL, 0xc0000000UL, - 0x3fd1fd43UL, 0xa1543f71UL, 0xbe3487abUL, 0xc0000000UL, 0x3fd1d67bUL, - 0x4ec8867cUL, 0x3df6a2dcUL, 0x00000000UL, 0x3fd1afc4UL, 0x4328e3bbUL, - 0x3e41d9c0UL, 0x80000000UL, 0x3fd1891cUL, 0x2e1cda84UL, 0x3e3bdd87UL, - 0x40000000UL, 0x3fd16285UL, 0x4b5331aeUL, 0xbe53128eUL, 0x00000000UL, - 0x3fd13bfeUL, 0xb9aec164UL, 0xbe52ac98UL, 0xc0000000UL, 0x3fd11586UL, - 0xd91e1316UL, 0xbe350630UL, 0x80000000UL, 0x3fd0ef1fUL, 0x7cacc12cUL, - 0x3e3f5219UL, 0x40000000UL, 0x3fd0c8c8UL, 0xbce277b7UL, 0x3e3d30c0UL, - 0x00000000UL, 0x3fd0a281UL, 0x2a63447dUL, 0xbe541377UL, 0x80000000UL, - 0x3fd07c49UL, 0xfac483b5UL, 0xbe5772ecUL, 0xc0000000UL, 0x3fd05621UL, - 0x36b8a570UL, 0xbe4fd4bdUL, 0xc0000000UL, 0x3fd03009UL, 0xbae505f7UL, - 0xbe450388UL, 0x80000000UL, 0x3fd00a01UL, 0x3e35aeadUL, 0xbe5430fcUL, - 0x80000000UL, 0x3fcfc811UL, 0x707475acUL, 0x3e38806eUL, 0x80000000UL, - 0x3fcf7c3fUL, 0xc91817fcUL, 0xbe40cceaUL, 0x80000000UL, 0x3fcf308cUL, - 0xae05d5e9UL, 0xbe4919b8UL, 0x80000000UL, 0x3fcee4f8UL, 0xae6cc9e6UL, - 0xbe530b94UL, 0x00000000UL, 0x3fce9983UL, 0x1efe3e8eUL, 0x3e57747eUL, - 0x00000000UL, 0x3fce4e2dUL, 0xda78d9bfUL, 0xbe59a608UL, 0x00000000UL, - 0x3fce02f5UL, 0x8abe2c2eUL, 0x3e4a35adUL, 0x00000000UL, 0x3fcdb7dcUL, - 0x1495450dUL, 0xbe0872ccUL, 0x80000000UL, 0x3fcd6ce1UL, 0x86ee0ba0UL, - 0xbe4f59a0UL, 0x00000000UL, 0x3fcd2205UL, 0xe81ca888UL, 0x3e5402c3UL, - 0x00000000UL, 0x3fccd747UL, 0x3b4424b9UL, 0x3e5dfdc3UL, 0x80000000UL, - 0x3fcc8ca7UL, 0xd305b56cUL, 0x3e202da6UL, 0x00000000UL, 0x3fcc4226UL, - 0x399a6910UL, 0xbe482a1cUL, 0x80000000UL, 0x3fcbf7c2UL, 0x747f7938UL, - 0xbe587372UL, 0x80000000UL, 0x3fcbad7cUL, 0x6fc246a0UL, 0x3e50d83dUL, - 0x00000000UL, 0x3fcb6355UL, 0xee9e9be5UL, 0xbe5c35bdUL, 0x80000000UL, - 0x3fcb194aUL, 0x8416c0bcUL, 0x3e546d4fUL, 0x00000000UL, 0x3fcacf5eUL, - 0x49f7f08fUL, 0x3e56da76UL, 0x00000000UL, 0x3fca858fUL, 0x5dc30de2UL, - 0x3e5f390cUL, 0x00000000UL, 0x3fca3bdeUL, 0x950583b6UL, 0xbe5e4169UL, - 0x80000000UL, 0x3fc9f249UL, 0x33631553UL, 0x3e52aeb1UL, 0x00000000UL, - 0x3fc9a8d3UL, 0xde8795a6UL, 0xbe59a504UL, 0x00000000UL, 0x3fc95f79UL, - 0x076bf41eUL, 0x3e5122feUL, 0x80000000UL, 0x3fc9163cUL, 0x2914c8e7UL, - 0x3e3dd064UL, 0x00000000UL, 0x3fc8cd1dUL, 0x3a30eca3UL, 0xbe21b4aaUL, - 0x80000000UL, 0x3fc8841aUL, 0xb2a96650UL, 0xbe575444UL, 0x80000000UL, - 0x3fc83b34UL, 0x2376c0cbUL, 0xbe2a74c7UL, 0x80000000UL, 0x3fc7f26bUL, - 0xd8a0b653UL, 0xbe5181b6UL, 0x00000000UL, 0x3fc7a9bfUL, 0x32257882UL, - 0xbe4a78b4UL, 0x00000000UL, 0x3fc7612fUL, 0x1eee8bd9UL, 0xbe1bfe9dUL, - 0x80000000UL, 0x3fc718bbUL, 0x0c603cc4UL, 0x3e36fdc9UL, 0x80000000UL, - 0x3fc6d064UL, 0x3728b8cfUL, 0xbe1e542eUL, 0x80000000UL, 0x3fc68829UL, - 0xc79a4067UL, 0x3e5c380fUL, 0x00000000UL, 0x3fc6400bUL, 0xf69eac69UL, - 0x3e550a84UL, 0x80000000UL, 0x3fc5f808UL, 0xb7a780a4UL, 0x3e5d9224UL, - 0x80000000UL, 0x3fc5b022UL, 0xad9dfb1eUL, 0xbe55242fUL, 0x00000000UL, - 0x3fc56858UL, 0x659b18beUL, 0xbe4bfda3UL, 0x80000000UL, 0x3fc520a9UL, - 0x66ee3631UL, 0xbe57d769UL, 0x80000000UL, 0x3fc4d916UL, 0x1ec62819UL, - 0x3e2427f7UL, 0x80000000UL, 0x3fc4919fUL, 0xdec25369UL, 0xbe435431UL, - 0x00000000UL, 0x3fc44a44UL, 0xa8acfc4bUL, 0xbe3c62e8UL, 0x00000000UL, - 0x3fc40304UL, 0xcf1d3eabUL, 0xbdfba29fUL, 0x80000000UL, 0x3fc3bbdfUL, - 0x79aba3eaUL, 0xbdf1b7c8UL, 0x80000000UL, 0x3fc374d6UL, 0xb8d186daUL, - 0xbe5130cfUL, 0x80000000UL, 0x3fc32de8UL, 0x9d74f152UL, 0x3e2285b6UL, - 0x00000000UL, 0x3fc2e716UL, 0x50ae7ca9UL, 0xbe503920UL, 0x80000000UL, - 0x3fc2a05eUL, 0x6caed92eUL, 0xbe533924UL, 0x00000000UL, 0x3fc259c2UL, - 0x9cb5034eUL, 0xbe510e31UL, 0x80000000UL, 0x3fc21340UL, 0x12c4d378UL, - 0xbe540b43UL, 0x80000000UL, 0x3fc1ccd9UL, 0xcc418706UL, 0x3e59887aUL, - 0x00000000UL, 0x3fc1868eUL, 0x921f4106UL, 0xbe528e67UL, 0x80000000UL, - 0x3fc1405cUL, 0x3969441eUL, 0x3e5d8051UL, 0x00000000UL, 0x3fc0fa46UL, - 0xd941ef5bUL, 0x3e5f9079UL, 0x80000000UL, 0x3fc0b44aUL, 0x5a3e81b2UL, - 0xbe567691UL, 0x00000000UL, 0x3fc06e69UL, 0x9d66afe7UL, 0xbe4d43fbUL, - 0x00000000UL, 0x3fc028a2UL, 0x0a92a162UL, 0xbe52f394UL, 0x00000000UL, - 0x3fbfc5eaUL, 0x209897e5UL, 0x3e529e37UL, 0x00000000UL, 0x3fbf3ac5UL, - 0x8458bd7bUL, 0x3e582831UL, 0x00000000UL, 0x3fbeafd5UL, 0xb8d8b4b8UL, - 0xbe486b4aUL, 0x00000000UL, 0x3fbe2518UL, 0xe0a3b7b6UL, 0x3e5bafd2UL, - 0x00000000UL, 0x3fbd9a90UL, 0x2bf2710eUL, 0x3e383b2bUL, 0x00000000UL, - 0x3fbd103cUL, 0x73eb6ab7UL, 0xbe56d78dUL, 0x00000000UL, 0x3fbc861bUL, - 0x32ceaff5UL, 0xbe32dc5aUL, 0x00000000UL, 0x3fbbfc2eUL, 0xbee04cb7UL, - 0xbe4a71a4UL, 0x00000000UL, 0x3fbb7274UL, 0x35ae9577UL, 0x3e38142fUL, - 0x00000000UL, 0x3fbae8eeUL, 0xcbaddab4UL, 0xbe5490f0UL, 0x00000000UL, - 0x3fba5f9aUL, 0x95ce1114UL, 0x3e597c71UL, 0x00000000UL, 0x3fb9d67aUL, - 0x6d7c0f78UL, 0x3e3abc2dUL, 0x00000000UL, 0x3fb94d8dUL, 0x2841a782UL, - 0xbe566cbcUL, 0x00000000UL, 0x3fb8c4d2UL, 0x6ed429c6UL, 0xbe3cfff9UL, - 0x00000000UL, 0x3fb83c4aUL, 0xe4a49fbbUL, 0xbe552964UL, 0x00000000UL, - 0x3fb7b3f4UL, 0x2193d81eUL, 0xbe42fa72UL, 0x00000000UL, 0x3fb72bd0UL, - 0xdd70c122UL, 0x3e527a8cUL, 0x00000000UL, 0x3fb6a3dfUL, 0x03108a54UL, - 0xbe450393UL, 0x00000000UL, 0x3fb61c1fUL, 0x30ff7954UL, 0x3e565840UL, - 0x00000000UL, 0x3fb59492UL, 0xdedd460cUL, 0xbe5422b5UL, 0x00000000UL, - 0x3fb50d36UL, 0x950f9f45UL, 0xbe5313f6UL, 0x00000000UL, 0x3fb4860bUL, - 0x582cdcb1UL, 0x3e506d39UL, 0x00000000UL, 0x3fb3ff12UL, 0x7216d3a6UL, - 0x3e4aa719UL, 0x00000000UL, 0x3fb3784aUL, 0x57a423fdUL, 0x3e5a9b9fUL, - 0x00000000UL, 0x3fb2f1b4UL, 0x7a138b41UL, 0xbe50b418UL, 0x00000000UL, - 0x3fb26b4eUL, 0x2fbfd7eaUL, 0x3e23a53eUL, 0x00000000UL, 0x3fb1e519UL, - 0x18913ccbUL, 0x3e465fc1UL, 0x00000000UL, 0x3fb15f15UL, 0x7ea24e21UL, - 0x3e042843UL, 0x00000000UL, 0x3fb0d941UL, 0x7c6d9c77UL, 0x3e59f61eUL, - 0x00000000UL, 0x3fb0539eUL, 0x114efd44UL, 0x3e4ccab7UL, 0x00000000UL, - 0x3faf9c56UL, 0x1777f657UL, 0x3e552f65UL, 0x00000000UL, 0x3fae91d2UL, - 0xc317b86aUL, 0xbe5a61e0UL, 0x00000000UL, 0x3fad87acUL, 0xb7664efbUL, - 0xbe41f64eUL, 0x00000000UL, 0x3fac7de6UL, 0x5d3d03a9UL, 0x3e0807a0UL, - 0x00000000UL, 0x3fab7480UL, 0x743c38ebUL, 0xbe3726e1UL, 0x00000000UL, - 0x3faa6b78UL, 0x06a253f1UL, 0x3e5ad636UL, 0x00000000UL, 0x3fa962d0UL, - 0xa35f541bUL, 0x3e5a187aUL, 0x00000000UL, 0x3fa85a88UL, 0x4b86e446UL, - 0xbe508150UL, 0x00000000UL, 0x3fa7529cUL, 0x2589cacfUL, 0x3e52938aUL, - 0x00000000UL, 0x3fa64b10UL, 0xaf6b11f2UL, 0xbe3454cdUL, 0x00000000UL, - 0x3fa543e2UL, 0x97506fefUL, 0xbe5fdec5UL, 0x00000000UL, 0x3fa43d10UL, - 0xe75f7dd9UL, 0xbe388dd3UL, 0x00000000UL, 0x3fa3369cUL, 0xa4139632UL, - 0xbdea5177UL, 0x00000000UL, 0x3fa23086UL, 0x352d6f1eUL, 0xbe565ad6UL, - 0x00000000UL, 0x3fa12accUL, 0x77449eb7UL, 0xbe50d5c7UL, 0x00000000UL, - 0x3fa0256eUL, 0x7478da78UL, 0x3e404724UL, 0x00000000UL, 0x3f9e40dcUL, - 0xf59cef7fUL, 0xbe539d0aUL, 0x00000000UL, 0x3f9c3790UL, 0x1511d43cUL, - 0x3e53c2c8UL, 0x00000000UL, 0x3f9a2f00UL, 0x9b8bff3cUL, 0xbe43b3e1UL, - 0x00000000UL, 0x3f982724UL, 0xad1e22a5UL, 0x3e46f0bdUL, 0x00000000UL, - 0x3f962000UL, 0x130d9356UL, 0x3e475ba0UL, 0x00000000UL, 0x3f941994UL, - 0x8f86f883UL, 0xbe513d0bUL, 0x00000000UL, 0x3f9213dcUL, 0x914d0dc8UL, - 0xbe534335UL, 0x00000000UL, 0x3f900ed8UL, 0x2d73e5e7UL, 0xbe22ba75UL, - 0x00000000UL, 0x3f8c1510UL, 0xc5b7d70eUL, 0x3e599c5dUL, 0x00000000UL, - 0x3f880de0UL, 0x8a27857eUL, 0xbe3d28c8UL, 0x00000000UL, 0x3f840810UL, - 0xda767328UL, 0x3e531b3dUL, 0x00000000UL, 0x3f8003b0UL, 0x77bacaf3UL, - 0xbe5f04e3UL, 0x00000000UL, 0x3f780150UL, 0xdf4b0720UL, 0x3e5a8bffUL, - 0x00000000UL, 0x3f6ffc40UL, 0x34c48e71UL, 0xbe3fcd99UL, 0x00000000UL, - 0x3f5ff6c0UL, 0x1ad218afUL, 0xbe4c78a7UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x80000000UL -}; - -ALIGNED_(8) juint _log2_pow[] = -{ - 0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL -}; - -//registers, -// input: xmm0, xmm1 -// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 -// rax, rdx, rcx, r8, r11 - -// Code generated by Intel C compiler for LIBM library - -void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp1, Register tmp2, Register tmp3, Register tmp4) { - Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; - Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; - Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; - Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, L_2TAG_PACKET_14_0_2, L_2TAG_PACKET_15_0_2; - Label L_2TAG_PACKET_16_0_2, L_2TAG_PACKET_17_0_2, L_2TAG_PACKET_18_0_2, L_2TAG_PACKET_19_0_2; - Label L_2TAG_PACKET_20_0_2, L_2TAG_PACKET_21_0_2, L_2TAG_PACKET_22_0_2, L_2TAG_PACKET_23_0_2; - Label L_2TAG_PACKET_24_0_2, L_2TAG_PACKET_25_0_2, L_2TAG_PACKET_26_0_2, L_2TAG_PACKET_27_0_2; - Label L_2TAG_PACKET_28_0_2, L_2TAG_PACKET_29_0_2, L_2TAG_PACKET_30_0_2, L_2TAG_PACKET_31_0_2; - Label L_2TAG_PACKET_32_0_2, L_2TAG_PACKET_33_0_2, L_2TAG_PACKET_34_0_2, L_2TAG_PACKET_35_0_2; - Label L_2TAG_PACKET_36_0_2, L_2TAG_PACKET_37_0_2, L_2TAG_PACKET_38_0_2, L_2TAG_PACKET_39_0_2; - Label L_2TAG_PACKET_40_0_2, L_2TAG_PACKET_41_0_2, L_2TAG_PACKET_42_0_2, L_2TAG_PACKET_43_0_2; - Label L_2TAG_PACKET_44_0_2, L_2TAG_PACKET_45_0_2, L_2TAG_PACKET_46_0_2, L_2TAG_PACKET_47_0_2; - Label L_2TAG_PACKET_48_0_2, L_2TAG_PACKET_49_0_2, L_2TAG_PACKET_50_0_2, L_2TAG_PACKET_51_0_2; - Label L_2TAG_PACKET_52_0_2, L_2TAG_PACKET_53_0_2, L_2TAG_PACKET_54_0_2, L_2TAG_PACKET_55_0_2; - Label L_2TAG_PACKET_56_0_2; - Label B1_2, B1_3, B1_5, start; - - assert_different_registers(tmp1, tmp2, eax, ecx, edx); - jmp(start); - address HIGHSIGMASK = (address)_HIGHSIGMASK; - address LOG2_E = (address)_LOG2_E; - address coeff = (address)_coeff_pow; - address L_tbl = (address)_L_tbl_pow; - address HIGHMASK_Y = (address)_HIGHMASK_Y; - address T_exp = (address)_T_exp; - address e_coeff = (address)_e_coeff; - address coeff_h = (address)_coeff_h; - address HIGHMASK_LOG_X = (address)_HIGHMASK_LOG_X; - address HALFMASK = (address)_HALFMASK; - address log2 = (address)_log2_pow; - - - bind(start); - subq(rsp, 40); - movsd(Address(rsp, 8), xmm0); - movsd(Address(rsp, 16), xmm1); - - bind(B1_2); - pextrw(eax, xmm0, 3); - xorpd(xmm2, xmm2); - mov64(tmp2, 0x3ff0000000000000); - movdq(xmm2, tmp2); - movl(tmp1, 1069088768); - movdq(xmm7, tmp1); - xorpd(xmm1, xmm1); - mov64(tmp3, 0x77f0000000000000); - movdq(xmm1, tmp3); - movdqu(xmm3, xmm0); - movl(edx, 32752); - andl(edx, eax); - subl(edx, 16368); - movl(ecx, edx); - sarl(edx, 31); - addl(ecx, edx); - xorl(ecx, edx); - por(xmm0, xmm2); - movdqu(xmm6, ExternalAddress(HIGHSIGMASK)); //0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL - psrlq(xmm0, 27); - movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL - psrld(xmm0, 2); - addl(ecx, 16); - bsrl(ecx, ecx); - rcpps(xmm0, xmm0); - psllq(xmm3, 12); - movl(tmp4, 8192); - movdq(xmm4, tmp4); - psrlq(xmm3, 12); - subl(eax, 16); - cmpl(eax, 32736); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); - movl(tmp1, 0); - - bind(L_2TAG_PACKET_1_0_2); - mulss(xmm0, xmm7); - movl(edx, -1); - subl(ecx, 4); - shll(edx); - shlq(edx, 32); - movdq(xmm5, edx); - por(xmm3, xmm1); - subl(eax, 16351); - cmpl(eax, 1); - jcc(Assembler::belowEqual, L_2TAG_PACKET_2_0_2); - paddd(xmm0, xmm4); - pand(xmm5, xmm3); - movdl(edx, xmm0); - psllq(xmm0, 29); - - bind(L_2TAG_PACKET_3_0_2); - subsd(xmm3, xmm5); - pand(xmm0, xmm6); - subl(eax, 1); - sarl(eax, 4); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - - bind(L_2TAG_PACKET_4_0_2); - mulsd(xmm3, xmm0); - movdqu(xmm1, ExternalAddress(coeff)); //0x6dc96112UL, 0xbf836578UL, 0xee241472UL, 0xbf9b0301UL - lea(tmp4, ExternalAddress(L_tbl)); - subsd(xmm5, xmm2); - movdqu(xmm4, ExternalAddress(16 + coeff)); //0x9f95985aUL, 0xbfb528dbUL, 0xb3841d2aUL, 0xbfd619b6UL - movl(ecx, eax); - sarl(eax, 31); - addl(ecx, eax); - xorl(eax, ecx); - addl(eax, 1); - bsrl(eax, eax); - unpcklpd(xmm5, xmm3); - movdqu(xmm6, ExternalAddress(32 + coeff)); //0x518775e3UL, 0x3f9004f2UL, 0xac8349bbUL, 0x3fa76c9bUL - addsd(xmm3, xmm5); - andl(edx, 16760832); - shrl(edx, 10); - addpd(xmm5, Address(tmp4, edx, Address::times_1, -3648)); - movdqu(xmm0, ExternalAddress(48 + coeff)); //0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, 0xbf5dabe1UL - pshufd(xmm2, xmm3, 68); - mulsd(xmm3, xmm3); - mulpd(xmm1, xmm2); - mulpd(xmm4, xmm2); - addsd(xmm5, xmm7); - mulsd(xmm2, xmm3); - addpd(xmm6, xmm1); - mulsd(xmm3, xmm3); - addpd(xmm0, xmm4); - movq(xmm1, Address(rsp, 16)); - movw(ecx, Address(rsp, 22)); - pshufd(xmm7, xmm5, 238); - movq(xmm4, ExternalAddress(HIGHMASK_Y)); //0x00000000UL, 0xfffffff8UL, 0x00000000UL, 0xffffffffUL - mulpd(xmm6, xmm2); - pshufd(xmm3, xmm3, 68); - mulpd(xmm0, xmm2); - shll(eax, 4); - subl(eax, 15872); - andl(ecx, 32752); - addl(eax, ecx); - mulpd(xmm3, xmm6); - cmpl(eax, 624); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_5_0_2); - xorpd(xmm6, xmm6); - movl(edx, 17080); - pinsrw(xmm6, edx, 3); - movdqu(xmm2, xmm1); - pand(xmm4, xmm1); - subsd(xmm1, xmm4); - mulsd(xmm4, xmm5); - addsd(xmm0, xmm7); - mulsd(xmm1, xmm5); - movdqu(xmm7, xmm6); - addsd(xmm6, xmm4); - lea(tmp4, ExternalAddress(T_exp)); - addpd(xmm3, xmm0); - movdl(edx, xmm6); - subsd(xmm6, xmm7); - pshufd(xmm0, xmm3, 238); - subsd(xmm4, xmm6); - addsd(xmm0, xmm3); - movl(ecx, edx); - andl(edx, 255); - addl(edx, edx); - movdqu(xmm5, Address(tmp4, edx, Address::times_8, 0)); - addsd(xmm4, xmm1); - mulsd(xmm2, xmm0); - movdqu(xmm7, ExternalAddress(e_coeff)); //0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL - movdqu(xmm3, ExternalAddress(16 + e_coeff)); //0x6fba4e77UL, 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL - shll(ecx, 12); - xorl(ecx, tmp1); - andl(rcx, -1048576); - movdq(xmm6, rcx); - addsd(xmm2, xmm4); - mov64(tmp2, 0x3fe62e42fefa39ef); - movdq(xmm1, tmp2); - pshufd(xmm0, xmm2, 68); - pshufd(xmm4, xmm2, 68); - mulsd(xmm1, xmm2); - pshufd(xmm6, xmm6, 17); - mulpd(xmm0, xmm0); - mulpd(xmm7, xmm4); - paddd(xmm5, xmm6); - mulsd(xmm1, xmm5); - pshufd(xmm6, xmm5, 238); - mulsd(xmm0, xmm0); - addpd(xmm3, xmm7); - addsd(xmm1, xmm6); - mulpd(xmm0, xmm3); - pshufd(xmm3, xmm0, 238); - mulsd(xmm0, xmm5); - mulsd(xmm3, xmm5); - addsd(xmm0, xmm1); - addsd(xmm0, xmm3); - addsd(xmm0, xmm5); - jmp(B1_5); - - bind(L_2TAG_PACKET_0_0_2); - addl(eax, 16); - movl(edx, 32752); - andl(edx, eax); - cmpl(edx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_6_0_2); - testl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_7_0_2); - - bind(L_2TAG_PACKET_8_0_2); - movq(xmm0, Address(rsp, 8)); - movq(xmm3, Address(rsp, 8)); - movdl(edx, xmm3); - psrlq(xmm3, 32); - movdl(ecx, xmm3); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_9_0_2); - xorpd(xmm3, xmm3); - movl(eax, 18416); - pinsrw(xmm3, eax, 3); - mulsd(xmm0, xmm3); - xorpd(xmm2, xmm2); - movl(eax, 16368); - pinsrw(xmm2, eax, 3); - movdqu(xmm3, xmm0); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - movl(ecx, 18416); - psrlq(xmm0, 27); - movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL - psrld(xmm0, 2); - rcpps(xmm0, xmm0); - psllq(xmm3, 12); - movdqu(xmm6, ExternalAddress(HIGHSIGMASK)); //0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL - psrlq(xmm3, 12); - mulss(xmm0, xmm7); - movl(edx, -1024); - movdl(xmm5, edx); - por(xmm3, xmm1); - paddd(xmm0, xmm4); - psllq(xmm5, 32); - movdl(edx, xmm0); - psllq(xmm0, 29); - pand(xmm5, xmm3); - movl(tmp1, 0); - pand(xmm0, xmm6); - subsd(xmm3, xmm5); - andl(eax, 32752); - subl(eax, 18416); - sarl(eax, 4); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - jmp(L_2TAG_PACKET_4_0_2); - - bind(L_2TAG_PACKET_10_0_2); - movq(xmm0, Address(rsp, 8)); - movq(xmm3, Address(rsp, 8)); - movdl(edx, xmm3); - psrlq(xmm3, 32); - movdl(ecx, xmm3); - orl(edx, ecx); - cmpl(edx, 0); - jcc(Assembler::equal, L_2TAG_PACKET_9_0_2); - xorpd(xmm3, xmm3); - movl(eax, 18416); - pinsrw(xmm3, eax, 3); - mulsd(xmm0, xmm3); - xorpd(xmm2, xmm2); - movl(eax, 16368); - pinsrw(xmm2, eax, 3); - movdqu(xmm3, xmm0); - pextrw(eax, xmm0, 3); - por(xmm0, xmm2); - movl(ecx, 18416); - psrlq(xmm0, 27); - movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL - psrld(xmm0, 2); - rcpps(xmm0, xmm0); - psllq(xmm3, 12); - movdqu(xmm6, ExternalAddress(HIGHSIGMASK)); //0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL - psrlq(xmm3, 12); - mulss(xmm0, xmm7); - movl(edx, -1024); - movdl(xmm5, edx); - por(xmm3, xmm1); - paddd(xmm0, xmm4); - psllq(xmm5, 32); - movdl(edx, xmm0); - psllq(xmm0, 29); - pand(xmm5, xmm3); - movl(tmp1, INT_MIN); - pand(xmm0, xmm6); - subsd(xmm3, xmm5); - andl(eax, 32752); - subl(eax, 18416); - sarl(eax, 4); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - jmp(L_2TAG_PACKET_4_0_2); - - bind(L_2TAG_PACKET_5_0_2); - cmpl(eax, 0); - jcc(Assembler::less, L_2TAG_PACKET_11_0_2); - cmpl(eax, 752); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_12_0_2); - addsd(xmm0, xmm7); - movq(xmm2, ExternalAddress(HALFMASK)); //0xf8000000UL, 0xffffffffUL, 0xf8000000UL, 0xffffffffUL - addpd(xmm3, xmm0); - xorpd(xmm6, xmm6); - movl(eax, 17080); - pinsrw(xmm6, eax, 3); - pshufd(xmm0, xmm3, 238); - addsd(xmm0, xmm3); - movdqu(xmm3, xmm5); - addsd(xmm5, xmm0); - movdqu(xmm4, xmm2); - subsd(xmm3, xmm5); - movdqu(xmm7, xmm5); - pand(xmm5, xmm2); - movdqu(xmm2, xmm1); - pand(xmm4, xmm1); - subsd(xmm7, xmm5); - addsd(xmm0, xmm3); - subsd(xmm1, xmm4); - mulsd(xmm4, xmm5); - addsd(xmm0, xmm7); - mulsd(xmm2, xmm0); - movdqu(xmm7, xmm6); - mulsd(xmm1, xmm5); - addsd(xmm6, xmm4); - movdl(eax, xmm6); - subsd(xmm6, xmm7); - lea(tmp4, ExternalAddress(T_exp)); - addsd(xmm2, xmm1); - movdqu(xmm7, ExternalAddress(e_coeff)); //0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL - movdqu(xmm3, ExternalAddress(16 + e_coeff)); //0x6fba4e77UL, 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL - subsd(xmm4, xmm6); - pextrw(edx, xmm6, 3); - movl(ecx, eax); - andl(eax, 255); - addl(eax, eax); - movdqu(xmm5, Address(tmp4, rax, Address::times_8, 0)); - addsd(xmm2, xmm4); - sarl(ecx, 8); - movl(eax, ecx); - sarl(ecx, 1); - subl(eax, ecx); - shll(ecx, 20); - xorl(ecx, tmp1); - movdl(xmm6, ecx); - movq(xmm1, ExternalAddress(32 + e_coeff)); //0xfefa39efUL, 0x3fe62e42UL, 0x00000000UL, 0x00000000UL - andl(edx, 32767); - cmpl(edx, 16529); - jcc(Assembler::above, L_2TAG_PACKET_12_0_2); - pshufd(xmm0, xmm2, 68); - pshufd(xmm4, xmm2, 68); - mulpd(xmm0, xmm0); - mulpd(xmm7, xmm4); - pshufd(xmm6, xmm6, 17); - mulsd(xmm1, xmm2); - mulsd(xmm0, xmm0); - paddd(xmm5, xmm6); - addpd(xmm3, xmm7); - mulsd(xmm1, xmm5); - pshufd(xmm6, xmm5, 238); - mulpd(xmm0, xmm3); - addsd(xmm1, xmm6); - pshufd(xmm3, xmm0, 238); - mulsd(xmm0, xmm5); - mulsd(xmm3, xmm5); - shll(eax, 4); - xorpd(xmm4, xmm4); - addl(eax, 16368); - pinsrw(xmm4, eax, 3); - addsd(xmm0, xmm1); - addsd(xmm0, xmm3); - movdqu(xmm1, xmm0); - addsd(xmm0, xmm5); - mulsd(xmm0, xmm4); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_13_0_2); - cmpl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_14_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_6_0_2); - movq(xmm1, Address(rsp, 16)); - movq(xmm0, Address(rsp, 8)); - movdqu(xmm2, xmm0); - movdl(eax, xmm2); - psrlq(xmm2, 20); - movdl(edx, xmm2); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_15_0_2); - movdl(eax, xmm1); - psrlq(xmm1, 32); - movdl(edx, xmm1); - movl(ecx, edx); - addl(edx, edx); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_16_0_2); - addsd(xmm0, xmm0); - jmp(B1_5); - - bind(L_2TAG_PACKET_16_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - movl(Address(rsp, 0), 29); - jmp(L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_18_0_2); - movq(xmm0, Address(rsp, 16)); - addpd(xmm0, xmm0); - jmp(B1_5); - - bind(L_2TAG_PACKET_15_0_2); - movdl(eax, xmm1); - movdqu(xmm2, xmm1); - psrlq(xmm1, 32); - movdl(edx, xmm1); - movl(ecx, edx); - addl(edx, edx); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_19_0_2); - pextrw(eax, xmm2, 3); - andl(eax, 32752); - cmpl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_20_0_2); - movdl(eax, xmm2); - psrlq(xmm2, 20); - movdl(edx, xmm2); - orl(eax, edx); - jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_20_0_2); - pextrw(eax, xmm0, 3); - testl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_21_0_2); - testl(ecx, INT_MIN); - jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_23_0_2); - movq(xmm1, Address(rsp, 16)); - movdl(eax, xmm1); - testl(eax, 1); - jcc(Assembler::notEqual, L_2TAG_PACKET_24_0_2); - testl(eax, 2); - jcc(Assembler::notEqual, L_2TAG_PACKET_25_0_2); - jmp(L_2TAG_PACKET_24_0_2); - - bind(L_2TAG_PACKET_21_0_2); - shrl(ecx, 20); - andl(ecx, 2047); - cmpl(ecx, 1075); - jcc(Assembler::above, L_2TAG_PACKET_24_0_2); - jcc(Assembler::equal, L_2TAG_PACKET_26_0_2); - cmpl(ecx, 1074); - jcc(Assembler::above, L_2TAG_PACKET_23_0_2); - cmpl(ecx, 1023); - jcc(Assembler::below, L_2TAG_PACKET_24_0_2); - movq(xmm1, Address(rsp, 16)); - movl(eax, 17208); - xorpd(xmm3, xmm3); - pinsrw(xmm3, eax, 3); - movdqu(xmm4, xmm3); - addsd(xmm3, xmm1); - subsd(xmm4, xmm3); - addsd(xmm1, xmm4); - pextrw(eax, xmm1, 3); - andl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_24_0_2); - movdl(eax, xmm3); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_24_0_2); - - bind(L_2TAG_PACKET_25_0_2); - movq(xmm1, Address(rsp, 16)); - pextrw(eax, xmm1, 3); - andl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_27_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_27_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32768); - pinsrw(xmm0, eax, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_24_0_2); - movq(xmm1, Address(rsp, 16)); - pextrw(eax, xmm1, 3); - andl(eax, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32752); - pinsrw(xmm0, eax, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_26_0_2); - movq(xmm1, Address(rsp, 16)); - movdl(eax, xmm1); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_24_0_2); - jmp(L_2TAG_PACKET_25_0_2); - - bind(L_2TAG_PACKET_28_0_2); - movdl(eax, xmm1); - psrlq(xmm1, 20); - movdl(edx, xmm1); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_29_0_2); - movq(xmm0, Address(rsp, 16)); - addsd(xmm0, xmm0); - jmp(B1_5); - - bind(L_2TAG_PACKET_29_0_2); - movq(xmm0, Address(rsp, 8)); - pextrw(eax, xmm0, 3); - cmpl(eax, 49136); - jcc(Assembler::notEqual, L_2TAG_PACKET_30_0_2); - movdl(ecx, xmm0); - psrlq(xmm0, 20); - movdl(edx, xmm0); - orl(ecx, edx); - jcc(Assembler::notEqual, L_2TAG_PACKET_30_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32760); - pinsrw(xmm0, eax, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_30_0_2); - movq(xmm1, Address(rsp, 16)); - andl(eax, 32752); - subl(eax, 16368); - pextrw(edx, xmm1, 3); - xorpd(xmm0, xmm0); - xorl(eax, edx); - andl(eax, 32768); - jcc(Assembler::equal, L_2TAG_PACKET_31_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_31_0_2); - movl(ecx, 32752); - pinsrw(xmm0, ecx, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_32_0_2); - movdl(eax, xmm1); - cmpl(edx, 17184); - jcc(Assembler::above, L_2TAG_PACKET_33_0_2); - testl(eax, 1); - jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); - testl(eax, 2); - jcc(Assembler::equal, L_2TAG_PACKET_35_0_2); - jmp(L_2TAG_PACKET_36_0_2); - - bind(L_2TAG_PACKET_33_0_2); - testl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_35_0_2); - jmp(L_2TAG_PACKET_36_0_2); - - bind(L_2TAG_PACKET_7_0_2); - movq(xmm2, Address(rsp, 8)); - movdl(eax, xmm2); - psrlq(xmm2, 31); - movdl(ecx, xmm2); - orl(eax, ecx); - jcc(Assembler::equal, L_2TAG_PACKET_9_0_2); - movq(xmm1, Address(rsp, 16)); - pextrw(edx, xmm1, 3); - movdl(eax, xmm1); - movdqu(xmm2, xmm1); - psrlq(xmm2, 32); - movdl(ecx, xmm2); - addl(ecx, ecx); - orl(ecx, eax); - jcc(Assembler::equal, L_2TAG_PACKET_37_0_2); - andl(edx, 32752); - cmpl(edx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_28_0_2); - cmpl(edx, 17200); - jcc(Assembler::above, L_2TAG_PACKET_35_0_2); - cmpl(edx, 17184); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_32_0_2); - cmpl(edx, 16368); - jcc(Assembler::below, L_2TAG_PACKET_34_0_2); - movl(eax, 17208); - xorpd(xmm2, xmm2); - pinsrw(xmm2, eax, 3); - movdqu(xmm4, xmm2); - addsd(xmm2, xmm1); - subsd(xmm4, xmm2); - addsd(xmm1, xmm4); - pextrw(eax, xmm1, 3); - andl(eax, 32767); - jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); - movdl(eax, xmm2); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_35_0_2); - - bind(L_2TAG_PACKET_36_0_2); - xorpd(xmm1, xmm1); - movl(edx, 30704); - pinsrw(xmm1, edx, 3); - movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL - movq(xmm4, Address(rsp, 8)); - pextrw(eax, xmm4, 3); - movl(edx, 8192); - movdl(xmm4, edx); - andl(eax, 32767); - subl(eax, 16); - jcc(Assembler::less, L_2TAG_PACKET_10_0_2); - movl(edx, eax); - andl(edx, 32752); - subl(edx, 16368); - movl(ecx, edx); - sarl(edx, 31); - addl(ecx, edx); - xorl(ecx, edx); - addl(ecx, 16); - bsrl(ecx, ecx); - movl(tmp1, INT_MIN); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_34_0_2); - xorpd(xmm1, xmm1); - movl(eax, 32752); - pinsrw(xmm1, eax, 3); - xorpd(xmm0, xmm0); - mulsd(xmm0, xmm1); - movl(Address(rsp, 0), 28); - jmp(L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_35_0_2); - xorpd(xmm1, xmm1); - movl(edx, 30704); - pinsrw(xmm1, edx, 3); - movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL - movq(xmm4, Address(rsp, 8)); - pextrw(eax, xmm4, 3); - movl(edx, 8192); - movdl(xmm4, edx); - andl(eax, 32767); - subl(eax, 16); - jcc(Assembler::less, L_2TAG_PACKET_8_0_2); - movl(edx, eax); - andl(edx, 32752); - subl(edx, 16368); - movl(ecx, edx); - sarl(edx, 31); - addl(ecx, edx); - xorl(ecx, edx); - addl(ecx, 16); - bsrl(ecx, ecx); - movl(tmp1, 0); - jmp(L_2TAG_PACKET_1_0_2); - - bind(L_2TAG_PACKET_19_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_22_0_2); - xorpd(xmm0, xmm0); - jmp(B1_5); - - bind(L_2TAG_PACKET_11_0_2); - addl(eax, 384); - cmpl(eax, 0); - jcc(Assembler::less, L_2TAG_PACKET_38_0_2); - mulsd(xmm5, xmm1); - addsd(xmm0, xmm7); - shrl(tmp1, 31); - addpd(xmm3, xmm0); - pshufd(xmm0, xmm3, 238); - addsd(xmm3, xmm0); - lea(tmp4, ExternalAddress(log2)); //0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL - movq(xmm4, Address(tmp4, tmp1, Address::times_8, 0)); - mulsd(xmm1, xmm3); - xorpd(xmm0, xmm0); - movl(eax, 16368); - shll(tmp1, 15); - orl(eax, tmp1); - pinsrw(xmm0, eax, 3); - addsd(xmm5, xmm1); - mulsd(xmm5, xmm4); - addsd(xmm0, xmm5); - jmp(B1_5); - - bind(L_2TAG_PACKET_38_0_2); - - bind(L_2TAG_PACKET_37_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_39_0_2); - xorpd(xmm0, xmm0); - movl(eax, 16368); - pinsrw(xmm0, eax, 3); - movl(Address(rsp, 0), 26); - jmp(L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_9_0_2); - movq(xmm1, Address(rsp, 16)); - movdqu(xmm2, xmm1); - pextrw(eax, xmm1, 3); - andl(eax, 32752); - cmpl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_40_0_2); - movdl(eax, xmm2); - psrlq(xmm2, 20); - movdl(edx, xmm2); - orl(eax, edx); - jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); - - bind(L_2TAG_PACKET_40_0_2); - movdl(eax, xmm1); - psrlq(xmm1, 32); - movdl(edx, xmm1); - movl(ecx, edx); - addl(edx, edx); - orl(eax, edx); - jcc(Assembler::equal, L_2TAG_PACKET_39_0_2); - shrl(edx, 21); - cmpl(edx, 1075); - jcc(Assembler::above, L_2TAG_PACKET_41_0_2); - jcc(Assembler::equal, L_2TAG_PACKET_42_0_2); - cmpl(edx, 1023); - jcc(Assembler::below, L_2TAG_PACKET_41_0_2); - movq(xmm1, Address(rsp, 16)); - movl(eax, 17208); - xorpd(xmm3, xmm3); - pinsrw(xmm3, eax, 3); - movdqu(xmm4, xmm3); - addsd(xmm3, xmm1); - subsd(xmm4, xmm3); - addsd(xmm1, xmm4); - pextrw(eax, xmm1, 3); - andl(eax, 32752); - jcc(Assembler::notEqual, L_2TAG_PACKET_41_0_2); - movdl(eax, xmm3); - andl(eax, 1); - jcc(Assembler::equal, L_2TAG_PACKET_41_0_2); - - bind(L_2TAG_PACKET_43_0_2); - movq(xmm0, Address(rsp, 8)); - testl(ecx, INT_MIN); - jcc(Assembler::notEqual, L_2TAG_PACKET_44_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_42_0_2); - movq(xmm1, Address(rsp, 16)); - movdl(eax, xmm1); - testl(eax, 1); - jcc(Assembler::notEqual, L_2TAG_PACKET_43_0_2); - - bind(L_2TAG_PACKET_41_0_2); - testl(ecx, INT_MIN); - jcc(Assembler::equal, L_2TAG_PACKET_22_0_2); - xorpd(xmm0, xmm0); - - bind(L_2TAG_PACKET_44_0_2); - movl(eax, 16368); - xorpd(xmm1, xmm1); - pinsrw(xmm1, eax, 3); - divsd(xmm1, xmm0); - movdqu(xmm0, xmm1); - movl(Address(rsp, 0), 27); - jmp(L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_12_0_2); - movq(xmm2, Address(rsp, 8)); - movq(xmm6, Address(rsp, 16)); - pextrw(eax, xmm2, 3); - pextrw(edx, xmm6, 3); - movl(ecx, 32752); - andl(ecx, edx); - cmpl(ecx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_45_0_2); - andl(eax, 32752); - subl(eax, 16368); - xorl(edx, eax); - testl(edx, 32768); - jcc(Assembler::notEqual, L_2TAG_PACKET_46_0_2); - - bind(L_2TAG_PACKET_47_0_2); - movl(eax, 32736); - pinsrw(xmm0, eax, 3); - shrl(tmp1, 16); - orl(eax, tmp1); - pinsrw(xmm1, eax, 3); - mulsd(xmm0, xmm1); - - bind(L_2TAG_PACKET_14_0_2); - movl(Address(rsp, 0), 24); - jmp(L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_46_0_2); - movl(eax, 16); - pinsrw(xmm0, eax, 3); - mulsd(xmm0, xmm0); - testl(tmp1, INT_MIN); - jcc(Assembler::equal, L_2TAG_PACKET_48_0_2); - mov64(tmp2, 0x8000000000000000); - movdq(xmm2, tmp2); - xorpd(xmm0, xmm2); - - bind(L_2TAG_PACKET_48_0_2); - movl(Address(rsp, 0), 25); - jmp(L_2TAG_PACKET_17_0_2); - - bind(L_2TAG_PACKET_13_0_2); - pextrw(ecx, xmm5, 3); - pextrw(edx, xmm4, 3); - movl(eax, -1); - andl(ecx, 32752); - subl(ecx, 16368); - andl(edx, 32752); - addl(edx, ecx); - movl(ecx, -31); - sarl(edx, 4); - subl(ecx, edx); - jcc(Assembler::lessEqual, L_2TAG_PACKET_49_0_2); - cmpl(ecx, 20); - jcc(Assembler::above, L_2TAG_PACKET_50_0_2); - shll(eax); - - bind(L_2TAG_PACKET_49_0_2); - movdl(xmm0, eax); - psllq(xmm0, 32); - pand(xmm0, xmm5); - subsd(xmm5, xmm0); - addsd(xmm5, xmm1); - mulsd(xmm0, xmm4); - mulsd(xmm5, xmm4); - addsd(xmm0, xmm5); - - bind(L_2TAG_PACKET_50_0_2); - jmp(L_2TAG_PACKET_48_0_2); - - bind(L_2TAG_PACKET_2_0_2); - movw(ecx, Address(rsp, 22)); - movl(edx, INT_MIN); - movdl(xmm1, rdx); - xorpd(xmm7, xmm7); - paddd(xmm0, xmm4); - movdl(edx, xmm0); - psllq(xmm0, 29); - paddq(xmm1, xmm3); - pand(xmm5, xmm1); - andl(ecx, 32752); - cmpl(ecx, 16560); - jcc(Assembler::less, L_2TAG_PACKET_3_0_2); - pand(xmm0, xmm6); - subsd(xmm3, xmm5); - addl(eax, 16351); - shrl(eax, 4); - subl(eax, 1022); - cvtsi2sdl(xmm7, eax); - mulpd(xmm5, xmm0); - lea(r11, ExternalAddress(L_tbl)); - movq(xmm4, ExternalAddress(coeff_h)); //0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL - mulsd(xmm3, xmm0); - movq(xmm6, ExternalAddress(coeff_h)); //0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL - subsd(xmm5, xmm2); - movq(xmm1, ExternalAddress(8 + coeff_h)); //0x00000000UL, 0xbf5dabe1UL - pshufd(xmm2, xmm3, 68); - unpcklpd(xmm5, xmm3); - addsd(xmm3, xmm5); - movq(xmm0, ExternalAddress(8 + coeff_h)); //0x00000000UL, 0xbf5dabe1UL - andl(edx, 16760832); - shrl(edx, 10); - addpd(xmm7, Address(tmp4, edx, Address::times_1, -3648)); - mulsd(xmm4, xmm5); - mulsd(xmm0, xmm5); - mulsd(xmm6, xmm2); - mulsd(xmm1, xmm2); - movdqu(xmm2, xmm5); - mulsd(xmm4, xmm5); - addsd(xmm5, xmm0); - movdqu(xmm0, xmm7); - addsd(xmm2, xmm3); - addsd(xmm7, xmm5); - mulsd(xmm6, xmm2); - subsd(xmm0, xmm7); - movdqu(xmm2, xmm7); - addsd(xmm7, xmm4); - addsd(xmm0, xmm5); - subsd(xmm2, xmm7); - addsd(xmm4, xmm2); - pshufd(xmm2, xmm5, 238); - movdqu(xmm5, xmm7); - addsd(xmm7, xmm2); - addsd(xmm4, xmm0); - movdqu(xmm0, ExternalAddress(coeff)); //0x6dc96112UL, 0xbf836578UL, 0xee241472UL, 0xbf9b0301UL - subsd(xmm5, xmm7); - addsd(xmm6, xmm4); - movdqu(xmm4, xmm7); - addsd(xmm5, xmm2); - addsd(xmm7, xmm1); - movdqu(xmm2, ExternalAddress(64 + coeff)); //0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, 0xbf5dabe1UL - subsd(xmm4, xmm7); - addsd(xmm6, xmm5); - addsd(xmm4, xmm1); - pshufd(xmm5, xmm7, 238); - movapd(xmm1, xmm7); - addsd(xmm7, xmm5); - subsd(xmm1, xmm7); - addsd(xmm1, xmm5); - movdqu(xmm5, ExternalAddress(80 + coeff)); //0x9f95985aUL, 0xbfb528dbUL, 0xf8b5787dUL, 0x3ef2531eUL - pshufd(xmm3, xmm3, 68); - addsd(xmm6, xmm4); - addsd(xmm6, xmm1); - movdqu(xmm1, ExternalAddress(32 + coeff)); //0x9f95985aUL, 0xbfb528dbUL, 0xb3841d2aUL, 0xbfd619b6UL - mulpd(xmm0, xmm3); - mulpd(xmm2, xmm3); - pshufd(xmm4, xmm3, 68); - mulpd(xmm3, xmm3); - addpd(xmm0, xmm1); - addpd(xmm5, xmm2); - mulsd(xmm4, xmm3); - movq(xmm2, ExternalAddress(HIGHMASK_LOG_X)); //0xf8000000UL, 0xffffffffUL, 0x00000000UL, 0xfffff800UL - mulpd(xmm3, xmm3); - movq(xmm1, Address(rsp, 16)); - movw(ecx, Address(rsp, 22)); - mulpd(xmm0, xmm4); - pextrw(eax, xmm7, 3); - mulpd(xmm5, xmm4); - mulpd(xmm0, xmm3); - movq(xmm4, ExternalAddress(8 + HIGHMASK_Y)); //0x00000000UL, 0xffffffffUL - pand(xmm2, xmm7); - addsd(xmm5, xmm6); - subsd(xmm7, xmm2); - addpd(xmm5, xmm0); - andl(eax, 32752); - subl(eax, 16368); - andl(ecx, 32752); - cmpl(ecx, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_45_0_2); - addl(ecx, eax); - cmpl(ecx, 16576); - jcc(Assembler::aboveEqual, L_2TAG_PACKET_51_0_2); - pshufd(xmm0, xmm5, 238); - pand(xmm4, xmm1); - movdqu(xmm3, xmm1); - addsd(xmm5, xmm0); - subsd(xmm1, xmm4); - xorpd(xmm6, xmm6); - movl(edx, 17080); - pinsrw(xmm6, edx, 3); - addsd(xmm7, xmm5); - mulsd(xmm4, xmm2); - mulsd(xmm1, xmm2); - movdqu(xmm5, xmm6); - mulsd(xmm3, xmm7); - addsd(xmm6, xmm4); - addsd(xmm1, xmm3); - movdqu(xmm7, ExternalAddress(e_coeff)); //0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL - movdl(edx, xmm6); - subsd(xmm6, xmm5); - lea(tmp4, ExternalAddress(T_exp)); - movdqu(xmm3, ExternalAddress(16 + e_coeff)); //0x6fba4e77UL, 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL - movq(xmm2, ExternalAddress(32 + e_coeff)); //0xfefa39efUL, 0x3fe62e42UL, 0x00000000UL, 0x00000000UL - subsd(xmm4, xmm6); - movl(ecx, edx); - andl(edx, 255); - addl(edx, edx); - movdqu(xmm5, Address(tmp4, edx, Address::times_8, 0)); - addsd(xmm4, xmm1); - pextrw(edx, xmm6, 3); - shrl(ecx, 8); - movl(eax, ecx); - shrl(ecx, 1); - subl(eax, ecx); - shll(ecx, 20); - movdl(xmm6, ecx); - pshufd(xmm0, xmm4, 68); - pshufd(xmm1, xmm4, 68); - mulpd(xmm0, xmm0); - mulpd(xmm7, xmm1); - pshufd(xmm6, xmm6, 17); - mulsd(xmm2, xmm4); - andl(edx, 32767); - cmpl(edx, 16529); - jcc(Assembler::above, L_2TAG_PACKET_12_0_2); - mulsd(xmm0, xmm0); - paddd(xmm5, xmm6); - addpd(xmm3, xmm7); - mulsd(xmm2, xmm5); - pshufd(xmm6, xmm5, 238); - mulpd(xmm0, xmm3); - addsd(xmm2, xmm6); - pshufd(xmm3, xmm0, 238); - addl(eax, 1023); - shll(eax, 20); - orl(eax, tmp1); - movdl(xmm4, eax); - mulsd(xmm0, xmm5); - mulsd(xmm3, xmm5); - addsd(xmm0, xmm2); - psllq(xmm4, 32); - addsd(xmm0, xmm3); - movdqu(xmm1, xmm0); - addsd(xmm0, xmm5); - mulsd(xmm0, xmm4); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_13_0_2); - cmpl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_14_0_2); - - bind(L_2TAG_PACKET_52_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_45_0_2); - movq(xmm0, Address(rsp, 8)); - xorpd(xmm2, xmm2); - movl(eax, 49136); - pinsrw(xmm2, eax, 3); - addsd(xmm2, xmm0); - pextrw(eax, xmm2, 3); - cmpl(eax, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_53_0_2); - xorpd(xmm0, xmm0); - movl(eax, 32760); - pinsrw(xmm0, eax, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_53_0_2); - movq(xmm1, Address(rsp, 16)); - movdl(edx, xmm1); - movdqu(xmm3, xmm1); - psrlq(xmm3, 20); - movdl(ecx, xmm3); - orl(ecx, edx); - jcc(Assembler::equal, L_2TAG_PACKET_54_0_2); - addsd(xmm1, xmm1); - movdqu(xmm0, xmm1); - jmp(B1_5); - - bind(L_2TAG_PACKET_51_0_2); - pextrw(eax, xmm1, 3); - pextrw(ecx, xmm2, 3); - xorl(eax, ecx); - testl(eax, 32768); - jcc(Assembler::equal, L_2TAG_PACKET_47_0_2); - jmp(L_2TAG_PACKET_46_0_2); - - bind(L_2TAG_PACKET_54_0_2); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - pextrw(edx, xmm1, 3); - xorpd(xmm0, xmm0); - subl(eax, 16368); - xorl(eax, edx); - testl(eax, 32768); - jcc(Assembler::equal, L_2TAG_PACKET_55_0_2); - jmp(B1_5); - - bind(L_2TAG_PACKET_55_0_2); - movl(edx, 32752); - pinsrw(xmm0, edx, 3); - jmp(B1_5); - - bind(L_2TAG_PACKET_17_0_2); - movq(Address(rsp, 24), xmm0); - - bind(B1_3); - movq(xmm0, Address(rsp, 24)); - - bind(L_2TAG_PACKET_56_0_2); - - bind(B1_5); - addq(rsp, 40); -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - SIN() -// --------------------- -// -// 1. RANGE REDUCTION -// -// We perform an initial range reduction from X to r with -// -// X =~= N * pi/32 + r -// -// so that |r| <= pi/64 + epsilon. We restrict inputs to those -// where |N| <= 932560. Beyond this, the range reduction is -// insufficiently accurate. For extremely small inputs, -// denormalization can occur internally, impacting performance. -// This means that the main path is actually only taken for -// 2^-252 <= |X| < 90112. -// -// To avoid branches, we perform the range reduction to full -// accuracy each time. -// -// X - N * (P_1 + P_2 + P_3) -// -// where P_1 and P_2 are 32-bit numbers (so multiplication by N -// is exact) and P_3 is a 53-bit number. Together, these -// approximate pi well enough for all cases in the restricted -// range. -// -// The main reduction sequence is: -// -// y = 32/pi * x -// N = integer(y) -// (computed by adding and subtracting off SHIFTER) -// -// m_1 = N * P_1 -// m_2 = N * P_2 -// r_1 = x - m_1 -// r = r_1 - m_2 -// (this r can be used for most of the calculation) -// -// c_1 = r_1 - r -// m_3 = N * P_3 -// c_2 = c_1 - m_2 -// c = c_2 - m_3 -// -// 2. MAIN ALGORITHM -// -// The algorithm uses a table lookup based on B = M * pi / 32 -// where M = N mod 64. The stored values are: -// sigma closest power of 2 to cos(B) -// C_hl 53-bit cos(B) - sigma -// S_hi + S_lo 2 * 53-bit sin(B) -// -// The computation is organized as follows: -// -// sin(B + r + c) = [sin(B) + sigma * r] + -// r * (cos(B) - sigma) + -// sin(B) * [cos(r + c) - 1] + -// cos(B) * [sin(r + c) - r] -// -// which is approximately: -// -// [S_hi + sigma * r] + -// C_hl * r + -// S_lo + S_hi * [(cos(r) - 1) - r * c] + -// (C_hl + sigma) * [(sin(r) - r) + c] -// -// and this is what is actually computed. We separate this sum -// into four parts: -// -// hi + med + pols + corr -// -// where -// -// hi = S_hi + sigma r -// med = C_hl * r -// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r) -// corr = S_lo + c * ((C_hl + sigma) - S_hi * r) -// -// 3. POLYNOMIAL -// -// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) * -// (sin(r) - r) can be rearranged freely, since it is quite -// small, so we exploit parallelism to the fullest. -// -// psc4 = SC_4 * r_1 -// msc4 = psc4 * r -// r2 = r * r -// msc2 = SC_2 * r2 -// r4 = r2 * r2 -// psc3 = SC_3 + msc4 -// psc1 = SC_1 + msc2 -// msc3 = r4 * psc3 -// sincospols = psc1 + msc3 -// pols = sincospols * -// -// -// 4. CORRECTION TERM -// -// This is where the "c" component of the range reduction is -// taken into account; recall that just "r" is used for most of -// the calculation. -// -// -c = m_3 - c_2 -// -d = S_hi * r - (C_hl + sigma) -// corr = -c * -d + S_lo -// -// 5. COMPENSATED SUMMATIONS -// -// The two successive compensated summations add up the high -// and medium parts, leaving just the low parts to add up at -// the end. -// -// rs = sigma * r -// res_int = S_hi + rs -// k_0 = S_hi - res_int -// k_2 = k_0 + rs -// med = C_hl * r -// res_hi = res_int + med -// k_1 = res_int - res_hi -// k_3 = k_1 + med -// -// 6. FINAL SUMMATION -// -// We now add up all the small parts: -// -// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3 -// -// Now the overall result is just: -// -// res_hi + res_lo -// -// 7. SMALL ARGUMENTS -// -// If |x| < SNN (SNN meaning the smallest normal number), we -// simply perform 0.1111111 cdots 1111 * x. For SNN <= |x|, we -// do 2^-55 * (2^55 * x - x). -// -// Special cases: -// sin(NaN) = quiet NaN, and raise invalid exception -// sin(INF) = NaN and raise invalid exception -// sin(+/-0) = +/-0 -// -/******************************************************************************/ - -ALIGNED_(16) juint _ONEHALF[] = -{ - 0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL -}; - -ALIGNED_(16) juint _P_2[] = -{ - 0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL -}; - -ALIGNED_(16) juint _SC_4[] = -{ - 0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL -}; - -ALIGNED_(16) juint _Ctable[] = -{ - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, 0xbf73b92eUL, - 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, - 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, - 0xc0000000UL, 0xbc626d19UL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, - 0xbfa60beaUL, 0x2ed59f06UL, 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, - 0x00000000UL, 0x3ff00000UL, 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, - 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, 0x00000000UL, 0x3ff00000UL, - 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, 0x20000000UL, - 0x3c5e0d89UL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, 0xbfc59267UL, - 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, - 0x3ff00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, - 0x20000000UL, 0x3c68076aUL, 0x00000000UL, 0x3ff00000UL, 0x99fcef32UL, - 0x3fca8279UL, 0x667f3bcdUL, 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, - 0x00000000UL, 0x3fe00000UL, 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, - 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, 0x00000000UL, 0x3fe00000UL, - 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, 0xe0000000UL, - 0x3c39f630UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, 0xbf9d4a2cUL, - 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, - 0x3fe00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0x3fed906bUL, - 0x20000000UL, 0x3c7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x76acf82dUL, - 0x3fa4a031UL, 0x56c62ddaUL, 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, - 0x00000000UL, 0x3fd00000UL, 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, - 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, 0x00000000UL, 0x3fd00000UL, - 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, 0x40000000UL, - 0xbc887df6UL, 0x00000000UL, 0x3fc00000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, - 0x40000000UL, 0xbc887df6UL, 0x00000000UL, 0xbfc00000UL, 0x0e5967d5UL, - 0x3fac1d1fUL, 0xcff75cb0UL, 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, - 0x00000000UL, 0xbfd00000UL, 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, - 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, 0x00000000UL, 0xbfd00000UL, - 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, 0x3fed906bUL, 0x20000000UL, - 0x3c7457e6UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, 0x3f9d4a2cUL, - 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, - 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, - 0xe0000000UL, 0x3c39f630UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, - 0xbfc133ccUL, 0x6b151741UL, 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, - 0x00000000UL, 0xbfe00000UL, 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, - 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, 0x00000000UL, 0xbfe00000UL, - 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, 0x20000000UL, - 0x3c68076aUL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, 0x3fc59267UL, - 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, - 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, - 0x20000000UL, 0x3c5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, - 0x3fb37ca1UL, 0xa6aea963UL, 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, - 0x00000000UL, 0xbff00000UL, 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, - 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, 0x00000000UL, 0xbff00000UL, - 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, 0xc0000000UL, - 0xbc626d19UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, 0x3f73b92eUL, - 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, - 0xbff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, - 0x3f73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, - 0x00000000UL, 0xbff00000UL, 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, - 0xbfc8f8b8UL, 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0xbff00000UL, - 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, - 0x3c75d28dUL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, 0x3fb37ca1UL, - 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, 0x3c672cedUL, 0x00000000UL, - 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0xbfde2b5dUL, - 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, - 0x3fc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, - 0x00000000UL, 0xbff00000UL, 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, - 0xbfe44cf3UL, 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0xbff00000UL, - 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, - 0x3c8bdd34UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, 0xbfc133ccUL, - 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, 0x3c82c5e1UL, 0x00000000UL, - 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0xbfea9b66UL, - 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, - 0x3f9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, - 0x00000000UL, 0xbfe00000UL, 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, - 0xbfed906bUL, 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0xbfe00000UL, - 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, - 0xbc8760b1UL, 0x00000000UL, 0xbfd00000UL, 0x0e5967d5UL, 0x3fac1d1fUL, - 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, 0xbc756217UL, 0x00000000UL, - 0xbfd00000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0xbfefd88dUL, - 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0xbfc00000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x00000000UL, 0x00000000UL, - 0x00000000UL, 0x00000000UL, 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, - 0xbfefd88dUL, 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0x3fc00000UL, - 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, - 0xbc756217UL, 0x00000000UL, 0x3fd00000UL, 0x76acf82dUL, 0x3fa4a031UL, - 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, 0xbc8760b1UL, 0x00000000UL, - 0x3fd00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0xbfed906bUL, - 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, - 0xbf9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, - 0x00000000UL, 0x3fe00000UL, 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, - 0xbfea9b66UL, 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0x3fe00000UL, - 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, - 0x3c82c5e1UL, 0x00000000UL, 0x3fe00000UL, 0x99fcef32UL, 0x3fca8279UL, - 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, 0x3c8bdd34UL, 0x00000000UL, - 0x3fe00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0xbfe44cf3UL, - 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, - 0xbfc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, - 0x00000000UL, 0x3ff00000UL, 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, - 0xbfde2b5dUL, 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0x3ff00000UL, - 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, - 0x3c672cedUL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, 0xbfa60beaUL, - 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, 0x3c75d28dUL, 0x00000000UL, - 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0xbfc8f8b8UL, - 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, - 0xbf73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, - 0x00000000UL, 0x3ff00000UL -}; - -ALIGNED_(16) juint _SC_2[] = -{ - 0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL -}; - -ALIGNED_(16) juint _SC_3[] = -{ - 0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL -}; - -ALIGNED_(16) juint _SC_1[] = -{ - 0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL -}; - -ALIGNED_(16) juint _PI_INV_TABLE[] = -{ - 0x00000000UL, 0x00000000UL, 0xa2f9836eUL, 0x4e441529UL, 0xfc2757d1UL, - 0xf534ddc0UL, 0xdb629599UL, 0x3c439041UL, 0xfe5163abUL, 0xdebbc561UL, - 0xb7246e3aUL, 0x424dd2e0UL, 0x06492eeaUL, 0x09d1921cUL, 0xfe1deb1cUL, - 0xb129a73eUL, 0xe88235f5UL, 0x2ebb4484UL, 0xe99c7026UL, 0xb45f7e41UL, - 0x3991d639UL, 0x835339f4UL, 0x9c845f8bUL, 0xbdf9283bUL, 0x1ff897ffUL, - 0xde05980fUL, 0xef2f118bUL, 0x5a0a6d1fUL, 0x6d367ecfUL, 0x27cb09b7UL, - 0x4f463f66UL, 0x9e5fea2dUL, 0x7527bac7UL, 0xebe5f17bUL, 0x3d0739f7UL, - 0x8a5292eaUL, 0x6bfb5fb1UL, 0x1f8d5d08UL, 0x56033046UL, 0xfc7b6babUL, - 0xf0cfbc21UL -}; - -ALIGNED_(8) juint _PI_4[] = -{ - 0x40000000UL, 0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL -}; - -ALIGNED_(8) juint _PI32INV[] = -{ - 0x6dc9c883UL, 0x40245f30UL -}; - -ALIGNED_(8) juint _SHIFTER[] = -{ - 0x00000000UL, 0x43380000UL -}; - -ALIGNED_(8) juint _SIGN_MASK[] = -{ - 0x00000000UL, 0x80000000UL -}; - -ALIGNED_(8) juint _P_3[] = -{ - 0x2e037073UL, 0x3b63198aUL -}; - -ALIGNED_(8) juint _ALL_ONES[] = -{ - 0xffffffffUL, 0x3fefffffUL -}; - -ALIGNED_(8) juint _TWO_POW_55[] = -{ - 0x00000000UL, 0x43600000UL -}; - -ALIGNED_(8) juint _TWO_POW_M55[] = -{ - 0x00000000UL, 0x3c800000ULL -}; - -ALIGNED_(8) juint _P_1[] = -{ - 0x54400000UL, 0x3fb921fbUL -}; - -ALIGNED_(8) juint _NEG_ZERO[] = -{ - 0x00000000UL, 0x80000000UL -}; - -void MacroAssembler::fast_sin(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ebx, Register ecx, Register edx, Register tmp1, Register tmp2, Register tmp3, Register tmp4) { - Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1; - Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; - Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; - Label L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1; - Label L_2TAG_PACKET_12_0_1, B1_1, B1_2, B1_4, start; - - assert_different_registers(tmp1, tmp2, tmp3, tmp4, eax, ebx, ecx, edx); - address ONEHALF = (address)_ONEHALF; - address P_2 = (address)_P_2; - address SC_4 = (address)_SC_4; - address Ctable = (address)_Ctable; - address SC_2 = (address)_SC_2; - address SC_3 = (address)_SC_3; - address SC_1 = (address)_SC_1; - address PI_INV_TABLE = (address)_PI_INV_TABLE; - address PI_4 = (address)_PI_4; - address PI32INV = (address)_PI32INV; - address SHIFTER = (address)_SHIFTER; - address SIGN_MASK = (address)_SIGN_MASK; - address P_3 = (address)_P_3; - address ALL_ONES = (address)_ALL_ONES; - address TWO_POW_55 = (address)_TWO_POW_55; - address TWO_POW_M55 = (address)_TWO_POW_M55; - address P_1 = (address)_P_1; - address NEG_ZERO = (address)_NEG_ZERO; - - bind(start); - push(rbx); - subq(rsp, 16); - movsd(Address(rsp, 8), xmm0); - movl(eax, Address(rsp, 12)); - movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL - movq(xmm2, ExternalAddress(SHIFTER)); //0x00000000UL, 0x43380000UL - andl(eax, 2147418112); - subl(eax, 808452096); - cmpl(eax, 281346048); - jcc(Assembler::above, L_2TAG_PACKET_0_0_1); - mulsd(xmm1, xmm0); - movdqu(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL - movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL - pand(xmm4, xmm0); - por(xmm5, xmm4); - addpd(xmm1, xmm5); - cvttsd2sil(edx, xmm1); - cvtsi2sdl(xmm1, edx); - movdqu(xmm6, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL - mov64(r8, 0x3fb921fb54400000); - movdq(xmm3, r8); - movdqu(xmm5, ExternalAddress(SC_4)); //0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL - pshufd(xmm4, xmm0, 68); - mulsd(xmm3, xmm1); - movddup(xmm1, xmm1); - andl(edx, 63); - shll(edx, 5); - lea(rax, ExternalAddress(Ctable)); - addq(rax, rdx); - mulpd(xmm6, xmm1); - mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL - subsd(xmm4, xmm3); - movq(xmm7, Address(rax, 8)); - subsd(xmm0, xmm3); - movddup(xmm3, xmm4); - subsd(xmm4, xmm6); - pshufd(xmm0, xmm0, 68); - movdqu(xmm2, Address(rax, 0)); - mulpd(xmm5, xmm0); - subpd(xmm0, xmm6); - mulsd(xmm7, xmm4); - subsd(xmm3, xmm4); - mulpd(xmm5, xmm0); - mulpd(xmm0, xmm0); - subsd(xmm3, xmm6); - movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL - subsd(xmm1, xmm3); - movq(xmm3, Address(rax, 24)); - addsd(xmm2, xmm3); - subsd(xmm7, xmm2); - mulsd(xmm2, xmm4); - mulpd(xmm6, xmm0); - mulsd(xmm3, xmm4); - mulpd(xmm2, xmm0); - mulpd(xmm0, xmm0); - addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL - mulsd(xmm4, Address(rax, 0)); - addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL - mulpd(xmm5, xmm0); - movdqu(xmm0, xmm3); - addsd(xmm3, Address(rax, 8)); - mulpd(xmm1, xmm7); - movdqu(xmm7, xmm4); - addsd(xmm4, xmm3); - addpd(xmm6, xmm5); - movq(xmm5, Address(rax, 8)); - subsd(xmm5, xmm3); - subsd(xmm3, xmm4); - addsd(xmm1, Address(rax, 16)); - mulpd(xmm6, xmm2); - addsd(xmm5, xmm0); - addsd(xmm3, xmm7); - addsd(xmm1, xmm5); - addsd(xmm1, xmm3); - addsd(xmm1, xmm6); - unpckhpd(xmm6, xmm6); - movdqu(xmm0, xmm4); - addsd(xmm1, xmm6); - addsd(xmm0, xmm1); - jmp(B1_4); - - bind(L_2TAG_PACKET_0_0_1); - jcc(Assembler::greater, L_2TAG_PACKET_1_0_1); - shrl(eax, 20); - cmpl(eax, 3325); - jcc(Assembler::notEqual, L_2TAG_PACKET_2_0_1); - mulsd(xmm0, ExternalAddress(ALL_ONES)); //0xffffffffUL, 0x3fefffffUL - jmp(B1_4); - - bind(L_2TAG_PACKET_2_0_1); - movq(xmm3, ExternalAddress(TWO_POW_55)); //0x00000000UL, 0x43600000UL - mulsd(xmm3, xmm0); - subsd(xmm3, xmm0); - mulsd(xmm3, ExternalAddress(TWO_POW_M55)); //0x00000000UL, 0x3c800000UL - jmp(B1_4); - - bind(L_2TAG_PACKET_1_0_1); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - cmpl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_3_0_1); - pextrw(ecx, xmm0, 3); - andl(ecx, 32752); - subl(ecx, 16224); - shrl(ecx, 7); - andl(ecx, 65532); - lea(r11, ExternalAddress(PI_INV_TABLE)); - addq(rcx, r11); - movdq(rax, xmm0); - movl(r10, Address(rcx, 20)); - movl(r8, Address(rcx, 24)); - movl(edx, eax); - shrq(rax, 21); - orl(eax, INT_MIN); - shrl(eax, 11); - movl(r9, r10); - imulq(r10, rdx); - imulq(r9, rax); - imulq(r8, rax); - movl(rsi, Address(rcx, 16)); - movl(rdi, Address(rcx, 12)); - movl(r11, r10); - shrq(r10, 32); - addq(r9, r10); - addq(r11, r8); - movl(r8, r11); - shrq(r11, 32); - addq(r9, r11); - movl(r10, rsi); - imulq(rsi, rdx); - imulq(r10, rax); - movl(r11, rdi); - imulq(rdi, rdx); - movl(ebx, rsi); - shrq(rsi, 32); - addq(r9, rbx); - movl(ebx, r9); - shrq(r9, 32); - addq(r10, rsi); - addq(r10, r9); - shlq(rbx, 32); - orq(r8, rbx); - imulq(r11, rax); - movl(r9, Address(rcx, 8)); - movl(rsi, Address(rcx, 4)); - movl(ebx, rdi); - shrq(rdi, 32); - addq(r10, rbx); - movl(ebx, r10); - shrq(r10, 32); - addq(r11, rdi); - addq(r11, r10); - movq(rdi, r9); - imulq(r9, rdx); - imulq(rdi, rax); - movl(r10, r9); - shrq(r9, 32); - addq(r11, r10); - movl(r10, r11); - shrq(r11, 32); - addq(rdi, r9); - addq(rdi, r11); - movq(r9, rsi); - imulq(rsi, rdx); - imulq(r9, rax); - shlq(r10, 32); - orq(r10, rbx); - movl(eax, Address(rcx, 0)); - movl(r11, rsi); - shrq(rsi, 32); - addq(rdi, r11); - movl(r11, rdi); - shrq(rdi, 32); - addq(r9, rsi); - addq(r9, rdi); - imulq(rdx, rax); - pextrw(ebx, xmm0, 3); - lea(rdi, ExternalAddress(PI_INV_TABLE)); - subq(rcx, rdi); - addl(ecx, ecx); - addl(ecx, ecx); - addl(ecx, ecx); - addl(ecx, 19); - movl(rsi, 32768); - andl(rsi, ebx); - shrl(ebx, 4); - andl(ebx, 2047); - subl(ebx, 1023); - subl(ecx, ebx); - addq(r9, rdx); - movl(edx, ecx); - addl(edx, 32); - cmpl(ecx, 1); - jcc(Assembler::less, L_2TAG_PACKET_4_0_1); - negl(ecx); - addl(ecx, 29); - shll(r9); - movl(rdi, r9); - andl(r9, 536870911); - testl(r9, 268435456); - jcc(Assembler::notEqual, L_2TAG_PACKET_5_0_1); - shrl(r9); - movl(ebx, 0); - shlq(r9, 32); - orq(r9, r11); - - bind(L_2TAG_PACKET_6_0_1); - - bind(L_2TAG_PACKET_7_0_1); - - cmpq(r9, 0); - jcc(Assembler::equal, L_2TAG_PACKET_8_0_1); - - bind(L_2TAG_PACKET_9_0_1); - bsrq(r11, r9); - movl(ecx, 29); - subl(ecx, r11); - jcc(Assembler::lessEqual, L_2TAG_PACKET_10_0_1); - shlq(r9); - movq(rax, r10); - shlq(r10); - addl(edx, ecx); - negl(ecx); - addl(ecx, 64); - shrq(rax); - shrq(r8); - orq(r9, rax); - orq(r10, r8); - - bind(L_2TAG_PACKET_11_0_1); - cvtsi2sdq(xmm0, r9); - shrq(r10, 1); - cvtsi2sdq(xmm3, r10); - xorpd(xmm4, xmm4); - shll(edx, 4); - negl(edx); - addl(edx, 16368); - orl(edx, rsi); - xorl(edx, ebx); - pinsrw(xmm4, edx, 3); - movq(xmm2, ExternalAddress(PI_4)); //0x40000000UL, 0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL - movq(xmm6, ExternalAddress(8 + PI_4)); //0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL - xorpd(xmm5, xmm5); - subl(edx, 1008); - pinsrw(xmm5, edx, 3); - mulsd(xmm0, xmm4); - shll(rsi, 16); - sarl(rsi, 31); - mulsd(xmm3, xmm5); - movdqu(xmm1, xmm0); - mulsd(xmm0, xmm2); - shrl(rdi, 29); - addsd(xmm1, xmm3); - mulsd(xmm3, xmm2); - addl(rdi, rsi); - xorl(rdi, rsi); - mulsd(xmm6, xmm1); - movl(eax, rdi); - addsd(xmm6, xmm3); - movdqu(xmm2, xmm0); - addsd(xmm0, xmm6); - subsd(xmm2, xmm0); - addsd(xmm6, xmm2); - - bind(L_2TAG_PACKET_12_0_1); - movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL - mulsd(xmm1, xmm0); - movq(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL - movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL - pand(xmm4, xmm0); - por(xmm5, xmm4); - addpd(xmm1, xmm5); - cvttsd2sil(edx, xmm1); - cvtsi2sdl(xmm1, edx); - movq(xmm3, ExternalAddress(P_1)); //0x54400000UL, 0x3fb921fbUL - movdqu(xmm2, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL - mulsd(xmm3, xmm1); - unpcklpd(xmm1, xmm1); - shll(eax, 3); - addl(edx, 1865216); - movdqu(xmm4, xmm0); - addl(edx, eax); - andl(edx, 63); - movdqu(xmm5, ExternalAddress(SC_4)); //0x54400000UL, 0x3fb921fbUL - lea(rax, ExternalAddress(Ctable)); - shll(edx, 5); - addq(rax, rdx); - mulpd(xmm2, xmm1); - subsd(xmm0, xmm3); - mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL - subsd(xmm4, xmm3); - movq(xmm7, Address(rax, 8)); - unpcklpd(xmm0, xmm0); - movdqu(xmm3, xmm4); - subsd(xmm4, xmm2); - mulpd(xmm5, xmm0); - subpd(xmm0, xmm2); - mulsd(xmm7, xmm4); - subsd(xmm3, xmm4); - mulpd(xmm5, xmm0); - mulpd(xmm0, xmm0); - subsd(xmm3, xmm2); - movdqu(xmm2, Address(rax, 0)); - subsd(xmm1, xmm3); - movq(xmm3, Address(rax, 24)); - addsd(xmm2, xmm3); - subsd(xmm7, xmm2); - subsd(xmm1, xmm6); - movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL - mulsd(xmm2, xmm4); - mulpd(xmm6, xmm0); - mulsd(xmm3, xmm4); - mulpd(xmm2, xmm0); - mulpd(xmm0, xmm0); - addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL - mulsd(xmm4, Address(rax, 0)); - addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL - mulpd(xmm5, xmm0); - movdqu(xmm0, xmm3); - addsd(xmm3, Address(rax, 8)); - mulpd(xmm1, xmm7); - movdqu(xmm7, xmm4); - addsd(xmm4, xmm3); - addpd(xmm6, xmm5); - movq(xmm5, Address(rax, 8)); - subsd(xmm5, xmm3); - subsd(xmm3, xmm4); - addsd(xmm1, Address(rax, 16)); - mulpd(xmm6, xmm2); - addsd(xmm5, xmm0); - addsd(xmm3, xmm7); - addsd(xmm1, xmm5); - addsd(xmm1, xmm3); - addsd(xmm1, xmm6); - unpckhpd(xmm6, xmm6); - movdqu(xmm0, xmm4); - addsd(xmm1, xmm6); - addsd(xmm0, xmm1); - jmp(B1_4); - - bind(L_2TAG_PACKET_8_0_1); - addl(edx, 64); - movq(r9, r10); - movq(r10, r8); - movl(r8, 0); - cmpq(r9, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_9_0_1); - addl(edx, 64); - movq(r9, r10); - movq(r10, r8); - cmpq(r9, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_9_0_1); - xorpd(xmm0, xmm0); - xorpd(xmm6, xmm6); - jmp(L_2TAG_PACKET_12_0_1); - - bind(L_2TAG_PACKET_10_0_1); - jcc(Assembler::equal, L_2TAG_PACKET_11_0_1); - negl(ecx); - shrq(r10); - movq(rax, r9); - shrq(r9); - subl(edx, ecx); - negl(ecx); - addl(ecx, 64); - shlq(rax); - orq(r10, rax); - jmp(L_2TAG_PACKET_11_0_1); - - bind(L_2TAG_PACKET_4_0_1); - negl(ecx); - shlq(r9, 32); - orq(r9, r11); - shlq(r9); - movq(rdi, r9); - testl(r9, INT_MIN); - jcc(Assembler::notEqual, L_2TAG_PACKET_13_0_1); - shrl(r9); - movl(ebx, 0); - shrq(rdi, 3); - jmp(L_2TAG_PACKET_7_0_1); - - bind(L_2TAG_PACKET_5_0_1); - shrl(r9); - movl(ebx, 536870912); - shrl(ebx); - shlq(r9, 32); - orq(r9, r11); - shlq(rbx, 32); - addl(rdi, 536870912); - movl(rcx, 0); - movl(r11, 0); - subq(rcx, r8); - sbbq(r11, r10); - sbbq(rbx, r9); - movq(r8, rcx); - movq(r10, r11); - movq(r9, rbx); - movl(ebx, 32768); - jmp(L_2TAG_PACKET_6_0_1); - - bind(L_2TAG_PACKET_13_0_1); - shrl(r9); - mov64(rbx, 0x100000000); - shrq(rbx); - movl(rcx, 0); - movl(r11, 0); - subq(rcx, r8); - sbbq(r11, r10); - sbbq(rbx, r9); - movq(r8, rcx); - movq(r10, r11); - movq(r9, rbx); - movl(ebx, 32768); - shrq(rdi, 3); - addl(rdi, 536870912); - jmp(L_2TAG_PACKET_7_0_1); - - bind(L_2TAG_PACKET_3_0_1); - movq(xmm0, Address(rsp, 8)); - mulsd(xmm0, ExternalAddress(NEG_ZERO)); //0x00000000UL, 0x80000000UL - movq(Address(rsp, 0), xmm0); - - bind(L_2TAG_PACKET_14_0_1); - - bind(B1_4); - addq(rsp, 16); - pop(rbx); -} - -/******************************************************************************/ -// ALGORITHM DESCRIPTION - COS() -// --------------------- -// -// 1. RANGE REDUCTION -// -// We perform an initial range reduction from X to r with -// -// X =~= N * pi/32 + r -// -// so that |r| <= pi/64 + epsilon. We restrict inputs to those -// where |N| <= 932560. Beyond this, the range reduction is -// insufficiently accurate. For extremely small inputs, -// denormalization can occur internally, impacting performance. -// This means that the main path is actually only taken for -// 2^-252 <= |X| < 90112. -// -// To avoid branches, we perform the range reduction to full -// accuracy each time. -// -// X - N * (P_1 + P_2 + P_3) -// -// where P_1 and P_2 are 32-bit numbers (so multiplication by N -// is exact) and P_3 is a 53-bit number. Together, these -// approximate pi well enough for all cases in the restricted -// range. -// -// The main reduction sequence is: -// -// y = 32/pi * x -// N = integer(y) -// (computed by adding and subtracting off SHIFTER) -// -// m_1 = N * P_1 -// m_2 = N * P_2 -// r_1 = x - m_1 -// r = r_1 - m_2 -// (this r can be used for most of the calculation) -// -// c_1 = r_1 - r -// m_3 = N * P_3 -// c_2 = c_1 - m_2 -// c = c_2 - m_3 -// -// 2. MAIN ALGORITHM -// -// The algorithm uses a table lookup based on B = M * pi / 32 -// where M = N mod 64. The stored values are: -// sigma closest power of 2 to cos(B) -// C_hl 53-bit cos(B) - sigma -// S_hi + S_lo 2 * 53-bit sin(B) -// -// The computation is organized as follows: -// -// sin(B + r + c) = [sin(B) + sigma * r] + -// r * (cos(B) - sigma) + -// sin(B) * [cos(r + c) - 1] + -// cos(B) * [sin(r + c) - r] -// -// which is approximately: -// -// [S_hi + sigma * r] + -// C_hl * r + -// S_lo + S_hi * [(cos(r) - 1) - r * c] + -// (C_hl + sigma) * [(sin(r) - r) + c] -// -// and this is what is actually computed. We separate this sum -// into four parts: -// -// hi + med + pols + corr -// -// where -// -// hi = S_hi + sigma r -// med = C_hl * r -// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r) -// corr = S_lo + c * ((C_hl + sigma) - S_hi * r) -// -// 3. POLYNOMIAL -// -// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) * -// (sin(r) - r) can be rearranged freely, since it is quite -// small, so we exploit parallelism to the fullest. -// -// psc4 = SC_4 * r_1 -// msc4 = psc4 * r -// r2 = r * r -// msc2 = SC_2 * r2 -// r4 = r2 * r2 -// psc3 = SC_3 + msc4 -// psc1 = SC_1 + msc2 -// msc3 = r4 * psc3 -// sincospols = psc1 + msc3 -// pols = sincospols * -// -// -// 4. CORRECTION TERM -// -// This is where the "c" component of the range reduction is -// taken into account; recall that just "r" is used for most of -// the calculation. -// -// -c = m_3 - c_2 -// -d = S_hi * r - (C_hl + sigma) -// corr = -c * -d + S_lo -// -// 5. COMPENSATED SUMMATIONS -// -// The two successive compensated summations add up the high -// and medium parts, leaving just the low parts to add up at -// the end. -// -// rs = sigma * r -// res_int = S_hi + rs -// k_0 = S_hi - res_int -// k_2 = k_0 + rs -// med = C_hl * r -// res_hi = res_int + med -// k_1 = res_int - res_hi -// k_3 = k_1 + med -// -// 6. FINAL SUMMATION -// -// We now add up all the small parts: -// -// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3 -// -// Now the overall result is just: -// -// res_hi + res_lo -// -// 7. SMALL ARGUMENTS -// -// Inputs with |X| < 2^-252 are treated specially as -// 1 - |x|. -// -// Special cases: -// cos(NaN) = quiet NaN, and raise invalid exception -// cos(INF) = NaN and raise invalid exception -// cos(0) = 1 -// -/******************************************************************************/ - -ALIGNED_(8) juint _ONE[] = -{ - 0x00000000UL, 0x3ff00000UL -}; - -void MacroAssembler::fast_cos(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register r8, Register r9, Register r10, Register r11) { - Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1; - Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; - Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; - Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, B1_2, B1_3, B1_4, B1_5, start; - - assert_different_registers(r8, r9, r10, r11, eax, ecx, edx); - - address ONEHALF = (address)_ONEHALF; - address P_2 = (address)_P_2; - address SC_4 = (address)_SC_4; - address Ctable = (address)_Ctable; - address SC_2 = (address)_SC_2; - address SC_3 = (address)_SC_3; - address SC_1 = (address)_SC_1; - address PI_INV_TABLE = (address)_PI_INV_TABLE; - address PI_4 = (address)_PI_4; - address PI32INV = (address)_PI32INV; - address SIGN_MASK = (address)_SIGN_MASK; - address P_1 = (address)_P_1; - address P_3 = (address)_P_3; - address ONE = (address)_ONE; - address NEG_ZERO = (address)_NEG_ZERO; - - bind(start); - push(rbx); - subq(rsp, 16); - movsd(Address(rsp, 8), xmm0); - - bind(B1_2); - movl(eax, Address(rsp, 12)); - movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL - andl(eax, 2147418112); - subl(eax, 808452096); - cmpl(eax, 281346048); - jcc(Assembler::above, L_2TAG_PACKET_0_0_1); - mulsd(xmm1, xmm0); - movdqu(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL - movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL - pand(xmm4, xmm0); - por(xmm5, xmm4); - addpd(xmm1, xmm5); - cvttsd2sil(edx, xmm1); - cvtsi2sdl(xmm1, edx); - movdqu(xmm2, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL - movq(xmm3, ExternalAddress(P_1)); //0x54400000UL, 0x3fb921fbUL - mulsd(xmm3, xmm1); - unpcklpd(xmm1, xmm1); - addq(rdx, 1865232); - movdqu(xmm4, xmm0); - andq(rdx, 63); - movdqu(xmm5, ExternalAddress(SC_4)); //0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL - lea(rax, ExternalAddress(Ctable)); - shlq(rdx, 5); - addq(rax, rdx); - mulpd(xmm2, xmm1); - subsd(xmm0, xmm3); - mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL - subsd(xmm4, xmm3); - movq(xmm7, Address(rax, 8)); - unpcklpd(xmm0, xmm0); - movdqu(xmm3, xmm4); - subsd(xmm4, xmm2); - mulpd(xmm5, xmm0); - subpd(xmm0, xmm2); - movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL - mulsd(xmm7, xmm4); - subsd(xmm3, xmm4); - mulpd(xmm5, xmm0); - mulpd(xmm0, xmm0); - subsd(xmm3, xmm2); - movdqu(xmm2, Address(rax, 0)); - subsd(xmm1, xmm3); - movq(xmm3, Address(rax, 24)); - addsd(xmm2, xmm3); - subsd(xmm7, xmm2); - mulsd(xmm2, xmm4); - mulpd(xmm6, xmm0); - mulsd(xmm3, xmm4); - mulpd(xmm2, xmm0); - mulpd(xmm0, xmm0); - addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL - mulsd(xmm4, Address(rax, 0)); - addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL - mulpd(xmm5, xmm0); - movdqu(xmm0, xmm3); - addsd(xmm3, Address(rax, 8)); - mulpd(xmm1, xmm7); - movdqu(xmm7, xmm4); - addsd(xmm4, xmm3); - addpd(xmm6, xmm5); - movq(xmm5, Address(rax, 8)); - subsd(xmm5, xmm3); - subsd(xmm3, xmm4); - addsd(xmm1, Address(rax, 16)); - mulpd(xmm6, xmm2); - addsd(xmm0, xmm5); - addsd(xmm3, xmm7); - addsd(xmm0, xmm1); - addsd(xmm0, xmm3); - addsd(xmm0, xmm6); - unpckhpd(xmm6, xmm6); - addsd(xmm0, xmm6); - addsd(xmm0, xmm4); - jmp(B1_4); - - bind(L_2TAG_PACKET_0_0_1); - jcc(Assembler::greater, L_2TAG_PACKET_1_0_1); - pextrw(eax, xmm0, 3); - andl(eax, 32767); - pinsrw(xmm0, eax, 3); - movq(xmm1, ExternalAddress(ONE)); //0x00000000UL, 0x3ff00000UL - subsd(xmm1, xmm0); - movdqu(xmm0, xmm1); - jmp(B1_4); - - bind(L_2TAG_PACKET_1_0_1); - pextrw(eax, xmm0, 3); - andl(eax, 32752); - cmpl(eax, 32752); - jcc(Assembler::equal, L_2TAG_PACKET_2_0_1); - pextrw(ecx, xmm0, 3); - andl(ecx, 32752); - subl(ecx, 16224); - shrl(ecx, 7); - andl(ecx, 65532); - lea(r11, ExternalAddress(PI_INV_TABLE)); - addq(rcx, r11); - movdq(rax, xmm0); - movl(r10, Address(rcx, 20)); - movl(r8, Address(rcx, 24)); - movl(edx, eax); - shrq(rax, 21); - orl(eax, INT_MIN); - shrl(eax, 11); - movl(r9, r10); - imulq(r10, rdx); - imulq(r9, rax); - imulq(r8, rax); - movl(rsi, Address(rcx, 16)); - movl(rdi, Address(rcx, 12)); - movl(r11, r10); - shrq(r10, 32); - addq(r9, r10); - addq(r11, r8); - movl(r8, r11); - shrq(r11, 32); - addq(r9, r11); - movl(r10, rsi); - imulq(rsi, rdx); - imulq(r10, rax); - movl(r11, rdi); - imulq(rdi, rdx); - movl(rbx, rsi); - shrq(rsi, 32); - addq(r9, rbx); - movl(rbx, r9); - shrq(r9, 32); - addq(r10, rsi); - addq(r10, r9); - shlq(rbx, 32); - orq(r8, rbx); - imulq(r11, rax); - movl(r9, Address(rcx, 8)); - movl(rsi, Address(rcx, 4)); - movl(rbx, rdi); - shrq(rdi, 32); - addq(r10, rbx); - movl(rbx, r10); - shrq(r10, 32); - addq(r11, rdi); - addq(r11, r10); - movq(rdi, r9); - imulq(r9, rdx); - imulq(rdi, rax); - movl(r10, r9); - shrq(r9, 32); - addq(r11, r10); - movl(r10, r11); - shrq(r11, 32); - addq(rdi, r9); - addq(rdi, r11); - movq(r9, rsi); - imulq(rsi, rdx); - imulq(r9, rax); - shlq(r10, 32); - orq(r10, rbx); - movl(eax, Address(rcx, 0)); - movl(r11, rsi); - shrq(rsi, 32); - addq(rdi, r11); - movl(r11, rdi); - shrq(rdi, 32); - addq(r9, rsi); - addq(r9, rdi); - imulq(rdx, rax); - pextrw(rbx, xmm0, 3); - lea(rdi, ExternalAddress(PI_INV_TABLE)); - subq(rcx, rdi); - addl(ecx, ecx); - addl(ecx, ecx); - addl(ecx, ecx); - addl(ecx, 19); - movl(rsi, 32768); - andl(rsi, rbx); - shrl(rbx, 4); - andl(rbx, 2047); - subl(rbx, 1023); - subl(ecx, rbx); - addq(r9, rdx); - movl(edx, ecx); - addl(edx, 32); - cmpl(ecx, 1); - jcc(Assembler::less, L_2TAG_PACKET_3_0_1); - negl(ecx); - addl(ecx, 29); - shll(r9); - movl(rdi, r9); - andl(r9, 536870911); - testl(r9, 268435456); - jcc(Assembler::notEqual, L_2TAG_PACKET_4_0_1); - shrl(r9); - movl(rbx, 0); - shlq(r9, 32); - orq(r9, r11); - - bind(L_2TAG_PACKET_5_0_1); - - bind(L_2TAG_PACKET_6_0_1); - cmpq(r9, 0); - jcc(Assembler::equal, L_2TAG_PACKET_7_0_1); - - bind(L_2TAG_PACKET_8_0_1); - bsrq(r11, r9); - movl(ecx, 29); - subl(ecx, r11); - jcc(Assembler::lessEqual, L_2TAG_PACKET_9_0_1); - shlq(r9); - movq(rax, r10); - shlq(r10); - addl(edx, ecx); - negl(ecx); - addl(ecx, 64); - shrq(rax); - shrq(r8); - orq(r9, rax); - orq(r10, r8); - - bind(L_2TAG_PACKET_10_0_1); - cvtsi2sdq(xmm0, r9); - shrq(r10, 1); - cvtsi2sdq(xmm3, r10); - xorpd(xmm4, xmm4); - shll(edx, 4); - negl(edx); - addl(edx, 16368); - orl(edx, rsi); - xorl(edx, rbx); - pinsrw(xmm4, edx, 3); - movq(xmm2, ExternalAddress(PI_4)); //0x40000000UL, 0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL - movq(xmm6, ExternalAddress(8 + PI_4)); //0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL - xorpd(xmm5, xmm5); - subl(edx, 1008); - pinsrw(xmm5, edx, 3); - mulsd(xmm0, xmm4); - shll(rsi, 16); - sarl(rsi, 31); - mulsd(xmm3, xmm5); - movdqu(xmm1, xmm0); - mulsd(xmm0, xmm2); - shrl(rdi, 29); - addsd(xmm1, xmm3); - mulsd(xmm3, xmm2); - addl(rdi, rsi); - xorl(rdi, rsi); - mulsd(xmm6, xmm1); - movl(eax, rdi); - addsd(xmm6, xmm3); - movdqu(xmm2, xmm0); - addsd(xmm0, xmm6); - subsd(xmm2, xmm0); - addsd(xmm6, xmm2); - - bind(L_2TAG_PACKET_11_0_1); - movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL - mulsd(xmm1, xmm0); - movq(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL - movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL - pand(xmm4, xmm0); - por(xmm5, xmm4); - addpd(xmm1, xmm5); - cvttsd2siq(rdx, xmm1); - cvtsi2sdq(xmm1, rdx); - movq(xmm3, ExternalAddress(P_1)); //0x54400000UL, 0x3fb921fbUL - movdqu(xmm2, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL - mulsd(xmm3, xmm1); - unpcklpd(xmm1, xmm1); - shll(eax, 3); - addl(edx, 1865232); - movdqu(xmm4, xmm0); - addl(edx, eax); - andl(edx, 63); - movdqu(xmm5, ExternalAddress(SC_4)); //0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL - lea(rax, ExternalAddress(Ctable)); - shll(edx, 5); - addq(rax, rdx); - mulpd(xmm2, xmm1); - subsd(xmm0, xmm3); - mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL - subsd(xmm4, xmm3); - movq(xmm7, Address(rax, 8)); - unpcklpd(xmm0, xmm0); - movdqu(xmm3, xmm4); - subsd(xmm4, xmm2); - mulpd(xmm5, xmm0); - subpd(xmm0, xmm2); - mulsd(xmm7, xmm4); - subsd(xmm3, xmm4); - mulpd(xmm5, xmm0); - mulpd(xmm0, xmm0); - subsd(xmm3, xmm2); - movdqu(xmm2, Address(rax, 0)); - subsd(xmm1, xmm3); - movq(xmm3, Address(rax, 24)); - addsd(xmm2, xmm3); - subsd(xmm7, xmm2); - subsd(xmm1, xmm6); - movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL - mulsd(xmm2, xmm4); - mulpd(xmm6, xmm0); - mulsd(xmm3, xmm4); - mulpd(xmm2, xmm0); - mulpd(xmm0, xmm0); - addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL - mulsd(xmm4, Address(rax, 0)); - addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL - mulpd(xmm5, xmm0); - movdqu(xmm0, xmm3); - addsd(xmm3, Address(rax, 8)); - mulpd(xmm1, xmm7); - movdqu(xmm7, xmm4); - addsd(xmm4, xmm3); - addpd(xmm6, xmm5); - movq(xmm5, Address(rax, 8)); - subsd(xmm5, xmm3); - subsd(xmm3, xmm4); - addsd(xmm1, Address(rax, 16)); - mulpd(xmm6, xmm2); - addsd(xmm5, xmm0); - addsd(xmm3, xmm7); - addsd(xmm1, xmm5); - addsd(xmm1, xmm3); - addsd(xmm1, xmm6); - unpckhpd(xmm6, xmm6); - movdqu(xmm0, xmm4); - addsd(xmm1, xmm6); - addsd(xmm0, xmm1); - jmp(B1_4); - - bind(L_2TAG_PACKET_7_0_1); - addl(edx, 64); - movq(r9, r10); - movq(r10, r8); - movl(r8, 0); - cmpq(r9, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_8_0_1); - addl(edx, 64); - movq(r9, r10); - movq(r10, r8); - cmpq(r9, 0); - jcc(Assembler::notEqual, L_2TAG_PACKET_8_0_1); - xorpd(xmm0, xmm0); - xorpd(xmm6, xmm6); - jmp(L_2TAG_PACKET_11_0_1); - - bind(L_2TAG_PACKET_9_0_1); - jcc(Assembler::equal, L_2TAG_PACKET_10_0_1); - negl(ecx); - shrq(r10); - movq(rax, r9); - shrq(r9); - subl(edx, ecx); - negl(ecx); - addl(ecx, 64); - shlq(rax); - orq(r10, rax); - jmp(L_2TAG_PACKET_10_0_1); - bind(L_2TAG_PACKET_3_0_1); - negl(ecx); - shlq(r9, 32); - orq(r9, r11); - shlq(r9); - movq(rdi, r9); - testl(r9, INT_MIN); - jcc(Assembler::notEqual, L_2TAG_PACKET_12_0_1); - shrl(r9); - movl(rbx, 0); - shrq(rdi, 3); - jmp(L_2TAG_PACKET_6_0_1); - - bind(L_2TAG_PACKET_4_0_1); - shrl(r9); - movl(rbx, 536870912); - shrl(rbx); - shlq(r9, 32); - orq(r9, r11); - shlq(rbx, 32); - addl(rdi, 536870912); - movl(rcx, 0); - movl(r11, 0); - subq(rcx, r8); - sbbq(r11, r10); - sbbq(rbx, r9); - movq(r8, rcx); - movq(r10, r11); - movq(r9, rbx); - movl(rbx, 32768); - jmp(L_2TAG_PACKET_5_0_1); - - bind(L_2TAG_PACKET_12_0_1); - shrl(r9); - mov64(rbx, 0x100000000); - shrq(rbx); - movl(rcx, 0); - movl(r11, 0); - subq(rcx, r8); - sbbq(r11, r10); - sbbq(rbx, r9); - movq(r8, rcx); - movq(r10, r11); - movq(r9, rbx); - movl(rbx, 32768); - shrq(rdi, 3); - addl(rdi, 536870912); - jmp(L_2TAG_PACKET_6_0_1); - - bind(L_2TAG_PACKET_2_0_1); - movsd(xmm0, Address(rsp, 8)); - mulsd(xmm0, ExternalAddress(NEG_ZERO)); //0x00000000UL, 0x80000000UL - movq(Address(rsp, 0), xmm0); - - bind(L_2TAG_PACKET_13_0_1); - - bind(B1_4); - addq(rsp, 16); - pop(rbx); -} diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp index 7d2c73af358..1a18af590f6 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp @@ -3399,6 +3399,18 @@ void MacroAssembler::movq(XMMRegister dst, AddressLiteral src) { } } +void MacroAssembler::setvectmask(Register dst, Register src) { + Assembler::movl(dst, 1); + Assembler::shlxl(dst, dst, src); + Assembler::decl(dst); + Assembler::kmovdl(k1, dst); + Assembler::movl(dst, src); +} + +void MacroAssembler::restorevectmask() { + Assembler::knotwl(k1, k0); +} + void MacroAssembler::movdbl(XMMRegister dst, AddressLiteral src) { if (reachable(src)) { if (UseXmmLoadAndClearUpper) { @@ -4320,9 +4332,7 @@ void MacroAssembler::vpcmpeqb(XMMRegister dst, XMMRegister nds, XMMRegister src, int nds_enc = nds->encoding(); int src_enc = src->encoding(); assert(dst_enc == nds_enc, ""); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpcmpeqb(dst, nds, src, vector_len); - } else if ((dst_enc < 16) && (src_enc < 16)) { + if ((dst_enc < 16) && (src_enc < 16)) { Assembler::vpcmpeqb(dst, nds, src, vector_len); } else if (src_enc < 16) { subptr(rsp, 64); @@ -4360,9 +4370,7 @@ void MacroAssembler::vpcmpeqw(XMMRegister dst, XMMRegister nds, XMMRegister src, int nds_enc = nds->encoding(); int src_enc = src->encoding(); assert(dst_enc == nds_enc, ""); - if (VM_Version::supports_avxonly() || VM_Version::supports_avx512bw()) { - Assembler::vpcmpeqw(dst, nds, src, vector_len); - } else if ((dst_enc < 16) && (src_enc < 16)) { + if ((dst_enc < 16) && (src_enc < 16)) { Assembler::vpcmpeqw(dst, nds, src, vector_len); } else if (src_enc < 16) { subptr(rsp, 64); @@ -6693,6 +6701,14 @@ void MacroAssembler::restore_cpu_control_state_after_jni() { #endif // _LP64 } +void MacroAssembler::load_mirror(Register mirror, Register method) { + // get mirror + const int mirror_offset = in_bytes(Klass::java_mirror_offset()); + movptr(mirror, Address(method, Method::const_offset())); + movptr(mirror, Address(mirror, ConstMethod::constants_offset())); + movptr(mirror, Address(mirror, ConstantPool::pool_holder_offset_in_bytes())); + movptr(mirror, Address(mirror, mirror_offset)); +} void MacroAssembler::load_klass(Register dst, Register src) { #ifdef _LP64 @@ -7318,7 +7334,7 @@ void MacroAssembler::string_indexofC8(Register str1, Register str2, decrementl(cnt1); // Shift to next element cmpl(cnt1, cnt2); - jccb(Assembler::negative, RET_NOT_FOUND); // Left less then substring + jcc(Assembler::negative, RET_NOT_FOUND); // Left less then substring addptr(result, (1< stride) { // This code is optimized for the case when whole substring @@ -7367,7 +7383,7 @@ void MacroAssembler::string_indexofC8(Register str1, Register str2, bind(MATCH_SUBSTR_HEAD); pcmpestri(vec, Address(result, 0), mode); // Reload only string if does not match - jccb(Assembler::noOverflow, RELOAD_STR); // OF == 0 + jcc(Assembler::noOverflow, RELOAD_STR); // OF == 0 Label CONT_SCAN_SUBSTR; // Compare the rest of substring (> 8 chars). @@ -7625,7 +7641,7 @@ void MacroAssembler::string_indexof(Register str1, Register str2, addl(cnt1, str1); decrementl(cnt1); // Shift to next element cmpl(cnt1, cnt2); - jccb(Assembler::negative, RET_NOT_FOUND); // Left less then substring + jcc(Assembler::negative, RET_NOT_FOUND); // Left less then substring addptr(result, (1<= 2) { cmpl(cnt1, stride); - jccb(Assembler::less, SCAN_TO_CHAR_LOOP); + jcc(Assembler::less, SCAN_TO_CHAR_LOOP); cmpl(cnt1, 2*stride); - jccb(Assembler::less, SCAN_TO_8_CHAR_INIT); + jcc(Assembler::less, SCAN_TO_8_CHAR_INIT); movdl(vec1, ch); vpbroadcastw(vec1, vec1); vpxor(vec2, vec2); @@ -7791,9 +7807,9 @@ void MacroAssembler::string_indexof_char(Register str1, Register cnt1, Register bind(SCAN_TO_8_CHAR); cmpl(cnt1, stride); if (UseAVX >= 2) { - jccb(Assembler::less, SCAN_TO_CHAR); + jcc(Assembler::less, SCAN_TO_CHAR); } else { - jccb(Assembler::less, SCAN_TO_CHAR_LOOP); + jcc(Assembler::less, SCAN_TO_CHAR_LOOP); movdl(vec1, ch); pshuflw(vec1, vec1, 0x00); pshufd(vec1, vec1, 0); @@ -8045,14 +8061,14 @@ void MacroAssembler::string_compare(Register str1, Register str2, jcc(Assembler::notZero, VECTOR_NOT_EQUAL); addptr(result, stride2); subl(cnt2, stride2); - jccb(Assembler::notZero, COMPARE_WIDE_VECTORS_LOOP); + jcc(Assembler::notZero, COMPARE_WIDE_VECTORS_LOOP); // clean upper bits of YMM registers vpxor(vec1, vec1); // compare wide vectors tail bind(COMPARE_WIDE_TAIL); testptr(result, result); - jccb(Assembler::zero, LENGTH_DIFF_LABEL); + jcc(Assembler::zero, LENGTH_DIFF_LABEL); movl(result, stride2); movl(cnt2, result); @@ -8076,7 +8092,7 @@ void MacroAssembler::string_compare(Register str1, Register str2, bind(COMPARE_TAIL_LONG); movl(cnt2, result); cmpl(cnt2, stride); - jccb(Assembler::less, COMPARE_SMALL_STR); + jcc(Assembler::less, COMPARE_SMALL_STR); if (ae == StrIntrinsicNode::LL || ae == StrIntrinsicNode::UU) { movdqu(vec1, Address(str1, 0)); @@ -8086,7 +8102,7 @@ void MacroAssembler::string_compare(Register str1, Register str2, pcmpestri(vec1, Address(str2, 0), pcmpmask); jcc(Assembler::below, COMPARE_INDEX_CHAR); subptr(cnt2, stride); - jccb(Assembler::zero, LENGTH_DIFF_LABEL); + jcc(Assembler::zero, LENGTH_DIFF_LABEL); if (ae == StrIntrinsicNode::LL || ae == StrIntrinsicNode::UU) { lea(str1, Address(str1, result, scale)); lea(str2, Address(str2, result, scale)); @@ -8109,7 +8125,7 @@ void MacroAssembler::string_compare(Register str1, Register str2, if (ae == StrIntrinsicNode::LL) { pcmpmask &= ~0x01; } - jccb(Assembler::zero, COMPARE_TAIL); + jcc(Assembler::zero, COMPARE_TAIL); if (ae == StrIntrinsicNode::LL || ae == StrIntrinsicNode::UU) { lea(str1, Address(str1, result, scale)); lea(str2, Address(str2, result, scale)); @@ -8148,7 +8164,7 @@ void MacroAssembler::string_compare(Register str1, Register str2, // compare wide vectors tail testptr(result, result); - jccb(Assembler::zero, LENGTH_DIFF_LABEL); + jcc(Assembler::zero, LENGTH_DIFF_LABEL); movl(cnt2, stride); movl(result, stride); @@ -8243,10 +8259,19 @@ void MacroAssembler::string_compare(Register str1, Register str2, // Search for Non-ASCII character (Negative byte value) in a byte array, // return true if it has any and false otherwise. +// ..\jdk\src\java.base\share\classes\java\lang\StringCoding.java +// @HotSpotIntrinsicCandidate +// private static boolean hasNegatives(byte[] ba, int off, int len) { +// for (int i = off; i < off + len; i++) { +// if (ba[i] < 0) { +// return true; +// } +// } +// return false; +// } void MacroAssembler::has_negatives(Register ary1, Register len, - Register result, Register tmp1, - XMMRegister vec1, XMMRegister vec2) { - + Register result, Register tmp1, + XMMRegister vec1, XMMRegister vec2) { // rsi: byte array // rcx: len // rax: result @@ -8259,79 +8284,161 @@ void MacroAssembler::has_negatives(Register ary1, Register len, testl(len, len); jcc(Assembler::zero, FALSE_LABEL); - movl(result, len); // copy + if ((UseAVX > 2) && // AVX512 + VM_Version::supports_avx512vlbw() && + VM_Version::supports_bmi2()) { - if (UseAVX >= 2 && UseSSE >= 2) { - // With AVX2, use 32-byte vector compare - Label COMPARE_WIDE_VECTORS, COMPARE_TAIL; + set_vector_masking(); // opening of the stub context for programming mask registers - // Compare 32-byte vectors - andl(result, 0x0000001f); // tail count (in bytes) - andl(len, 0xffffffe0); // vector count (in bytes) - jccb(Assembler::zero, COMPARE_TAIL); + Label test_64_loop, test_tail; + Register tmp3_aliased = len; + + movl(tmp1, len); + vpxor(vec2, vec2, vec2, Assembler::AVX_512bit); + + andl(tmp1, 64 - 1); // tail count (in chars) 0x3F + andl(len, ~(64 - 1)); // vector count (in chars) + jccb(Assembler::zero, test_tail); lea(ary1, Address(ary1, len, Address::times_1)); negptr(len); - movl(tmp1, 0x80808080); // create mask to test for Unicode chars in vector - movdl(vec2, tmp1); - vpbroadcastd(vec2, vec2); + bind(test_64_loop); + // Check whether our 64 elements of size byte contain negatives + evpcmpgtb(k2, vec2, Address(ary1, len, Address::times_1), Assembler::AVX_512bit); + kortestql(k2, k2); + jcc(Assembler::notZero, TRUE_LABEL); - bind(COMPARE_WIDE_VECTORS); - vmovdqu(vec1, Address(ary1, len, Address::times_1)); - vptest(vec1, vec2); - jccb(Assembler::notZero, TRUE_LABEL); - addptr(len, 32); - jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); + addptr(len, 64); + jccb(Assembler::notZero, test_64_loop); - testl(result, result); - jccb(Assembler::zero, FALSE_LABEL); - vmovdqu(vec1, Address(ary1, result, Address::times_1, -32)); - vptest(vec1, vec2); - jccb(Assembler::notZero, TRUE_LABEL); - jmpb(FALSE_LABEL); + bind(test_tail); + // bail out when there is nothing to be done + testl(tmp1, -1); + jcc(Assembler::zero, FALSE_LABEL); - bind(COMPARE_TAIL); // len is zero - movl(len, result); - // Fallthru to tail compare - } else if (UseSSE42Intrinsics) { - assert(UseSSE >= 4, "SSE4 must be for SSE4.2 intrinsics to be available"); - // With SSE4.2, use double quad vector compare - Label COMPARE_WIDE_VECTORS, COMPARE_TAIL; + // Save k1 + kmovql(k3, k1); - // Compare 16-byte vectors - andl(result, 0x0000000f); // tail count (in bytes) - andl(len, 0xfffffff0); // vector count (in bytes) - jccb(Assembler::zero, COMPARE_TAIL); + // ~(~0 << len) applied up to two times (for 32-bit scenario) +#ifdef _LP64 + mov64(tmp3_aliased, 0xFFFFFFFFFFFFFFFF); + shlxq(tmp3_aliased, tmp3_aliased, tmp1); + notq(tmp3_aliased); + kmovql(k1, tmp3_aliased); +#else + Label k_init; + jmp(k_init); - lea(ary1, Address(ary1, len, Address::times_1)); - negptr(len); + // We could not read 64-bits from a general purpose register thus we move + // data required to compose 64 1's to the instruction stream + // We emit 64 byte wide series of elements from 0..63 which later on would + // be used as a compare targets with tail count contained in tmp1 register. + // Result would be a k1 register having tmp1 consecutive number or 1 + // counting from least significant bit. + address tmp = pc(); + emit_int64(0x0706050403020100); + emit_int64(0x0F0E0D0C0B0A0908); + emit_int64(0x1716151413121110); + emit_int64(0x1F1E1D1C1B1A1918); + emit_int64(0x2726252423222120); + emit_int64(0x2F2E2D2C2B2A2928); + emit_int64(0x3736353433323130); + emit_int64(0x3F3E3D3C3B3A3938); - movl(tmp1, 0x80808080); - movdl(vec2, tmp1); - pshufd(vec2, vec2, 0); + bind(k_init); + lea(len, InternalAddress(tmp)); + // create mask to test for negative byte inside a vector + evpbroadcastb(vec1, tmp1, Assembler::AVX_512bit); + evpcmpgtb(k1, vec1, Address(len, 0), Assembler::AVX_512bit); - bind(COMPARE_WIDE_VECTORS); - movdqu(vec1, Address(ary1, len, Address::times_1)); - ptest(vec1, vec2); - jccb(Assembler::notZero, TRUE_LABEL); - addptr(len, 16); - jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); +#endif + evpcmpgtb(k2, k1, vec2, Address(ary1, 0), Assembler::AVX_512bit); + ktestq(k2, k1); + // Restore k1 + kmovql(k1, k3); + jcc(Assembler::notZero, TRUE_LABEL); - testl(result, result); - jccb(Assembler::zero, FALSE_LABEL); + jmp(FALSE_LABEL); - movdqu(vec1, Address(ary1, result, Address::times_1, -16)); - ptest(vec1, vec2); - jccb(Assembler::notZero, TRUE_LABEL); - jmpb(FALSE_LABEL); - - bind(COMPARE_TAIL); // len is zero - movl(len, result); - // Fallthru to tail compare + clear_vector_masking(); // closing of the stub context for programming mask registers } + else { + movl(result, len); // copy + if (UseAVX == 2 && UseSSE >= 2) { + // With AVX2, use 32-byte vector compare + Label COMPARE_WIDE_VECTORS, COMPARE_TAIL; + + // Compare 32-byte vectors + andl(result, 0x0000001f); // tail count (in bytes) + andl(len, 0xffffffe0); // vector count (in bytes) + jccb(Assembler::zero, COMPARE_TAIL); + + lea(ary1, Address(ary1, len, Address::times_1)); + negptr(len); + + movl(tmp1, 0x80808080); // create mask to test for Unicode chars in vector + movdl(vec2, tmp1); + vpbroadcastd(vec2, vec2); + + bind(COMPARE_WIDE_VECTORS); + vmovdqu(vec1, Address(ary1, len, Address::times_1)); + vptest(vec1, vec2); + jccb(Assembler::notZero, TRUE_LABEL); + addptr(len, 32); + jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); + + testl(result, result); + jccb(Assembler::zero, FALSE_LABEL); + + vmovdqu(vec1, Address(ary1, result, Address::times_1, -32)); + vptest(vec1, vec2); + jccb(Assembler::notZero, TRUE_LABEL); + jmpb(FALSE_LABEL); + + bind(COMPARE_TAIL); // len is zero + movl(len, result); + // Fallthru to tail compare + } + else if (UseSSE42Intrinsics) { + assert(UseSSE >= 4, "SSE4 must be for SSE4.2 intrinsics to be available"); + // With SSE4.2, use double quad vector compare + Label COMPARE_WIDE_VECTORS, COMPARE_TAIL; + + // Compare 16-byte vectors + andl(result, 0x0000000f); // tail count (in bytes) + andl(len, 0xfffffff0); // vector count (in bytes) + jccb(Assembler::zero, COMPARE_TAIL); + + lea(ary1, Address(ary1, len, Address::times_1)); + negptr(len); + + movl(tmp1, 0x80808080); + movdl(vec2, tmp1); + pshufd(vec2, vec2, 0); + + bind(COMPARE_WIDE_VECTORS); + movdqu(vec1, Address(ary1, len, Address::times_1)); + ptest(vec1, vec2); + jccb(Assembler::notZero, TRUE_LABEL); + addptr(len, 16); + jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); + + testl(result, result); + jccb(Assembler::zero, FALSE_LABEL); + + movdqu(vec1, Address(ary1, result, Address::times_1, -16)); + ptest(vec1, vec2); + jccb(Assembler::notZero, TRUE_LABEL); + jmpb(FALSE_LABEL); + + bind(COMPARE_TAIL); // len is zero + movl(len, result); + // Fallthru to tail compare + } + } // Compare 4-byte vectors andl(len, 0xfffffffc); // vector count (in bytes) jccb(Assembler::zero, COMPARE_CHAR); @@ -8379,7 +8486,6 @@ void MacroAssembler::has_negatives(Register ary1, Register len, vpxor(vec2, vec2); } } - // Compare char[] or byte[] arrays aligned to 4 bytes or substrings. void MacroAssembler::arrays_equals(bool is_array_equ, Register ary1, Register ary2, Register limit, Register result, Register chr, @@ -8482,12 +8588,12 @@ void MacroAssembler::arrays_equals(bool is_array_equ, Register ary1, Register ar vpxor(vec1, vec2); vptest(vec1, vec1); - jccb(Assembler::notZero, FALSE_LABEL); + jcc(Assembler::notZero, FALSE_LABEL); addptr(limit, 32); jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); testl(result, result); - jccb(Assembler::zero, TRUE_LABEL); + jcc(Assembler::zero, TRUE_LABEL); vmovdqu(vec1, Address(ary1, result, Address::times_1, -32)); vmovdqu(vec2, Address(ary2, result, Address::times_1, -32)); @@ -8508,7 +8614,7 @@ void MacroAssembler::arrays_equals(bool is_array_equ, Register ary1, Register ar // Compare 16-byte vectors andl(result, 0x0000000f); // tail count (in bytes) andl(limit, 0xfffffff0); // vector count (in bytes) - jccb(Assembler::zero, COMPARE_TAIL); + jcc(Assembler::zero, COMPARE_TAIL); lea(ary1, Address(ary1, limit, Address::times_1)); lea(ary2, Address(ary2, limit, Address::times_1)); @@ -8520,12 +8626,12 @@ void MacroAssembler::arrays_equals(bool is_array_equ, Register ary1, Register ar pxor(vec1, vec2); ptest(vec1, vec1); - jccb(Assembler::notZero, FALSE_LABEL); + jcc(Assembler::notZero, FALSE_LABEL); addptr(limit, 16); jcc(Assembler::notZero, COMPARE_WIDE_VECTORS); testl(result, result); - jccb(Assembler::zero, TRUE_LABEL); + jcc(Assembler::zero, TRUE_LABEL); movdqu(vec1, Address(ary1, result, Address::times_1, -16)); movdqu(vec2, Address(ary2, result, Address::times_1, -16)); @@ -8825,10 +8931,23 @@ void MacroAssembler::generate_fill(BasicType t, bool aligned, } // encode char[] to byte[] in ISO_8859_1 + //@HotSpotIntrinsicCandidate + //private static int implEncodeISOArray(byte[] sa, int sp, + //byte[] da, int dp, int len) { + // int i = 0; + // for (; i < len; i++) { + // char c = StringUTF16.getChar(sa, sp++); + // if (c > '\u00FF') + // break; + // da[dp++] = (byte)c; + // } + // return i; + //} void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, - XMMRegister tmp1Reg, XMMRegister tmp2Reg, - XMMRegister tmp3Reg, XMMRegister tmp4Reg, - Register tmp5, Register result) { + XMMRegister tmp1Reg, XMMRegister tmp2Reg, + XMMRegister tmp3Reg, XMMRegister tmp4Reg, + Register tmp5, Register result) { + // rsi: src // rdi: dst // rdx: len @@ -8843,6 +8962,7 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, // check for zero length testl(len, len); jcc(Assembler::zero, L_done); + movl(result, len); // Setup pointers @@ -8860,7 +8980,7 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, movl(tmp5, 0xff00ff00); // create mask to test for Unicode chars in vector movdl(tmp1Reg, tmp5); vpbroadcastd(tmp1Reg, tmp1Reg); - jmpb(L_chars_32_check); + jmp(L_chars_32_check); bind(L_copy_32_chars); vmovdqu(tmp3Reg, Address(src, len, Address::times_2, -64)); @@ -8874,7 +8994,7 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, bind(L_chars_32_check); addptr(len, 32); - jccb(Assembler::lessEqual, L_copy_32_chars); + jcc(Assembler::lessEqual, L_copy_32_chars); bind(L_copy_32_chars_exit); subptr(len, 16); @@ -8891,7 +9011,7 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, if (UseAVX >= 2) { vmovdqu(tmp2Reg, Address(src, len, Address::times_2, -32)); vptest(tmp2Reg, tmp1Reg); - jccb(Assembler::notZero, L_copy_16_chars_exit); + jcc(Assembler::notZero, L_copy_16_chars_exit); vpackuswb(tmp2Reg, tmp2Reg, tmp1Reg, /* vector_len */ 1); vpermq(tmp3Reg, tmp2Reg, 0xD8, /* vector_len */ 1); } else { @@ -8913,7 +9033,7 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, bind(L_chars_16_check); addptr(len, 16); - jccb(Assembler::lessEqual, L_copy_16_chars); + jcc(Assembler::lessEqual, L_copy_16_chars); bind(L_copy_16_chars_exit); if (UseAVX >= 2) { @@ -8951,6 +9071,7 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len, bind(L_copy_1_char_exit); addptr(result, len); // len is negative count of not processed elements + bind(L_done); } @@ -9417,6 +9538,7 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register length, Register log2_array_indxscale, Register result, Register tmp1, Register tmp2, XMMRegister rymm0, XMMRegister rymm1, XMMRegister rymm2){ assert(UseSSE42Intrinsics, "SSE4.2 must be enabled."); + Label VECTOR64_LOOP, VECTOR64_TAIL, VECTOR64_NOT_EQUAL, VECTOR32_TAIL; Label VECTOR32_LOOP, VECTOR16_LOOP, VECTOR8_LOOP, VECTOR4_LOOP; Label VECTOR16_TAIL, VECTOR8_TAIL, VECTOR4_TAIL; Label VECTOR32_NOT_EQUAL, VECTOR16_NOT_EQUAL, VECTOR8_NOT_EQUAL, VECTOR4_NOT_EQUAL; @@ -9429,11 +9551,62 @@ void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register shlq(length); xorq(result, result); + if ((UseAVX > 2) && + VM_Version::supports_avx512vlbw()) { + set_vector_masking(); // opening of the stub context for programming mask registers + cmpq(length, 64); + jcc(Assembler::less, VECTOR32_TAIL); + movq(tmp1, length); + andq(tmp1, 0x3F); // tail count + andq(length, ~(0x3F)); //vector count + + bind(VECTOR64_LOOP); + // AVX512 code to compare 64 byte vectors. + evmovdqub(rymm0, Address(obja, result), Assembler::AVX_512bit); + evpcmpeqb(k7, rymm0, Address(objb, result), Assembler::AVX_512bit); + kortestql(k7, k7); + jcc(Assembler::aboveEqual, VECTOR64_NOT_EQUAL); // mismatch + addq(result, 64); + subq(length, 64); + jccb(Assembler::notZero, VECTOR64_LOOP); + + //bind(VECTOR64_TAIL); + testq(tmp1, tmp1); + jcc(Assembler::zero, SAME_TILL_END); + + bind(VECTOR64_TAIL); + // AVX512 code to compare upto 63 byte vectors. + // Save k1 + kmovql(k3, k1); + mov64(tmp2, 0xFFFFFFFFFFFFFFFF); + shlxq(tmp2, tmp2, tmp1); + notq(tmp2); + kmovql(k1, tmp2); + + evmovdqub(rymm0, k1, Address(obja, result), Assembler::AVX_512bit); + evpcmpeqb(k7, k1, rymm0, Address(objb, result), Assembler::AVX_512bit); + + ktestql(k7, k1); + // Restore k1 + kmovql(k1, k3); + jcc(Assembler::below, SAME_TILL_END); // not mismatch + + bind(VECTOR64_NOT_EQUAL); + kmovql(tmp1, k7); + notq(tmp1); + tzcntq(tmp1, tmp1); + addq(result, tmp1); + shrq(result); + jmp(DONE); + bind(VECTOR32_TAIL); + clear_vector_masking(); // closing of the stub context for programming mask registers + } + cmpq(length, 8); jcc(Assembler::equal, VECTOR8_LOOP); jcc(Assembler::less, VECTOR4_TAIL); - if (UseAVX >= 2){ + if (UseAVX >= 2) { cmpq(length, 16); jcc(Assembler::equal, VECTOR16_LOOP); @@ -9541,7 +9714,7 @@ void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register jccb(Assembler::notZero, BYTES_NOT_EQUAL);//mismatch found jmpb(SAME_TILL_END); - if (UseAVX >= 2){ + if (UseAVX >= 2) { bind(VECTOR32_NOT_EQUAL); vpcmpeqb(rymm2, rymm2, rymm2, Assembler::AVX_256bit); vpcmpeqb(rymm0, rymm0, rymm1, Assembler::AVX_256bit); @@ -9554,7 +9727,7 @@ void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register } bind(VECTOR16_NOT_EQUAL); - if (UseAVX >= 2){ + if (UseAVX >= 2) { vpcmpeqb(rymm2, rymm2, rymm2, Assembler::AVX_128bit); vpcmpeqb(rymm0, rymm0, rymm1, Assembler::AVX_128bit); pxor(rymm0, rymm2); @@ -9585,7 +9758,6 @@ void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register bind(DONE); } - //Helper functions for square_to_len() /** @@ -10771,13 +10943,24 @@ void MacroAssembler::crc32c_ipl_alg2_alt2(Register in_out, Register in1, Registe #undef BIND #undef BLOCK_COMMENT - // Compress char[] array to byte[]. +// ..\jdk\src\java.base\share\classes\java\lang\StringUTF16.java +// @HotSpotIntrinsicCandidate +// private static int compress(char[] src, int srcOff, byte[] dst, int dstOff, int len) { +// for (int i = 0; i < len; i++) { +// int c = src[srcOff++]; +// if (c >>> 8 != 0) { +// return 0; +// } +// dst[dstOff++] = (byte)c; +// } +// return len; +// } void MacroAssembler::char_array_compress(Register src, Register dst, Register len, - XMMRegister tmp1Reg, XMMRegister tmp2Reg, - XMMRegister tmp3Reg, XMMRegister tmp4Reg, - Register tmp5, Register result) { - Label copy_chars_loop, return_length, return_zero, done; + XMMRegister tmp1Reg, XMMRegister tmp2Reg, + XMMRegister tmp3Reg, XMMRegister tmp4Reg, + Register tmp5, Register result) { + Label copy_chars_loop, return_length, return_zero, done, below_threshold; // rsi: src // rdi: dst @@ -10794,11 +10977,141 @@ void MacroAssembler::char_array_compress(Register src, Register dst, Register le // save length for return push(len); + if ((UseAVX > 2) && // AVX512 + VM_Version::supports_avx512vlbw() && + VM_Version::supports_bmi2()) { + + set_vector_masking(); // opening of the stub context for programming mask registers + + Label copy_32_loop, copy_loop_tail, copy_just_portion_of_candidates; + + // alignement + Label post_alignement; + + // if length of the string is less than 16, handle it in an old fashioned + // way + testl(len, -32); + jcc(Assembler::zero, below_threshold); + + // First check whether a character is compressable ( <= 0xFF). + // Create mask to test for Unicode chars inside zmm vector + movl(result, 0x00FF); + evpbroadcastw(tmp2Reg, result, Assembler::AVX_512bit); + + testl(len, -64); + jcc(Assembler::zero, post_alignement); + + // Save k1 + kmovql(k3, k1); + + movl(tmp5, dst); + andl(tmp5, (64 - 1)); + negl(tmp5); + andl(tmp5, (64 - 1)); + + // bail out when there is nothing to be done + testl(tmp5, 0xFFFFFFFF); + jcc(Assembler::zero, post_alignement); + + // ~(~0 << len), where len is the # of remaining elements to process + movl(result, 0xFFFFFFFF); + shlxl(result, result, tmp5); + notl(result); + + kmovdl(k1, result); + + evmovdquw(tmp1Reg, k1, Address(src, 0), Assembler::AVX_512bit); + evpcmpuw(k2, k1, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); + ktestd(k2, k1); + jcc(Assembler::carryClear, copy_just_portion_of_candidates); + + evpmovwb(Address(dst, 0), k1, tmp1Reg, Assembler::AVX_512bit); + + addptr(src, tmp5); + addptr(src, tmp5); + addptr(dst, tmp5); + subl(len, tmp5); + + bind(post_alignement); + // end of alignement + + movl(tmp5, len); + andl(tmp5, (32 - 1)); // tail count (in chars) + andl(len, ~(32 - 1)); // vector count (in chars) + jcc(Assembler::zero, copy_loop_tail); + + lea(src, Address(src, len, Address::times_2)); + lea(dst, Address(dst, len, Address::times_1)); + negptr(len); + + bind(copy_32_loop); + evmovdquw(tmp1Reg, Address(src, len, Address::times_2), Assembler::AVX_512bit); + evpcmpuw(k2, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); + kortestdl(k2, k2); + jcc(Assembler::carryClear, copy_just_portion_of_candidates); + + // All elements in current processed chunk are valid candidates for + // compression. Write a truncated byte elements to the memory. + evpmovwb(Address(dst, len, Address::times_1), tmp1Reg, Assembler::AVX_512bit); + addptr(len, 32); + jcc(Assembler::notZero, copy_32_loop); + + bind(copy_loop_tail); + // bail out when there is nothing to be done + testl(tmp5, 0xFFFFFFFF); + jcc(Assembler::zero, return_length); + + // Save k1 + kmovql(k3, k1); + + movl(len, tmp5); + + // ~(~0 << len), where len is the # of remaining elements to process + movl(result, 0xFFFFFFFF); + shlxl(result, result, len); + notl(result); + + kmovdl(k1, result); + + evmovdquw(tmp1Reg, k1, Address(src, 0), Assembler::AVX_512bit); + evpcmpuw(k2, k1, tmp1Reg, tmp2Reg, Assembler::le, Assembler::AVX_512bit); + ktestd(k2, k1); + jcc(Assembler::carryClear, copy_just_portion_of_candidates); + + evpmovwb(Address(dst, 0), k1, tmp1Reg, Assembler::AVX_512bit); + // Restore k1 + kmovql(k1, k3); + + jmp(return_length); + + bind(copy_just_portion_of_candidates); + kmovdl(tmp5, k2); + tzcntl(tmp5, tmp5); + + // ~(~0 << tmp5), where tmp5 is a number of elements in an array from the + // result to the first element larger than 0xFF + movl(result, 0xFFFFFFFF); + shlxl(result, result, tmp5); + notl(result); + + kmovdl(k1, result); + + evpmovwb(Address(dst, 0), k1, tmp1Reg, Assembler::AVX_512bit); + // Restore k1 + kmovql(k1, k3); + + jmp(return_zero); + + clear_vector_masking(); // closing of the stub context for programming mask registers + } if (UseSSE42Intrinsics) { assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available"); Label copy_32_loop, copy_16, copy_tail; + bind(below_threshold); + movl(result, len); + movl(tmp5, 0xff00ff00); // create mask to test for Unicode chars in vectors // vectored compression @@ -10880,10 +11193,16 @@ void MacroAssembler::char_array_compress(Register src, Register dst, Register le } // Inflate byte[] array to char[]. +// ..\jdk\src\java.base\share\classes\java\lang\StringLatin1.java +// @HotSpotIntrinsicCandidate +// private static void inflate(byte[] src, int srcOff, char[] dst, int dstOff, int len) { +// for (int i = 0; i < len; i++) { +// dst[dstOff++] = (char)(src[srcOff++] & 0xff); +// } +// } void MacroAssembler::byte_array_inflate(Register src, Register dst, Register len, - XMMRegister tmp1, Register tmp2) { - Label copy_chars_loop, done; - + XMMRegister tmp1, Register tmp2) { + Label copy_chars_loop, done, below_threshold; // rsi: src // rdi: dst // rdx: len @@ -10894,20 +11213,109 @@ void MacroAssembler::byte_array_inflate(Register src, Register dst, Register len // rdx holds length assert_different_registers(src, dst, len, tmp2); + if ((UseAVX > 2) && // AVX512 + VM_Version::supports_avx512vlbw() && + VM_Version::supports_bmi2()) { + + set_vector_masking(); // opening of the stub context for programming mask registers + + Label copy_32_loop, copy_tail; + Register tmp3_aliased = len; + + // if length of the string is less than 16, handle it in an old fashioned + // way + testl(len, -16); + jcc(Assembler::zero, below_threshold); + + // In order to use only one arithmetic operation for the main loop we use + // this pre-calculation + movl(tmp2, len); + andl(tmp2, (32 - 1)); // tail count (in chars), 32 element wide loop + andl(len, -32); // vector count + jccb(Assembler::zero, copy_tail); + + lea(src, Address(src, len, Address::times_1)); + lea(dst, Address(dst, len, Address::times_2)); + negptr(len); + + + // inflate 32 chars per iter + bind(copy_32_loop); + vpmovzxbw(tmp1, Address(src, len, Address::times_1), Assembler::AVX_512bit); + evmovdquw(Address(dst, len, Address::times_2), tmp1, Assembler::AVX_512bit); + addptr(len, 32); + jcc(Assembler::notZero, copy_32_loop); + + bind(copy_tail); + // bail out when there is nothing to be done + testl(tmp2, -1); // we don't destroy the contents of tmp2 here + jcc(Assembler::zero, done); + + // Save k1 + kmovql(k2, k1); + + // ~(~0 << length), where length is the # of remaining elements to process + movl(tmp3_aliased, -1); + shlxl(tmp3_aliased, tmp3_aliased, tmp2); + notl(tmp3_aliased); + kmovdl(k1, tmp3_aliased); + evpmovzxbw(tmp1, k1, Address(src, 0), Assembler::AVX_512bit); + evmovdquw(Address(dst, 0), k1, tmp1, Assembler::AVX_512bit); + + // Restore k1 + kmovql(k1, k2); + jmp(done); + + clear_vector_masking(); // closing of the stub context for programming mask registers + } if (UseSSE42Intrinsics) { assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available"); - Label copy_8_loop, copy_bytes, copy_tail; + Label copy_16_loop, copy_8_loop, copy_bytes, copy_new_tail, copy_tail; movl(tmp2, len); - andl(tmp2, 0x00000007); // tail count (in chars) - andl(len, 0xfffffff8); // vector count (in chars) - jccb(Assembler::zero, copy_tail); + + if (UseAVX > 1) { + andl(tmp2, (16 - 1)); + andl(len, -16); + jccb(Assembler::zero, copy_new_tail); + } else { + andl(tmp2, 0x00000007); // tail count (in chars) + andl(len, 0xfffffff8); // vector count (in chars) + jccb(Assembler::zero, copy_tail); + } // vectored inflation lea(src, Address(src, len, Address::times_1)); lea(dst, Address(dst, len, Address::times_2)); negptr(len); + if (UseAVX > 1) { + bind(copy_16_loop); + vpmovzxbw(tmp1, Address(src, len, Address::times_1), Assembler::AVX_256bit); + vmovdqu(Address(dst, len, Address::times_2), tmp1); + addptr(len, 16); + jcc(Assembler::notZero, copy_16_loop); + + bind(below_threshold); + bind(copy_new_tail); + if (UseAVX > 2) { + movl(tmp2, len); + } + else { + movl(len, tmp2); + } + andl(tmp2, 0x00000007); + andl(len, 0xFFFFFFF8); + jccb(Assembler::zero, copy_tail); + + pmovzxbw(tmp1, Address(src, 0)); + movdqu(Address(dst, 0), tmp1); + addptr(src, 8); + addptr(dst, 2 * 8); + + jmp(copy_tail, true); + } + // inflate 8 chars per iter bind(copy_8_loop); pmovzxbw(tmp1, Address(src, len, Address::times_1)); // unpack to 8 words @@ -10946,7 +11354,6 @@ void MacroAssembler::byte_array_inflate(Register src, Register dst, Register len bind(done); } - Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { switch (cond) { // Note some conditions are synonyms for others diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp index 836f8c4fb45..48975683350 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp @@ -156,6 +156,10 @@ class MacroAssembler: public Assembler { void incrementq(Register reg, int value = 1); void incrementq(Address dst, int value = 1); + // special instructions for EVEX + void setvectmask(Register dst, Register src); + void restorevectmask(); + // Support optimal SSE move instructions. void movflt(XMMRegister dst, XMMRegister src) { if (UseXmmRegToRegMoveAll) { movaps(dst, src); return; } @@ -319,6 +323,8 @@ class MacroAssembler: public Assembler { void movbool(Address dst, Register src); void testbool(Register dst); + void load_mirror(Register mirror, Register method); + // oop manipulations void load_klass(Register dst, Register src); void store_klass(Register dst, Register src); @@ -841,7 +847,7 @@ class MacroAssembler: public Assembler { void call(Label& L, relocInfo::relocType rtype); void call(Register entry); - // NOTE: this call tranfers to the effective address of entry NOT + // NOTE: this call transfers to the effective address of entry NOT // the address contained by entry. This is because this is more natural // for jumps/calls. void call(AddressLiteral entry); @@ -902,6 +908,45 @@ class MacroAssembler: public Assembler { void ldmxcsr(Address src) { Assembler::ldmxcsr(src); } void ldmxcsr(AddressLiteral src); +#ifdef _LP64 + private: + void sha256_AVX2_one_round_compute( + Register reg_old_h, + Register reg_a, + Register reg_b, + Register reg_c, + Register reg_d, + Register reg_e, + Register reg_f, + Register reg_g, + Register reg_h, + int iter); + void sha256_AVX2_four_rounds_compute_first(int start); + void sha256_AVX2_four_rounds_compute_last(int start); + void sha256_AVX2_one_round_and_sched( + XMMRegister xmm_0, /* == ymm4 on 0, 1, 2, 3 iterations, then rotate 4 registers left on 4, 8, 12 iterations */ + XMMRegister xmm_1, /* ymm5 */ /* full cycle is 16 iterations */ + XMMRegister xmm_2, /* ymm6 */ + XMMRegister xmm_3, /* ymm7 */ + Register reg_a, /* == eax on 0 iteration, then rotate 8 register right on each next iteration */ + Register reg_b, /* ebx */ /* full cycle is 8 iterations */ + Register reg_c, /* edi */ + Register reg_d, /* esi */ + Register reg_e, /* r8d */ + Register reg_f, /* r9d */ + Register reg_g, /* r10d */ + Register reg_h, /* r11d */ + int iter); + + void addm(int disp, Register r1, Register r2); + + public: + void sha256_AVX2(XMMRegister msg, XMMRegister state0, XMMRegister state1, XMMRegister msgtmp0, + XMMRegister msgtmp1, XMMRegister msgtmp2, XMMRegister msgtmp3, XMMRegister msgtmp4, + Register buf, Register state, Register ofs, Register limit, Register rsp, + bool multi_block, XMMRegister shuf_mask); +#endif + void fast_sha1(XMMRegister abcd, XMMRegister e0, XMMRegister e1, XMMRegister msg0, XMMRegister msg1, XMMRegister msg2, XMMRegister msg3, XMMRegister shuf_mask, Register buf, Register state, Register ofs, Register limit, Register rsp, @@ -928,6 +973,10 @@ class MacroAssembler: public Assembler { XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register rax, Register rcx, Register rdx, Register tmp1, Register tmp2); + void fast_log10(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, + XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, + Register rax, Register rcx, Register rdx, Register r11); + void fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register rax, Register rcx, Register rdx, Register tmp1, Register tmp2, Register tmp3, Register tmp4); @@ -941,11 +990,19 @@ class MacroAssembler: public Assembler { XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register rax, Register rcx, Register rdx, Register tmp1, Register tmp2, Register tmp3, Register tmp4); + void fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, + XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, + Register rax, Register rcx, Register rdx, Register tmp1, + Register tmp2, Register tmp3, Register tmp4); #else void fast_log(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register rax, Register rcx, Register rdx, Register tmp1); + void fast_log10(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, + XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, + Register rax, Register rcx, Register rdx, Register tmp); + void fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register rax, Register rcx, Register rdx, Register tmp); @@ -964,6 +1021,14 @@ class MacroAssembler: public Assembler { void libm_reduce_pi04l(Register eax, Register ecx, Register edx, Register ebx, Register esi, Register edi, Register ebp, Register esp); + + void libm_tancot_huge(XMMRegister xmm0, XMMRegister xmm1, Register eax, Register ecx, + Register edx, Register ebx, Register esi, Register edi, + Register ebp, Register esp); + + void fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, + XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, + Register rax, Register rcx, Register rdx, Register tmp); #endif void increase_precision(); diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_cos.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_cos.cpp new file mode 100644 index 00000000000..1ebed3523ab --- /dev/null +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_cos.cpp @@ -0,0 +1,889 @@ +/* +* Copyright (c) 2016, Intel Corporation. +* Intel Math Library (LIBM) Source Code +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +* +*/ + +#include "precompiled.hpp" +#include "asm/assembler.hpp" +#include "asm/assembler.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "macroAssembler_x86.hpp" + +#ifdef _MSC_VER +#define ALIGNED_(x) __declspec(align(x)) +#else +#define ALIGNED_(x) __attribute__ ((aligned(x))) +#endif + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - COS() +// --------------------- +// +// 1. RANGE REDUCTION +// +// We perform an initial range reduction from X to r with +// +// X =~= N * pi/32 + r +// +// so that |r| <= pi/64 + epsilon. We restrict inputs to those +// where |N| <= 932560. Beyond this, the range reduction is +// insufficiently accurate. For extremely small inputs, +// denormalization can occur internally, impacting performance. +// This means that the main path is actually only taken for +// 2^-252 <= |X| < 90112. +// +// To avoid branches, we perform the range reduction to full +// accuracy each time. +// +// X - N * (P_1 + P_2 + P_3) +// +// where P_1 and P_2 are 32-bit numbers (so multiplication by N +// is exact) and P_3 is a 53-bit number. Together, these +// approximate pi well enough for all cases in the restricted +// range. +// +// The main reduction sequence is: +// +// y = 32/pi * x +// N = integer(y) +// (computed by adding and subtracting off SHIFTER) +// +// m_1 = N * P_1 +// m_2 = N * P_2 +// r_1 = x - m_1 +// r = r_1 - m_2 +// (this r can be used for most of the calculation) +// +// c_1 = r_1 - r +// m_3 = N * P_3 +// c_2 = c_1 - m_2 +// c = c_2 - m_3 +// +// 2. MAIN ALGORITHM +// +// The algorithm uses a table lookup based on B = M * pi / 32 +// where M = N mod 64. The stored values are: +// sigma closest power of 2 to cos(B) +// C_hl 53-bit cos(B) - sigma +// S_hi + S_lo 2 * 53-bit sin(B) +// +// The computation is organized as follows: +// +// sin(B + r + c) = [sin(B) + sigma * r] + +// r * (cos(B) - sigma) + +// sin(B) * [cos(r + c) - 1] + +// cos(B) * [sin(r + c) - r] +// +// which is approximately: +// +// [S_hi + sigma * r] + +// C_hl * r + +// S_lo + S_hi * [(cos(r) - 1) - r * c] + +// (C_hl + sigma) * [(sin(r) - r) + c] +// +// and this is what is actually computed. We separate this sum +// into four parts: +// +// hi + med + pols + corr +// +// where +// +// hi = S_hi + sigma r +// med = C_hl * r +// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r) +// corr = S_lo + c * ((C_hl + sigma) - S_hi * r) +// +// 3. POLYNOMIAL +// +// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) * +// (sin(r) - r) can be rearranged freely, since it is quite +// small, so we exploit parallelism to the fullest. +// +// psc4 = SC_4 * r_1 +// msc4 = psc4 * r +// r2 = r * r +// msc2 = SC_2 * r2 +// r4 = r2 * r2 +// psc3 = SC_3 + msc4 +// psc1 = SC_1 + msc2 +// msc3 = r4 * psc3 +// sincospols = psc1 + msc3 +// pols = sincospols * +// +// +// 4. CORRECTION TERM +// +// This is where the "c" component of the range reduction is +// taken into account; recall that just "r" is used for most of +// the calculation. +// +// -c = m_3 - c_2 +// -d = S_hi * r - (C_hl + sigma) +// corr = -c * -d + S_lo +// +// 5. COMPENSATED SUMMATIONS +// +// The two successive compensated summations add up the high +// and medium parts, leaving just the low parts to add up at +// the end. +// +// rs = sigma * r +// res_int = S_hi + rs +// k_0 = S_hi - res_int +// k_2 = k_0 + rs +// med = C_hl * r +// res_hi = res_int + med +// k_1 = res_int - res_hi +// k_3 = k_1 + med +// +// 6. FINAL SUMMATION +// +// We now add up all the small parts: +// +// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3 +// +// Now the overall result is just: +// +// res_hi + res_lo +// +// 7. SMALL ARGUMENTS +// +// Inputs with |X| < 2^-252 are treated specially as +// 1 - |x|. +// +// Special cases: +// cos(NaN) = quiet NaN, and raise invalid exception +// cos(INF) = NaN and raise invalid exception +// cos(0) = 1 +// +/******************************************************************************/ + +#ifdef _LP64 +// The 64 bit code is at most SSE2 compliant +ALIGNED_(8) juint _ONE[] = +{ + 0x00000000UL, 0x3ff00000UL +}; +void MacroAssembler::fast_cos(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register r8, Register r9, Register r10, Register r11) { + + Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1; + Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; + Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; + Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, B1_2, B1_3, B1_4, B1_5, start; + + assert_different_registers(r8, r9, r10, r11, eax, ecx, edx); + + address ONEHALF = StubRoutines::x86::_ONEHALF_addr(); + address P_2 = StubRoutines::x86::_P_2_addr(); + address SC_4 = StubRoutines::x86::_SC_4_addr(); + address Ctable = StubRoutines::x86::_Ctable_addr(); + address SC_2 = StubRoutines::x86::_SC_2_addr(); + address SC_3 = StubRoutines::x86::_SC_3_addr(); + address SC_1 = StubRoutines::x86::_SC_1_addr(); + address PI_INV_TABLE = StubRoutines::x86::_PI_INV_TABLE_addr(); + address PI_4 = (address)StubRoutines::x86::_PI_4_addr(); + address PI32INV = (address)StubRoutines::x86::_PI32INV_addr(); + address SIGN_MASK = (address)StubRoutines::x86::_SIGN_MASK_addr(); + address P_1 = (address)StubRoutines::x86::_P_1_addr(); + address P_3 = (address)StubRoutines::x86::_P_3_addr(); + address ONE = (address)_ONE; + address NEG_ZERO = (address)StubRoutines::x86::_NEG_ZERO_addr(); + + bind(start); + push(rbx); + subq(rsp, 16); + movsd(Address(rsp, 8), xmm0); + + bind(B1_2); + movl(eax, Address(rsp, 12)); + movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL + andl(eax, 2147418112); + subl(eax, 808452096); + cmpl(eax, 281346048); + jcc(Assembler::above, L_2TAG_PACKET_0_0_1); + mulsd(xmm1, xmm0); + movdqu(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL + movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL + pand(xmm4, xmm0); + por(xmm5, xmm4); + addpd(xmm1, xmm5); + cvttsd2sil(edx, xmm1); + cvtsi2sdl(xmm1, edx); + movdqu(xmm2, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL + movq(xmm3, ExternalAddress(P_1)); //0x54400000UL, 0x3fb921fbUL + mulsd(xmm3, xmm1); + unpcklpd(xmm1, xmm1); + addq(rdx, 1865232); + movdqu(xmm4, xmm0); + andq(rdx, 63); + movdqu(xmm5, ExternalAddress(SC_4)); //0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL + lea(rax, ExternalAddress(Ctable)); + shlq(rdx, 5); + addq(rax, rdx); + mulpd(xmm2, xmm1); + subsd(xmm0, xmm3); + mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL + subsd(xmm4, xmm3); + movq(xmm7, Address(rax, 8)); + unpcklpd(xmm0, xmm0); + movdqu(xmm3, xmm4); + subsd(xmm4, xmm2); + mulpd(xmm5, xmm0); + subpd(xmm0, xmm2); + movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL + mulsd(xmm7, xmm4); + subsd(xmm3, xmm4); + mulpd(xmm5, xmm0); + mulpd(xmm0, xmm0); + subsd(xmm3, xmm2); + movdqu(xmm2, Address(rax, 0)); + subsd(xmm1, xmm3); + movq(xmm3, Address(rax, 24)); + addsd(xmm2, xmm3); + subsd(xmm7, xmm2); + mulsd(xmm2, xmm4); + mulpd(xmm6, xmm0); + mulsd(xmm3, xmm4); + mulpd(xmm2, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL + mulsd(xmm4, Address(rax, 0)); + addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL + mulpd(xmm5, xmm0); + movdqu(xmm0, xmm3); + addsd(xmm3, Address(rax, 8)); + mulpd(xmm1, xmm7); + movdqu(xmm7, xmm4); + addsd(xmm4, xmm3); + addpd(xmm6, xmm5); + movq(xmm5, Address(rax, 8)); + subsd(xmm5, xmm3); + subsd(xmm3, xmm4); + addsd(xmm1, Address(rax, 16)); + mulpd(xmm6, xmm2); + addsd(xmm0, xmm5); + addsd(xmm3, xmm7); + addsd(xmm0, xmm1); + addsd(xmm0, xmm3); + addsd(xmm0, xmm6); + unpckhpd(xmm6, xmm6); + addsd(xmm0, xmm6); + addsd(xmm0, xmm4); + jmp(B1_4); + + bind(L_2TAG_PACKET_0_0_1); + jcc(Assembler::greater, L_2TAG_PACKET_1_0_1); + pextrw(eax, xmm0, 3); + andl(eax, 32767); + pinsrw(xmm0, eax, 3); + movq(xmm1, ExternalAddress(ONE)); //0x00000000UL, 0x3ff00000UL + subsd(xmm1, xmm0); + movdqu(xmm0, xmm1); + jmp(B1_4); + + bind(L_2TAG_PACKET_1_0_1); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + cmpl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_2_0_1); + pextrw(ecx, xmm0, 3); + andl(ecx, 32752); + subl(ecx, 16224); + shrl(ecx, 7); + andl(ecx, 65532); + lea(r11, ExternalAddress(PI_INV_TABLE)); + addq(rcx, r11); + movdq(rax, xmm0); + movl(r10, Address(rcx, 20)); + movl(r8, Address(rcx, 24)); + movl(edx, eax); + shrq(rax, 21); + orl(eax, INT_MIN); + shrl(eax, 11); + movl(r9, r10); + imulq(r10, rdx); + imulq(r9, rax); + imulq(r8, rax); + movl(rsi, Address(rcx, 16)); + movl(rdi, Address(rcx, 12)); + movl(r11, r10); + shrq(r10, 32); + addq(r9, r10); + addq(r11, r8); + movl(r8, r11); + shrq(r11, 32); + addq(r9, r11); + movl(r10, rsi); + imulq(rsi, rdx); + imulq(r10, rax); + movl(r11, rdi); + imulq(rdi, rdx); + movl(rbx, rsi); + shrq(rsi, 32); + addq(r9, rbx); + movl(rbx, r9); + shrq(r9, 32); + addq(r10, rsi); + addq(r10, r9); + shlq(rbx, 32); + orq(r8, rbx); + imulq(r11, rax); + movl(r9, Address(rcx, 8)); + movl(rsi, Address(rcx, 4)); + movl(rbx, rdi); + shrq(rdi, 32); + addq(r10, rbx); + movl(rbx, r10); + shrq(r10, 32); + addq(r11, rdi); + addq(r11, r10); + movq(rdi, r9); + imulq(r9, rdx); + imulq(rdi, rax); + movl(r10, r9); + shrq(r9, 32); + addq(r11, r10); + movl(r10, r11); + shrq(r11, 32); + addq(rdi, r9); + addq(rdi, r11); + movq(r9, rsi); + imulq(rsi, rdx); + imulq(r9, rax); + shlq(r10, 32); + orq(r10, rbx); + movl(eax, Address(rcx, 0)); + movl(r11, rsi); + shrq(rsi, 32); + addq(rdi, r11); + movl(r11, rdi); + shrq(rdi, 32); + addq(r9, rsi); + addq(r9, rdi); + imulq(rdx, rax); + pextrw(rbx, xmm0, 3); + lea(rdi, ExternalAddress(PI_INV_TABLE)); + subq(rcx, rdi); + addl(ecx, ecx); + addl(ecx, ecx); + addl(ecx, ecx); + addl(ecx, 19); + movl(rsi, 32768); + andl(rsi, rbx); + shrl(rbx, 4); + andl(rbx, 2047); + subl(rbx, 1023); + subl(ecx, rbx); + addq(r9, rdx); + movl(edx, ecx); + addl(edx, 32); + cmpl(ecx, 1); + jcc(Assembler::less, L_2TAG_PACKET_3_0_1); + negl(ecx); + addl(ecx, 29); + shll(r9); + movl(rdi, r9); + andl(r9, 536870911); + testl(r9, 268435456); + jcc(Assembler::notEqual, L_2TAG_PACKET_4_0_1); + shrl(r9); + movl(rbx, 0); + shlq(r9, 32); + orq(r9, r11); + + bind(L_2TAG_PACKET_5_0_1); + + bind(L_2TAG_PACKET_6_0_1); + cmpq(r9, 0); + jcc(Assembler::equal, L_2TAG_PACKET_7_0_1); + + bind(L_2TAG_PACKET_8_0_1); + bsrq(r11, r9); + movl(ecx, 29); + subl(ecx, r11); + jcc(Assembler::lessEqual, L_2TAG_PACKET_9_0_1); + shlq(r9); + movq(rax, r10); + shlq(r10); + addl(edx, ecx); + negl(ecx); + addl(ecx, 64); + shrq(rax); + shrq(r8); + orq(r9, rax); + orq(r10, r8); + + bind(L_2TAG_PACKET_10_0_1); + cvtsi2sdq(xmm0, r9); + shrq(r10, 1); + cvtsi2sdq(xmm3, r10); + xorpd(xmm4, xmm4); + shll(edx, 4); + negl(edx); + addl(edx, 16368); + orl(edx, rsi); + xorl(edx, rbx); + pinsrw(xmm4, edx, 3); + movq(xmm2, ExternalAddress(PI_4)); //0x40000000UL, 0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL + movq(xmm6, ExternalAddress(8 + PI_4)); //0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL + xorpd(xmm5, xmm5); + subl(edx, 1008); + pinsrw(xmm5, edx, 3); + mulsd(xmm0, xmm4); + shll(rsi, 16); + sarl(rsi, 31); + mulsd(xmm3, xmm5); + movdqu(xmm1, xmm0); + mulsd(xmm0, xmm2); + shrl(rdi, 29); + addsd(xmm1, xmm3); + mulsd(xmm3, xmm2); + addl(rdi, rsi); + xorl(rdi, rsi); + mulsd(xmm6, xmm1); + movl(eax, rdi); + addsd(xmm6, xmm3); + movdqu(xmm2, xmm0); + addsd(xmm0, xmm6); + subsd(xmm2, xmm0); + addsd(xmm6, xmm2); + + bind(L_2TAG_PACKET_11_0_1); + movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL + mulsd(xmm1, xmm0); + movq(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL + movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL + pand(xmm4, xmm0); + por(xmm5, xmm4); + addpd(xmm1, xmm5); + cvttsd2siq(rdx, xmm1); + cvtsi2sdq(xmm1, rdx); + movq(xmm3, ExternalAddress(P_1)); //0x54400000UL, 0x3fb921fbUL + movdqu(xmm2, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL + mulsd(xmm3, xmm1); + unpcklpd(xmm1, xmm1); + shll(eax, 3); + addl(edx, 1865232); + movdqu(xmm4, xmm0); + addl(edx, eax); + andl(edx, 63); + movdqu(xmm5, ExternalAddress(SC_4)); //0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL + lea(rax, ExternalAddress(Ctable)); + shll(edx, 5); + addq(rax, rdx); + mulpd(xmm2, xmm1); + subsd(xmm0, xmm3); + mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL + subsd(xmm4, xmm3); + movq(xmm7, Address(rax, 8)); + unpcklpd(xmm0, xmm0); + movdqu(xmm3, xmm4); + subsd(xmm4, xmm2); + mulpd(xmm5, xmm0); + subpd(xmm0, xmm2); + mulsd(xmm7, xmm4); + subsd(xmm3, xmm4); + mulpd(xmm5, xmm0); + mulpd(xmm0, xmm0); + subsd(xmm3, xmm2); + movdqu(xmm2, Address(rax, 0)); + subsd(xmm1, xmm3); + movq(xmm3, Address(rax, 24)); + addsd(xmm2, xmm3); + subsd(xmm7, xmm2); + subsd(xmm1, xmm6); + movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL + mulsd(xmm2, xmm4); + mulpd(xmm6, xmm0); + mulsd(xmm3, xmm4); + mulpd(xmm2, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL + mulsd(xmm4, Address(rax, 0)); + addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL + mulpd(xmm5, xmm0); + movdqu(xmm0, xmm3); + addsd(xmm3, Address(rax, 8)); + mulpd(xmm1, xmm7); + movdqu(xmm7, xmm4); + addsd(xmm4, xmm3); + addpd(xmm6, xmm5); + movq(xmm5, Address(rax, 8)); + subsd(xmm5, xmm3); + subsd(xmm3, xmm4); + addsd(xmm1, Address(rax, 16)); + mulpd(xmm6, xmm2); + addsd(xmm5, xmm0); + addsd(xmm3, xmm7); + addsd(xmm1, xmm5); + addsd(xmm1, xmm3); + addsd(xmm1, xmm6); + unpckhpd(xmm6, xmm6); + movdqu(xmm0, xmm4); + addsd(xmm1, xmm6); + addsd(xmm0, xmm1); + jmp(B1_4); + + bind(L_2TAG_PACKET_7_0_1); + addl(edx, 64); + movq(r9, r10); + movq(r10, r8); + movl(r8, 0); + cmpq(r9, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_8_0_1); + addl(edx, 64); + movq(r9, r10); + movq(r10, r8); + cmpq(r9, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_8_0_1); + xorpd(xmm0, xmm0); + xorpd(xmm6, xmm6); + jmp(L_2TAG_PACKET_11_0_1); + + bind(L_2TAG_PACKET_9_0_1); + jcc(Assembler::equal, L_2TAG_PACKET_10_0_1); + negl(ecx); + shrq(r10); + movq(rax, r9); + shrq(r9); + subl(edx, ecx); + negl(ecx); + addl(ecx, 64); + shlq(rax); + orq(r10, rax); + jmp(L_2TAG_PACKET_10_0_1); + bind(L_2TAG_PACKET_3_0_1); + negl(ecx); + shlq(r9, 32); + orq(r9, r11); + shlq(r9); + movq(rdi, r9); + testl(r9, INT_MIN); + jcc(Assembler::notEqual, L_2TAG_PACKET_12_0_1); + shrl(r9); + movl(rbx, 0); + shrq(rdi, 3); + jmp(L_2TAG_PACKET_6_0_1); + + bind(L_2TAG_PACKET_4_0_1); + shrl(r9); + movl(rbx, 536870912); + shrl(rbx); + shlq(r9, 32); + orq(r9, r11); + shlq(rbx, 32); + addl(rdi, 536870912); + movl(rcx, 0); + movl(r11, 0); + subq(rcx, r8); + sbbq(r11, r10); + sbbq(rbx, r9); + movq(r8, rcx); + movq(r10, r11); + movq(r9, rbx); + movl(rbx, 32768); + jmp(L_2TAG_PACKET_5_0_1); + + bind(L_2TAG_PACKET_12_0_1); + shrl(r9); + mov64(rbx, 0x100000000); + shrq(rbx); + movl(rcx, 0); + movl(r11, 0); + subq(rcx, r8); + sbbq(r11, r10); + sbbq(rbx, r9); + movq(r8, rcx); + movq(r10, r11); + movq(r9, rbx); + movl(rbx, 32768); + shrq(rdi, 3); + addl(rdi, 536870912); + jmp(L_2TAG_PACKET_6_0_1); + + bind(L_2TAG_PACKET_2_0_1); + movsd(xmm0, Address(rsp, 8)); + mulsd(xmm0, ExternalAddress(NEG_ZERO)); //0x00000000UL, 0x80000000UL + movq(Address(rsp, 0), xmm0); + + bind(L_2TAG_PACKET_13_0_1); + + bind(B1_4); + addq(rsp, 16); + pop(rbx); +} +#else +// The 32 bit code is at most SSE2 compliant + +ALIGNED_(16) juint _static_const_table_cos[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, 0xbf73b92eUL, + 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, + 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, + 0xc0000000UL, 0xbc626d19UL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, + 0xbfa60beaUL, 0x2ed59f06UL, 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, + 0x00000000UL, 0x3ff00000UL, 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, + 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, 0x00000000UL, 0x3ff00000UL, + 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, 0x20000000UL, + 0x3c5e0d89UL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, 0xbfc59267UL, + 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, + 0x3ff00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, + 0x20000000UL, 0x3c68076aUL, 0x00000000UL, 0x3ff00000UL, 0x99fcef32UL, + 0x3fca8279UL, 0x667f3bcdUL, 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, + 0x00000000UL, 0x3fe00000UL, 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, + 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, 0x00000000UL, 0x3fe00000UL, + 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, 0xe0000000UL, + 0x3c39f630UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, 0xbf9d4a2cUL, + 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, + 0x3fe00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0x3fed906bUL, + 0x20000000UL, 0x3c7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x76acf82dUL, + 0x3fa4a031UL, 0x56c62ddaUL, 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, + 0x00000000UL, 0x3fd00000UL, 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, + 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, 0x00000000UL, 0x3fd00000UL, + 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, 0x40000000UL, + 0xbc887df6UL, 0x00000000UL, 0x3fc00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, + 0x40000000UL, 0xbc887df6UL, 0x00000000UL, 0xbfc00000UL, 0x0e5967d5UL, + 0x3fac1d1fUL, 0xcff75cb0UL, 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, + 0x00000000UL, 0xbfd00000UL, 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, + 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, 0x00000000UL, 0xbfd00000UL, + 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, 0x3fed906bUL, 0x20000000UL, + 0x3c7457e6UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, 0x3f9d4a2cUL, + 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, + 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, + 0xe0000000UL, 0x3c39f630UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, + 0xbfc133ccUL, 0x6b151741UL, 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, + 0x00000000UL, 0xbfe00000UL, 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, + 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, 0x00000000UL, 0xbfe00000UL, + 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, 0x20000000UL, + 0x3c68076aUL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, 0x3fc59267UL, + 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, + 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, + 0x20000000UL, 0x3c5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, + 0x3fb37ca1UL, 0xa6aea963UL, 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, + 0x00000000UL, 0xbff00000UL, 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, + 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, 0x00000000UL, 0xbff00000UL, + 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, 0xc0000000UL, + 0xbc626d19UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, 0x3f73b92eUL, + 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, + 0xbff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, + 0x3f73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, + 0x00000000UL, 0xbff00000UL, 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, + 0xbfc8f8b8UL, 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0xbff00000UL, + 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, + 0x3c75d28dUL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, 0x3fb37ca1UL, + 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, 0x3c672cedUL, 0x00000000UL, + 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0xbfde2b5dUL, + 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, + 0x3fc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, + 0x00000000UL, 0xbff00000UL, 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, + 0xbfe44cf3UL, 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0xbff00000UL, + 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, + 0x3c8bdd34UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, 0xbfc133ccUL, + 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, 0x3c82c5e1UL, 0x00000000UL, + 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0xbfea9b66UL, + 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, + 0x3f9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, + 0x00000000UL, 0xbfe00000UL, 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, + 0xbfed906bUL, 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0xbfe00000UL, + 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, + 0xbc8760b1UL, 0x00000000UL, 0xbfd00000UL, 0x0e5967d5UL, 0x3fac1d1fUL, + 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, 0xbc756217UL, 0x00000000UL, + 0xbfd00000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0xbfefd88dUL, + 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0xbfc00000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, + 0xbfefd88dUL, 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0x3fc00000UL, + 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, + 0xbc756217UL, 0x00000000UL, 0x3fd00000UL, 0x76acf82dUL, 0x3fa4a031UL, + 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, 0xbc8760b1UL, 0x00000000UL, + 0x3fd00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0xbfed906bUL, + 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, + 0xbf9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, + 0x00000000UL, 0x3fe00000UL, 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, + 0xbfea9b66UL, 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0x3fe00000UL, + 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, + 0x3c82c5e1UL, 0x00000000UL, 0x3fe00000UL, 0x99fcef32UL, 0x3fca8279UL, + 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, 0x3c8bdd34UL, 0x00000000UL, + 0x3fe00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0xbfe44cf3UL, + 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, + 0xbfc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, + 0x00000000UL, 0x3ff00000UL, 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, + 0xbfde2b5dUL, 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0x3ff00000UL, + 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, + 0x3c672cedUL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, 0xbfa60beaUL, + 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, 0x3c75d28dUL, 0x00000000UL, + 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0xbfc8f8b8UL, + 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, + 0xbf73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, + 0x00000000UL, 0x3ff00000UL, 0x55555555UL, 0xbfc55555UL, 0x00000000UL, + 0xbfe00000UL, 0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL, + 0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL, 0xa556c734UL, + 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL, 0x1a600000UL, 0x3d90b461UL, + 0x1a600000UL, 0x3d90b461UL, 0x54400000UL, 0x3fb921fbUL, 0x00000000UL, + 0x00000000UL, 0x2e037073UL, 0x3b63198aUL, 0x00000000UL, 0x00000000UL, + 0x6dc9c883UL, 0x40245f30UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x43380000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x80000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL +}; +//registers, +// input: (rbp + 8) +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, rbx (tmp) + +// Code generated by Intel C compiler for LIBM library + +void MacroAssembler::fast_cos(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; + Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + + assert_different_registers(tmp, eax, ecx, edx); + + address static_const_table_cos = (address)_static_const_table_cos; + + bind(start); + subl(rsp, 120); + movl(Address(rsp, 56), tmp); + lea(tmp, ExternalAddress(static_const_table_cos)); + movsd(xmm0, Address(rsp, 128)); + pextrw(eax, xmm0, 3); + andl(eax, 32767); + subl(eax, 12336); + cmpl(eax, 4293); + jcc(Assembler::above, L_2TAG_PACKET_0_0_2); + movsd(xmm1, Address(tmp, 2160)); + mulsd(xmm1, xmm0); + movdqu(xmm5, Address(tmp, 2240)); + movsd(xmm4, Address(tmp, 2224)); + pand(xmm4, xmm0); + por(xmm5, xmm4); + movsd(xmm3, Address(tmp, 2128)); + movdqu(xmm2, Address(tmp, 2112)); + addpd(xmm1, xmm5); + cvttsd2sil(edx, xmm1); + cvtsi2sdl(xmm1, edx); + mulsd(xmm3, xmm1); + unpcklpd(xmm1, xmm1); + addl(edx, 1865232); + movdqu(xmm4, xmm0); + andl(edx, 63); + movdqu(xmm5, Address(tmp, 2096)); + lea(eax, Address(tmp, 0)); + shll(edx, 5); + addl(eax, edx); + mulpd(xmm2, xmm1); + subsd(xmm0, xmm3); + mulsd(xmm1, Address(tmp, 2144)); + subsd(xmm4, xmm3); + movsd(xmm7, Address(eax, 8)); + unpcklpd(xmm0, xmm0); + movapd(xmm3, xmm4); + subsd(xmm4, xmm2); + mulpd(xmm5, xmm0); + subpd(xmm0, xmm2); + movdqu(xmm6, Address(tmp, 2064)); + mulsd(xmm7, xmm4); + subsd(xmm3, xmm4); + mulpd(xmm5, xmm0); + mulpd(xmm0, xmm0); + subsd(xmm3, xmm2); + movdqu(xmm2, Address(eax, 0)); + subsd(xmm1, xmm3); + movsd(xmm3, Address(eax, 24)); + addsd(xmm2, xmm3); + subsd(xmm7, xmm2); + mulsd(xmm2, xmm4); + mulpd(xmm6, xmm0); + mulsd(xmm3, xmm4); + mulpd(xmm2, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm5, Address(tmp, 2080)); + mulsd(xmm4, Address(eax, 0)); + addpd(xmm6, Address(tmp, 2048)); + mulpd(xmm5, xmm0); + movapd(xmm0, xmm3); + addsd(xmm3, Address(eax, 8)); + mulpd(xmm1, xmm7); + movapd(xmm7, xmm4); + addsd(xmm4, xmm3); + addpd(xmm6, xmm5); + movsd(xmm5, Address(eax, 8)); + subsd(xmm5, xmm3); + subsd(xmm3, xmm4); + addsd(xmm1, Address(eax, 16)); + mulpd(xmm6, xmm2); + addsd(xmm5, xmm0); + addsd(xmm3, xmm7); + addsd(xmm1, xmm5); + addsd(xmm1, xmm3); + addsd(xmm1, xmm6); + unpckhpd(xmm6, xmm6); + addsd(xmm1, xmm6); + addsd(xmm4, xmm1); + movsd(Address(rsp, 0), xmm4); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_0_0_2); + jcc(Assembler::greater, L_2TAG_PACKET_2_0_2); + pextrw(eax, xmm0, 3); + andl(eax, 32767); + pinsrw(xmm0, eax, 3); + movsd(xmm1, Address(tmp, 2192)); + subsd(xmm1, xmm0); + movsd(Address(rsp, 0), xmm1); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movl(eax, Address(rsp, 132)); + andl(eax, 2146435072); + cmpl(eax, 2146435072); + jcc(Assembler::equal, L_2TAG_PACKET_3_0_2); + subl(rsp, 32); + movsd(Address(rsp, 0), xmm0); + lea(eax, Address(rsp, 40)); + movl(Address(rsp, 8), eax); + movl(eax, 1); + movl(Address(rsp, 12), eax); + call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_sin_cos_huge()))); + addl(rsp, 32); + fld_d(Address(rsp, 8)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_3_0_2); + fld_d(Address(rsp, 128)); + fmul_d(Address(tmp, 2208)); + + bind(L_2TAG_PACKET_1_0_2); + movl(tmp, Address(rsp, 56)); +} +#endif diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_exp.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_exp.cpp new file mode 100644 index 00000000000..faea7b9434b --- /dev/null +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_exp.cpp @@ -0,0 +1,674 @@ +/* +* Copyright (c) 2016, Intel Corporation. +* Intel Math Library (LIBM) Source Code +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +* +*/ + +#include "precompiled.hpp" +#include "asm/assembler.hpp" +#include "asm/assembler.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "macroAssembler_x86.hpp" + +#ifdef _MSC_VER +#define ALIGNED_(x) __declspec(align(x)) +#else +#define ALIGNED_(x) __attribute__ ((aligned(x))) +#endif + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - EXP() +// --------------------- +// +// Description: +// Let K = 64 (table size). +// x x/log(2) n +// e = 2 = 2 * T[j] * (1 + P(y)) +// where +// x = m*log(2)/K + y, y in [-log(2)/K..log(2)/K] +// m = n*K + j, m,n,j - signed integer, j in [-K/2..K/2] +// j/K +// values of 2 are tabulated as T[j] = T_hi[j] ( 1 + T_lo[j]). +// +// P(y) is a minimax polynomial approximation of exp(x)-1 +// on small interval [-log(2)/K..log(2)/K] (were calculated by Maple V). +// +// To avoid problems with arithmetic overflow and underflow, +// n n1 n2 +// value of 2 is safely computed as 2 * 2 where n1 in [-BIAS/2..BIAS/2] +// where BIAS is a value of exponent bias. +// +// Special cases: +// exp(NaN) = NaN +// exp(+INF) = +INF +// exp(-INF) = 0 +// exp(x) = 1 for subnormals +// for finite argument, only exp(0)=1 is exact +// For IEEE double +// if x > 709.782712893383973096 then exp(x) overflow +// if x < -745.133219101941108420 then exp(x) underflow +// +/******************************************************************************/ + +#ifdef _LP64 +// The 64 bit code is at most SSE2 compliant +ALIGNED_(16) juint _cv[] = +{ + 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL, 0xfefa0000UL, + 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL, 0xbc9e3b3aUL, 0x3d1cf79aUL, + 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xfffffffeUL, 0x3fdfffffUL, 0xfffffffeUL, + 0x3fdfffffUL, 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, 0x3fa55555UL, + 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL +}; + +ALIGNED_(16) juint _shifter[] = +{ + 0x00000000UL, 0x43380000UL, 0x00000000UL, 0x43380000UL +}; + +ALIGNED_(16) juint _mmask[] = +{ + 0xffffffc0UL, 0x00000000UL, 0xffffffc0UL, 0x00000000UL +}; + +ALIGNED_(16) juint _bias[] = +{ + 0x0000ffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL +}; + +ALIGNED_(16) juint _Tbl_addr[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x0e03754dUL, + 0x3cad7bbfUL, 0x3e778060UL, 0x00002c9aUL, 0x3567f613UL, 0x3c8cd252UL, + 0xd3158574UL, 0x000059b0UL, 0x61e6c861UL, 0x3c60f74eUL, 0x18759bc8UL, + 0x00008745UL, 0x5d837b6cUL, 0x3c979aa6UL, 0x6cf9890fUL, 0x0000b558UL, + 0x702f9cd1UL, 0x3c3ebe3dUL, 0x32d3d1a2UL, 0x0000e3ecUL, 0x1e63bcd8UL, + 0x3ca3516eUL, 0xd0125b50UL, 0x00011301UL, 0x26f0387bUL, 0x3ca4c554UL, + 0xaea92ddfUL, 0x0001429aUL, 0x62523fb6UL, 0x3ca95153UL, 0x3c7d517aUL, + 0x000172b8UL, 0x3f1353bfUL, 0x3c8b898cUL, 0xeb6fcb75UL, 0x0001a35bUL, + 0x3e3a2f5fUL, 0x3c9aecf7UL, 0x3168b9aaUL, 0x0001d487UL, 0x44a6c38dUL, + 0x3c8a6f41UL, 0x88628cd6UL, 0x0002063bUL, 0xe3a8a894UL, 0x3c968efdUL, + 0x6e756238UL, 0x0002387aUL, 0x981fe7f2UL, 0x3c80472bUL, 0x65e27cddUL, + 0x00026b45UL, 0x6d09ab31UL, 0x3c82f7e1UL, 0xf51fdee1UL, 0x00029e9dUL, + 0x720c0ab3UL, 0x3c8b3782UL, 0xa6e4030bUL, 0x0002d285UL, 0x4db0abb6UL, + 0x3c834d75UL, 0x0a31b715UL, 0x000306feUL, 0x5dd3f84aUL, 0x3c8fdd39UL, + 0xb26416ffUL, 0x00033c08UL, 0xcc187d29UL, 0x3ca12f8cUL, 0x373aa9caUL, + 0x000371a7UL, 0x738b5e8bUL, 0x3ca7d229UL, 0x34e59ff6UL, 0x0003a7dbUL, + 0xa72a4c6dUL, 0x3c859f48UL, 0x4c123422UL, 0x0003dea6UL, 0x259d9205UL, + 0x3ca8b846UL, 0x21f72e29UL, 0x0004160aUL, 0x60c2ac12UL, 0x3c4363edUL, + 0x6061892dUL, 0x00044e08UL, 0xdaa10379UL, 0x3c6ecce1UL, 0xb5c13cd0UL, + 0x000486a2UL, 0xbb7aafb0UL, 0x3c7690ceUL, 0xd5362a27UL, 0x0004bfdaUL, + 0x9b282a09UL, 0x3ca083ccUL, 0x769d2ca6UL, 0x0004f9b2UL, 0xc1aae707UL, + 0x3ca509b0UL, 0x569d4f81UL, 0x0005342bUL, 0x18fdd78eUL, 0x3c933505UL, + 0x36b527daUL, 0x00056f47UL, 0xe21c5409UL, 0x3c9063e1UL, 0xdd485429UL, + 0x0005ab07UL, 0x2b64c035UL, 0x3c9432e6UL, 0x15ad2148UL, 0x0005e76fUL, + 0x99f08c0aUL, 0x3ca01284UL, 0xb03a5584UL, 0x0006247eUL, 0x0073dc06UL, + 0x3c99f087UL, 0x82552224UL, 0x00066238UL, 0x0da05571UL, 0x3c998d4dUL, + 0x667f3bccUL, 0x0006a09eUL, 0x86ce4786UL, 0x3ca52bb9UL, 0x3c651a2eUL, + 0x0006dfb2UL, 0x206f0dabUL, 0x3ca32092UL, 0xe8ec5f73UL, 0x00071f75UL, + 0x8e17a7a6UL, 0x3ca06122UL, 0x564267c8UL, 0x00075febUL, 0x461e9f86UL, + 0x3ca244acUL, 0x73eb0186UL, 0x0007a114UL, 0xabd66c55UL, 0x3c65ebe1UL, + 0x36cf4e62UL, 0x0007e2f3UL, 0xbbff67d0UL, 0x3c96fe9fUL, 0x994cce12UL, + 0x00082589UL, 0x14c801dfUL, 0x3c951f14UL, 0x9b4492ecUL, 0x000868d9UL, + 0xc1f0eab4UL, 0x3c8db72fUL, 0x422aa0dbUL, 0x0008ace5UL, 0x59f35f44UL, + 0x3c7bf683UL, 0x99157736UL, 0x0008f1aeUL, 0x9c06283cUL, 0x3ca360baUL, + 0xb0cdc5e4UL, 0x00093737UL, 0x20f962aaUL, 0x3c95e8d1UL, 0x9fde4e4fUL, + 0x00097d82UL, 0x2b91ce27UL, 0x3c71affcUL, 0x82a3f090UL, 0x0009c491UL, + 0x589a2ebdUL, 0x3c9b6d34UL, 0x7b5de564UL, 0x000a0c66UL, 0x9ab89880UL, + 0x3c95277cUL, 0xb23e255cUL, 0x000a5503UL, 0x6e735ab3UL, 0x3c846984UL, + 0x5579fdbfUL, 0x000a9e6bUL, 0x92cb3387UL, 0x3c8c1a77UL, 0x995ad3adUL, + 0x000ae89fUL, 0xdc2d1d96UL, 0x3ca22466UL, 0xb84f15faUL, 0x000b33a2UL, + 0xb19505aeUL, 0x3ca1112eUL, 0xf2fb5e46UL, 0x000b7f76UL, 0x0a5fddcdUL, + 0x3c74ffd7UL, 0x904bc1d2UL, 0x000bcc1eUL, 0x30af0cb3UL, 0x3c736eaeUL, + 0xdd85529cUL, 0x000c199bUL, 0xd10959acUL, 0x3c84e08fUL, 0x2e57d14bUL, + 0x000c67f1UL, 0x6c921968UL, 0x3c676b2cUL, 0xdcef9069UL, 0x000cb720UL, + 0x36df99b3UL, 0x3c937009UL, 0x4a07897bUL, 0x000d072dUL, 0xa63d07a7UL, + 0x3c74a385UL, 0xdcfba487UL, 0x000d5818UL, 0xd5c192acUL, 0x3c8e5a50UL, + 0x03db3285UL, 0x000da9e6UL, 0x1c4a9792UL, 0x3c98bb73UL, 0x337b9b5eUL, + 0x000dfc97UL, 0x603a88d3UL, 0x3c74b604UL, 0xe78b3ff6UL, 0x000e502eUL, + 0x92094926UL, 0x3c916f27UL, 0xa2a490d9UL, 0x000ea4afUL, 0x41aa2008UL, + 0x3c8ec3bcUL, 0xee615a27UL, 0x000efa1bUL, 0x31d185eeUL, 0x3c8a64a9UL, + 0x5b6e4540UL, 0x000f5076UL, 0x4d91cd9dUL, 0x3c77893bUL, 0x819e90d8UL, + 0x000fa7c1UL +}; + +ALIGNED_(16) juint _ALLONES[] = +{ + 0xffffffffUL, 0xffffffffUL, 0xffffffffUL, 0xffffffffUL +}; + +ALIGNED_(16) juint _ebias[] = +{ + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3ff00000UL +}; + +ALIGNED_(4) juint _XMAX[] = +{ + 0xffffffffUL, 0x7fefffffUL +}; + +ALIGNED_(4) juint _XMIN[] = +{ + 0x00000000UL, 0x00100000UL +}; + +ALIGNED_(4) juint _INF[] = +{ + 0x00000000UL, 0x7ff00000UL +}; + +ALIGNED_(4) juint _ZERO[] = +{ + 0x00000000UL, 0x00000000UL +}; + +ALIGNED_(4) juint _ONE_val[] = +{ + 0x00000000UL, 0x3ff00000UL +}; + + +// Registers: +// input: xmm0 +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, tmp - r11 + +// Code generated by Intel C compiler for LIBM library + +void MacroAssembler::fast_exp(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; + Label L_2TAG_PACKET_12_0_2, B1_3, B1_5, start; + + assert_different_registers(tmp, eax, ecx, edx); + jmp(start); + address cv = (address)_cv; + address Shifter = (address)_shifter; + address mmask = (address)_mmask; + address bias = (address)_bias; + address Tbl_addr = (address)_Tbl_addr; + address ALLONES = (address)_ALLONES; + address ebias = (address)_ebias; + address XMAX = (address)_XMAX; + address XMIN = (address)_XMIN; + address INF = (address)_INF; + address ZERO = (address)_ZERO; + address ONE_val = (address)_ONE_val; + + bind(start); + subq(rsp, 24); + movsd(Address(rsp, 8), xmm0); + unpcklpd(xmm0, xmm0); + movdqu(xmm1, ExternalAddress(cv)); // 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL + movdqu(xmm6, ExternalAddress(Shifter)); // 0x00000000UL, 0x43380000UL, 0x00000000UL, 0x43380000UL + movdqu(xmm2, ExternalAddress(16 + cv)); // 0xfefa0000UL, 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL + movdqu(xmm3, ExternalAddress(32 + cv)); // 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xbc9e3b3aUL, 0x3d1cf79aUL + pextrw(eax, xmm0, 3); + andl(eax, 32767); + movl(edx, 16527); + subl(edx, eax); + subl(eax, 15504); + orl(edx, eax); + cmpl(edx, INT_MIN); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + mulpd(xmm1, xmm0); + addpd(xmm1, xmm6); + movapd(xmm7, xmm1); + subpd(xmm1, xmm6); + mulpd(xmm2, xmm1); + movdqu(xmm4, ExternalAddress(64 + cv)); // 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, 0x3fa55555UL + mulpd(xmm3, xmm1); + movdqu(xmm5, ExternalAddress(80 + cv)); // 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL + subpd(xmm0, xmm2); + movdl(eax, xmm7); + movl(ecx, eax); + andl(ecx, 63); + shll(ecx, 4); + sarl(eax, 6); + movl(edx, eax); + movdqu(xmm6, ExternalAddress(mmask)); // 0xffffffc0UL, 0x00000000UL, 0xffffffc0UL, 0x00000000UL + pand(xmm7, xmm6); + movdqu(xmm6, ExternalAddress(bias)); // 0x0000ffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL + paddq(xmm7, xmm6); + psllq(xmm7, 46); + subpd(xmm0, xmm3); + lea(tmp, ExternalAddress(Tbl_addr)); + movdqu(xmm2, Address(ecx, tmp)); + mulpd(xmm4, xmm0); + movapd(xmm6, xmm0); + movapd(xmm1, xmm0); + mulpd(xmm6, xmm6); + mulpd(xmm0, xmm6); + addpd(xmm5, xmm4); + mulsd(xmm0, xmm6); + mulpd(xmm6, ExternalAddress(48 + cv)); // 0xfffffffeUL, 0x3fdfffffUL, 0xfffffffeUL, 0x3fdfffffUL + addsd(xmm1, xmm2); + unpckhpd(xmm2, xmm2); + mulpd(xmm0, xmm5); + addsd(xmm1, xmm0); + por(xmm2, xmm7); + unpckhpd(xmm0, xmm0); + addsd(xmm0, xmm1); + addsd(xmm0, xmm6); + addl(edx, 894); + cmpl(edx, 1916); + jcc(Assembler::above, L_2TAG_PACKET_1_0_2); + mulsd(xmm0, xmm2); + addsd(xmm0, xmm2); + jmp(B1_5); + + bind(L_2TAG_PACKET_1_0_2); + xorpd(xmm3, xmm3); + movdqu(xmm4, ExternalAddress(ALLONES)); // 0xffffffffUL, 0xffffffffUL, 0xffffffffUL, 0xffffffffUL + movl(edx, -1022); + subl(edx, eax); + movdl(xmm5, edx); + psllq(xmm4, xmm5); + movl(ecx, eax); + sarl(eax, 1); + pinsrw(xmm3, eax, 3); + movdqu(xmm6, ExternalAddress(ebias)); // 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3ff00000UL + psllq(xmm3, 4); + psubd(xmm2, xmm3); + mulsd(xmm0, xmm2); + cmpl(edx, 52); + jcc(Assembler::greater, L_2TAG_PACKET_2_0_2); + pand(xmm4, xmm2); + paddd(xmm3, xmm6); + subsd(xmm2, xmm4); + addsd(xmm0, xmm2); + cmpl(ecx, 1023); + jcc(Assembler::greaterEqual, L_2TAG_PACKET_3_0_2); + pextrw(ecx, xmm0, 3); + andl(ecx, 32768); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_4_0_2); + movapd(xmm6, xmm0); + addsd(xmm0, xmm4); + mulsd(xmm0, xmm3); + pextrw(ecx, xmm0, 3); + andl(ecx, 32752); + cmpl(ecx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_5_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_5_0_2); + mulsd(xmm6, xmm3); + mulsd(xmm4, xmm3); + movdqu(xmm0, xmm6); + pxor(xmm6, xmm4); + psrad(xmm6, 31); + pshufd(xmm6, xmm6, 85); + psllq(xmm0, 1); + psrlq(xmm0, 1); + pxor(xmm0, xmm6); + psrlq(xmm6, 63); + paddq(xmm0, xmm6); + paddq(xmm0, xmm4); + movl(Address(rsp, 0), 15); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_4_0_2); + addsd(xmm0, xmm4); + mulsd(xmm0, xmm3); + jmp(B1_5); + + bind(L_2TAG_PACKET_3_0_2); + addsd(xmm0, xmm4); + mulsd(xmm0, xmm3); + pextrw(ecx, xmm0, 3); + andl(ecx, 32752); + cmpl(ecx, 32752); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_7_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_2_0_2); + paddd(xmm3, xmm6); + addpd(xmm0, xmm2); + mulsd(xmm0, xmm3); + movl(Address(rsp, 0), 15); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_8_0_2); + cmpl(eax, 2146435072); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_9_0_2); + movl(eax, Address(rsp, 12)); + cmpl(eax, INT_MIN); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_10_0_2); + movsd(xmm0, ExternalAddress(XMAX)); // 0xffffffffUL, 0x7fefffffUL + mulsd(xmm0, xmm0); + + bind(L_2TAG_PACKET_7_0_2); + movl(Address(rsp, 0), 14); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_10_0_2); + movsd(xmm0, ExternalAddress(XMIN)); // 0x00000000UL, 0x00100000UL + mulsd(xmm0, xmm0); + movl(Address(rsp, 0), 15); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_9_0_2); + movl(edx, Address(rsp, 8)); + cmpl(eax, 2146435072); + jcc(Assembler::above, L_2TAG_PACKET_11_0_2); + cmpl(edx, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_11_0_2); + movl(eax, Address(rsp, 12)); + cmpl(eax, 2146435072); + jcc(Assembler::notEqual, L_2TAG_PACKET_12_0_2); + movsd(xmm0, ExternalAddress(INF)); // 0x00000000UL, 0x7ff00000UL + jmp(B1_5); + + bind(L_2TAG_PACKET_12_0_2); + movsd(xmm0, ExternalAddress(ZERO)); // 0x00000000UL, 0x00000000UL + jmp(B1_5); + + bind(L_2TAG_PACKET_11_0_2); + movsd(xmm0, Address(rsp, 8)); + addsd(xmm0, xmm0); + jmp(B1_5); + + bind(L_2TAG_PACKET_0_0_2); + movl(eax, Address(rsp, 12)); + andl(eax, 2147483647); + cmpl(eax, 1083179008); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_8_0_2); + movsd(Address(rsp, 8), xmm0); + addsd(xmm0, ExternalAddress(ONE_val)); // 0x00000000UL, 0x3ff00000UL + jmp(B1_5); + + bind(L_2TAG_PACKET_6_0_2); + movq(Address(rsp, 16), xmm0); + + bind(B1_3); + movq(xmm0, Address(rsp, 16)); + + bind(B1_5); + addq(rsp, 24); +} +#else +// The 32 bit code is at most SSE2 compliant +ALIGNED_(16) juint _static_const_table[] = +{ + 0x00000000UL, 0xfff00000UL, 0x00000000UL, 0xfff00000UL, 0xffffffc0UL, + 0x00000000UL, 0xffffffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL, + 0x0000ffc0UL, 0x00000000UL, 0x00000000UL, 0x43380000UL, 0x00000000UL, + 0x43380000UL, 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL, + 0xfefa0000UL, 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL, 0xbc9e3b3aUL, + 0x3d1cf79aUL, 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xfffffffeUL, 0x3fdfffffUL, + 0xfffffffeUL, 0x3fdfffffUL, 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, + 0x3fa55555UL, 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x0e03754dUL, + 0x3cad7bbfUL, 0x3e778060UL, 0x00002c9aUL, 0x3567f613UL, 0x3c8cd252UL, + 0xd3158574UL, 0x000059b0UL, 0x61e6c861UL, 0x3c60f74eUL, 0x18759bc8UL, + 0x00008745UL, 0x5d837b6cUL, 0x3c979aa6UL, 0x6cf9890fUL, 0x0000b558UL, + 0x702f9cd1UL, 0x3c3ebe3dUL, 0x32d3d1a2UL, 0x0000e3ecUL, 0x1e63bcd8UL, + 0x3ca3516eUL, 0xd0125b50UL, 0x00011301UL, 0x26f0387bUL, 0x3ca4c554UL, + 0xaea92ddfUL, 0x0001429aUL, 0x62523fb6UL, 0x3ca95153UL, 0x3c7d517aUL, + 0x000172b8UL, 0x3f1353bfUL, 0x3c8b898cUL, 0xeb6fcb75UL, 0x0001a35bUL, + 0x3e3a2f5fUL, 0x3c9aecf7UL, 0x3168b9aaUL, 0x0001d487UL, 0x44a6c38dUL, + 0x3c8a6f41UL, 0x88628cd6UL, 0x0002063bUL, 0xe3a8a894UL, 0x3c968efdUL, + 0x6e756238UL, 0x0002387aUL, 0x981fe7f2UL, 0x3c80472bUL, 0x65e27cddUL, + 0x00026b45UL, 0x6d09ab31UL, 0x3c82f7e1UL, 0xf51fdee1UL, 0x00029e9dUL, + 0x720c0ab3UL, 0x3c8b3782UL, 0xa6e4030bUL, 0x0002d285UL, 0x4db0abb6UL, + 0x3c834d75UL, 0x0a31b715UL, 0x000306feUL, 0x5dd3f84aUL, 0x3c8fdd39UL, + 0xb26416ffUL, 0x00033c08UL, 0xcc187d29UL, 0x3ca12f8cUL, 0x373aa9caUL, + 0x000371a7UL, 0x738b5e8bUL, 0x3ca7d229UL, 0x34e59ff6UL, 0x0003a7dbUL, + 0xa72a4c6dUL, 0x3c859f48UL, 0x4c123422UL, 0x0003dea6UL, 0x259d9205UL, + 0x3ca8b846UL, 0x21f72e29UL, 0x0004160aUL, 0x60c2ac12UL, 0x3c4363edUL, + 0x6061892dUL, 0x00044e08UL, 0xdaa10379UL, 0x3c6ecce1UL, 0xb5c13cd0UL, + 0x000486a2UL, 0xbb7aafb0UL, 0x3c7690ceUL, 0xd5362a27UL, 0x0004bfdaUL, + 0x9b282a09UL, 0x3ca083ccUL, 0x769d2ca6UL, 0x0004f9b2UL, 0xc1aae707UL, + 0x3ca509b0UL, 0x569d4f81UL, 0x0005342bUL, 0x18fdd78eUL, 0x3c933505UL, + 0x36b527daUL, 0x00056f47UL, 0xe21c5409UL, 0x3c9063e1UL, 0xdd485429UL, + 0x0005ab07UL, 0x2b64c035UL, 0x3c9432e6UL, 0x15ad2148UL, 0x0005e76fUL, + 0x99f08c0aUL, 0x3ca01284UL, 0xb03a5584UL, 0x0006247eUL, 0x0073dc06UL, + 0x3c99f087UL, 0x82552224UL, 0x00066238UL, 0x0da05571UL, 0x3c998d4dUL, + 0x667f3bccUL, 0x0006a09eUL, 0x86ce4786UL, 0x3ca52bb9UL, 0x3c651a2eUL, + 0x0006dfb2UL, 0x206f0dabUL, 0x3ca32092UL, 0xe8ec5f73UL, 0x00071f75UL, + 0x8e17a7a6UL, 0x3ca06122UL, 0x564267c8UL, 0x00075febUL, 0x461e9f86UL, + 0x3ca244acUL, 0x73eb0186UL, 0x0007a114UL, 0xabd66c55UL, 0x3c65ebe1UL, + 0x36cf4e62UL, 0x0007e2f3UL, 0xbbff67d0UL, 0x3c96fe9fUL, 0x994cce12UL, + 0x00082589UL, 0x14c801dfUL, 0x3c951f14UL, 0x9b4492ecUL, 0x000868d9UL, + 0xc1f0eab4UL, 0x3c8db72fUL, 0x422aa0dbUL, 0x0008ace5UL, 0x59f35f44UL, + 0x3c7bf683UL, 0x99157736UL, 0x0008f1aeUL, 0x9c06283cUL, 0x3ca360baUL, + 0xb0cdc5e4UL, 0x00093737UL, 0x20f962aaUL, 0x3c95e8d1UL, 0x9fde4e4fUL, + 0x00097d82UL, 0x2b91ce27UL, 0x3c71affcUL, 0x82a3f090UL, 0x0009c491UL, + 0x589a2ebdUL, 0x3c9b6d34UL, 0x7b5de564UL, 0x000a0c66UL, 0x9ab89880UL, + 0x3c95277cUL, 0xb23e255cUL, 0x000a5503UL, 0x6e735ab3UL, 0x3c846984UL, + 0x5579fdbfUL, 0x000a9e6bUL, 0x92cb3387UL, 0x3c8c1a77UL, 0x995ad3adUL, + 0x000ae89fUL, 0xdc2d1d96UL, 0x3ca22466UL, 0xb84f15faUL, 0x000b33a2UL, + 0xb19505aeUL, 0x3ca1112eUL, 0xf2fb5e46UL, 0x000b7f76UL, 0x0a5fddcdUL, + 0x3c74ffd7UL, 0x904bc1d2UL, 0x000bcc1eUL, 0x30af0cb3UL, 0x3c736eaeUL, + 0xdd85529cUL, 0x000c199bUL, 0xd10959acUL, 0x3c84e08fUL, 0x2e57d14bUL, + 0x000c67f1UL, 0x6c921968UL, 0x3c676b2cUL, 0xdcef9069UL, 0x000cb720UL, + 0x36df99b3UL, 0x3c937009UL, 0x4a07897bUL, 0x000d072dUL, 0xa63d07a7UL, + 0x3c74a385UL, 0xdcfba487UL, 0x000d5818UL, 0xd5c192acUL, 0x3c8e5a50UL, + 0x03db3285UL, 0x000da9e6UL, 0x1c4a9792UL, 0x3c98bb73UL, 0x337b9b5eUL, + 0x000dfc97UL, 0x603a88d3UL, 0x3c74b604UL, 0xe78b3ff6UL, 0x000e502eUL, + 0x92094926UL, 0x3c916f27UL, 0xa2a490d9UL, 0x000ea4afUL, 0x41aa2008UL, + 0x3c8ec3bcUL, 0xee615a27UL, 0x000efa1bUL, 0x31d185eeUL, 0x3c8a64a9UL, + 0x5b6e4540UL, 0x000f5076UL, 0x4d91cd9dUL, 0x3c77893bUL, 0x819e90d8UL, + 0x000fa7c1UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x7ff00000UL, + 0x00000000UL, 0x00000000UL, 0xffffffffUL, 0x7fefffffUL, 0x00000000UL, + 0x00100000UL +}; + +//registers, +// input: (rbp + 8) +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, rbx (tmp) + +// Code generated by Intel C compiler for LIBM library + +void MacroAssembler::fast_exp(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; + Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + + assert_different_registers(tmp, eax, ecx, edx); + jmp(start); + address static_const_table = (address)_static_const_table; + + bind(start); + subl(rsp, 120); + movl(Address(rsp, 64), tmp); + lea(tmp, ExternalAddress(static_const_table)); + movdqu(xmm0, Address(rsp, 128)); + unpcklpd(xmm0, xmm0); + movdqu(xmm1, Address(tmp, 64)); // 0x652b82feUL, 0x40571547UL, 0x652b82feUL, 0x40571547UL + movdqu(xmm6, Address(tmp, 48)); // 0x00000000UL, 0x43380000UL, 0x00000000UL, 0x43380000UL + movdqu(xmm2, Address(tmp, 80)); // 0xfefa0000UL, 0x3f862e42UL, 0xfefa0000UL, 0x3f862e42UL + movdqu(xmm3, Address(tmp, 96)); // 0xbc9e3b3aUL, 0x3d1cf79aUL, 0xbc9e3b3aUL, 0x3d1cf79aUL + pextrw(eax, xmm0, 3); + andl(eax, 32767); + movl(edx, 16527); + subl(edx, eax); + subl(eax, 15504); + orl(edx, eax); + cmpl(edx, INT_MIN); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + mulpd(xmm1, xmm0); + addpd(xmm1, xmm6); + movapd(xmm7, xmm1); + subpd(xmm1, xmm6); + mulpd(xmm2, xmm1); + movdqu(xmm4, Address(tmp, 128)); // 0xe3289860UL, 0x3f56c15cUL, 0x555b9e25UL, 0x3fa55555UL + mulpd(xmm3, xmm1); + movdqu(xmm5, Address(tmp, 144)); // 0xc090cf0fUL, 0x3f811115UL, 0x55548ba1UL, 0x3fc55555UL + subpd(xmm0, xmm2); + movdl(eax, xmm7); + movl(ecx, eax); + andl(ecx, 63); + shll(ecx, 4); + sarl(eax, 6); + movl(edx, eax); + movdqu(xmm6, Address(tmp, 16)); // 0xffffffc0UL, 0x00000000UL, 0xffffffc0UL, 0x00000000UL + pand(xmm7, xmm6); + movdqu(xmm6, Address(tmp, 32)); // 0x0000ffc0UL, 0x00000000UL, 0x0000ffc0UL, 0x00000000UL + paddq(xmm7, xmm6); + psllq(xmm7, 46); + subpd(xmm0, xmm3); + movdqu(xmm2, Address(tmp, ecx, Address::times_1, 160)); + mulpd(xmm4, xmm0); + movapd(xmm6, xmm0); + movapd(xmm1, xmm0); + mulpd(xmm6, xmm6); + mulpd(xmm0, xmm6); + addpd(xmm5, xmm4); + mulsd(xmm0, xmm6); + mulpd(xmm6, Address(tmp, 112)); // 0xfffffffeUL, 0x3fdfffffUL, 0xfffffffeUL, 0x3fdfffffUL + addsd(xmm1, xmm2); + unpckhpd(xmm2, xmm2); + mulpd(xmm0, xmm5); + addsd(xmm1, xmm0); + por(xmm2, xmm7); + unpckhpd(xmm0, xmm0); + addsd(xmm0, xmm1); + addsd(xmm0, xmm6); + addl(edx, 894); + cmpl(edx, 1916); + jcc(Assembler::above, L_2TAG_PACKET_1_0_2); + mulsd(xmm0, xmm2); + addsd(xmm0, xmm2); + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_1_0_2); + fnstcw(Address(rsp, 24)); + movzwl(edx, Address(rsp, 24)); + orl(edx, 768); + movw(Address(rsp, 28), edx); + fldcw(Address(rsp, 28)); + movl(edx, eax); + sarl(eax, 1); + subl(edx, eax); + movdqu(xmm6, Address(tmp, 0)); // 0x00000000UL, 0xfff00000UL, 0x00000000UL, 0xfff00000UL + pandn(xmm6, xmm2); + addl(eax, 1023); + movdl(xmm3, eax); + psllq(xmm3, 52); + por(xmm6, xmm3); + addl(edx, 1023); + movdl(xmm4, edx); + psllq(xmm4, 52); + movsd(Address(rsp, 8), xmm0); + fld_d(Address(rsp, 8)); + movsd(Address(rsp, 16), xmm6); + fld_d(Address(rsp, 16)); + fmula(1); + faddp(1); + movsd(Address(rsp, 8), xmm4); + fld_d(Address(rsp, 8)); + fmulp(1); + fstp_d(Address(rsp, 8)); + movsd(xmm0, Address(rsp, 8)); + fldcw(Address(rsp, 24)); + pextrw(ecx, xmm0, 3); + andl(ecx, 32752); + cmpl(ecx, 32752); + jcc(Assembler::greaterEqual, L_2TAG_PACKET_3_0_2); + cmpl(ecx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_4_0_2); + jmp(L_2TAG_PACKET_2_0_2); + cmpl(ecx, INT_MIN); + jcc(Assembler::less, L_2TAG_PACKET_3_0_2); + cmpl(ecx, -1064950997); + jcc(Assembler::less, L_2TAG_PACKET_2_0_2); + jcc(Assembler::greater, L_2TAG_PACKET_4_0_2); + movl(edx, Address(rsp, 128)); + cmpl(edx, -17155601); + jcc(Assembler::less, L_2TAG_PACKET_2_0_2); + jmp(L_2TAG_PACKET_4_0_2); + + bind(L_2TAG_PACKET_3_0_2); + movl(edx, 14); + jmp(L_2TAG_PACKET_5_0_2); + + bind(L_2TAG_PACKET_4_0_2); + movl(edx, 15); + + bind(L_2TAG_PACKET_5_0_2); + movsd(Address(rsp, 0), xmm0); + movsd(xmm0, Address(rsp, 128)); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_7_0_2); + cmpl(eax, 2146435072); + jcc(Assembler::greaterEqual, L_2TAG_PACKET_8_0_2); + movl(eax, Address(rsp, 132)); + cmpl(eax, INT_MIN); + jcc(Assembler::greaterEqual, L_2TAG_PACKET_9_0_2); + movsd(xmm0, Address(tmp, 1208)); // 0xffffffffUL, 0x7fefffffUL + mulsd(xmm0, xmm0); + movl(edx, 14); + jmp(L_2TAG_PACKET_5_0_2); + + bind(L_2TAG_PACKET_9_0_2); + movsd(xmm0, Address(tmp, 1216)); + mulsd(xmm0, xmm0); + movl(edx, 15); + jmp(L_2TAG_PACKET_5_0_2); + + bind(L_2TAG_PACKET_8_0_2); + movl(edx, Address(rsp, 128)); + cmpl(eax, 2146435072); + jcc(Assembler::above, L_2TAG_PACKET_10_0_2); + cmpl(edx, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_10_0_2); + movl(eax, Address(rsp, 132)); + cmpl(eax, 2146435072); + jcc(Assembler::notEqual, L_2TAG_PACKET_11_0_2); + movsd(xmm0, Address(tmp, 1192)); // 0x00000000UL, 0x7ff00000UL + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_11_0_2); + movsd(xmm0, Address(tmp, 1200)); // 0x00000000UL, 0x00000000UL + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_10_0_2); + movsd(xmm0, Address(rsp, 128)); + addsd(xmm0, xmm0); + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_0_0_2); + movl(eax, Address(rsp, 132)); + andl(eax, 2147483647); + cmpl(eax, 1083179008); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_7_0_2); + movsd(xmm0, Address(rsp, 128)); + addsd(xmm0, Address(tmp, 1184)); // 0x00000000UL, 0x3ff00000UL + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movsd(Address(rsp, 48), xmm0); + fld_d(Address(rsp, 48)); + + bind(L_2TAG_PACKET_6_0_2); + movl(tmp, Address(rsp, 64)); +} +#endif diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_log.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_log.cpp new file mode 100644 index 00000000000..cd4ed0d79d8 --- /dev/null +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_log.cpp @@ -0,0 +1,655 @@ +/* +* Copyright (c) 2016, Intel Corporation. +* Intel Math Library (LIBM) Source Code +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +* +*/ + +#include "precompiled.hpp" +#include "asm/assembler.hpp" +#include "asm/assembler.inline.hpp" +#include "macroAssembler_x86.hpp" + +#ifdef _MSC_VER +#define ALIGNED_(x) __declspec(align(x)) +#else +#define ALIGNED_(x) __attribute__ ((aligned(x))) +#endif + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - LOG() +// --------------------- +// +// x=2^k * mx, mx in [1,2) +// +// Get B~1/mx based on the output of rcpss instruction (B0) +// B = int((B0*2^7+0.5))/2^7 +// +// Reduced argument: r=B*mx-1.0 (computed accurately in high and low parts) +// +// Result: k*log(2) - log(B) + p(r) if |x-1| >= small value (2^-6) and +// p(r) is a degree 7 polynomial +// -log(B) read from data table (high, low parts) +// Result is formed from high and low parts +// +// Special cases: +// log(NaN) = quiet NaN, and raise invalid exception +// log(+INF) = that INF +// log(0) = -INF with divide-by-zero exception raised +// log(1) = +0 +// log(x) = NaN with invalid exception raised if x < -0, including -INF +// +/******************************************************************************/ + +#ifdef _LP64 +// The 64 bit code is at most SSE2 compliant +ALIGNED_(16) juint _L_tbl[] = +{ + 0xfefa3800UL, 0x3fe62e42UL, 0x93c76730UL, 0x3d2ef357UL, 0xaa241800UL, + 0x3fe5ee82UL, 0x0cda46beUL, 0x3d220238UL, 0x5c364800UL, 0x3fe5af40UL, + 0xac10c9fbUL, 0x3d2dfa63UL, 0x26bb8c00UL, 0x3fe5707aUL, 0xff3303ddUL, + 0x3d09980bUL, 0x26867800UL, 0x3fe5322eUL, 0x5d257531UL, 0x3d05ccc4UL, + 0x835a5000UL, 0x3fe4f45aUL, 0x6d93b8fbUL, 0xbd2e6c51UL, 0x6f970c00UL, + 0x3fe4b6fdUL, 0xed4c541cUL, 0x3cef7115UL, 0x27e8a400UL, 0x3fe47a15UL, + 0xf94d60aaUL, 0xbd22cb6aUL, 0xf2f92400UL, 0x3fe43d9fUL, 0x481051f7UL, + 0xbcfd984fUL, 0x2125cc00UL, 0x3fe4019cUL, 0x30f0c74cUL, 0xbd26ce79UL, + 0x0c36c000UL, 0x3fe3c608UL, 0x7cfe13c2UL, 0xbd02b736UL, 0x17197800UL, + 0x3fe38ae2UL, 0xbb5569a4UL, 0xbd218b7aUL, 0xad9d8c00UL, 0x3fe35028UL, + 0x9527e6acUL, 0x3d10b83fUL, 0x44340800UL, 0x3fe315daUL, 0xc5a0ed9cUL, + 0xbd274e93UL, 0x57b0e000UL, 0x3fe2dbf5UL, 0x07b9dc11UL, 0xbd17a6e5UL, + 0x6d0ec000UL, 0x3fe2a278UL, 0xe797882dUL, 0x3d206d2bUL, 0x1134dc00UL, + 0x3fe26962UL, 0x05226250UL, 0xbd0b61f1UL, 0xd8bebc00UL, 0x3fe230b0UL, + 0x6e48667bUL, 0x3d12fc06UL, 0x5fc61800UL, 0x3fe1f863UL, 0xc9fe81d3UL, + 0xbd2a7242UL, 0x49ae6000UL, 0x3fe1c078UL, 0xed70e667UL, 0x3cccacdeUL, + 0x40f23c00UL, 0x3fe188eeUL, 0xf8ab4650UL, 0x3d14cc4eUL, 0xf6f29800UL, + 0x3fe151c3UL, 0xa293ae49UL, 0xbd2edd97UL, 0x23c75c00UL, 0x3fe11af8UL, + 0xbb9ddcb2UL, 0xbd258647UL, 0x8611cc00UL, 0x3fe0e489UL, 0x07801742UL, + 0x3d1c2998UL, 0xe2d05400UL, 0x3fe0ae76UL, 0x887e7e27UL, 0x3d1f486bUL, + 0x0533c400UL, 0x3fe078bfUL, 0x41edf5fdUL, 0x3d268122UL, 0xbe760400UL, + 0x3fe04360UL, 0xe79539e0UL, 0xbd04c45fUL, 0xe5b20800UL, 0x3fe00e5aUL, + 0xb1727b1cUL, 0xbd053ba3UL, 0xaf7a4800UL, 0x3fdfb358UL, 0x3c164935UL, + 0x3d0085faUL, 0xee031800UL, 0x3fdf4aa7UL, 0x6f014a8bUL, 0x3d12cde5UL, + 0x56b41000UL, 0x3fdee2a1UL, 0x5a470251UL, 0x3d2f27f4UL, 0xc3ddb000UL, + 0x3fde7b42UL, 0x5372bd08UL, 0xbd246550UL, 0x1a272800UL, 0x3fde148aUL, + 0x07322938UL, 0xbd1326b2UL, 0x484c9800UL, 0x3fddae75UL, 0x60dc616aUL, + 0xbd1ea42dUL, 0x46def800UL, 0x3fdd4902UL, 0xe9a767a8UL, 0x3d235bafUL, + 0x18064800UL, 0x3fdce42fUL, 0x3ec7a6b0UL, 0xbd0797c3UL, 0xc7455800UL, + 0x3fdc7ff9UL, 0xc15249aeUL, 0xbd29b6ddUL, 0x693fa000UL, 0x3fdc1c60UL, + 0x7fe8e180UL, 0x3d2cec80UL, 0x1b80e000UL, 0x3fdbb961UL, 0xf40a666dUL, + 0x3d27d85bUL, 0x04462800UL, 0x3fdb56faUL, 0x2d841995UL, 0x3d109525UL, + 0x5248d000UL, 0x3fdaf529UL, 0x52774458UL, 0xbd217cc5UL, 0x3c8ad800UL, + 0x3fda93edUL, 0xbea77a5dUL, 0x3d1e36f2UL, 0x0224f800UL, 0x3fda3344UL, + 0x7f9d79f5UL, 0x3d23c645UL, 0xea15f000UL, 0x3fd9d32bUL, 0x10d0c0b0UL, + 0xbd26279eUL, 0x43135800UL, 0x3fd973a3UL, 0xa502d9f0UL, 0xbd152313UL, + 0x635bf800UL, 0x3fd914a8UL, 0x2ee6307dUL, 0xbd1766b5UL, 0xa88b3000UL, + 0x3fd8b639UL, 0xe5e70470UL, 0xbd205ae1UL, 0x776dc800UL, 0x3fd85855UL, + 0x3333778aUL, 0x3d2fd56fUL, 0x3bd81800UL, 0x3fd7fafaUL, 0xc812566aUL, + 0xbd272090UL, 0x687cf800UL, 0x3fd79e26UL, 0x2efd1778UL, 0x3d29ec7dUL, + 0x76c67800UL, 0x3fd741d8UL, 0x49dc60b3UL, 0x3d2d8b09UL, 0xe6af1800UL, + 0x3fd6e60eUL, 0x7c222d87UL, 0x3d172165UL, 0x3e9c6800UL, 0x3fd68ac8UL, + 0x2756eba0UL, 0x3d20a0d3UL, 0x0b3ab000UL, 0x3fd63003UL, 0xe731ae00UL, + 0xbd2db623UL, 0xdf596000UL, 0x3fd5d5bdUL, 0x08a465dcUL, 0xbd0a0b2aUL, + 0x53c8d000UL, 0x3fd57bf7UL, 0xee5d40efUL, 0x3d1fadedUL, 0x0738a000UL, + 0x3fd522aeUL, 0x8164c759UL, 0x3d2ebe70UL, 0x9e173000UL, 0x3fd4c9e0UL, + 0x1b0ad8a4UL, 0xbd2e2089UL, 0xc271c800UL, 0x3fd4718dUL, 0x0967d675UL, + 0xbd2f27ceUL, 0x23d5e800UL, 0x3fd419b4UL, 0xec90e09dUL, 0x3d08e436UL, + 0x77333000UL, 0x3fd3c252UL, 0xb606bd5cUL, 0x3d183b54UL, 0x76be1000UL, + 0x3fd36b67UL, 0xb0f177c8UL, 0x3d116ecdUL, 0xe1d36000UL, 0x3fd314f1UL, + 0xd3213cb8UL, 0xbd28e27aUL, 0x7cdc9000UL, 0x3fd2bef0UL, 0x4a5004f4UL, + 0x3d2a9cfaUL, 0x1134d800UL, 0x3fd26962UL, 0xdf5bb3b6UL, 0x3d2c93c1UL, + 0x6d0eb800UL, 0x3fd21445UL, 0xba46baeaUL, 0x3d0a87deUL, 0x635a6800UL, + 0x3fd1bf99UL, 0x5147bdb7UL, 0x3d2ca6edUL, 0xcbacf800UL, 0x3fd16b5cUL, + 0xf7a51681UL, 0x3d2b9acdUL, 0x8227e800UL, 0x3fd1178eUL, 0x63a5f01cUL, + 0xbd2c210eUL, 0x67616000UL, 0x3fd0c42dUL, 0x163ceae9UL, 0x3d27188bUL, + 0x604d5800UL, 0x3fd07138UL, 0x16ed4e91UL, 0x3cf89cdbUL, 0x5626c800UL, + 0x3fd01eaeUL, 0x1485e94aUL, 0xbd16f08cUL, 0x6cb3b000UL, 0x3fcf991cUL, + 0xca0cdf30UL, 0x3d1bcbecUL, 0xe4dd0000UL, 0x3fcef5adUL, 0x65bb8e11UL, + 0xbcca2115UL, 0xffe71000UL, 0x3fce530eUL, 0x6041f430UL, 0x3cc21227UL, + 0xb0d49000UL, 0x3fcdb13dUL, 0xf715b035UL, 0xbd2aff2aUL, 0xf2656000UL, + 0x3fcd1037UL, 0x75b6f6e4UL, 0xbd084a7eUL, 0xc6f01000UL, 0x3fcc6ffbUL, + 0xc5962bd2UL, 0xbcf1ec72UL, 0x383be000UL, 0x3fcbd087UL, 0x595412b6UL, + 0xbd2d4bc4UL, 0x575bd000UL, 0x3fcb31d8UL, 0x4eace1aaUL, 0xbd0c358dUL, + 0x3c8ae000UL, 0x3fca93edUL, 0x50562169UL, 0xbd287243UL, 0x07089000UL, + 0x3fc9f6c4UL, 0x6865817aUL, 0x3d29904dUL, 0xdcf70000UL, 0x3fc95a5aUL, + 0x58a0ff6fUL, 0x3d07f228UL, 0xeb390000UL, 0x3fc8beafUL, 0xaae92cd1UL, + 0xbd073d54UL, 0x6551a000UL, 0x3fc823c1UL, 0x9a631e83UL, 0x3d1e0ddbUL, + 0x85445000UL, 0x3fc7898dUL, 0x70914305UL, 0xbd1c6610UL, 0x8b757000UL, + 0x3fc6f012UL, 0xe59c21e1UL, 0xbd25118dUL, 0xbe8c1000UL, 0x3fc6574eUL, + 0x2c3c2e78UL, 0x3d19cf8bUL, 0x6b544000UL, 0x3fc5bf40UL, 0xeb68981cUL, + 0xbd127023UL, 0xe4a1b000UL, 0x3fc527e5UL, 0xe5697dc7UL, 0x3d2633e8UL, + 0x8333b000UL, 0x3fc4913dUL, 0x54fdb678UL, 0x3d258379UL, 0xa5993000UL, + 0x3fc3fb45UL, 0x7e6a354dUL, 0xbd2cd1d8UL, 0xb0159000UL, 0x3fc365fcUL, + 0x234b7289UL, 0x3cc62fa8UL, 0x0c868000UL, 0x3fc2d161UL, 0xcb81b4a1UL, + 0x3d039d6cUL, 0x2a49c000UL, 0x3fc23d71UL, 0x8fd3df5cUL, 0x3d100d23UL, + 0x7e23f000UL, 0x3fc1aa2bUL, 0x44389934UL, 0x3d2ca78eUL, 0x8227e000UL, + 0x3fc1178eUL, 0xce2d07f2UL, 0x3d21ef78UL, 0xb59e4000UL, 0x3fc08598UL, + 0x7009902cUL, 0xbd27e5ddUL, 0x39dbe000UL, 0x3fbfe891UL, 0x4fa10afdUL, + 0xbd2534d6UL, 0x830a2000UL, 0x3fbec739UL, 0xafe645e0UL, 0xbd2dc068UL, + 0x63844000UL, 0x3fbda727UL, 0x1fa71733UL, 0x3d1a8940UL, 0x01bc4000UL, + 0x3fbc8858UL, 0xc65aacd3UL, 0x3d2646d1UL, 0x8dad6000UL, 0x3fbb6ac8UL, + 0x2bf768e5UL, 0xbd139080UL, 0x40b1c000UL, 0x3fba4e76UL, 0xb94407c8UL, + 0xbd0e42b6UL, 0x5d594000UL, 0x3fb9335eUL, 0x3abd47daUL, 0x3d23115cUL, + 0x2f40e000UL, 0x3fb8197eUL, 0xf96ffdf7UL, 0x3d0f80dcUL, 0x0aeac000UL, + 0x3fb700d3UL, 0xa99ded32UL, 0x3cec1e8dUL, 0x4d97a000UL, 0x3fb5e95aUL, + 0x3c5d1d1eUL, 0xbd2c6906UL, 0x5d208000UL, 0x3fb4d311UL, 0x82f4e1efUL, + 0xbcf53a25UL, 0xa7d1e000UL, 0x3fb3bdf5UL, 0xa5db4ed7UL, 0x3d2cc85eUL, + 0xa4472000UL, 0x3fb2aa04UL, 0xae9c697dUL, 0xbd20b6e8UL, 0xd1466000UL, + 0x3fb1973bUL, 0x560d9e9bUL, 0xbd25325dUL, 0xb59e4000UL, 0x3fb08598UL, + 0x7009902cUL, 0xbd17e5ddUL, 0xc006c000UL, 0x3faeea31UL, 0x4fc93b7bUL, + 0xbd0e113eUL, 0xcdddc000UL, 0x3faccb73UL, 0x47d82807UL, 0xbd1a68f2UL, + 0xd0fb0000UL, 0x3faaaef2UL, 0x353bb42eUL, 0x3d20fc1aUL, 0x149fc000UL, + 0x3fa894aaUL, 0xd05a267dUL, 0xbd197995UL, 0xf2d4c000UL, 0x3fa67c94UL, + 0xec19afa2UL, 0xbd029efbUL, 0xd42e0000UL, 0x3fa466aeUL, 0x75bdfd28UL, + 0xbd2c1673UL, 0x2f8d0000UL, 0x3fa252f3UL, 0xe021b67bUL, 0x3d283e9aUL, + 0x89e74000UL, 0x3fa0415dUL, 0x5cf1d753UL, 0x3d0111c0UL, 0xec148000UL, + 0x3f9c63d2UL, 0x3f9eb2f3UL, 0x3d2578c6UL, 0x28c90000UL, 0x3f984925UL, + 0x325a0c34UL, 0xbd2aa0baUL, 0x25980000UL, 0x3f9432a9UL, 0x928637feUL, + 0x3d098139UL, 0x58938000UL, 0x3f902056UL, 0x06e2f7d2UL, 0xbd23dc5bUL, + 0xa3890000UL, 0x3f882448UL, 0xda74f640UL, 0xbd275577UL, 0x75890000UL, + 0x3f801015UL, 0x999d2be8UL, 0xbd10c76bUL, 0x59580000UL, 0x3f700805UL, + 0xcb31c67bUL, 0x3d2166afUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x80000000UL +}; + +ALIGNED_(16) juint _log2[] = +{ + 0xfefa3800UL, 0x3fa62e42UL, 0x93c76730UL, 0x3ceef357UL +}; + +ALIGNED_(16) juint _coeff[] = +{ + 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL, 0x3d6fb175UL, + 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL, 0x9999999aUL, 0x3fc99999UL, + 0x00000000UL, 0xbfe00000UL +}; + +//registers, +// input: xmm0 +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, r8, r11 + +void MacroAssembler::fast_log(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp1, Register tmp2) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2; + Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + + assert_different_registers(tmp1, tmp2, eax, ecx, edx); + jmp(start); + address L_tbl = (address)_L_tbl; + address log2 = (address)_log2; + address coeff = (address)_coeff; + + bind(start); + subq(rsp, 24); + movsd(Address(rsp, 0), xmm0); + mov64(rax, 0x3ff0000000000000); + movdq(xmm2, rax); + mov64(rdx, 0x77f0000000000000); + movdq(xmm3, rdx); + movl(ecx, 32768); + movdl(xmm4, rcx); + mov64(tmp1, 0xffffe00000000000); + movdq(xmm5, tmp1); + movdqu(xmm1, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 16352); + psrlq(xmm0, 27); + lea(tmp2, ExternalAddress(L_tbl)); + psrld(xmm0, 2); + rcpps(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 228); + psrlq(xmm1, 12); + subl(eax, 16); + cmpl(eax, 32736); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + + bind(L_2TAG_PACKET_1_0_2); + paddd(xmm0, xmm4); + por(xmm1, xmm3); + movdl(edx, xmm0); + psllq(xmm0, 29); + pand(xmm5, xmm1); + pand(xmm0, xmm6); + subsd(xmm1, xmm5); + mulpd(xmm5, xmm0); + andl(eax, 32752); + subl(eax, ecx); + cvtsi2sdl(xmm7, eax); + mulsd(xmm1, xmm0); + movq(xmm6, ExternalAddress(log2)); // 0xfefa3800UL, 0x3fa62e42UL + movdqu(xmm3, ExternalAddress(coeff)); // 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL + subsd(xmm5, xmm2); + andl(edx, 16711680); + shrl(edx, 12); + movdqu(xmm0, Address(tmp2, edx)); + movdqu(xmm4, ExternalAddress(16 + coeff)); // 0x3d6fb175UL, 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL + addsd(xmm1, xmm5); + movdqu(xmm2, ExternalAddress(32 + coeff)); // 0x9999999aUL, 0x3fc99999UL, 0x00000000UL, 0xbfe00000UL + mulsd(xmm6, xmm7); + if (VM_Version::supports_sse3()) { + movddup(xmm5, xmm1); + } + else { + movdqu(xmm5, xmm1); + movlhps(xmm5, xmm5); + } + mulsd(xmm7, ExternalAddress(8 + log2)); // 0x93c76730UL, 0x3ceef357UL + mulsd(xmm3, xmm1); + addsd(xmm0, xmm6); + mulpd(xmm4, xmm5); + mulpd(xmm5, xmm5); + if (VM_Version::supports_sse3()) { + movddup(xmm6, xmm0); + } + else { + movdqu(xmm6, xmm0); + movlhps(xmm6, xmm6); + } + addsd(xmm0, xmm1); + addpd(xmm4, xmm2); + mulpd(xmm3, xmm5); + subsd(xmm6, xmm0); + mulsd(xmm4, xmm1); + pshufd(xmm2, xmm0, 238); + addsd(xmm1, xmm6); + mulsd(xmm5, xmm5); + addsd(xmm7, xmm2); + addpd(xmm4, xmm3); + addsd(xmm1, xmm7); + mulpd(xmm4, xmm5); + addsd(xmm1, xmm4); + pshufd(xmm5, xmm4, 238); + addsd(xmm1, xmm5); + addsd(xmm0, xmm1); + jmp(B1_5); + + bind(L_2TAG_PACKET_0_0_2); + movq(xmm0, Address(rsp, 0)); + movq(xmm1, Address(rsp, 0)); + addl(eax, 16); + cmpl(eax, 32768); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_2_0_2); + cmpl(eax, 16); + jcc(Assembler::below, L_2TAG_PACKET_3_0_2); + + bind(L_2TAG_PACKET_4_0_2); + addsd(xmm0, xmm0); + jmp(B1_5); + + bind(L_2TAG_PACKET_5_0_2); + jcc(Assembler::above, L_2TAG_PACKET_4_0_2); + cmpl(edx, 0); + jcc(Assembler::above, L_2TAG_PACKET_4_0_2); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_3_0_2); + xorpd(xmm1, xmm1); + addsd(xmm1, xmm0); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); + xorpd(xmm1, xmm1); + movl(eax, 18416); + pinsrw(xmm1, eax, 3); + mulsd(xmm0, xmm1); + movdqu(xmm1, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + psrlq(xmm0, 27); + movl(ecx, 18416); + psrld(xmm0, 2); + rcpps(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 228); + psrlq(xmm1, 12); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + addl(ecx, ecx); + cmpl(ecx, -2097152); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_5_0_2); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); + + bind(L_2TAG_PACKET_6_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 32752); + pinsrw(xmm1, eax, 3); + mulsd(xmm0, xmm1); + movl(Address(rsp, 16), 3); + jmp(L_2TAG_PACKET_8_0_2); + bind(L_2TAG_PACKET_7_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 49136); + pinsrw(xmm0, eax, 3); + divsd(xmm0, xmm1); + movl(Address(rsp, 16), 2); + + bind(L_2TAG_PACKET_8_0_2); + movq(Address(rsp, 8), xmm0); + + bind(B1_3); + movq(xmm0, Address(rsp, 8)); + + bind(B1_5); + addq(rsp, 24); +} +#else +// The 32 bit code is at most SSE2 compliant +ALIGNED_(16) juint _static_const_table_log[] = +{ + 0xfefa3800UL, 0x3fe62e42UL, 0x93c76730UL, 0x3d2ef357UL, 0xaa241800UL, + 0x3fe5ee82UL, 0x0cda46beUL, 0x3d220238UL, 0x5c364800UL, 0x3fe5af40UL, + 0xac10c9fbUL, 0x3d2dfa63UL, 0x26bb8c00UL, 0x3fe5707aUL, 0xff3303ddUL, + 0x3d09980bUL, 0x26867800UL, 0x3fe5322eUL, 0x5d257531UL, 0x3d05ccc4UL, + 0x835a5000UL, 0x3fe4f45aUL, 0x6d93b8fbUL, 0xbd2e6c51UL, 0x6f970c00UL, + 0x3fe4b6fdUL, 0xed4c541cUL, 0x3cef7115UL, 0x27e8a400UL, 0x3fe47a15UL, + 0xf94d60aaUL, 0xbd22cb6aUL, 0xf2f92400UL, 0x3fe43d9fUL, 0x481051f7UL, + 0xbcfd984fUL, 0x2125cc00UL, 0x3fe4019cUL, 0x30f0c74cUL, 0xbd26ce79UL, + 0x0c36c000UL, 0x3fe3c608UL, 0x7cfe13c2UL, 0xbd02b736UL, 0x17197800UL, + 0x3fe38ae2UL, 0xbb5569a4UL, 0xbd218b7aUL, 0xad9d8c00UL, 0x3fe35028UL, + 0x9527e6acUL, 0x3d10b83fUL, 0x44340800UL, 0x3fe315daUL, 0xc5a0ed9cUL, + 0xbd274e93UL, 0x57b0e000UL, 0x3fe2dbf5UL, 0x07b9dc11UL, 0xbd17a6e5UL, + 0x6d0ec000UL, 0x3fe2a278UL, 0xe797882dUL, 0x3d206d2bUL, 0x1134dc00UL, + 0x3fe26962UL, 0x05226250UL, 0xbd0b61f1UL, 0xd8bebc00UL, 0x3fe230b0UL, + 0x6e48667bUL, 0x3d12fc06UL, 0x5fc61800UL, 0x3fe1f863UL, 0xc9fe81d3UL, + 0xbd2a7242UL, 0x49ae6000UL, 0x3fe1c078UL, 0xed70e667UL, 0x3cccacdeUL, + 0x40f23c00UL, 0x3fe188eeUL, 0xf8ab4650UL, 0x3d14cc4eUL, 0xf6f29800UL, + 0x3fe151c3UL, 0xa293ae49UL, 0xbd2edd97UL, 0x23c75c00UL, 0x3fe11af8UL, + 0xbb9ddcb2UL, 0xbd258647UL, 0x8611cc00UL, 0x3fe0e489UL, 0x07801742UL, + 0x3d1c2998UL, 0xe2d05400UL, 0x3fe0ae76UL, 0x887e7e27UL, 0x3d1f486bUL, + 0x0533c400UL, 0x3fe078bfUL, 0x41edf5fdUL, 0x3d268122UL, 0xbe760400UL, + 0x3fe04360UL, 0xe79539e0UL, 0xbd04c45fUL, 0xe5b20800UL, 0x3fe00e5aUL, + 0xb1727b1cUL, 0xbd053ba3UL, 0xaf7a4800UL, 0x3fdfb358UL, 0x3c164935UL, + 0x3d0085faUL, 0xee031800UL, 0x3fdf4aa7UL, 0x6f014a8bUL, 0x3d12cde5UL, + 0x56b41000UL, 0x3fdee2a1UL, 0x5a470251UL, 0x3d2f27f4UL, 0xc3ddb000UL, + 0x3fde7b42UL, 0x5372bd08UL, 0xbd246550UL, 0x1a272800UL, 0x3fde148aUL, + 0x07322938UL, 0xbd1326b2UL, 0x484c9800UL, 0x3fddae75UL, 0x60dc616aUL, + 0xbd1ea42dUL, 0x46def800UL, 0x3fdd4902UL, 0xe9a767a8UL, 0x3d235bafUL, + 0x18064800UL, 0x3fdce42fUL, 0x3ec7a6b0UL, 0xbd0797c3UL, 0xc7455800UL, + 0x3fdc7ff9UL, 0xc15249aeUL, 0xbd29b6ddUL, 0x693fa000UL, 0x3fdc1c60UL, + 0x7fe8e180UL, 0x3d2cec80UL, 0x1b80e000UL, 0x3fdbb961UL, 0xf40a666dUL, + 0x3d27d85bUL, 0x04462800UL, 0x3fdb56faUL, 0x2d841995UL, 0x3d109525UL, + 0x5248d000UL, 0x3fdaf529UL, 0x52774458UL, 0xbd217cc5UL, 0x3c8ad800UL, + 0x3fda93edUL, 0xbea77a5dUL, 0x3d1e36f2UL, 0x0224f800UL, 0x3fda3344UL, + 0x7f9d79f5UL, 0x3d23c645UL, 0xea15f000UL, 0x3fd9d32bUL, 0x10d0c0b0UL, + 0xbd26279eUL, 0x43135800UL, 0x3fd973a3UL, 0xa502d9f0UL, 0xbd152313UL, + 0x635bf800UL, 0x3fd914a8UL, 0x2ee6307dUL, 0xbd1766b5UL, 0xa88b3000UL, + 0x3fd8b639UL, 0xe5e70470UL, 0xbd205ae1UL, 0x776dc800UL, 0x3fd85855UL, + 0x3333778aUL, 0x3d2fd56fUL, 0x3bd81800UL, 0x3fd7fafaUL, 0xc812566aUL, + 0xbd272090UL, 0x687cf800UL, 0x3fd79e26UL, 0x2efd1778UL, 0x3d29ec7dUL, + 0x76c67800UL, 0x3fd741d8UL, 0x49dc60b3UL, 0x3d2d8b09UL, 0xe6af1800UL, + 0x3fd6e60eUL, 0x7c222d87UL, 0x3d172165UL, 0x3e9c6800UL, 0x3fd68ac8UL, + 0x2756eba0UL, 0x3d20a0d3UL, 0x0b3ab000UL, 0x3fd63003UL, 0xe731ae00UL, + 0xbd2db623UL, 0xdf596000UL, 0x3fd5d5bdUL, 0x08a465dcUL, 0xbd0a0b2aUL, + 0x53c8d000UL, 0x3fd57bf7UL, 0xee5d40efUL, 0x3d1fadedUL, 0x0738a000UL, + 0x3fd522aeUL, 0x8164c759UL, 0x3d2ebe70UL, 0x9e173000UL, 0x3fd4c9e0UL, + 0x1b0ad8a4UL, 0xbd2e2089UL, 0xc271c800UL, 0x3fd4718dUL, 0x0967d675UL, + 0xbd2f27ceUL, 0x23d5e800UL, 0x3fd419b4UL, 0xec90e09dUL, 0x3d08e436UL, + 0x77333000UL, 0x3fd3c252UL, 0xb606bd5cUL, 0x3d183b54UL, 0x76be1000UL, + 0x3fd36b67UL, 0xb0f177c8UL, 0x3d116ecdUL, 0xe1d36000UL, 0x3fd314f1UL, + 0xd3213cb8UL, 0xbd28e27aUL, 0x7cdc9000UL, 0x3fd2bef0UL, 0x4a5004f4UL, + 0x3d2a9cfaUL, 0x1134d800UL, 0x3fd26962UL, 0xdf5bb3b6UL, 0x3d2c93c1UL, + 0x6d0eb800UL, 0x3fd21445UL, 0xba46baeaUL, 0x3d0a87deUL, 0x635a6800UL, + 0x3fd1bf99UL, 0x5147bdb7UL, 0x3d2ca6edUL, 0xcbacf800UL, 0x3fd16b5cUL, + 0xf7a51681UL, 0x3d2b9acdUL, 0x8227e800UL, 0x3fd1178eUL, 0x63a5f01cUL, + 0xbd2c210eUL, 0x67616000UL, 0x3fd0c42dUL, 0x163ceae9UL, 0x3d27188bUL, + 0x604d5800UL, 0x3fd07138UL, 0x16ed4e91UL, 0x3cf89cdbUL, 0x5626c800UL, + 0x3fd01eaeUL, 0x1485e94aUL, 0xbd16f08cUL, 0x6cb3b000UL, 0x3fcf991cUL, + 0xca0cdf30UL, 0x3d1bcbecUL, 0xe4dd0000UL, 0x3fcef5adUL, 0x65bb8e11UL, + 0xbcca2115UL, 0xffe71000UL, 0x3fce530eUL, 0x6041f430UL, 0x3cc21227UL, + 0xb0d49000UL, 0x3fcdb13dUL, 0xf715b035UL, 0xbd2aff2aUL, 0xf2656000UL, + 0x3fcd1037UL, 0x75b6f6e4UL, 0xbd084a7eUL, 0xc6f01000UL, 0x3fcc6ffbUL, + 0xc5962bd2UL, 0xbcf1ec72UL, 0x383be000UL, 0x3fcbd087UL, 0x595412b6UL, + 0xbd2d4bc4UL, 0x575bd000UL, 0x3fcb31d8UL, 0x4eace1aaUL, 0xbd0c358dUL, + 0x3c8ae000UL, 0x3fca93edUL, 0x50562169UL, 0xbd287243UL, 0x07089000UL, + 0x3fc9f6c4UL, 0x6865817aUL, 0x3d29904dUL, 0xdcf70000UL, 0x3fc95a5aUL, + 0x58a0ff6fUL, 0x3d07f228UL, 0xeb390000UL, 0x3fc8beafUL, 0xaae92cd1UL, + 0xbd073d54UL, 0x6551a000UL, 0x3fc823c1UL, 0x9a631e83UL, 0x3d1e0ddbUL, + 0x85445000UL, 0x3fc7898dUL, 0x70914305UL, 0xbd1c6610UL, 0x8b757000UL, + 0x3fc6f012UL, 0xe59c21e1UL, 0xbd25118dUL, 0xbe8c1000UL, 0x3fc6574eUL, + 0x2c3c2e78UL, 0x3d19cf8bUL, 0x6b544000UL, 0x3fc5bf40UL, 0xeb68981cUL, + 0xbd127023UL, 0xe4a1b000UL, 0x3fc527e5UL, 0xe5697dc7UL, 0x3d2633e8UL, + 0x8333b000UL, 0x3fc4913dUL, 0x54fdb678UL, 0x3d258379UL, 0xa5993000UL, + 0x3fc3fb45UL, 0x7e6a354dUL, 0xbd2cd1d8UL, 0xb0159000UL, 0x3fc365fcUL, + 0x234b7289UL, 0x3cc62fa8UL, 0x0c868000UL, 0x3fc2d161UL, 0xcb81b4a1UL, + 0x3d039d6cUL, 0x2a49c000UL, 0x3fc23d71UL, 0x8fd3df5cUL, 0x3d100d23UL, + 0x7e23f000UL, 0x3fc1aa2bUL, 0x44389934UL, 0x3d2ca78eUL, 0x8227e000UL, + 0x3fc1178eUL, 0xce2d07f2UL, 0x3d21ef78UL, 0xb59e4000UL, 0x3fc08598UL, + 0x7009902cUL, 0xbd27e5ddUL, 0x39dbe000UL, 0x3fbfe891UL, 0x4fa10afdUL, + 0xbd2534d6UL, 0x830a2000UL, 0x3fbec739UL, 0xafe645e0UL, 0xbd2dc068UL, + 0x63844000UL, 0x3fbda727UL, 0x1fa71733UL, 0x3d1a8940UL, 0x01bc4000UL, + 0x3fbc8858UL, 0xc65aacd3UL, 0x3d2646d1UL, 0x8dad6000UL, 0x3fbb6ac8UL, + 0x2bf768e5UL, 0xbd139080UL, 0x40b1c000UL, 0x3fba4e76UL, 0xb94407c8UL, + 0xbd0e42b6UL, 0x5d594000UL, 0x3fb9335eUL, 0x3abd47daUL, 0x3d23115cUL, + 0x2f40e000UL, 0x3fb8197eUL, 0xf96ffdf7UL, 0x3d0f80dcUL, 0x0aeac000UL, + 0x3fb700d3UL, 0xa99ded32UL, 0x3cec1e8dUL, 0x4d97a000UL, 0x3fb5e95aUL, + 0x3c5d1d1eUL, 0xbd2c6906UL, 0x5d208000UL, 0x3fb4d311UL, 0x82f4e1efUL, + 0xbcf53a25UL, 0xa7d1e000UL, 0x3fb3bdf5UL, 0xa5db4ed7UL, 0x3d2cc85eUL, + 0xa4472000UL, 0x3fb2aa04UL, 0xae9c697dUL, 0xbd20b6e8UL, 0xd1466000UL, + 0x3fb1973bUL, 0x560d9e9bUL, 0xbd25325dUL, 0xb59e4000UL, 0x3fb08598UL, + 0x7009902cUL, 0xbd17e5ddUL, 0xc006c000UL, 0x3faeea31UL, 0x4fc93b7bUL, + 0xbd0e113eUL, 0xcdddc000UL, 0x3faccb73UL, 0x47d82807UL, 0xbd1a68f2UL, + 0xd0fb0000UL, 0x3faaaef2UL, 0x353bb42eUL, 0x3d20fc1aUL, 0x149fc000UL, + 0x3fa894aaUL, 0xd05a267dUL, 0xbd197995UL, 0xf2d4c000UL, 0x3fa67c94UL, + 0xec19afa2UL, 0xbd029efbUL, 0xd42e0000UL, 0x3fa466aeUL, 0x75bdfd28UL, + 0xbd2c1673UL, 0x2f8d0000UL, 0x3fa252f3UL, 0xe021b67bUL, 0x3d283e9aUL, + 0x89e74000UL, 0x3fa0415dUL, 0x5cf1d753UL, 0x3d0111c0UL, 0xec148000UL, + 0x3f9c63d2UL, 0x3f9eb2f3UL, 0x3d2578c6UL, 0x28c90000UL, 0x3f984925UL, + 0x325a0c34UL, 0xbd2aa0baUL, 0x25980000UL, 0x3f9432a9UL, 0x928637feUL, + 0x3d098139UL, 0x58938000UL, 0x3f902056UL, 0x06e2f7d2UL, 0xbd23dc5bUL, + 0xa3890000UL, 0x3f882448UL, 0xda74f640UL, 0xbd275577UL, 0x75890000UL, + 0x3f801015UL, 0x999d2be8UL, 0xbd10c76bUL, 0x59580000UL, 0x3f700805UL, + 0xcb31c67bUL, 0x3d2166afUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x80000000UL, 0xfefa3800UL, 0x3fa62e42UL, 0x93c76730UL, 0x3ceef357UL, + 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL, 0x3d6fb175UL, + 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL, 0x9999999aUL, 0x3fc99999UL, + 0x00000000UL, 0xbfe00000UL, 0x00000000UL, 0xffffe000UL, 0x00000000UL, + 0xffffe000UL +}; +//registers, +// input: xmm0 +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, rbx (tmp) + +void MacroAssembler::fast_log(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2; + Label L_2TAG_PACKET_10_0_2, start; + + assert_different_registers(tmp, eax, ecx, edx); + jmp(start); + address static_const_table = (address)_static_const_table_log; + + bind(start); + subl(rsp, 104); + movl(Address(rsp, 40), tmp); + lea(tmp, ExternalAddress(static_const_table)); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + xorpd(xmm3, xmm3); + movl(edx, 30704); + pinsrw(xmm3, edx, 3); + movsd(xmm0, Address(rsp, 112)); + movapd(xmm1, xmm0); + movl(ecx, 32768); + movdl(xmm4, ecx); + movsd(xmm5, Address(tmp, 2128)); // 0x00000000UL, 0xffffe000UL + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + psllq(xmm0, 5); + movl(ecx, 16352); + psrlq(xmm0, 34); + rcpss(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 228); + psrlq(xmm1, 12); + subl(eax, 16); + cmpl(eax, 32736); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + + bind(L_2TAG_PACKET_1_0_2); + paddd(xmm0, xmm4); + por(xmm1, xmm3); + movdl(edx, xmm0); + psllq(xmm0, 29); + pand(xmm5, xmm1); + pand(xmm0, xmm6); + subsd(xmm1, xmm5); + mulpd(xmm5, xmm0); + andl(eax, 32752); + subl(eax, ecx); + cvtsi2sdl(xmm7, eax); + mulsd(xmm1, xmm0); + movsd(xmm6, Address(tmp, 2064)); // 0xfefa3800UL, 0x3fa62e42UL + movdqu(xmm3, Address(tmp, 2080)); // 0x92492492UL, 0x3fc24924UL, 0x00000000UL, 0xbfd00000UL + subsd(xmm5, xmm2); + andl(edx, 16711680); + shrl(edx, 12); + movdqu(xmm0, Address(tmp, edx)); + movdqu(xmm4, Address(tmp, 2096)); // 0x3d6fb175UL, 0xbfc5555eUL, 0x55555555UL, 0x3fd55555UL + addsd(xmm1, xmm5); + movdqu(xmm2, Address(tmp, 2112)); // 0x9999999aUL, 0x3fc99999UL, 0x00000000UL, 0xbfe00000UL + mulsd(xmm6, xmm7); + pshufd(xmm5, xmm1, 68); + mulsd(xmm7, Address(tmp, 2072)); // 0x93c76730UL, 0x3ceef357UL, 0x92492492UL, 0x3fc24924UL + mulsd(xmm3, xmm1); + addsd(xmm0, xmm6); + mulpd(xmm4, xmm5); + mulpd(xmm5, xmm5); + pshufd(xmm6, xmm0, 228); + addsd(xmm0, xmm1); + addpd(xmm4, xmm2); + mulpd(xmm3, xmm5); + subsd(xmm6, xmm0); + mulsd(xmm4, xmm1); + pshufd(xmm2, xmm0, 238); + addsd(xmm1, xmm6); + mulsd(xmm5, xmm5); + addsd(xmm7, xmm2); + addpd(xmm4, xmm3); + addsd(xmm1, xmm7); + mulpd(xmm4, xmm5); + addsd(xmm1, xmm4); + pshufd(xmm5, xmm4, 238); + addsd(xmm1, xmm5); + addsd(xmm0, xmm1); + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_0_0_2); + movsd(xmm0, Address(rsp, 112)); + movdqu(xmm1, xmm0); + addl(eax, 16); + cmpl(eax, 32768); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_3_0_2); + cmpl(eax, 16); + jcc(Assembler::below, L_2TAG_PACKET_4_0_2); + + bind(L_2TAG_PACKET_5_0_2); + addsd(xmm0, xmm0); + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_6_0_2); + jcc(Assembler::above, L_2TAG_PACKET_5_0_2); + cmpl(edx, 0); + jcc(Assembler::above, L_2TAG_PACKET_5_0_2); + jmp(L_2TAG_PACKET_7_0_2); + + bind(L_2TAG_PACKET_3_0_2); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + addl(ecx, ecx); + cmpl(ecx, -2097152); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_6_0_2); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); + + bind(L_2TAG_PACKET_7_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 32752); + pinsrw(xmm1, eax, 3); + movl(edx, 3); + mulsd(xmm0, xmm1); + + bind(L_2TAG_PACKET_9_0_2); + movsd(Address(rsp, 0), xmm0); + movsd(xmm0, Address(rsp, 112)); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_10_0_2); + + bind(L_2TAG_PACKET_8_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 49136); + pinsrw(xmm0, eax, 3); + divsd(xmm0, xmm1); + movl(edx, 2); + jmp(L_2TAG_PACKET_9_0_2); + + bind(L_2TAG_PACKET_4_0_2); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); + xorpd(xmm1, xmm1); + movl(eax, 18416); + pinsrw(xmm1, eax, 3); + mulsd(xmm0, xmm1); + movapd(xmm1, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + psllq(xmm0, 5); + movl(ecx, 18416); + psrlq(xmm0, 34); + rcpss(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 228); + psrlq(xmm1, 12); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movsd(Address(rsp, 24), xmm0); + fld_d(Address(rsp, 24)); + + bind(L_2TAG_PACKET_10_0_2); + movl(tmp, Address(rsp, 40)); +} +#endif diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_log10.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_log10.cpp new file mode 100644 index 00000000000..72a8aba01c7 --- /dev/null +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_log10.cpp @@ -0,0 +1,687 @@ +/* +* Copyright (c) 2016, Intel Corporation. +* Intel Math Library (LIBM) Source Code +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +* +*/ + +#include "precompiled.hpp" +#include "asm/assembler.hpp" +#include "asm/assembler.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "macroAssembler_x86.hpp" + +#ifdef _MSC_VER +#define ALIGNED_(x) __declspec(align(x)) +#else +#define ALIGNED_(x) __attribute__ ((aligned(x))) +#endif + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - LOG10() +// --------------------- +// +// Let x=2^k * mx, mx in [1,2) +// +// Get B~1/mx based on the output of rcpss instruction (B0) +// B = int((B0*LH*2^7+0.5))/2^7 +// LH is a short approximation for log10(e) +// +// Reduced argument: r=B*mx-LH (computed accurately in high and low parts) +// +// Result: k*log10(2) - log(B) + p(r) +// p(r) is a degree 7 polynomial +// -log(B) read from data table (high, low parts) +// Result is formed from high and low parts +// +// Special cases: +// log10(0) = -INF with divide-by-zero exception raised +// log10(1) = +0 +// log10(x) = NaN with invalid exception raised if x < -0, including -INF +// log10(+INF) = +INF +// +/******************************************************************************/ + +#ifdef _LP64 +// The 64 bit code is at most SSE2 compliant +ALIGNED_(16) juint _HIGHSIGMASK_log10[] = +{ + 0xf8000000UL, 0xffffffffUL, 0x00000000UL, 0xffffe000UL +}; + +ALIGNED_(16) juint _LOG10_E[] = +{ + 0x00000000UL, 0x3fdbc000UL, 0xbf2e4108UL, 0x3f5a7a6cUL +}; + +ALIGNED_(16) juint _L_tbl_log10[] = +{ + 0x509f7800UL, 0x3fd34413UL, 0x1f12b358UL, 0x3d1fef31UL, 0x80333400UL, + 0x3fd32418UL, 0xc671d9d0UL, 0xbcf542bfUL, 0x51195000UL, 0x3fd30442UL, + 0x78a4b0c3UL, 0x3d18216aUL, 0x6fc79400UL, 0x3fd2e490UL, 0x80fa389dUL, + 0xbc902869UL, 0x89d04000UL, 0x3fd2c502UL, 0x75c2f564UL, 0x3d040754UL, + 0x4ddd1c00UL, 0x3fd2a598UL, 0xd219b2c3UL, 0xbcfa1d84UL, 0x6baa7c00UL, + 0x3fd28651UL, 0xfd9abec1UL, 0x3d1be6d3UL, 0x94028800UL, 0x3fd2672dUL, + 0xe289a455UL, 0xbd1ede5eUL, 0x78b86400UL, 0x3fd2482cUL, 0x6734d179UL, + 0x3d1fe79bUL, 0xcca3c800UL, 0x3fd2294dUL, 0x981a40b8UL, 0xbced34eaUL, + 0x439c5000UL, 0x3fd20a91UL, 0xcc392737UL, 0xbd1a9cc3UL, 0x92752c00UL, + 0x3fd1ebf6UL, 0x03c9afe7UL, 0x3d1e98f8UL, 0x6ef8dc00UL, 0x3fd1cd7dUL, + 0x71dae7f4UL, 0x3d08a86cUL, 0x8fe4dc00UL, 0x3fd1af25UL, 0xee9185a1UL, + 0xbcff3412UL, 0xace59400UL, 0x3fd190eeUL, 0xc2cab353UL, 0x3cf17ed9UL, + 0x7e925000UL, 0x3fd172d8UL, 0x6952c1b2UL, 0x3cf1521cUL, 0xbe694400UL, + 0x3fd154e2UL, 0xcacb79caUL, 0xbd0bdc78UL, 0x26cbac00UL, 0x3fd1370dUL, + 0xf71f4de1UL, 0xbd01f8beUL, 0x72fa0800UL, 0x3fd11957UL, 0x55bf910bUL, + 0x3c946e2bUL, 0x5f106000UL, 0x3fd0fbc1UL, 0x39e639c1UL, 0x3d14a84bUL, + 0xa802a800UL, 0x3fd0de4aUL, 0xd3f31d5dUL, 0xbd178385UL, 0x0b992000UL, + 0x3fd0c0f3UL, 0x3843106fUL, 0xbd1f602fUL, 0x486ce800UL, 0x3fd0a3baUL, + 0x8819497cUL, 0x3cef987aUL, 0x1de49400UL, 0x3fd086a0UL, 0x1caa0467UL, + 0x3d0faec7UL, 0x4c30cc00UL, 0x3fd069a4UL, 0xa4424372UL, 0xbd1618fcUL, + 0x94490000UL, 0x3fd04cc6UL, 0x946517d2UL, 0xbd18384bUL, 0xb7e84000UL, + 0x3fd03006UL, 0xe0109c37UL, 0xbd19a6acUL, 0x798a0c00UL, 0x3fd01364UL, + 0x5121e864UL, 0xbd164cf7UL, 0x38ce8000UL, 0x3fcfedbfUL, 0x46214d1aUL, + 0xbcbbc402UL, 0xc8e62000UL, 0x3fcfb4efUL, 0xdab93203UL, 0x3d1e0176UL, + 0x2cb02800UL, 0x3fcf7c5aUL, 0x2a2ea8e4UL, 0xbcfec86aUL, 0xeeeaa000UL, + 0x3fcf43fdUL, 0xc18e49a4UL, 0x3cf110a8UL, 0x9bb6e800UL, 0x3fcf0bdaUL, + 0x923cc9c0UL, 0xbd15ce99UL, 0xc093f000UL, 0x3fced3efUL, 0x4d4b51e9UL, + 0x3d1a04c7UL, 0xec58f800UL, 0x3fce9c3cUL, 0x163cad59UL, 0x3cac8260UL, + 0x9a907000UL, 0x3fce2d7dUL, 0x3fa93646UL, 0x3ce4a1c0UL, 0x37311000UL, + 0x3fcdbf99UL, 0x32abd1fdUL, 0x3d07ea9dUL, 0x6744b800UL, 0x3fcd528cUL, + 0x4dcbdfd4UL, 0xbd1b08e2UL, 0xe36de800UL, 0x3fcce653UL, 0x0b7b7f7fUL, + 0xbd1b8f03UL, 0x77506800UL, 0x3fcc7aecUL, 0xa821c9fbUL, 0x3d13c163UL, + 0x00ff8800UL, 0x3fcc1053UL, 0x536bca76UL, 0xbd074ee5UL, 0x70719800UL, + 0x3fcba684UL, 0xd7da9b6bUL, 0xbd1fbf16UL, 0xc6f8d800UL, 0x3fcb3d7dUL, + 0xe2220bb3UL, 0x3d1a295dUL, 0x16c15800UL, 0x3fcad53cUL, 0xe724911eUL, + 0xbcf55822UL, 0x82533800UL, 0x3fca6dbcUL, 0x6d982371UL, 0x3cac567cUL, + 0x3c19e800UL, 0x3fca06fcUL, 0x84d17d80UL, 0x3d1da204UL, 0x85ef8000UL, + 0x3fc9a0f8UL, 0x54466a6aUL, 0xbd002204UL, 0xb0ac2000UL, 0x3fc93baeUL, + 0xd601fd65UL, 0x3d18840cUL, 0x1bb9b000UL, 0x3fc8d71cUL, 0x7bf58766UL, + 0xbd14f897UL, 0x34aae800UL, 0x3fc8733eUL, 0x3af6ac24UL, 0xbd0f5c45UL, + 0x76d68000UL, 0x3fc81012UL, 0x4303e1a1UL, 0xbd1f9a80UL, 0x6af57800UL, + 0x3fc7ad96UL, 0x43fbcb46UL, 0x3cf4c33eUL, 0xa6c51000UL, 0x3fc74bc7UL, + 0x70f0eac5UL, 0xbd192e3bUL, 0xccab9800UL, 0x3fc6eaa3UL, 0xc0093dfeUL, + 0xbd0faf15UL, 0x8b60b800UL, 0x3fc68a28UL, 0xde78d5fdUL, 0xbc9ea4eeUL, + 0x9d987000UL, 0x3fc62a53UL, 0x962bea6eUL, 0xbd194084UL, 0xc9b0e800UL, + 0x3fc5cb22UL, 0x888dd999UL, 0x3d1fe201UL, 0xe1634800UL, 0x3fc56c93UL, + 0x16ada7adUL, 0x3d1b1188UL, 0xc176c000UL, 0x3fc50ea4UL, 0x4159b5b5UL, + 0xbcf09c08UL, 0x51766000UL, 0x3fc4b153UL, 0x84393d23UL, 0xbcf6a89cUL, + 0x83695000UL, 0x3fc4549dUL, 0x9f0b8bbbUL, 0x3d1c4b8cUL, 0x538d5800UL, + 0x3fc3f881UL, 0xf49df747UL, 0x3cf89b99UL, 0xc8138000UL, 0x3fc39cfcUL, + 0xd503b834UL, 0xbd13b99fUL, 0xf0df0800UL, 0x3fc3420dUL, 0xf011b386UL, + 0xbd05d8beUL, 0xe7466800UL, 0x3fc2e7b2UL, 0xf39c7bc2UL, 0xbd1bb94eUL, + 0xcdd62800UL, 0x3fc28de9UL, 0x05e6d69bUL, 0xbd10ed05UL, 0xd015d800UL, + 0x3fc234b0UL, 0xe29b6c9dUL, 0xbd1ff967UL, 0x224ea800UL, 0x3fc1dc06UL, + 0x727711fcUL, 0xbcffb30dUL, 0x01540000UL, 0x3fc183e8UL, 0x39786c5aUL, + 0x3cc23f57UL, 0xb24d9800UL, 0x3fc12c54UL, 0xc905a342UL, 0x3d003a1dUL, + 0x82835800UL, 0x3fc0d54aUL, 0x9b9920c0UL, 0x3d03b25aUL, 0xc72ac000UL, + 0x3fc07ec7UL, 0x46f26a24UL, 0x3cf0fa41UL, 0xdd35d800UL, 0x3fc028caUL, + 0x41d9d6dcUL, 0x3d034a65UL, 0x52474000UL, 0x3fbfa6a4UL, 0x44f66449UL, + 0x3d19cad3UL, 0x2da3d000UL, 0x3fbefcb8UL, 0x67832999UL, 0x3d18400fUL, + 0x32a10000UL, 0x3fbe53ceUL, 0x9c0e3b1aUL, 0xbcff62fdUL, 0x556b7000UL, + 0x3fbdabe3UL, 0x02976913UL, 0xbcf8243bUL, 0x97e88000UL, 0x3fbd04f4UL, + 0xec793797UL, 0x3d1c0578UL, 0x09647000UL, 0x3fbc5effUL, 0x05fc0565UL, + 0xbd1d799eUL, 0xc6426000UL, 0x3fbbb9ffUL, 0x4625f5edUL, 0x3d1f5723UL, + 0xf7afd000UL, 0x3fbb15f3UL, 0xdd5aae61UL, 0xbd1a7e1eUL, 0xd358b000UL, + 0x3fba72d8UL, 0x3314e4d3UL, 0x3d17bc91UL, 0x9b1f5000UL, 0x3fb9d0abUL, + 0x9a4d514bUL, 0x3cf18c9bUL, 0x9cd4e000UL, 0x3fb92f69UL, 0x7e4496abUL, + 0x3cf1f96dUL, 0x31f4f000UL, 0x3fb88f10UL, 0xf56479e7UL, 0x3d165818UL, + 0xbf628000UL, 0x3fb7ef9cUL, 0x26bf486dUL, 0xbd1113a6UL, 0xb526b000UL, + 0x3fb7510cUL, 0x1a1c3384UL, 0x3ca9898dUL, 0x8e31e000UL, 0x3fb6b35dUL, + 0xb3875361UL, 0xbd0661acUL, 0xd01de000UL, 0x3fb6168cUL, 0x2a7cacfaUL, + 0xbd1bdf10UL, 0x0af23000UL, 0x3fb57a98UL, 0xff868816UL, 0x3cf046d0UL, + 0xd8ea0000UL, 0x3fb4df7cUL, 0x1515fbe7UL, 0xbd1fd529UL, 0xde3b2000UL, + 0x3fb44538UL, 0x6e59a132UL, 0x3d1faeeeUL, 0xc8df9000UL, 0x3fb3abc9UL, + 0xf1322361UL, 0xbd198807UL, 0x505f1000UL, 0x3fb3132dUL, 0x0888e6abUL, + 0x3d1e5380UL, 0x359bd000UL, 0x3fb27b61UL, 0xdfbcbb22UL, 0xbcfe2724UL, + 0x429ee000UL, 0x3fb1e463UL, 0x6eb4c58cUL, 0xbcfe4dd6UL, 0x4a673000UL, + 0x3fb14e31UL, 0x4ce1ac9bUL, 0x3d1ba691UL, 0x28b96000UL, 0x3fb0b8c9UL, + 0x8c7813b8UL, 0xbd0b3872UL, 0xc1f08000UL, 0x3fb02428UL, 0xc2bc8c2cUL, + 0x3cb5ea6bUL, 0x05a1a000UL, 0x3faf209cUL, 0x72e8f18eUL, 0xbce8df84UL, + 0xc0b5e000UL, 0x3fadfa6dUL, 0x9fdef436UL, 0x3d087364UL, 0xaf416000UL, + 0x3facd5c2UL, 0x1068c3a9UL, 0x3d0827e7UL, 0xdb356000UL, 0x3fabb296UL, + 0x120a34d3UL, 0x3d101a9fUL, 0x5dfea000UL, 0x3faa90e6UL, 0xdaded264UL, + 0xbd14c392UL, 0x6034c000UL, 0x3fa970adUL, 0x1c9d06a9UL, 0xbd1b705eUL, + 0x194c6000UL, 0x3fa851e8UL, 0x83996ad9UL, 0xbd0117bcUL, 0xcf4ac000UL, + 0x3fa73492UL, 0xb1a94a62UL, 0xbca5ea42UL, 0xd67b4000UL, 0x3fa618a9UL, + 0x75aed8caUL, 0xbd07119bUL, 0x9126c000UL, 0x3fa4fe29UL, 0x5291d533UL, + 0x3d12658fUL, 0x6f4d4000UL, 0x3fa3e50eUL, 0xcd2c5cd9UL, 0x3d1d5c70UL, + 0xee608000UL, 0x3fa2cd54UL, 0xd1008489UL, 0x3d1a4802UL, 0x9900e000UL, + 0x3fa1b6f9UL, 0x54fb5598UL, 0xbd16593fUL, 0x06bb6000UL, 0x3fa0a1f9UL, + 0x64ef57b4UL, 0xbd17636bUL, 0xb7940000UL, 0x3f9f1c9fUL, 0xee6a4737UL, + 0x3cb5d479UL, 0x91aa0000UL, 0x3f9cf7f5UL, 0x3a16373cUL, 0x3d087114UL, + 0x156b8000UL, 0x3f9ad5edUL, 0x836c554aUL, 0x3c6900b0UL, 0xd4764000UL, + 0x3f98b67fUL, 0xed12f17bUL, 0xbcffc974UL, 0x77dec000UL, 0x3f9699a7UL, + 0x232ce7eaUL, 0x3d1e35bbUL, 0xbfbf4000UL, 0x3f947f5dUL, 0xd84ffa6eUL, + 0x3d0e0a49UL, 0x82c7c000UL, 0x3f92679cUL, 0x8d170e90UL, 0xbd14d9f2UL, + 0xadd20000UL, 0x3f90525dUL, 0x86d9f88eUL, 0x3cdeb986UL, 0x86f10000UL, + 0x3f8c7f36UL, 0xb9e0a517UL, 0x3ce29faaUL, 0xb75c8000UL, 0x3f885e9eUL, + 0x542568cbUL, 0xbd1f7bdbUL, 0x46b30000UL, 0x3f8442e8UL, 0xb954e7d9UL, + 0x3d1e5287UL, 0xb7e60000UL, 0x3f802c07UL, 0x22da0b17UL, 0xbd19fb27UL, + 0x6c8b0000UL, 0x3f7833e3UL, 0x821271efUL, 0xbd190f96UL, 0x29910000UL, + 0x3f701936UL, 0xbc3491a5UL, 0xbd1bcf45UL, 0x354a0000UL, 0x3f600fe3UL, + 0xc0ff520aUL, 0xbd19d71cUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL +}; + +ALIGNED_(16) juint _log2_log10[] = +{ + 0x509f7800UL, 0x3f934413UL, 0x1f12b358UL, 0x3cdfef31UL +}; + +ALIGNED_(16) juint _coeff_log10[] = +{ + 0xc1a5f12eUL, 0x40358874UL, 0x64d4ef0dUL, 0xc0089309UL, 0x385593b1UL, + 0xc025c917UL, 0xdc963467UL, 0x3ffc6a02UL, 0x7f9d3aa1UL, 0x4016ab9fUL, + 0xdc77b115UL, 0xbff27af2UL +}; + +// Registers: +// input: xmm0 +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, tmp - r11 + +// Code generated by Intel C compiler for LIBM library + +void MacroAssembler::fast_log10(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register r11) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, B1_2, B1_3, B1_4, B1_5, start; + + assert_different_registers(r11, eax, ecx, edx); + + address HIGHSIGMASK = (address)_HIGHSIGMASK_log10; + address LOG10_E = (address)_LOG10_E; + address L_tbl = (address)_L_tbl_log10; + address log2 = (address)_log2_log10; + address coeff = (address)_coeff_log10; + + bind(start); + subq(rsp, 24); + movsd(Address(rsp, 0), xmm0); + + bind(B1_2); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movl(ecx, 1054736384); + movdl(xmm7, ecx); + xorpd(xmm3, xmm3); + movl(edx, 30704); + pinsrw(xmm3, edx, 3); + movdqu(xmm1, xmm0); + movl(edx, 32768); + movdl(xmm4, edx); + movdqu(xmm5, ExternalAddress(HIGHSIGMASK)); //0xf8000000UL, 0xffffffffUL, 0x00000000UL, 0xffffe000UL + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 16352); + psrlq(xmm0, 27); + movdqu(xmm2, ExternalAddress(LOG10_E)); //0x00000000UL, 0x3fdbc000UL, 0xbf2e4108UL, 0x3f5a7a6cUL + psrld(xmm0, 2); + rcpps(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 78); + psrlq(xmm1, 12); + subl(eax, 16); + cmpl(eax, 32736); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + + bind(L_2TAG_PACKET_1_0_2); + mulss(xmm0, xmm7); + por(xmm1, xmm3); + lea(r11, ExternalAddress(L_tbl)); + andpd(xmm5, xmm1); + paddd(xmm0, xmm4); + subsd(xmm1, xmm5); + movdl(edx, xmm0); + psllq(xmm0, 29); + andpd(xmm0, xmm6); + andl(eax, 32752); + subl(eax, ecx); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + mulsd(xmm1, xmm0); + movq(xmm6, ExternalAddress(log2)); //0x509f7800UL, 0x3f934413UL, 0x1f12b358UL, 0x3cdfef31UL + movdqu(xmm3, ExternalAddress(coeff)); //0xc1a5f12eUL, 0x40358874UL, 0x64d4ef0dUL, 0xc0089309UL + subsd(xmm5, xmm2); + andl(edx, 16711680); + shrl(edx, 12); + movdqu(xmm0, Address(r11, rdx, Address::times_1, -1504)); + movdqu(xmm4, ExternalAddress(16 + coeff)); //0x385593b1UL, 0xc025c917UL, 0xdc963467UL, 0x3ffc6a02UL + addsd(xmm1, xmm5); + movdqu(xmm2, ExternalAddress(32 + coeff)); //0x7f9d3aa1UL, 0x4016ab9fUL, 0xdc77b115UL, 0xbff27af2UL + mulsd(xmm6, xmm7); + pshufd(xmm5, xmm1, 68); + mulsd(xmm7, ExternalAddress(8 + log2)); //0x1f12b358UL, 0x3cdfef31UL + mulsd(xmm3, xmm1); + addsd(xmm0, xmm6); + mulpd(xmm4, xmm5); + movq(xmm6, ExternalAddress(8 + LOG10_E)); //0xbf2e4108UL, 0x3f5a7a6cUL + mulpd(xmm5, xmm5); + addpd(xmm4, xmm2); + mulpd(xmm3, xmm5); + pshufd(xmm2, xmm0, 228); + addsd(xmm0, xmm1); + mulsd(xmm4, xmm1); + subsd(xmm2, xmm0); + mulsd(xmm6, xmm1); + addsd(xmm1, xmm2); + pshufd(xmm2, xmm0, 238); + mulsd(xmm5, xmm5); + addsd(xmm7, xmm2); + addsd(xmm1, xmm6); + addpd(xmm4, xmm3); + addsd(xmm1, xmm7); + mulpd(xmm4, xmm5); + addsd(xmm1, xmm4); + pshufd(xmm5, xmm4, 238); + addsd(xmm1, xmm5); + addsd(xmm0, xmm1); + jmp(B1_5); + + bind(L_2TAG_PACKET_0_0_2); + movq(xmm0, Address(rsp, 0)); + movq(xmm1, Address(rsp, 0)); + addl(eax, 16); + cmpl(eax, 32768); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_2_0_2); + cmpl(eax, 16); + jcc(Assembler::below, L_2TAG_PACKET_3_0_2); + + bind(L_2TAG_PACKET_4_0_2); + addsd(xmm0, xmm0); + jmp(B1_5); + + bind(L_2TAG_PACKET_5_0_2); + jcc(Assembler::above, L_2TAG_PACKET_4_0_2); + cmpl(edx, 0); + jcc(Assembler::above, L_2TAG_PACKET_4_0_2); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_3_0_2); + xorpd(xmm1, xmm1); + addsd(xmm1, xmm0); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); + xorpd(xmm1, xmm1); + movl(eax, 18416); + pinsrw(xmm1, eax, 3); + mulsd(xmm0, xmm1); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movdqu(xmm1, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 18416); + psrlq(xmm0, 27); + movdqu(xmm2, ExternalAddress(LOG10_E)); //0x00000000UL, 0x3fdbc000UL, 0xbf2e4108UL, 0x3f5a7a6cUL + psrld(xmm0, 2); + rcpps(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 78); + psrlq(xmm1, 12); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + addl(ecx, ecx); + cmpl(ecx, -2097152); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_5_0_2); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); + + bind(L_2TAG_PACKET_6_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 32752); + pinsrw(xmm1, eax, 3); + mulsd(xmm0, xmm1); + movl(Address(rsp, 16), 9); + jmp(L_2TAG_PACKET_8_0_2); + + bind(L_2TAG_PACKET_7_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 49136); + pinsrw(xmm0, eax, 3); + divsd(xmm0, xmm1); + movl(Address(rsp, 16), 8); + + bind(L_2TAG_PACKET_8_0_2); + movq(Address(rsp, 8), xmm0); + + bind(B1_3); + movq(xmm0, Address(rsp, 8)); + + bind(L_2TAG_PACKET_9_0_2); + + bind(B1_5); + addq(rsp, 24); + +} +#else +// The 32 bit code is at most SSE2 compliant +ALIGNED_(16) juint _static_const_table_log10[] = +{ + 0x509f7800UL, 0x3fd34413UL, 0x1f12b358UL, 0x3d1fef31UL, 0x80333400UL, + 0x3fd32418UL, 0xc671d9d0UL, 0xbcf542bfUL, 0x51195000UL, 0x3fd30442UL, + 0x78a4b0c3UL, 0x3d18216aUL, 0x6fc79400UL, 0x3fd2e490UL, 0x80fa389dUL, + 0xbc902869UL, 0x89d04000UL, 0x3fd2c502UL, 0x75c2f564UL, 0x3d040754UL, + 0x4ddd1c00UL, 0x3fd2a598UL, 0xd219b2c3UL, 0xbcfa1d84UL, 0x6baa7c00UL, + 0x3fd28651UL, 0xfd9abec1UL, 0x3d1be6d3UL, 0x94028800UL, 0x3fd2672dUL, + 0xe289a455UL, 0xbd1ede5eUL, 0x78b86400UL, 0x3fd2482cUL, 0x6734d179UL, + 0x3d1fe79bUL, 0xcca3c800UL, 0x3fd2294dUL, 0x981a40b8UL, 0xbced34eaUL, + 0x439c5000UL, 0x3fd20a91UL, 0xcc392737UL, 0xbd1a9cc3UL, 0x92752c00UL, + 0x3fd1ebf6UL, 0x03c9afe7UL, 0x3d1e98f8UL, 0x6ef8dc00UL, 0x3fd1cd7dUL, + 0x71dae7f4UL, 0x3d08a86cUL, 0x8fe4dc00UL, 0x3fd1af25UL, 0xee9185a1UL, + 0xbcff3412UL, 0xace59400UL, 0x3fd190eeUL, 0xc2cab353UL, 0x3cf17ed9UL, + 0x7e925000UL, 0x3fd172d8UL, 0x6952c1b2UL, 0x3cf1521cUL, 0xbe694400UL, + 0x3fd154e2UL, 0xcacb79caUL, 0xbd0bdc78UL, 0x26cbac00UL, 0x3fd1370dUL, + 0xf71f4de1UL, 0xbd01f8beUL, 0x72fa0800UL, 0x3fd11957UL, 0x55bf910bUL, + 0x3c946e2bUL, 0x5f106000UL, 0x3fd0fbc1UL, 0x39e639c1UL, 0x3d14a84bUL, + 0xa802a800UL, 0x3fd0de4aUL, 0xd3f31d5dUL, 0xbd178385UL, 0x0b992000UL, + 0x3fd0c0f3UL, 0x3843106fUL, 0xbd1f602fUL, 0x486ce800UL, 0x3fd0a3baUL, + 0x8819497cUL, 0x3cef987aUL, 0x1de49400UL, 0x3fd086a0UL, 0x1caa0467UL, + 0x3d0faec7UL, 0x4c30cc00UL, 0x3fd069a4UL, 0xa4424372UL, 0xbd1618fcUL, + 0x94490000UL, 0x3fd04cc6UL, 0x946517d2UL, 0xbd18384bUL, 0xb7e84000UL, + 0x3fd03006UL, 0xe0109c37UL, 0xbd19a6acUL, 0x798a0c00UL, 0x3fd01364UL, + 0x5121e864UL, 0xbd164cf7UL, 0x38ce8000UL, 0x3fcfedbfUL, 0x46214d1aUL, + 0xbcbbc402UL, 0xc8e62000UL, 0x3fcfb4efUL, 0xdab93203UL, 0x3d1e0176UL, + 0x2cb02800UL, 0x3fcf7c5aUL, 0x2a2ea8e4UL, 0xbcfec86aUL, 0xeeeaa000UL, + 0x3fcf43fdUL, 0xc18e49a4UL, 0x3cf110a8UL, 0x9bb6e800UL, 0x3fcf0bdaUL, + 0x923cc9c0UL, 0xbd15ce99UL, 0xc093f000UL, 0x3fced3efUL, 0x4d4b51e9UL, + 0x3d1a04c7UL, 0xec58f800UL, 0x3fce9c3cUL, 0x163cad59UL, 0x3cac8260UL, + 0x9a907000UL, 0x3fce2d7dUL, 0x3fa93646UL, 0x3ce4a1c0UL, 0x37311000UL, + 0x3fcdbf99UL, 0x32abd1fdUL, 0x3d07ea9dUL, 0x6744b800UL, 0x3fcd528cUL, + 0x4dcbdfd4UL, 0xbd1b08e2UL, 0xe36de800UL, 0x3fcce653UL, 0x0b7b7f7fUL, + 0xbd1b8f03UL, 0x77506800UL, 0x3fcc7aecUL, 0xa821c9fbUL, 0x3d13c163UL, + 0x00ff8800UL, 0x3fcc1053UL, 0x536bca76UL, 0xbd074ee5UL, 0x70719800UL, + 0x3fcba684UL, 0xd7da9b6bUL, 0xbd1fbf16UL, 0xc6f8d800UL, 0x3fcb3d7dUL, + 0xe2220bb3UL, 0x3d1a295dUL, 0x16c15800UL, 0x3fcad53cUL, 0xe724911eUL, + 0xbcf55822UL, 0x82533800UL, 0x3fca6dbcUL, 0x6d982371UL, 0x3cac567cUL, + 0x3c19e800UL, 0x3fca06fcUL, 0x84d17d80UL, 0x3d1da204UL, 0x85ef8000UL, + 0x3fc9a0f8UL, 0x54466a6aUL, 0xbd002204UL, 0xb0ac2000UL, 0x3fc93baeUL, + 0xd601fd65UL, 0x3d18840cUL, 0x1bb9b000UL, 0x3fc8d71cUL, 0x7bf58766UL, + 0xbd14f897UL, 0x34aae800UL, 0x3fc8733eUL, 0x3af6ac24UL, 0xbd0f5c45UL, + 0x76d68000UL, 0x3fc81012UL, 0x4303e1a1UL, 0xbd1f9a80UL, 0x6af57800UL, + 0x3fc7ad96UL, 0x43fbcb46UL, 0x3cf4c33eUL, 0xa6c51000UL, 0x3fc74bc7UL, + 0x70f0eac5UL, 0xbd192e3bUL, 0xccab9800UL, 0x3fc6eaa3UL, 0xc0093dfeUL, + 0xbd0faf15UL, 0x8b60b800UL, 0x3fc68a28UL, 0xde78d5fdUL, 0xbc9ea4eeUL, + 0x9d987000UL, 0x3fc62a53UL, 0x962bea6eUL, 0xbd194084UL, 0xc9b0e800UL, + 0x3fc5cb22UL, 0x888dd999UL, 0x3d1fe201UL, 0xe1634800UL, 0x3fc56c93UL, + 0x16ada7adUL, 0x3d1b1188UL, 0xc176c000UL, 0x3fc50ea4UL, 0x4159b5b5UL, + 0xbcf09c08UL, 0x51766000UL, 0x3fc4b153UL, 0x84393d23UL, 0xbcf6a89cUL, + 0x83695000UL, 0x3fc4549dUL, 0x9f0b8bbbUL, 0x3d1c4b8cUL, 0x538d5800UL, + 0x3fc3f881UL, 0xf49df747UL, 0x3cf89b99UL, 0xc8138000UL, 0x3fc39cfcUL, + 0xd503b834UL, 0xbd13b99fUL, 0xf0df0800UL, 0x3fc3420dUL, 0xf011b386UL, + 0xbd05d8beUL, 0xe7466800UL, 0x3fc2e7b2UL, 0xf39c7bc2UL, 0xbd1bb94eUL, + 0xcdd62800UL, 0x3fc28de9UL, 0x05e6d69bUL, 0xbd10ed05UL, 0xd015d800UL, + 0x3fc234b0UL, 0xe29b6c9dUL, 0xbd1ff967UL, 0x224ea800UL, 0x3fc1dc06UL, + 0x727711fcUL, 0xbcffb30dUL, 0x01540000UL, 0x3fc183e8UL, 0x39786c5aUL, + 0x3cc23f57UL, 0xb24d9800UL, 0x3fc12c54UL, 0xc905a342UL, 0x3d003a1dUL, + 0x82835800UL, 0x3fc0d54aUL, 0x9b9920c0UL, 0x3d03b25aUL, 0xc72ac000UL, + 0x3fc07ec7UL, 0x46f26a24UL, 0x3cf0fa41UL, 0xdd35d800UL, 0x3fc028caUL, + 0x41d9d6dcUL, 0x3d034a65UL, 0x52474000UL, 0x3fbfa6a4UL, 0x44f66449UL, + 0x3d19cad3UL, 0x2da3d000UL, 0x3fbefcb8UL, 0x67832999UL, 0x3d18400fUL, + 0x32a10000UL, 0x3fbe53ceUL, 0x9c0e3b1aUL, 0xbcff62fdUL, 0x556b7000UL, + 0x3fbdabe3UL, 0x02976913UL, 0xbcf8243bUL, 0x97e88000UL, 0x3fbd04f4UL, + 0xec793797UL, 0x3d1c0578UL, 0x09647000UL, 0x3fbc5effUL, 0x05fc0565UL, + 0xbd1d799eUL, 0xc6426000UL, 0x3fbbb9ffUL, 0x4625f5edUL, 0x3d1f5723UL, + 0xf7afd000UL, 0x3fbb15f3UL, 0xdd5aae61UL, 0xbd1a7e1eUL, 0xd358b000UL, + 0x3fba72d8UL, 0x3314e4d3UL, 0x3d17bc91UL, 0x9b1f5000UL, 0x3fb9d0abUL, + 0x9a4d514bUL, 0x3cf18c9bUL, 0x9cd4e000UL, 0x3fb92f69UL, 0x7e4496abUL, + 0x3cf1f96dUL, 0x31f4f000UL, 0x3fb88f10UL, 0xf56479e7UL, 0x3d165818UL, + 0xbf628000UL, 0x3fb7ef9cUL, 0x26bf486dUL, 0xbd1113a6UL, 0xb526b000UL, + 0x3fb7510cUL, 0x1a1c3384UL, 0x3ca9898dUL, 0x8e31e000UL, 0x3fb6b35dUL, + 0xb3875361UL, 0xbd0661acUL, 0xd01de000UL, 0x3fb6168cUL, 0x2a7cacfaUL, + 0xbd1bdf10UL, 0x0af23000UL, 0x3fb57a98UL, 0xff868816UL, 0x3cf046d0UL, + 0xd8ea0000UL, 0x3fb4df7cUL, 0x1515fbe7UL, 0xbd1fd529UL, 0xde3b2000UL, + 0x3fb44538UL, 0x6e59a132UL, 0x3d1faeeeUL, 0xc8df9000UL, 0x3fb3abc9UL, + 0xf1322361UL, 0xbd198807UL, 0x505f1000UL, 0x3fb3132dUL, 0x0888e6abUL, + 0x3d1e5380UL, 0x359bd000UL, 0x3fb27b61UL, 0xdfbcbb22UL, 0xbcfe2724UL, + 0x429ee000UL, 0x3fb1e463UL, 0x6eb4c58cUL, 0xbcfe4dd6UL, 0x4a673000UL, + 0x3fb14e31UL, 0x4ce1ac9bUL, 0x3d1ba691UL, 0x28b96000UL, 0x3fb0b8c9UL, + 0x8c7813b8UL, 0xbd0b3872UL, 0xc1f08000UL, 0x3fb02428UL, 0xc2bc8c2cUL, + 0x3cb5ea6bUL, 0x05a1a000UL, 0x3faf209cUL, 0x72e8f18eUL, 0xbce8df84UL, + 0xc0b5e000UL, 0x3fadfa6dUL, 0x9fdef436UL, 0x3d087364UL, 0xaf416000UL, + 0x3facd5c2UL, 0x1068c3a9UL, 0x3d0827e7UL, 0xdb356000UL, 0x3fabb296UL, + 0x120a34d3UL, 0x3d101a9fUL, 0x5dfea000UL, 0x3faa90e6UL, 0xdaded264UL, + 0xbd14c392UL, 0x6034c000UL, 0x3fa970adUL, 0x1c9d06a9UL, 0xbd1b705eUL, + 0x194c6000UL, 0x3fa851e8UL, 0x83996ad9UL, 0xbd0117bcUL, 0xcf4ac000UL, + 0x3fa73492UL, 0xb1a94a62UL, 0xbca5ea42UL, 0xd67b4000UL, 0x3fa618a9UL, + 0x75aed8caUL, 0xbd07119bUL, 0x9126c000UL, 0x3fa4fe29UL, 0x5291d533UL, + 0x3d12658fUL, 0x6f4d4000UL, 0x3fa3e50eUL, 0xcd2c5cd9UL, 0x3d1d5c70UL, + 0xee608000UL, 0x3fa2cd54UL, 0xd1008489UL, 0x3d1a4802UL, 0x9900e000UL, + 0x3fa1b6f9UL, 0x54fb5598UL, 0xbd16593fUL, 0x06bb6000UL, 0x3fa0a1f9UL, + 0x64ef57b4UL, 0xbd17636bUL, 0xb7940000UL, 0x3f9f1c9fUL, 0xee6a4737UL, + 0x3cb5d479UL, 0x91aa0000UL, 0x3f9cf7f5UL, 0x3a16373cUL, 0x3d087114UL, + 0x156b8000UL, 0x3f9ad5edUL, 0x836c554aUL, 0x3c6900b0UL, 0xd4764000UL, + 0x3f98b67fUL, 0xed12f17bUL, 0xbcffc974UL, 0x77dec000UL, 0x3f9699a7UL, + 0x232ce7eaUL, 0x3d1e35bbUL, 0xbfbf4000UL, 0x3f947f5dUL, 0xd84ffa6eUL, + 0x3d0e0a49UL, 0x82c7c000UL, 0x3f92679cUL, 0x8d170e90UL, 0xbd14d9f2UL, + 0xadd20000UL, 0x3f90525dUL, 0x86d9f88eUL, 0x3cdeb986UL, 0x86f10000UL, + 0x3f8c7f36UL, 0xb9e0a517UL, 0x3ce29faaUL, 0xb75c8000UL, 0x3f885e9eUL, + 0x542568cbUL, 0xbd1f7bdbUL, 0x46b30000UL, 0x3f8442e8UL, 0xb954e7d9UL, + 0x3d1e5287UL, 0xb7e60000UL, 0x3f802c07UL, 0x22da0b17UL, 0xbd19fb27UL, + 0x6c8b0000UL, 0x3f7833e3UL, 0x821271efUL, 0xbd190f96UL, 0x29910000UL, + 0x3f701936UL, 0xbc3491a5UL, 0xbd1bcf45UL, 0x354a0000UL, 0x3f600fe3UL, + 0xc0ff520aUL, 0xbd19d71cUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x509f7800UL, 0x3f934413UL, 0x1f12b358UL, 0x3cdfef31UL, + 0xc1a5f12eUL, 0x40358874UL, 0x64d4ef0dUL, 0xc0089309UL, 0x385593b1UL, + 0xc025c917UL, 0xdc963467UL, 0x3ffc6a02UL, 0x7f9d3aa1UL, 0x4016ab9fUL, + 0xdc77b115UL, 0xbff27af2UL, 0xf8000000UL, 0xffffffffUL, 0x00000000UL, + 0xffffe000UL, 0x00000000UL, 0x3fdbc000UL, 0xbf2e4108UL, 0x3f5a7a6cUL +}; +//registers, +// input: xmm0 +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, rbx (tmp) + +void MacroAssembler::fast_log10(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { + + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, start; + + assert_different_registers(tmp, eax, ecx, edx); + + address static_const_table_log10 = (address)_static_const_table_log10; + + bind(start); + subl(rsp, 104); + movl(Address(rsp, 40), tmp); + lea(tmp, ExternalAddress(static_const_table_log10)); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movl(ecx, 1054736384); + movdl(xmm7, ecx); + xorpd(xmm3, xmm3); + movl(edx, 30704); + pinsrw(xmm3, edx, 3); + movsd(xmm0, Address(rsp, 112)); + movdqu(xmm1, xmm0); + movl(edx, 32768); + movdl(xmm4, edx); + movdqu(xmm5, Address(tmp, 2128)); //0x3ffc6a02UL, 0x7f9d3aa1UL, 0x4016ab9fUL, 0xdc77b115UL + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 16352); + psllq(xmm0, 5); + movsd(xmm2, Address(tmp, 2144)); //0xbff27af2UL, 0xf8000000UL, 0xffffffffUL, 0x00000000UL + psrlq(xmm0, 34); + rcpss(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 78); + psrlq(xmm1, 12); + subl(eax, 16); + cmpl(eax, 32736); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + + bind(L_2TAG_PACKET_1_0_2); + mulss(xmm0, xmm7); + por(xmm1, xmm3); + andpd(xmm5, xmm1); + paddd(xmm0, xmm4); + subsd(xmm1, xmm5); + movdl(edx, xmm0); + psllq(xmm0, 29); + andpd(xmm0, xmm6); + andl(eax, 32752); + subl(eax, ecx); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + mulsd(xmm1, xmm0); + movsd(xmm6, Address(tmp, 2064)); //0xbd19d71cUL, 0x00000000UL, 0x00000000UL, 0x00000000UL + movdqu(xmm3, Address(tmp, 2080)); //0x00000000UL, 0x509f7800UL, 0x3f934413UL, 0x1f12b358UL + subsd(xmm5, xmm2); + andl(edx, 16711680); + shrl(edx, 12); + movdqu(xmm0, Address(tmp, edx, Address::times_1, -1504)); + movdqu(xmm4, Address(tmp, 2096)); //0x3cdfef31UL, 0xc1a5f12eUL, 0x40358874UL, 0x64d4ef0dUL + addsd(xmm1, xmm5); + movdqu(xmm2, Address(tmp, 2112)); //0xc0089309UL, 0x385593b1UL, 0xc025c917UL, 0xdc963467UL + mulsd(xmm6, xmm7); + pshufd(xmm5, xmm1, 68); + mulsd(xmm7, Address(tmp, 2072)); //0x00000000UL, 0x00000000UL, 0x00000000UL, 0x509f7800UL + mulsd(xmm3, xmm1); + addsd(xmm0, xmm6); + mulpd(xmm4, xmm5); + movsd(xmm6, Address(tmp, 2152)); //0xffffffffUL, 0x00000000UL, 0xffffe000UL, 0x00000000UL + mulpd(xmm5, xmm5); + addpd(xmm4, xmm2); + mulpd(xmm3, xmm5); + pshufd(xmm2, xmm0, 228); + addsd(xmm0, xmm1); + mulsd(xmm4, xmm1); + subsd(xmm2, xmm0); + mulsd(xmm6, xmm1); + addsd(xmm1, xmm2); + pshufd(xmm2, xmm0, 238); + mulsd(xmm5, xmm5); + addsd(xmm7, xmm2); + addsd(xmm1, xmm6); + addpd(xmm4, xmm3); + addsd(xmm1, xmm7); + mulpd(xmm4, xmm5); + addsd(xmm1, xmm4); + pshufd(xmm5, xmm4, 238); + addsd(xmm1, xmm5); + addsd(xmm0, xmm1); + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_0_0_2); + movsd(xmm0, Address(rsp, 112)); //0xbcfa1d84UL, 0x6baa7c00UL, 0x3fd28651UL, 0xfd9abec1UL + movdqu(xmm1, xmm0); + addl(eax, 16); + cmpl(eax, 32768); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_3_0_2); + cmpl(eax, 16); + jcc(Assembler::below, L_2TAG_PACKET_4_0_2); + + bind(L_2TAG_PACKET_5_0_2); + addsd(xmm0, xmm0); + jmp(L_2TAG_PACKET_2_0_2); + + bind(L_2TAG_PACKET_6_0_2); + jcc(Assembler::above, L_2TAG_PACKET_5_0_2); + cmpl(edx, 0); + jcc(Assembler::above, L_2TAG_PACKET_5_0_2); + jmp(L_2TAG_PACKET_7_0_2); + + bind(L_2TAG_PACKET_3_0_2); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + addl(ecx, ecx); + cmpl(ecx, -2097152); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_6_0_2); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); + + bind(L_2TAG_PACKET_7_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 32752); + pinsrw(xmm1, eax, 3); + movl(edx, 9); + mulsd(xmm0, xmm1); + + bind(L_2TAG_PACKET_9_0_2); + movsd(Address(rsp, 0), xmm0); + movsd(xmm0, Address(rsp, 112)); //0xbcfa1d84UL, 0x6baa7c00UL, 0x3fd28651UL, 0xfd9abec1UL + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_10_0_2); + + bind(L_2TAG_PACKET_8_0_2); + xorpd(xmm1, xmm1); + xorpd(xmm0, xmm0); + movl(eax, 49136); + pinsrw(xmm0, eax, 3); + divsd(xmm0, xmm1); + movl(edx, 8); + jmp(L_2TAG_PACKET_9_0_2); + + bind(L_2TAG_PACKET_4_0_2); + movdl(edx, xmm1); + psrlq(xmm1, 32); + movdl(ecx, xmm1); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); + xorpd(xmm1, xmm1); + movl(eax, 18416); + pinsrw(xmm1, eax, 3); + mulsd(xmm0, xmm1); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movdqu(xmm1, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 18416); + psllq(xmm0, 5); + movsd(xmm2, Address(tmp, 2144)); //0xbff27af2UL, 0xf8000000UL, 0xffffffffUL, 0x00000000UL + psrlq(xmm0, 34); + rcpss(xmm0, xmm0); + psllq(xmm1, 12); + pshufd(xmm6, xmm5, 78); + psrlq(xmm1, 12); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movsd(Address(rsp, 24), xmm0); + fld_d(Address(rsp, 24)); + + bind(L_2TAG_PACKET_10_0_2); + movl(tmp, Address(rsp, 40)); + +} +#endif diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_pow.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_pow.cpp new file mode 100644 index 00000000000..12b38d8c5ef --- /dev/null +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_pow.cpp @@ -0,0 +1,3592 @@ +/* +* Copyright (c) 2016, Intel Corporation. +* Intel Math Library (LIBM) Source Code +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +* +*/ + +#include "precompiled.hpp" +#include "asm/assembler.hpp" +#include "asm/assembler.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "macroAssembler_x86.hpp" + +#ifdef _MSC_VER +#define ALIGNED_(x) __declspec(align(x)) +#else +#define ALIGNED_(x) __attribute__ ((aligned(x))) +#endif + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - POW() +// --------------------- +// +// Let x=2^k * mx, mx in [1,2) +// +// log2(x) calculation: +// +// Get B~1/mx based on the output of rcpps instruction (B0) +// B = int((B0*LH*2^9+0.5))/2^9 +// LH is a short approximation for log2(e) +// +// Reduced argument, scaled by LH: +// r=B*mx-LH (computed accurately in high and low parts) +// +// log2(x) result: k - log2(B) + p(r) +// p(r) is a degree 8 polynomial +// -log2(B) read from data table (high, low parts) +// log2(x) is formed from high and low parts +// For |x| in [1-1/32, 1+1/16), a slower but more accurate computation +// based om the same table design is performed. +// +// Main path is taken if | floor(log2(|log2(|x|)|) + floor(log2|y|) | < 8, +// to filter out all potential OF/UF cases. +// exp2(y*log2(x)) is computed using an 8-bit index table and a degree 5 +// polynomial +// +// Special cases: +// pow(-0,y) = -INF and raises the divide-by-zero exception for y an odd +// integer < 0. +// pow(-0,y) = +INF and raises the divide-by-zero exception for y < 0 and +// not an odd integer. +// pow(-0,y) = -0 for y an odd integer > 0. +// pow(-0,y) = +0 for y > 0 and not an odd integer. +// pow(-1,-INF) = NaN. +// pow(+1,y) = NaN for any y, even a NaN. +// pow(x,-0) = 1 for any x, even a NaN. +// pow(x,y) = a NaN and raises the invalid exception for finite x < 0 and +// finite non-integer y. +// pow(x,-INF) = +INF for |x|<1. +// pow(x,-INF) = +0 for |x|>1. +// pow(x,+INF) = +0 for |x|<1. +// pow(x,+INF) = +INF for |x|>1. +// pow(-INF,y) = -0 for y an odd integer < 0. +// pow(-INF,y) = +0 for y < 0 and not an odd integer. +// pow(-INF,y) = -INF for y an odd integer > 0. +// pow(-INF,y) = +INF for y > 0 and not an odd integer. +// pow(+INF,y) = +0 for y <0. +// pow(+INF,y) = +INF for y >0. +// +/******************************************************************************/ + +#ifdef _LP64 +// The 64 bit code is at most SSE2 compliant +ALIGNED_(16) juint _HIGHSIGMASK[] = +{ + 0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL +}; + +ALIGNED_(16) juint _LOG2_E[] = +{ + 0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL +}; + +ALIGNED_(16) juint _HIGHMASK_Y[] = +{ + 0x00000000UL, 0xfffffff8UL, 0x00000000UL, 0xffffffffUL +}; + +ALIGNED_(16) juint _T_exp[] = +{ + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3b700000UL, 0xfa5abcbfUL, + 0x3ff00b1aUL, 0xa7609f71UL, 0xbc84f6b2UL, 0xa9fb3335UL, 0x3ff0163dUL, + 0x9ab8cdb7UL, 0x3c9b6129UL, 0x143b0281UL, 0x3ff02168UL, 0x0fc54eb6UL, + 0xbc82bf31UL, 0x3e778061UL, 0x3ff02c9aUL, 0x535b085dUL, 0xbc719083UL, + 0x2e11bbccUL, 0x3ff037d4UL, 0xeeade11aUL, 0x3c656811UL, 0xe86e7f85UL, + 0x3ff04315UL, 0x1977c96eUL, 0xbc90a31cUL, 0x72f654b1UL, 0x3ff04e5fUL, + 0x3aa0d08cUL, 0x3c84c379UL, 0xd3158574UL, 0x3ff059b0UL, 0xa475b465UL, + 0x3c8d73e2UL, 0x0e3c1f89UL, 0x3ff0650aUL, 0x5799c397UL, 0xbc95cb7bUL, + 0x29ddf6deUL, 0x3ff0706bUL, 0xe2b13c27UL, 0xbc8c91dfUL, 0x2b72a836UL, + 0x3ff07bd4UL, 0x54458700UL, 0x3c832334UL, 0x18759bc8UL, 0x3ff08745UL, + 0x4bb284ffUL, 0x3c6186beUL, 0xf66607e0UL, 0x3ff092bdUL, 0x800a3fd1UL, + 0xbc968063UL, 0xcac6f383UL, 0x3ff09e3eUL, 0x18316136UL, 0x3c914878UL, + 0x9b1f3919UL, 0x3ff0a9c7UL, 0x873d1d38UL, 0x3c85d16cUL, 0x6cf9890fUL, + 0x3ff0b558UL, 0x4adc610bUL, 0x3c98a62eUL, 0x45e46c85UL, 0x3ff0c0f1UL, + 0x06d21cefUL, 0x3c94f989UL, 0x2b7247f7UL, 0x3ff0cc92UL, 0x16e24f71UL, + 0x3c901edcUL, 0x23395decUL, 0x3ff0d83bUL, 0xe43f316aUL, 0xbc9bc14dUL, + 0x32d3d1a2UL, 0x3ff0e3ecUL, 0x27c57b52UL, 0x3c403a17UL, 0x5fdfa9c5UL, + 0x3ff0efa5UL, 0xbc54021bUL, 0xbc949db9UL, 0xaffed31bUL, 0x3ff0fb66UL, + 0xc44ebd7bUL, 0xbc6b9bedUL, 0x28d7233eUL, 0x3ff10730UL, 0x1692fdd5UL, + 0x3c8d46ebUL, 0xd0125b51UL, 0x3ff11301UL, 0x39449b3aUL, 0xbc96c510UL, + 0xab5e2ab6UL, 0x3ff11edbUL, 0xf703fb72UL, 0xbc9ca454UL, 0xc06c31ccUL, + 0x3ff12abdUL, 0xb36ca5c7UL, 0xbc51b514UL, 0x14f204abUL, 0x3ff136a8UL, + 0xba48dcf0UL, 0xbc67108fUL, 0xaea92de0UL, 0x3ff1429aUL, 0x9af1369eUL, + 0xbc932fbfUL, 0x934f312eUL, 0x3ff14e95UL, 0x39bf44abUL, 0xbc8b91e8UL, + 0xc8a58e51UL, 0x3ff15a98UL, 0xb9eeab0aUL, 0x3c82406aUL, 0x5471c3c2UL, + 0x3ff166a4UL, 0x82ea1a32UL, 0x3c58f23bUL, 0x3c7d517bUL, 0x3ff172b8UL, + 0xb9d78a76UL, 0xbc819041UL, 0x8695bbc0UL, 0x3ff17ed4UL, 0xe2ac5a64UL, + 0x3c709e3fUL, 0x388c8deaUL, 0x3ff18af9UL, 0xd1970f6cUL, 0xbc911023UL, + 0x58375d2fUL, 0x3ff19726UL, 0x85f17e08UL, 0x3c94aaddUL, 0xeb6fcb75UL, + 0x3ff1a35bUL, 0x7b4968e4UL, 0x3c8e5b4cUL, 0xf8138a1cUL, 0x3ff1af99UL, + 0xa4b69280UL, 0x3c97bf85UL, 0x84045cd4UL, 0x3ff1bbe0UL, 0x352ef607UL, + 0xbc995386UL, 0x95281c6bUL, 0x3ff1c82fUL, 0x8010f8c9UL, 0x3c900977UL, + 0x3168b9aaUL, 0x3ff1d487UL, 0x00a2643cUL, 0x3c9e016eUL, 0x5eb44027UL, + 0x3ff1e0e7UL, 0x088cb6deUL, 0xbc96fdd8UL, 0x22fcd91dUL, 0x3ff1ed50UL, + 0x027bb78cUL, 0xbc91df98UL, 0x8438ce4dUL, 0x3ff1f9c1UL, 0xa097af5cUL, + 0xbc9bf524UL, 0x88628cd6UL, 0x3ff2063bUL, 0x814a8495UL, 0x3c8dc775UL, + 0x3578a819UL, 0x3ff212beUL, 0x2cfcaac9UL, 0x3c93592dUL, 0x917ddc96UL, + 0x3ff21f49UL, 0x9494a5eeUL, 0x3c82a97eUL, 0xa27912d1UL, 0x3ff22bddUL, + 0x5577d69fUL, 0x3c8d34fbUL, 0x6e756238UL, 0x3ff2387aUL, 0xb6c70573UL, + 0x3c99b07eUL, 0xfb82140aUL, 0x3ff2451fUL, 0x911ca996UL, 0x3c8acfccUL, + 0x4fb2a63fUL, 0x3ff251ceUL, 0xbef4f4a4UL, 0x3c8ac155UL, 0x711ece75UL, + 0x3ff25e85UL, 0x4ac31b2cUL, 0x3c93e1a2UL, 0x65e27cddUL, 0x3ff26b45UL, + 0x9940e9d9UL, 0x3c82bd33UL, 0x341ddf29UL, 0x3ff2780eUL, 0x05f9e76cUL, + 0x3c9e067cUL, 0xe1f56381UL, 0x3ff284dfUL, 0x8c3f0d7eUL, 0xbc9a4c3aUL, + 0x7591bb70UL, 0x3ff291baUL, 0x28401cbdUL, 0xbc82cc72UL, 0xf51fdee1UL, + 0x3ff29e9dUL, 0xafad1255UL, 0x3c8612e8UL, 0x66d10f13UL, 0x3ff2ab8aUL, + 0x191690a7UL, 0xbc995743UL, 0xd0dad990UL, 0x3ff2b87fUL, 0xd6381aa4UL, + 0xbc410adcUL, 0x39771b2fUL, 0x3ff2c57eUL, 0xa6eb5124UL, 0xbc950145UL, + 0xa6e4030bUL, 0x3ff2d285UL, 0x54db41d5UL, 0x3c900247UL, 0x1f641589UL, + 0x3ff2df96UL, 0xfbbce198UL, 0x3c9d16cfUL, 0xa93e2f56UL, 0x3ff2ecafUL, + 0x45d52383UL, 0x3c71ca0fUL, 0x4abd886bUL, 0x3ff2f9d2UL, 0x532bda93UL, + 0xbc653c55UL, 0x0a31b715UL, 0x3ff306feUL, 0xd23182e4UL, 0x3c86f46aUL, + 0xedeeb2fdUL, 0x3ff31432UL, 0xf3f3fcd1UL, 0x3c8959a3UL, 0xfc4cd831UL, + 0x3ff32170UL, 0x8e18047cUL, 0x3c8a9ce7UL, 0x3ba8ea32UL, 0x3ff32eb8UL, + 0x3cb4f318UL, 0xbc9c45e8UL, 0xb26416ffUL, 0x3ff33c08UL, 0x843659a6UL, + 0x3c932721UL, 0x66e3fa2dUL, 0x3ff34962UL, 0x930881a4UL, 0xbc835a75UL, + 0x5f929ff1UL, 0x3ff356c5UL, 0x5c4e4628UL, 0xbc8b5ceeUL, 0xa2de883bUL, + 0x3ff36431UL, 0xa06cb85eUL, 0xbc8c3144UL, 0x373aa9cbUL, 0x3ff371a7UL, + 0xbf42eae2UL, 0xbc963aeaUL, 0x231e754aUL, 0x3ff37f26UL, 0x9eceb23cUL, + 0xbc99f5caUL, 0x6d05d866UL, 0x3ff38caeUL, 0x3c9904bdUL, 0xbc9e958dUL, + 0x1b7140efUL, 0x3ff39a40UL, 0xfc8e2934UL, 0xbc99a9a5UL, 0x34e59ff7UL, + 0x3ff3a7dbUL, 0xd661f5e3UL, 0xbc75e436UL, 0xbfec6cf4UL, 0x3ff3b57fUL, + 0xe26fff18UL, 0x3c954c66UL, 0xc313a8e5UL, 0x3ff3c32dUL, 0x375d29c3UL, + 0xbc9efff8UL, 0x44ede173UL, 0x3ff3d0e5UL, 0x8c284c71UL, 0x3c7fe8d0UL, + 0x4c123422UL, 0x3ff3dea6UL, 0x11f09ebcUL, 0x3c8ada09UL, 0xdf1c5175UL, + 0x3ff3ec70UL, 0x7b8c9bcaUL, 0xbc8af663UL, 0x04ac801cUL, 0x3ff3fa45UL, + 0xf956f9f3UL, 0xbc97d023UL, 0xc367a024UL, 0x3ff40822UL, 0xb6f4d048UL, + 0x3c8bddf8UL, 0x21f72e2aUL, 0x3ff4160aUL, 0x1c309278UL, 0xbc5ef369UL, + 0x2709468aUL, 0x3ff423fbUL, 0xc0b314ddUL, 0xbc98462dUL, 0xd950a897UL, + 0x3ff431f5UL, 0xe35f7999UL, 0xbc81c7ddUL, 0x3f84b9d4UL, 0x3ff43ffaUL, + 0x9704c003UL, 0x3c8880beUL, 0x6061892dUL, 0x3ff44e08UL, 0x04ef80d0UL, + 0x3c489b7aUL, 0x42a7d232UL, 0x3ff45c20UL, 0x82fb1f8eUL, 0xbc686419UL, + 0xed1d0057UL, 0x3ff46a41UL, 0xd1648a76UL, 0x3c9c944bUL, 0x668b3237UL, + 0x3ff4786dUL, 0xed445733UL, 0xbc9c20f0UL, 0xb5c13cd0UL, 0x3ff486a2UL, + 0xb69062f0UL, 0x3c73c1a3UL, 0xe192aed2UL, 0x3ff494e1UL, 0x5e499ea0UL, + 0xbc83b289UL, 0xf0d7d3deUL, 0x3ff4a32aUL, 0xf3d1be56UL, 0x3c99cb62UL, + 0xea6db7d7UL, 0x3ff4b17dUL, 0x7f2897f0UL, 0xbc8125b8UL, 0xd5362a27UL, + 0x3ff4bfdaUL, 0xafec42e2UL, 0x3c7d4397UL, 0xb817c114UL, 0x3ff4ce41UL, + 0x690abd5dUL, 0x3c905e29UL, 0x99fddd0dUL, 0x3ff4dcb2UL, 0xbc6a7833UL, + 0x3c98ecdbUL, 0x81d8abffUL, 0x3ff4eb2dUL, 0x2e5d7a52UL, 0xbc95257dUL, + 0x769d2ca7UL, 0x3ff4f9b2UL, 0xd25957e3UL, 0xbc94b309UL, 0x7f4531eeUL, + 0x3ff50841UL, 0x49b7465fUL, 0x3c7a249bUL, 0xa2cf6642UL, 0x3ff516daUL, + 0x69bd93efUL, 0xbc8f7685UL, 0xe83f4eefUL, 0x3ff5257dUL, 0x43efef71UL, + 0xbc7c998dUL, 0x569d4f82UL, 0x3ff5342bUL, 0x1db13cadUL, 0xbc807abeUL, + 0xf4f6ad27UL, 0x3ff542e2UL, 0x192d5f7eUL, 0x3c87926dUL, 0xca5d920fUL, + 0x3ff551a4UL, 0xefede59bUL, 0xbc8d689cUL, 0xdde910d2UL, 0x3ff56070UL, + 0x168eebf0UL, 0xbc90fb6eUL, 0x36b527daUL, 0x3ff56f47UL, 0x011d93adUL, + 0x3c99bb2cUL, 0xdbe2c4cfUL, 0x3ff57e27UL, 0x8a57b9c4UL, 0xbc90b98cUL, + 0xd497c7fdUL, 0x3ff58d12UL, 0x5b9a1de8UL, 0x3c8295e1UL, 0x27ff07ccUL, + 0x3ff59c08UL, 0xe467e60fUL, 0xbc97e2ceUL, 0xdd485429UL, 0x3ff5ab07UL, + 0x054647adUL, 0x3c96324cUL, 0xfba87a03UL, 0x3ff5ba11UL, 0x4c233e1aUL, + 0xbc9b77a1UL, 0x8a5946b7UL, 0x3ff5c926UL, 0x816986a2UL, 0x3c3c4b1bUL, + 0x90998b93UL, 0x3ff5d845UL, 0xa8b45643UL, 0xbc9cd6a7UL, 0x15ad2148UL, + 0x3ff5e76fUL, 0x3080e65eUL, 0x3c9ba6f9UL, 0x20dceb71UL, 0x3ff5f6a3UL, + 0xe3cdcf92UL, 0xbc89eaddUL, 0xb976dc09UL, 0x3ff605e1UL, 0x9b56de47UL, + 0xbc93e242UL, 0xe6cdf6f4UL, 0x3ff6152aUL, 0x4ab84c27UL, 0x3c9e4b3eUL, + 0xb03a5585UL, 0x3ff6247eUL, 0x7e40b497UL, 0xbc9383c1UL, 0x1d1929fdUL, + 0x3ff633ddUL, 0xbeb964e5UL, 0x3c984710UL, 0x34ccc320UL, 0x3ff64346UL, + 0x759d8933UL, 0xbc8c483cUL, 0xfebc8fb7UL, 0x3ff652b9UL, 0xc9a73e09UL, + 0xbc9ae3d5UL, 0x82552225UL, 0x3ff66238UL, 0x87591c34UL, 0xbc9bb609UL, + 0xc70833f6UL, 0x3ff671c1UL, 0x586c6134UL, 0xbc8e8732UL, 0xd44ca973UL, + 0x3ff68155UL, 0x44f73e65UL, 0x3c6038aeUL, 0xb19e9538UL, 0x3ff690f4UL, + 0x9aeb445dUL, 0x3c8804bdUL, 0x667f3bcdUL, 0x3ff6a09eUL, 0x13b26456UL, + 0xbc9bdd34UL, 0xfa75173eUL, 0x3ff6b052UL, 0x2c9a9d0eUL, 0x3c7a38f5UL, + 0x750bdabfUL, 0x3ff6c012UL, 0x67ff0b0dUL, 0xbc728956UL, 0xddd47645UL, + 0x3ff6cfdcUL, 0xb6f17309UL, 0x3c9c7aa9UL, 0x3c651a2fUL, 0x3ff6dfb2UL, + 0x683c88abUL, 0xbc6bbe3aUL, 0x98593ae5UL, 0x3ff6ef92UL, 0x9e1ac8b2UL, + 0xbc90b974UL, 0xf9519484UL, 0x3ff6ff7dUL, 0x25860ef6UL, 0xbc883c0fUL, + 0x66f42e87UL, 0x3ff70f74UL, 0xd45aa65fUL, 0x3c59d644UL, 0xe8ec5f74UL, + 0x3ff71f75UL, 0x86887a99UL, 0xbc816e47UL, 0x86ead08aUL, 0x3ff72f82UL, + 0x2cd62c72UL, 0xbc920aa0UL, 0x48a58174UL, 0x3ff73f9aUL, 0x6c65d53cUL, + 0xbc90a8d9UL, 0x35d7cbfdUL, 0x3ff74fbdUL, 0x618a6e1cUL, 0x3c9047fdUL, + 0x564267c9UL, 0x3ff75febUL, 0x57316dd3UL, 0xbc902459UL, 0xb1ab6e09UL, + 0x3ff77024UL, 0x169147f8UL, 0x3c9b7877UL, 0x4fde5d3fUL, 0x3ff78069UL, + 0x0a02162dUL, 0x3c9866b8UL, 0x38ac1cf6UL, 0x3ff790b9UL, 0x62aadd3eUL, + 0x3c9349a8UL, 0x73eb0187UL, 0x3ff7a114UL, 0xee04992fUL, 0xbc841577UL, + 0x0976cfdbUL, 0x3ff7b17bUL, 0x8468dc88UL, 0xbc9bebb5UL, 0x0130c132UL, + 0x3ff7c1edUL, 0xd1164dd6UL, 0x3c9f124cUL, 0x62ff86f0UL, 0x3ff7d26aUL, + 0xfb72b8b4UL, 0x3c91bddbUL, 0x36cf4e62UL, 0x3ff7e2f3UL, 0xba15797eUL, + 0x3c705d02UL, 0x8491c491UL, 0x3ff7f387UL, 0xcf9311aeUL, 0xbc807f11UL, + 0x543e1a12UL, 0x3ff80427UL, 0x626d972bUL, 0xbc927c86UL, 0xadd106d9UL, + 0x3ff814d2UL, 0x0d151d4dUL, 0x3c946437UL, 0x994cce13UL, 0x3ff82589UL, + 0xd41532d8UL, 0xbc9d4c1dUL, 0x1eb941f7UL, 0x3ff8364cUL, 0x31df2bd5UL, + 0x3c999b9aUL, 0x4623c7adUL, 0x3ff8471aUL, 0xa341cdfbUL, 0xbc88d684UL, + 0x179f5b21UL, 0x3ff857f4UL, 0xf8b216d0UL, 0xbc5ba748UL, 0x9b4492edUL, + 0x3ff868d9UL, 0x9bd4f6baUL, 0xbc9fc6f8UL, 0xd931a436UL, 0x3ff879caUL, + 0xd2db47bdUL, 0x3c85d2d7UL, 0xd98a6699UL, 0x3ff88ac7UL, 0xf37cb53aUL, + 0x3c9994c2UL, 0xa478580fUL, 0x3ff89bd0UL, 0x4475202aUL, 0x3c9d5395UL, + 0x422aa0dbUL, 0x3ff8ace5UL, 0x56864b27UL, 0x3c96e9f1UL, 0xbad61778UL, + 0x3ff8be05UL, 0xfc43446eUL, 0x3c9ecb5eUL, 0x16b5448cUL, 0x3ff8cf32UL, + 0x32e9e3aaUL, 0xbc70d55eUL, 0x5e0866d9UL, 0x3ff8e06aUL, 0x6fc9b2e6UL, + 0xbc97114aUL, 0x99157736UL, 0x3ff8f1aeUL, 0xa2e3976cUL, 0x3c85cc13UL, + 0xd0282c8aUL, 0x3ff902feUL, 0x85fe3fd2UL, 0x3c9592caUL, 0x0b91ffc6UL, + 0x3ff9145bUL, 0x2e582524UL, 0xbc9dd679UL, 0x53aa2fe2UL, 0x3ff925c3UL, + 0xa639db7fUL, 0xbc83455fUL, 0xb0cdc5e5UL, 0x3ff93737UL, 0x81b57ebcUL, + 0xbc675fc7UL, 0x2b5f98e5UL, 0x3ff948b8UL, 0x797d2d99UL, 0xbc8dc3d6UL, + 0xcbc8520fUL, 0x3ff95a44UL, 0x96a5f039UL, 0xbc764b7cUL, 0x9a7670b3UL, + 0x3ff96bddUL, 0x7f19c896UL, 0xbc5ba596UL, 0x9fde4e50UL, 0x3ff97d82UL, + 0x7c1b85d1UL, 0xbc9d185bUL, 0xe47a22a2UL, 0x3ff98f33UL, 0xa24c78ecUL, + 0x3c7cabdaUL, 0x70ca07baUL, 0x3ff9a0f1UL, 0x91cee632UL, 0xbc9173bdUL, + 0x4d53fe0dUL, 0x3ff9b2bbUL, 0x4df6d518UL, 0xbc9dd84eUL, 0x82a3f090UL, + 0x3ff9c491UL, 0xb071f2beUL, 0x3c7c7c46UL, 0x194bb8d5UL, 0x3ff9d674UL, + 0xa3dd8233UL, 0xbc9516beUL, 0x19e32323UL, 0x3ff9e863UL, 0x78e64c6eUL, + 0x3c7824caUL, 0x8d07f29eUL, 0x3ff9fa5eUL, 0xaaf1faceUL, 0xbc84a9ceUL, + 0x7b5de565UL, 0x3ffa0c66UL, 0x5d1cd533UL, 0xbc935949UL, 0xed8eb8bbUL, + 0x3ffa1e7aUL, 0xee8be70eUL, 0x3c9c6618UL, 0xec4a2d33UL, 0x3ffa309bUL, + 0x7ddc36abUL, 0x3c96305cUL, 0x80460ad8UL, 0x3ffa42c9UL, 0x589fb120UL, + 0xbc9aa780UL, 0xb23e255dUL, 0x3ffa5503UL, 0xdb8d41e1UL, 0xbc9d2f6eUL, + 0x8af46052UL, 0x3ffa674aUL, 0x30670366UL, 0x3c650f56UL, 0x1330b358UL, + 0x3ffa799eUL, 0xcac563c7UL, 0x3c9bcb7eUL, 0x53c12e59UL, 0x3ffa8bfeUL, + 0xb2ba15a9UL, 0xbc94f867UL, 0x5579fdbfUL, 0x3ffa9e6bUL, 0x0ef7fd31UL, + 0x3c90fac9UL, 0x21356ebaUL, 0x3ffab0e5UL, 0xdae94545UL, 0x3c889c31UL, + 0xbfd3f37aUL, 0x3ffac36bUL, 0xcae76cd0UL, 0xbc8f9234UL, 0x3a3c2774UL, + 0x3ffad5ffUL, 0xb6b1b8e5UL, 0x3c97ef3bUL, 0x995ad3adUL, 0x3ffae89fUL, + 0x345dcc81UL, 0x3c97a1cdUL, 0xe622f2ffUL, 0x3ffafb4cUL, 0x0f315ecdUL, + 0xbc94b2fcUL, 0x298db666UL, 0x3ffb0e07UL, 0x4c80e425UL, 0xbc9bdef5UL, + 0x6c9a8952UL, 0x3ffb20ceUL, 0x4a0756ccUL, 0x3c94dd02UL, 0xb84f15fbUL, + 0x3ffb33a2UL, 0x3084d708UL, 0xbc62805eUL, 0x15b749b1UL, 0x3ffb4684UL, + 0xe9df7c90UL, 0xbc7f763dUL, 0x8de5593aUL, 0x3ffb5972UL, 0xbbba6de3UL, + 0xbc9c71dfUL, 0x29f1c52aUL, 0x3ffb6c6eUL, 0x52883f6eUL, 0x3c92a8f3UL, + 0xf2fb5e47UL, 0x3ffb7f76UL, 0x7e54ac3bUL, 0xbc75584fUL, 0xf22749e4UL, + 0x3ffb928cUL, 0x54cb65c6UL, 0xbc9b7216UL, 0x30a1064aUL, 0x3ffba5b0UL, + 0x0e54292eUL, 0xbc9efcd3UL, 0xb79a6f1fUL, 0x3ffbb8e0UL, 0xc9696205UL, + 0xbc3f52d1UL, 0x904bc1d2UL, 0x3ffbcc1eUL, 0x7a2d9e84UL, 0x3c823dd0UL, + 0xc3f3a207UL, 0x3ffbdf69UL, 0x60ea5b53UL, 0xbc3c2623UL, 0x5bd71e09UL, + 0x3ffbf2c2UL, 0x3f6b9c73UL, 0xbc9efdcaUL, 0x6141b33dUL, 0x3ffc0628UL, + 0xa1fbca34UL, 0xbc8d8a5aUL, 0xdd85529cUL, 0x3ffc199bUL, 0x895048ddUL, + 0x3c811065UL, 0xd9fa652cUL, 0x3ffc2d1cUL, 0x17c8a5d7UL, 0xbc96e516UL, + 0x5fffd07aUL, 0x3ffc40abUL, 0xe083c60aUL, 0x3c9b4537UL, 0x78fafb22UL, + 0x3ffc5447UL, 0x2493b5afUL, 0x3c912f07UL, 0x2e57d14bUL, 0x3ffc67f1UL, + 0xff483cadUL, 0x3c92884dUL, 0x8988c933UL, 0x3ffc7ba8UL, 0xbe255559UL, + 0xbc8e76bbUL, 0x9406e7b5UL, 0x3ffc8f6dUL, 0x48805c44UL, 0x3c71acbcUL, + 0x5751c4dbUL, 0x3ffca340UL, 0xd10d08f5UL, 0xbc87f2beUL, 0xdcef9069UL, + 0x3ffcb720UL, 0xd1e949dbUL, 0x3c7503cbUL, 0x2e6d1675UL, 0x3ffccb0fUL, + 0x86009092UL, 0xbc7d220fUL, 0x555dc3faUL, 0x3ffcdf0bUL, 0x53829d72UL, + 0xbc8dd83bUL, 0x5b5bab74UL, 0x3ffcf315UL, 0xb86dff57UL, 0xbc9a08e9UL, + 0x4a07897cUL, 0x3ffd072dUL, 0x43797a9cUL, 0xbc9cbc37UL, 0x2b08c968UL, + 0x3ffd1b53UL, 0x219a36eeUL, 0x3c955636UL, 0x080d89f2UL, 0x3ffd2f87UL, + 0x719d8578UL, 0xbc9d487bUL, 0xeacaa1d6UL, 0x3ffd43c8UL, 0xbf5a1614UL, + 0x3c93db53UL, 0xdcfba487UL, 0x3ffd5818UL, 0xd75b3707UL, 0x3c82ed02UL, + 0xe862e6d3UL, 0x3ffd6c76UL, 0x4a8165a0UL, 0x3c5fe87aUL, 0x16c98398UL, + 0x3ffd80e3UL, 0x8beddfe8UL, 0xbc911ec1UL, 0x71ff6075UL, 0x3ffd955dUL, + 0xbb9af6beUL, 0x3c9a052dUL, 0x03db3285UL, 0x3ffda9e6UL, 0x696db532UL, + 0x3c9c2300UL, 0xd63a8315UL, 0x3ffdbe7cUL, 0x926b8be4UL, 0xbc9b76f1UL, + 0xf301b460UL, 0x3ffdd321UL, 0x78f018c3UL, 0x3c92da57UL, 0x641c0658UL, + 0x3ffde7d5UL, 0x8e79ba8fUL, 0xbc9ca552UL, 0x337b9b5fUL, 0x3ffdfc97UL, + 0x4f184b5cUL, 0xbc91a5cdUL, 0x6b197d17UL, 0x3ffe1167UL, 0xbd5c7f44UL, + 0xbc72b529UL, 0x14f5a129UL, 0x3ffe2646UL, 0x817a1496UL, 0xbc97b627UL, + 0x3b16ee12UL, 0x3ffe3b33UL, 0x31fdc68bUL, 0xbc99f4a4UL, 0xe78b3ff6UL, + 0x3ffe502eUL, 0x80a9cc8fUL, 0x3c839e89UL, 0x24676d76UL, 0x3ffe6539UL, + 0x7522b735UL, 0xbc863ff8UL, 0xfbc74c83UL, 0x3ffe7a51UL, 0xca0c8de2UL, + 0x3c92d522UL, 0x77cdb740UL, 0x3ffe8f79UL, 0x80b054b1UL, 0xbc910894UL, + 0xa2a490daUL, 0x3ffea4afUL, 0x179c2893UL, 0xbc9e9c23UL, 0x867cca6eUL, + 0x3ffeb9f4UL, 0x2293e4f2UL, 0x3c94832fUL, 0x2d8e67f1UL, 0x3ffecf48UL, + 0xb411ad8cUL, 0xbc9c93f3UL, 0xa2188510UL, 0x3ffee4aaUL, 0xa487568dUL, + 0x3c91c68dUL, 0xee615a27UL, 0x3ffefa1bUL, 0x86a4b6b0UL, 0x3c9dc7f4UL, + 0x1cb6412aUL, 0x3fff0f9cUL, 0x65181d45UL, 0xbc932200UL, 0x376bba97UL, + 0x3fff252bUL, 0xbf0d8e43UL, 0x3c93a1a5UL, 0x48dd7274UL, 0x3fff3ac9UL, + 0x3ed837deUL, 0xbc795a5aUL, 0x5b6e4540UL, 0x3fff5076UL, 0x2dd8a18bUL, + 0x3c99d3e1UL, 0x798844f8UL, 0x3fff6632UL, 0x3539343eUL, 0x3c9fa37bUL, + 0xad9cbe14UL, 0x3fff7bfdUL, 0xd006350aUL, 0xbc9dbb12UL, 0x02243c89UL, + 0x3fff91d8UL, 0xa779f689UL, 0xbc612ea8UL, 0x819e90d8UL, 0x3fffa7c1UL, + 0xf3a5931eUL, 0x3c874853UL, 0x3692d514UL, 0x3fffbdbaUL, 0x15098eb6UL, + 0xbc796773UL, 0x2b8f71f1UL, 0x3fffd3c2UL, 0x966579e7UL, 0x3c62eb74UL, + 0x6b2a23d9UL, 0x3fffe9d9UL, 0x7442fde3UL, 0x3c74a603UL +}; + +ALIGNED_(16) juint _e_coeff[] = +{ + 0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL, 0x6fba4e77UL, + 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL, 0xfefa39efUL, 0x3fe62e42UL, + 0x00000000UL, 0x00000000UL +}; + +ALIGNED_(16) juint _coeff_h[] = +{ + 0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL +}; + +ALIGNED_(16) juint _HIGHMASK_LOG_X[] = +{ + 0xf8000000UL, 0xffffffffUL, 0x00000000UL, 0xfffff800UL +}; + +ALIGNED_(8) juint _HALFMASK[] = +{ + 0xf8000000UL, 0xffffffffUL, 0xf8000000UL, 0xffffffffUL +}; + +ALIGNED_(16) juint _coeff_pow[] = +{ + 0x6dc96112UL, 0xbf836578UL, 0xee241472UL, 0xbf9b0301UL, 0x9f95985aUL, + 0xbfb528dbUL, 0xb3841d2aUL, 0xbfd619b6UL, 0x518775e3UL, 0x3f9004f2UL, + 0xac8349bbUL, 0x3fa76c9bUL, 0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, + 0xbf5dabe1UL, 0x9f95985aUL, 0xbfb528dbUL, 0xf8b5787dUL, 0x3ef2531eUL, + 0x486ececbUL, 0x3fc4635eUL, 0x412055ccUL, 0xbdd61bb2UL +}; + +ALIGNED_(16) juint _L_tbl_pow[] = +{ + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x20000000UL, + 0x3feff00aUL, 0x96621f95UL, 0x3e5b1856UL, 0xe0000000UL, 0x3fefe019UL, + 0xe5916f9eUL, 0xbe325278UL, 0x00000000UL, 0x3fefd02fUL, 0x859a1062UL, + 0x3e595fb7UL, 0xc0000000UL, 0x3fefc049UL, 0xb245f18fUL, 0xbe529c38UL, + 0xe0000000UL, 0x3fefb069UL, 0xad2880a7UL, 0xbe501230UL, 0x60000000UL, + 0x3fefa08fUL, 0xc8e72420UL, 0x3e597bd1UL, 0x80000000UL, 0x3fef90baUL, + 0xc30c4500UL, 0xbe5d6c75UL, 0xe0000000UL, 0x3fef80eaUL, 0x02c63f43UL, + 0x3e2e1318UL, 0xc0000000UL, 0x3fef7120UL, 0xb3d4ccccUL, 0xbe44c52aUL, + 0x00000000UL, 0x3fef615cUL, 0xdbd91397UL, 0xbe4e7d6cUL, 0xa0000000UL, + 0x3fef519cUL, 0x65c5cd68UL, 0xbe522dc8UL, 0xa0000000UL, 0x3fef41e2UL, + 0x46d1306cUL, 0xbe5a840eUL, 0xe0000000UL, 0x3fef322dUL, 0xd2980e94UL, + 0x3e5071afUL, 0xa0000000UL, 0x3fef227eUL, 0x773abadeUL, 0xbe5891e5UL, + 0xa0000000UL, 0x3fef12d4UL, 0xdc6bf46bUL, 0xbe5cccbeUL, 0xe0000000UL, + 0x3fef032fUL, 0xbc7247faUL, 0xbe2bab83UL, 0x80000000UL, 0x3feef390UL, + 0xbcaa1e46UL, 0xbe53bb3bUL, 0x60000000UL, 0x3feee3f6UL, 0x5f6c682dUL, + 0xbe54c619UL, 0x80000000UL, 0x3feed461UL, 0x5141e368UL, 0xbe4b6d86UL, + 0xe0000000UL, 0x3feec4d1UL, 0xec678f76UL, 0xbe369af6UL, 0x80000000UL, + 0x3feeb547UL, 0x41301f55UL, 0xbe2d4312UL, 0x60000000UL, 0x3feea5c2UL, + 0x676da6bdUL, 0xbe4d8dd0UL, 0x60000000UL, 0x3fee9642UL, 0x57a891c4UL, + 0x3e51f991UL, 0xa0000000UL, 0x3fee86c7UL, 0xe4eb491eUL, 0x3e579bf9UL, + 0x20000000UL, 0x3fee7752UL, 0xfddc4a2cUL, 0xbe3356e6UL, 0xc0000000UL, + 0x3fee67e1UL, 0xd75b5bf1UL, 0xbe449531UL, 0x80000000UL, 0x3fee5876UL, + 0xbd423b8eUL, 0x3df54fe4UL, 0x60000000UL, 0x3fee4910UL, 0x330e51b9UL, + 0x3e54289cUL, 0x80000000UL, 0x3fee39afUL, 0x8651a95fUL, 0xbe55aad6UL, + 0xa0000000UL, 0x3fee2a53UL, 0x5e98c708UL, 0xbe2fc4a9UL, 0xe0000000UL, + 0x3fee1afcUL, 0x0989328dUL, 0x3e23958cUL, 0x40000000UL, 0x3fee0babUL, + 0xee642abdUL, 0xbe425dd8UL, 0xa0000000UL, 0x3fedfc5eUL, 0xc394d236UL, + 0x3e526362UL, 0x20000000UL, 0x3feded17UL, 0xe104aa8eUL, 0x3e4ce247UL, + 0xc0000000UL, 0x3fedddd4UL, 0x265a9be4UL, 0xbe5bb77aUL, 0x40000000UL, + 0x3fedce97UL, 0x0ecac52fUL, 0x3e4a7cb1UL, 0xe0000000UL, 0x3fedbf5eUL, + 0x124cb3b8UL, 0x3e257024UL, 0x80000000UL, 0x3fedb02bUL, 0xe6d4febeUL, + 0xbe2033eeUL, 0x20000000UL, 0x3feda0fdUL, 0x39cca00eUL, 0xbe3ddabcUL, + 0xc0000000UL, 0x3fed91d3UL, 0xef8a552aUL, 0xbe543390UL, 0x40000000UL, + 0x3fed82afUL, 0xb8e85204UL, 0x3e513850UL, 0xe0000000UL, 0x3fed738fUL, + 0x3d59fe08UL, 0xbe5db728UL, 0x40000000UL, 0x3fed6475UL, 0x3aa7ead1UL, + 0x3e58804bUL, 0xc0000000UL, 0x3fed555fUL, 0xf8a35ba9UL, 0xbe5298b0UL, + 0x00000000UL, 0x3fed464fUL, 0x9a88dd15UL, 0x3e5a8cdbUL, 0x40000000UL, + 0x3fed3743UL, 0xb0b0a190UL, 0x3e598635UL, 0x80000000UL, 0x3fed283cUL, + 0xe2113295UL, 0xbe5c1119UL, 0x80000000UL, 0x3fed193aUL, 0xafbf1728UL, + 0xbe492e9cUL, 0x60000000UL, 0x3fed0a3dUL, 0xe4a4ccf3UL, 0x3e19b90eUL, + 0x20000000UL, 0x3fecfb45UL, 0xba3cbeb8UL, 0x3e406b50UL, 0xc0000000UL, + 0x3fecec51UL, 0x110f7dddUL, 0x3e0d6806UL, 0x40000000UL, 0x3fecdd63UL, + 0x7dd7d508UL, 0xbe5a8943UL, 0x80000000UL, 0x3fecce79UL, 0x9b60f271UL, + 0xbe50676aUL, 0x80000000UL, 0x3fecbf94UL, 0x0b9ad660UL, 0x3e59174fUL, + 0x60000000UL, 0x3fecb0b4UL, 0x00823d9cUL, 0x3e5bbf72UL, 0x20000000UL, + 0x3feca1d9UL, 0x38a6ec89UL, 0xbe4d38f9UL, 0x80000000UL, 0x3fec9302UL, + 0x3a0b7d8eUL, 0x3e53dbfdUL, 0xc0000000UL, 0x3fec8430UL, 0xc6826b34UL, + 0xbe27c5c9UL, 0xc0000000UL, 0x3fec7563UL, 0x0c706381UL, 0xbe593653UL, + 0x60000000UL, 0x3fec669bUL, 0x7df34ec7UL, 0x3e461ab5UL, 0xe0000000UL, + 0x3fec57d7UL, 0x40e5e7e8UL, 0xbe5c3daeUL, 0x00000000UL, 0x3fec4919UL, + 0x5602770fUL, 0xbe55219dUL, 0xc0000000UL, 0x3fec3a5eUL, 0xec7911ebUL, + 0x3e5a5d25UL, 0x60000000UL, 0x3fec2ba9UL, 0xb39ea225UL, 0xbe53c00bUL, + 0x80000000UL, 0x3fec1cf8UL, 0x967a212eUL, 0x3e5a8ddfUL, 0x60000000UL, + 0x3fec0e4cUL, 0x580798bdUL, 0x3e5f53abUL, 0x00000000UL, 0x3febffa5UL, + 0xb8282df6UL, 0xbe46b874UL, 0x20000000UL, 0x3febf102UL, 0xe33a6729UL, + 0x3e54963fUL, 0x00000000UL, 0x3febe264UL, 0x3b53e88aUL, 0xbe3adce1UL, + 0x60000000UL, 0x3febd3caUL, 0xc2585084UL, 0x3e5cde9fUL, 0x80000000UL, + 0x3febc535UL, 0xa335c5eeUL, 0xbe39fd9cUL, 0x20000000UL, 0x3febb6a5UL, + 0x7325b04dUL, 0x3e42ba15UL, 0x60000000UL, 0x3feba819UL, 0x1564540fUL, + 0x3e3a9f35UL, 0x40000000UL, 0x3feb9992UL, 0x83fff592UL, 0xbe5465ceUL, + 0xa0000000UL, 0x3feb8b0fUL, 0xb9da63d3UL, 0xbe4b1a0aUL, 0x80000000UL, + 0x3feb7c91UL, 0x6d6f1ea4UL, 0x3e557657UL, 0x00000000UL, 0x3feb6e18UL, + 0x5e80a1bfUL, 0x3e4ddbb6UL, 0x00000000UL, 0x3feb5fa3UL, 0x1c9eacb5UL, + 0x3e592877UL, 0xa0000000UL, 0x3feb5132UL, 0x6d40beb3UL, 0xbe51858cUL, + 0xa0000000UL, 0x3feb42c6UL, 0xd740c67bUL, 0x3e427ad2UL, 0x40000000UL, + 0x3feb345fUL, 0xa3e0cceeUL, 0xbe5c2fc4UL, 0x40000000UL, 0x3feb25fcUL, + 0x8e752b50UL, 0xbe3da3c2UL, 0xc0000000UL, 0x3feb179dUL, 0xa892e7deUL, + 0x3e1fb481UL, 0xc0000000UL, 0x3feb0943UL, 0x21ed71e9UL, 0xbe365206UL, + 0x20000000UL, 0x3feafaeeUL, 0x0e1380a3UL, 0x3e5c5b7bUL, 0x20000000UL, + 0x3feaec9dUL, 0x3c3d640eUL, 0xbe5dbbd0UL, 0x60000000UL, 0x3feade50UL, + 0x8f97a715UL, 0x3e3a8ec5UL, 0x20000000UL, 0x3fead008UL, 0x23ab2839UL, + 0x3e2fe98aUL, 0x40000000UL, 0x3feac1c4UL, 0xf4bbd50fUL, 0x3e54d8f6UL, + 0xe0000000UL, 0x3feab384UL, 0x14757c4dUL, 0xbe48774cUL, 0xc0000000UL, + 0x3feaa549UL, 0x7c7b0eeaUL, 0x3e5b51bbUL, 0x20000000UL, 0x3fea9713UL, + 0xf56f7013UL, 0x3e386200UL, 0xe0000000UL, 0x3fea88e0UL, 0xbe428ebeUL, + 0xbe514af5UL, 0xe0000000UL, 0x3fea7ab2UL, 0x8d0e4496UL, 0x3e4f9165UL, + 0x60000000UL, 0x3fea6c89UL, 0xdbacc5d5UL, 0xbe5c063bUL, 0x20000000UL, + 0x3fea5e64UL, 0x3f19d970UL, 0xbe5a0c8cUL, 0x20000000UL, 0x3fea5043UL, + 0x09ea3e6bUL, 0x3e5065dcUL, 0x80000000UL, 0x3fea4226UL, 0x78df246cUL, + 0x3e5e05f6UL, 0x40000000UL, 0x3fea340eUL, 0x4057d4a0UL, 0x3e431b2bUL, + 0x40000000UL, 0x3fea25faUL, 0x82867bb5UL, 0x3e4b76beUL, 0xa0000000UL, + 0x3fea17eaUL, 0x9436f40aUL, 0xbe5aad39UL, 0x20000000UL, 0x3fea09dfUL, + 0x4b5253b3UL, 0x3e46380bUL, 0x00000000UL, 0x3fe9fbd8UL, 0x8fc52466UL, + 0xbe386f9bUL, 0x20000000UL, 0x3fe9edd5UL, 0x22d3f344UL, 0xbe538347UL, + 0x60000000UL, 0x3fe9dfd6UL, 0x1ac33522UL, 0x3e5dbc53UL, 0x00000000UL, + 0x3fe9d1dcUL, 0xeabdff1dUL, 0x3e40fc0cUL, 0xe0000000UL, 0x3fe9c3e5UL, + 0xafd30e73UL, 0xbe585e63UL, 0xe0000000UL, 0x3fe9b5f3UL, 0xa52f226aUL, + 0xbe43e8f9UL, 0x20000000UL, 0x3fe9a806UL, 0xecb8698dUL, 0xbe515b36UL, + 0x80000000UL, 0x3fe99a1cUL, 0xf2b4e89dUL, 0x3e48b62bUL, 0x20000000UL, + 0x3fe98c37UL, 0x7c9a88fbUL, 0x3e44414cUL, 0x00000000UL, 0x3fe97e56UL, + 0xda015741UL, 0xbe5d13baUL, 0xe0000000UL, 0x3fe97078UL, 0x5fdace06UL, + 0x3e51b947UL, 0x00000000UL, 0x3fe962a0UL, 0x956ca094UL, 0x3e518785UL, + 0x40000000UL, 0x3fe954cbUL, 0x01164c1dUL, 0x3e5d5b57UL, 0xc0000000UL, + 0x3fe946faUL, 0xe63b3767UL, 0xbe4f84e7UL, 0x40000000UL, 0x3fe9392eUL, + 0xe57cc2a9UL, 0x3e34eda3UL, 0xe0000000UL, 0x3fe92b65UL, 0x8c75b544UL, + 0x3e5766a0UL, 0xc0000000UL, 0x3fe91da1UL, 0x37d1d087UL, 0xbe5e2ab1UL, + 0x80000000UL, 0x3fe90fe1UL, 0xa953dc20UL, 0x3e5fa1f3UL, 0x80000000UL, + 0x3fe90225UL, 0xdbd3f369UL, 0x3e47d6dbUL, 0xa0000000UL, 0x3fe8f46dUL, + 0x1c9be989UL, 0xbe5e2b0aUL, 0xa0000000UL, 0x3fe8e6b9UL, 0x3c93d76aUL, + 0x3e5c8618UL, 0xe0000000UL, 0x3fe8d909UL, 0x2182fc9aUL, 0xbe41aa9eUL, + 0x20000000UL, 0x3fe8cb5eUL, 0xe6b3539dUL, 0xbe530d19UL, 0x60000000UL, + 0x3fe8bdb6UL, 0x49e58cc3UL, 0xbe3bb374UL, 0xa0000000UL, 0x3fe8b012UL, + 0xa7cfeb8fUL, 0x3e56c412UL, 0x00000000UL, 0x3fe8a273UL, 0x8d52bc19UL, + 0x3e1429b8UL, 0x60000000UL, 0x3fe894d7UL, 0x4dc32c6cUL, 0xbe48604cUL, + 0xc0000000UL, 0x3fe8873fUL, 0x0c868e56UL, 0xbe564ee5UL, 0x00000000UL, + 0x3fe879acUL, 0x56aee828UL, 0x3e5e2fd8UL, 0x60000000UL, 0x3fe86c1cUL, + 0x7ceab8ecUL, 0x3e493365UL, 0xc0000000UL, 0x3fe85e90UL, 0x78d4dadcUL, + 0xbe4f7f25UL, 0x00000000UL, 0x3fe85109UL, 0x0ccd8280UL, 0x3e31e7a2UL, + 0x40000000UL, 0x3fe84385UL, 0x34ba4e15UL, 0x3e328077UL, 0x80000000UL, + 0x3fe83605UL, 0xa670975aUL, 0xbe53eee5UL, 0xa0000000UL, 0x3fe82889UL, + 0xf61b77b2UL, 0xbe43a20aUL, 0xa0000000UL, 0x3fe81b11UL, 0x13e6643bUL, + 0x3e5e5fe5UL, 0xc0000000UL, 0x3fe80d9dUL, 0x82cc94e8UL, 0xbe5ff1f9UL, + 0xa0000000UL, 0x3fe8002dUL, 0x8a0c9c5dUL, 0xbe42b0e7UL, 0x60000000UL, + 0x3fe7f2c1UL, 0x22a16f01UL, 0x3e5d9ea0UL, 0x20000000UL, 0x3fe7e559UL, + 0xc38cd451UL, 0x3e506963UL, 0xc0000000UL, 0x3fe7d7f4UL, 0x9902bc71UL, + 0x3e4503d7UL, 0x40000000UL, 0x3fe7ca94UL, 0xdef2a3c0UL, 0x3e3d98edUL, + 0xa0000000UL, 0x3fe7bd37UL, 0xed49abb0UL, 0x3e24c1ffUL, 0xe0000000UL, + 0x3fe7afdeUL, 0xe3b0be70UL, 0xbe40c467UL, 0x00000000UL, 0x3fe7a28aUL, + 0xaf9f193cUL, 0xbe5dff6cUL, 0xe0000000UL, 0x3fe79538UL, 0xb74cf6b6UL, + 0xbe258ed0UL, 0xa0000000UL, 0x3fe787ebUL, 0x1d9127c7UL, 0x3e345fb0UL, + 0x40000000UL, 0x3fe77aa2UL, 0x1028c21dUL, 0xbe4619bdUL, 0xa0000000UL, + 0x3fe76d5cUL, 0x7cb0b5e4UL, 0x3e40f1a2UL, 0xe0000000UL, 0x3fe7601aUL, + 0x2b1bc4adUL, 0xbe32e8bbUL, 0xe0000000UL, 0x3fe752dcUL, 0x6839f64eUL, + 0x3e41f57bUL, 0xc0000000UL, 0x3fe745a2UL, 0xc4121f7eUL, 0xbe52c40aUL, + 0x60000000UL, 0x3fe7386cUL, 0xd6852d72UL, 0xbe5c4e6bUL, 0xc0000000UL, + 0x3fe72b39UL, 0x91d690f7UL, 0xbe57f88fUL, 0xe0000000UL, 0x3fe71e0aUL, + 0x627a2159UL, 0xbe4425d5UL, 0xc0000000UL, 0x3fe710dfUL, 0x50a54033UL, + 0x3e422b7eUL, 0x60000000UL, 0x3fe703b8UL, 0x3b0b5f91UL, 0x3e5d3857UL, + 0xe0000000UL, 0x3fe6f694UL, 0x84d628a2UL, 0xbe51f090UL, 0x00000000UL, + 0x3fe6e975UL, 0x306d8894UL, 0xbe414d83UL, 0xe0000000UL, 0x3fe6dc58UL, + 0x30bf24aaUL, 0xbe4650caUL, 0x80000000UL, 0x3fe6cf40UL, 0xd4628d69UL, + 0xbe5db007UL, 0xc0000000UL, 0x3fe6c22bUL, 0xa2aae57bUL, 0xbe31d279UL, + 0xc0000000UL, 0x3fe6b51aUL, 0x860edf7eUL, 0xbe2d4c4aUL, 0x80000000UL, + 0x3fe6a80dUL, 0xf3559341UL, 0xbe5f7e98UL, 0xe0000000UL, 0x3fe69b03UL, + 0xa885899eUL, 0xbe5c2011UL, 0xe0000000UL, 0x3fe68dfdUL, 0x2bdc6d37UL, + 0x3e224a82UL, 0xa0000000UL, 0x3fe680fbUL, 0xc12ad1b9UL, 0xbe40cf56UL, + 0x00000000UL, 0x3fe673fdUL, 0x1bcdf659UL, 0xbdf52f2dUL, 0x00000000UL, + 0x3fe66702UL, 0x5df10408UL, 0x3e5663e0UL, 0xc0000000UL, 0x3fe65a0aUL, + 0xa4070568UL, 0xbe40b12fUL, 0x00000000UL, 0x3fe64d17UL, 0x71c54c47UL, + 0x3e5f5e8bUL, 0x00000000UL, 0x3fe64027UL, 0xbd4b7e83UL, 0x3e42ead6UL, + 0xa0000000UL, 0x3fe6333aUL, 0x61598bd2UL, 0xbe4c48d4UL, 0xc0000000UL, + 0x3fe62651UL, 0x6f538d61UL, 0x3e548401UL, 0xa0000000UL, 0x3fe6196cUL, + 0x14344120UL, 0xbe529af6UL, 0x00000000UL, 0x3fe60c8bUL, 0x5982c587UL, + 0xbe3e1e4fUL, 0x00000000UL, 0x3fe5ffadUL, 0xfe51d4eaUL, 0xbe4c897aUL, + 0x80000000UL, 0x3fe5f2d2UL, 0xfd46ebe1UL, 0x3e552e00UL, 0xa0000000UL, + 0x3fe5e5fbUL, 0xa4695699UL, 0x3e5ed471UL, 0x60000000UL, 0x3fe5d928UL, + 0x80d118aeUL, 0x3e456b61UL, 0xa0000000UL, 0x3fe5cc58UL, 0x304c330bUL, + 0x3e54dc29UL, 0x80000000UL, 0x3fe5bf8cUL, 0x0af2dedfUL, 0xbe3aa9bdUL, + 0xe0000000UL, 0x3fe5b2c3UL, 0x15fc9258UL, 0xbe479a37UL, 0xc0000000UL, + 0x3fe5a5feUL, 0x9292c7eaUL, 0x3e188650UL, 0x20000000UL, 0x3fe5993dUL, + 0x33b4d380UL, 0x3e5d6d93UL, 0x20000000UL, 0x3fe58c7fUL, 0x02fd16c7UL, + 0x3e2fe961UL, 0xa0000000UL, 0x3fe57fc4UL, 0x4a05edb6UL, 0xbe4d55b4UL, + 0xa0000000UL, 0x3fe5730dUL, 0x3d443abbUL, 0xbe5e6954UL, 0x00000000UL, + 0x3fe5665aUL, 0x024acfeaUL, 0x3e50e61bUL, 0x00000000UL, 0x3fe559aaUL, + 0xcc9edd09UL, 0xbe325403UL, 0x60000000UL, 0x3fe54cfdUL, 0x1fe26950UL, + 0x3e5d500eUL, 0x60000000UL, 0x3fe54054UL, 0x6c5ae164UL, 0xbe4a79b4UL, + 0xc0000000UL, 0x3fe533aeUL, 0x154b0287UL, 0xbe401571UL, 0xa0000000UL, + 0x3fe5270cUL, 0x0673f401UL, 0xbe56e56bUL, 0xe0000000UL, 0x3fe51a6dUL, + 0x751b639cUL, 0x3e235269UL, 0xa0000000UL, 0x3fe50dd2UL, 0x7c7b2bedUL, + 0x3ddec887UL, 0xc0000000UL, 0x3fe5013aUL, 0xafab4e17UL, 0x3e5e7575UL, + 0x60000000UL, 0x3fe4f4a6UL, 0x2e308668UL, 0x3e59aed6UL, 0x80000000UL, + 0x3fe4e815UL, 0xf33e2a76UL, 0xbe51f184UL, 0xe0000000UL, 0x3fe4db87UL, + 0x839f3e3eUL, 0x3e57db01UL, 0xc0000000UL, 0x3fe4cefdUL, 0xa9eda7bbUL, + 0x3e535e0fUL, 0x00000000UL, 0x3fe4c277UL, 0x2a8f66a5UL, 0x3e5ce451UL, + 0xc0000000UL, 0x3fe4b5f3UL, 0x05192456UL, 0xbe4e8518UL, 0xc0000000UL, + 0x3fe4a973UL, 0x4aa7cd1dUL, 0x3e46784aUL, 0x40000000UL, 0x3fe49cf7UL, + 0x8e23025eUL, 0xbe5749f2UL, 0x00000000UL, 0x3fe4907eUL, 0x18d30215UL, + 0x3e360f39UL, 0x20000000UL, 0x3fe48408UL, 0x63dcf2f3UL, 0x3e5e00feUL, + 0xc0000000UL, 0x3fe47795UL, 0x46182d09UL, 0xbe5173d9UL, 0xa0000000UL, + 0x3fe46b26UL, 0x8f0e62aaUL, 0xbe48f281UL, 0xe0000000UL, 0x3fe45ebaUL, + 0x5775c40cUL, 0xbe56aad4UL, 0x60000000UL, 0x3fe45252UL, 0x0fe25f69UL, + 0x3e48bd71UL, 0x40000000UL, 0x3fe445edUL, 0xe9989ec5UL, 0x3e590d97UL, + 0x80000000UL, 0x3fe4398bUL, 0xb3d9ffe3UL, 0x3e479dbcUL, 0x20000000UL, + 0x3fe42d2dUL, 0x388e4d2eUL, 0xbe5eed80UL, 0xe0000000UL, 0x3fe420d1UL, + 0x6f797c18UL, 0x3e554b4cUL, 0x20000000UL, 0x3fe4147aUL, 0x31048bb4UL, + 0xbe5b1112UL, 0x80000000UL, 0x3fe40825UL, 0x2efba4f9UL, 0x3e48ebc7UL, + 0x40000000UL, 0x3fe3fbd4UL, 0x50201119UL, 0x3e40b701UL, 0x40000000UL, + 0x3fe3ef86UL, 0x0a4db32cUL, 0x3e551de8UL, 0xa0000000UL, 0x3fe3e33bUL, + 0x0c9c148bUL, 0xbe50c1f6UL, 0x20000000UL, 0x3fe3d6f4UL, 0xc9129447UL, + 0x3e533fa0UL, 0x00000000UL, 0x3fe3cab0UL, 0xaae5b5a0UL, 0xbe22b68eUL, + 0x20000000UL, 0x3fe3be6fUL, 0x02305e8aUL, 0xbe54fc08UL, 0x60000000UL, + 0x3fe3b231UL, 0x7f908258UL, 0x3e57dc05UL, 0x00000000UL, 0x3fe3a5f7UL, + 0x1a09af78UL, 0x3e08038bUL, 0xe0000000UL, 0x3fe399bfUL, 0x490643c1UL, + 0xbe5dbe42UL, 0xe0000000UL, 0x3fe38d8bUL, 0x5e8ad724UL, 0xbe3c2b72UL, + 0x20000000UL, 0x3fe3815bUL, 0xc67196b6UL, 0x3e1713cfUL, 0xa0000000UL, + 0x3fe3752dUL, 0x6182e429UL, 0xbe3ec14cUL, 0x40000000UL, 0x3fe36903UL, + 0xab6eb1aeUL, 0x3e5a2cc5UL, 0x40000000UL, 0x3fe35cdcUL, 0xfe5dc064UL, + 0xbe5c5878UL, 0x40000000UL, 0x3fe350b8UL, 0x0ba6b9e4UL, 0x3e51619bUL, + 0x80000000UL, 0x3fe34497UL, 0x857761aaUL, 0x3e5fff53UL, 0x00000000UL, + 0x3fe3387aUL, 0xf872d68cUL, 0x3e484f4dUL, 0xa0000000UL, 0x3fe32c5fUL, + 0x087e97c2UL, 0x3e52842eUL, 0x80000000UL, 0x3fe32048UL, 0x73d6d0c0UL, + 0xbe503edfUL, 0x80000000UL, 0x3fe31434UL, 0x0c1456a1UL, 0xbe5f72adUL, + 0xa0000000UL, 0x3fe30823UL, 0x83a1a4d5UL, 0xbe5e65ccUL, 0xe0000000UL, + 0x3fe2fc15UL, 0x855a7390UL, 0xbe506438UL, 0x40000000UL, 0x3fe2f00bUL, + 0xa2898287UL, 0x3e3d22a2UL, 0xe0000000UL, 0x3fe2e403UL, 0x8b56f66fUL, + 0xbe5aa5fdUL, 0x80000000UL, 0x3fe2d7ffUL, 0x52db119aUL, 0x3e3a2e3dUL, + 0x60000000UL, 0x3fe2cbfeUL, 0xe2ddd4c0UL, 0xbe586469UL, 0x40000000UL, + 0x3fe2c000UL, 0x6b01bf10UL, 0x3e352b9dUL, 0x40000000UL, 0x3fe2b405UL, + 0xb07a1cdfUL, 0x3e5c5cdaUL, 0x80000000UL, 0x3fe2a80dUL, 0xc7b5f868UL, + 0xbe5668b3UL, 0xc0000000UL, 0x3fe29c18UL, 0x185edf62UL, 0xbe563d66UL, + 0x00000000UL, 0x3fe29027UL, 0xf729e1ccUL, 0x3e59a9a0UL, 0x80000000UL, + 0x3fe28438UL, 0x6433c727UL, 0xbe43cc89UL, 0x00000000UL, 0x3fe2784dUL, + 0x41782631UL, 0xbe30750cUL, 0xa0000000UL, 0x3fe26c64UL, 0x914911b7UL, + 0xbe58290eUL, 0x40000000UL, 0x3fe2607fUL, 0x3dcc73e1UL, 0xbe4269cdUL, + 0x00000000UL, 0x3fe2549dUL, 0x2751bf70UL, 0xbe5a6998UL, 0xc0000000UL, + 0x3fe248bdUL, 0x4248b9fbUL, 0xbe4ddb00UL, 0x80000000UL, 0x3fe23ce1UL, + 0xf35cf82fUL, 0x3e561b71UL, 0x60000000UL, 0x3fe23108UL, 0x8e481a2dUL, + 0x3e518fb9UL, 0x60000000UL, 0x3fe22532UL, 0x5ab96edcUL, 0xbe5fafc5UL, + 0x40000000UL, 0x3fe2195fUL, 0x80943911UL, 0xbe07f819UL, 0x40000000UL, + 0x3fe20d8fUL, 0x386f2d6cUL, 0xbe54ba8bUL, 0x40000000UL, 0x3fe201c2UL, + 0xf29664acUL, 0xbe5eb815UL, 0x20000000UL, 0x3fe1f5f8UL, 0x64f03390UL, + 0x3e5e320cUL, 0x20000000UL, 0x3fe1ea31UL, 0x747ff696UL, 0x3e5ef0a5UL, + 0x40000000UL, 0x3fe1de6dUL, 0x3e9ceb51UL, 0xbe5f8d27UL, 0x20000000UL, + 0x3fe1d2acUL, 0x4ae0b55eUL, 0x3e5faa21UL, 0x20000000UL, 0x3fe1c6eeUL, + 0x28569a5eUL, 0x3e598a4fUL, 0x20000000UL, 0x3fe1bb33UL, 0x54b33e07UL, + 0x3e46130aUL, 0x20000000UL, 0x3fe1af7bUL, 0x024f1078UL, 0xbe4dbf93UL, + 0x00000000UL, 0x3fe1a3c6UL, 0xb0783bfaUL, 0x3e419248UL, 0xe0000000UL, + 0x3fe19813UL, 0x2f02b836UL, 0x3e4e02b7UL, 0xc0000000UL, 0x3fe18c64UL, + 0x28dec9d4UL, 0x3e09064fUL, 0x80000000UL, 0x3fe180b8UL, 0x45cbf406UL, + 0x3e5b1f46UL, 0x40000000UL, 0x3fe1750fUL, 0x03d9964cUL, 0x3e5b0a79UL, + 0x00000000UL, 0x3fe16969UL, 0x8b5b882bUL, 0xbe238086UL, 0xa0000000UL, + 0x3fe15dc5UL, 0x73bad6f8UL, 0xbdf1fca4UL, 0x20000000UL, 0x3fe15225UL, + 0x5385769cUL, 0x3e5e8d76UL, 0xa0000000UL, 0x3fe14687UL, 0x1676dc6bUL, + 0x3e571d08UL, 0x20000000UL, 0x3fe13aedUL, 0xa8c41c7fUL, 0xbe598a25UL, + 0x60000000UL, 0x3fe12f55UL, 0xc4e1aaf0UL, 0x3e435277UL, 0xa0000000UL, + 0x3fe123c0UL, 0x403638e1UL, 0xbe21aa7cUL, 0xc0000000UL, 0x3fe1182eUL, + 0x557a092bUL, 0xbdd0116bUL, 0xc0000000UL, 0x3fe10c9fUL, 0x7d779f66UL, + 0x3e4a61baUL, 0xc0000000UL, 0x3fe10113UL, 0x2b09c645UL, 0xbe5d586eUL, + 0x20000000UL, 0x3fe0ea04UL, 0xea2cad46UL, 0x3e5aa97cUL, 0x20000000UL, + 0x3fe0d300UL, 0x23190e54UL, 0x3e50f1a7UL, 0xa0000000UL, 0x3fe0bc07UL, + 0x1379a5a6UL, 0xbe51619dUL, 0x60000000UL, 0x3fe0a51aUL, 0x926a3d4aUL, + 0x3e5cf019UL, 0xa0000000UL, 0x3fe08e38UL, 0xa8c24358UL, 0x3e35241eUL, + 0x20000000UL, 0x3fe07762UL, 0x24317e7aUL, 0x3e512cfaUL, 0x00000000UL, + 0x3fe06097UL, 0xfd9cf274UL, 0xbe55bef3UL, 0x00000000UL, 0x3fe049d7UL, + 0x3689b49dUL, 0xbe36d26dUL, 0x40000000UL, 0x3fe03322UL, 0xf72ef6c4UL, + 0xbe54cd08UL, 0xa0000000UL, 0x3fe01c78UL, 0x23702d2dUL, 0xbe5900bfUL, + 0x00000000UL, 0x3fe005daUL, 0x3f59c14cUL, 0x3e57d80bUL, 0x40000000UL, + 0x3fdfde8dUL, 0xad67766dUL, 0xbe57fad4UL, 0x40000000UL, 0x3fdfb17cUL, + 0x644f4ae7UL, 0x3e1ee43bUL, 0x40000000UL, 0x3fdf8481UL, 0x903234d2UL, + 0x3e501a86UL, 0x40000000UL, 0x3fdf579cUL, 0xafe9e509UL, 0xbe267c3eUL, + 0x00000000UL, 0x3fdf2acdUL, 0xb7dfda0bUL, 0xbe48149bUL, 0x40000000UL, + 0x3fdefe13UL, 0x3b94305eUL, 0x3e5f4ea7UL, 0x80000000UL, 0x3fded16fUL, + 0x5d95da61UL, 0xbe55c198UL, 0x00000000UL, 0x3fdea4e1UL, 0x406960c9UL, + 0xbdd99a19UL, 0x00000000UL, 0x3fde7868UL, 0xd22f3539UL, 0x3e470c78UL, + 0x80000000UL, 0x3fde4c04UL, 0x83eec535UL, 0xbe3e1232UL, 0x40000000UL, + 0x3fde1fb6UL, 0x3dfbffcbUL, 0xbe4b7d71UL, 0x40000000UL, 0x3fddf37dUL, + 0x7e1be4e0UL, 0xbe5b8f8fUL, 0x40000000UL, 0x3fddc759UL, 0x46dae887UL, + 0xbe350458UL, 0x80000000UL, 0x3fdd9b4aUL, 0xed6ecc49UL, 0xbe5f0045UL, + 0x80000000UL, 0x3fdd6f50UL, 0x2e9e883cUL, 0x3e2915daUL, 0x80000000UL, + 0x3fdd436bUL, 0xf0bccb32UL, 0x3e4a68c9UL, 0x80000000UL, 0x3fdd179bUL, + 0x9bbfc779UL, 0xbe54a26aUL, 0x00000000UL, 0x3fdcebe0UL, 0x7cea33abUL, + 0x3e43c6b7UL, 0x40000000UL, 0x3fdcc039UL, 0xe740fd06UL, 0x3e5526c2UL, + 0x40000000UL, 0x3fdc94a7UL, 0x9eadeb1aUL, 0xbe396d8dUL, 0xc0000000UL, + 0x3fdc6929UL, 0xf0a8f95aUL, 0xbe5c0ab2UL, 0x80000000UL, 0x3fdc3dc0UL, + 0x6ee2693bUL, 0x3e0992e6UL, 0xc0000000UL, 0x3fdc126bUL, 0x5ac6b581UL, + 0xbe2834b6UL, 0x40000000UL, 0x3fdbe72bUL, 0x8cc226ffUL, 0x3e3596a6UL, + 0x00000000UL, 0x3fdbbbffUL, 0xf92a74bbUL, 0x3e3c5813UL, 0x00000000UL, + 0x3fdb90e7UL, 0x479664c0UL, 0xbe50d644UL, 0x00000000UL, 0x3fdb65e3UL, + 0x5004975bUL, 0xbe55258fUL, 0x00000000UL, 0x3fdb3af3UL, 0xe4b23194UL, + 0xbe588407UL, 0xc0000000UL, 0x3fdb1016UL, 0xe65d4d0aUL, 0x3e527c26UL, + 0x80000000UL, 0x3fdae54eUL, 0x814fddd6UL, 0x3e5962a2UL, 0x40000000UL, + 0x3fdaba9aUL, 0xe19d0913UL, 0xbe562f4eUL, 0x80000000UL, 0x3fda8ff9UL, + 0x43cfd006UL, 0xbe4cfdebUL, 0x40000000UL, 0x3fda656cUL, 0x686f0a4eUL, + 0x3e5e47a8UL, 0xc0000000UL, 0x3fda3af2UL, 0x7200d410UL, 0x3e5e1199UL, + 0xc0000000UL, 0x3fda108cUL, 0xabd2266eUL, 0x3e5ee4d1UL, 0x40000000UL, + 0x3fd9e63aUL, 0x396f8f2cUL, 0x3e4dbffbUL, 0x00000000UL, 0x3fd9bbfbUL, + 0xe32b25ddUL, 0x3e5c3a54UL, 0x40000000UL, 0x3fd991cfUL, 0x431e4035UL, + 0xbe457925UL, 0x80000000UL, 0x3fd967b6UL, 0x7bed3dd3UL, 0x3e40c61dUL, + 0x00000000UL, 0x3fd93db1UL, 0xd7449365UL, 0x3e306419UL, 0x80000000UL, + 0x3fd913beUL, 0x1746e791UL, 0x3e56fcfcUL, 0x40000000UL, 0x3fd8e9dfUL, + 0xf3a9028bUL, 0xbe5041b9UL, 0xc0000000UL, 0x3fd8c012UL, 0x56840c50UL, + 0xbe26e20aUL, 0x40000000UL, 0x3fd89659UL, 0x19763102UL, 0xbe51f466UL, + 0x80000000UL, 0x3fd86cb2UL, 0x7032de7cUL, 0xbe4d298aUL, 0x80000000UL, + 0x3fd8431eUL, 0xdeb39fabUL, 0xbe4361ebUL, 0x40000000UL, 0x3fd8199dUL, + 0x5d01cbe0UL, 0xbe5425b3UL, 0x80000000UL, 0x3fd7f02eUL, 0x3ce99aa9UL, + 0x3e146fa8UL, 0x80000000UL, 0x3fd7c6d2UL, 0xd1a262b9UL, 0xbe5a1a69UL, + 0xc0000000UL, 0x3fd79d88UL, 0x8606c236UL, 0x3e423a08UL, 0x80000000UL, + 0x3fd77451UL, 0x8fd1e1b7UL, 0x3e5a6a63UL, 0xc0000000UL, 0x3fd74b2cUL, + 0xe491456aUL, 0x3e42c1caUL, 0x40000000UL, 0x3fd7221aUL, 0x4499a6d7UL, + 0x3e36a69aUL, 0x00000000UL, 0x3fd6f91aUL, 0x5237df94UL, 0xbe0f8f02UL, + 0x00000000UL, 0x3fd6d02cUL, 0xb6482c6eUL, 0xbe5abcf7UL, 0x00000000UL, + 0x3fd6a750UL, 0x1919fd61UL, 0xbe57ade2UL, 0x00000000UL, 0x3fd67e86UL, + 0xaa7a994dUL, 0xbe3f3fbdUL, 0x00000000UL, 0x3fd655ceUL, 0x67db014cUL, + 0x3e33c550UL, 0x00000000UL, 0x3fd62d28UL, 0xa82856b7UL, 0xbe1409d1UL, + 0xc0000000UL, 0x3fd60493UL, 0x1e6a300dUL, 0x3e55d899UL, 0x80000000UL, + 0x3fd5dc11UL, 0x1222bd5cUL, 0xbe35bfc0UL, 0xc0000000UL, 0x3fd5b3a0UL, + 0x6e8dc2d3UL, 0x3e5d4d79UL, 0x00000000UL, 0x3fd58b42UL, 0xe0e4ace6UL, + 0xbe517303UL, 0x80000000UL, 0x3fd562f4UL, 0xb306e0a8UL, 0x3e5edf0fUL, + 0xc0000000UL, 0x3fd53ab8UL, 0x6574bc54UL, 0x3e5ee859UL, 0x80000000UL, + 0x3fd5128eUL, 0xea902207UL, 0x3e5f6188UL, 0xc0000000UL, 0x3fd4ea75UL, + 0x9f911d79UL, 0x3e511735UL, 0x80000000UL, 0x3fd4c26eUL, 0xf9c77397UL, + 0xbe5b1643UL, 0x40000000UL, 0x3fd49a78UL, 0x15fc9258UL, 0x3e479a37UL, + 0x80000000UL, 0x3fd47293UL, 0xd5a04dd9UL, 0xbe426e56UL, 0xc0000000UL, + 0x3fd44abfUL, 0xe04042f5UL, 0x3e56f7c6UL, 0x40000000UL, 0x3fd422fdUL, + 0x1d8bf2c8UL, 0x3e5d8810UL, 0x00000000UL, 0x3fd3fb4cUL, 0x88a8ddeeUL, + 0xbe311454UL, 0xc0000000UL, 0x3fd3d3abUL, 0x3e3b5e47UL, 0xbe5d1b72UL, + 0x40000000UL, 0x3fd3ac1cUL, 0xc2ab5d59UL, 0x3e31b02bUL, 0xc0000000UL, + 0x3fd3849dUL, 0xd4e34b9eUL, 0x3e51cb2fUL, 0x40000000UL, 0x3fd35d30UL, + 0x177204fbUL, 0xbe2b8cd7UL, 0x80000000UL, 0x3fd335d3UL, 0xfcd38c82UL, + 0xbe4356e1UL, 0x80000000UL, 0x3fd30e87UL, 0x64f54accUL, 0xbe4e6224UL, + 0x00000000UL, 0x3fd2e74cUL, 0xaa7975d9UL, 0x3e5dc0feUL, 0x80000000UL, + 0x3fd2c021UL, 0x516dab3fUL, 0xbe50ffa3UL, 0x40000000UL, 0x3fd29907UL, + 0x2bfb7313UL, 0x3e5674a2UL, 0xc0000000UL, 0x3fd271fdUL, 0x0549fc99UL, + 0x3e385d29UL, 0xc0000000UL, 0x3fd24b04UL, 0x55b63073UL, 0xbe500c6dUL, + 0x00000000UL, 0x3fd2241cUL, 0x3f91953aUL, 0x3e389977UL, 0xc0000000UL, + 0x3fd1fd43UL, 0xa1543f71UL, 0xbe3487abUL, 0xc0000000UL, 0x3fd1d67bUL, + 0x4ec8867cUL, 0x3df6a2dcUL, 0x00000000UL, 0x3fd1afc4UL, 0x4328e3bbUL, + 0x3e41d9c0UL, 0x80000000UL, 0x3fd1891cUL, 0x2e1cda84UL, 0x3e3bdd87UL, + 0x40000000UL, 0x3fd16285UL, 0x4b5331aeUL, 0xbe53128eUL, 0x00000000UL, + 0x3fd13bfeUL, 0xb9aec164UL, 0xbe52ac98UL, 0xc0000000UL, 0x3fd11586UL, + 0xd91e1316UL, 0xbe350630UL, 0x80000000UL, 0x3fd0ef1fUL, 0x7cacc12cUL, + 0x3e3f5219UL, 0x40000000UL, 0x3fd0c8c8UL, 0xbce277b7UL, 0x3e3d30c0UL, + 0x00000000UL, 0x3fd0a281UL, 0x2a63447dUL, 0xbe541377UL, 0x80000000UL, + 0x3fd07c49UL, 0xfac483b5UL, 0xbe5772ecUL, 0xc0000000UL, 0x3fd05621UL, + 0x36b8a570UL, 0xbe4fd4bdUL, 0xc0000000UL, 0x3fd03009UL, 0xbae505f7UL, + 0xbe450388UL, 0x80000000UL, 0x3fd00a01UL, 0x3e35aeadUL, 0xbe5430fcUL, + 0x80000000UL, 0x3fcfc811UL, 0x707475acUL, 0x3e38806eUL, 0x80000000UL, + 0x3fcf7c3fUL, 0xc91817fcUL, 0xbe40cceaUL, 0x80000000UL, 0x3fcf308cUL, + 0xae05d5e9UL, 0xbe4919b8UL, 0x80000000UL, 0x3fcee4f8UL, 0xae6cc9e6UL, + 0xbe530b94UL, 0x00000000UL, 0x3fce9983UL, 0x1efe3e8eUL, 0x3e57747eUL, + 0x00000000UL, 0x3fce4e2dUL, 0xda78d9bfUL, 0xbe59a608UL, 0x00000000UL, + 0x3fce02f5UL, 0x8abe2c2eUL, 0x3e4a35adUL, 0x00000000UL, 0x3fcdb7dcUL, + 0x1495450dUL, 0xbe0872ccUL, 0x80000000UL, 0x3fcd6ce1UL, 0x86ee0ba0UL, + 0xbe4f59a0UL, 0x00000000UL, 0x3fcd2205UL, 0xe81ca888UL, 0x3e5402c3UL, + 0x00000000UL, 0x3fccd747UL, 0x3b4424b9UL, 0x3e5dfdc3UL, 0x80000000UL, + 0x3fcc8ca7UL, 0xd305b56cUL, 0x3e202da6UL, 0x00000000UL, 0x3fcc4226UL, + 0x399a6910UL, 0xbe482a1cUL, 0x80000000UL, 0x3fcbf7c2UL, 0x747f7938UL, + 0xbe587372UL, 0x80000000UL, 0x3fcbad7cUL, 0x6fc246a0UL, 0x3e50d83dUL, + 0x00000000UL, 0x3fcb6355UL, 0xee9e9be5UL, 0xbe5c35bdUL, 0x80000000UL, + 0x3fcb194aUL, 0x8416c0bcUL, 0x3e546d4fUL, 0x00000000UL, 0x3fcacf5eUL, + 0x49f7f08fUL, 0x3e56da76UL, 0x00000000UL, 0x3fca858fUL, 0x5dc30de2UL, + 0x3e5f390cUL, 0x00000000UL, 0x3fca3bdeUL, 0x950583b6UL, 0xbe5e4169UL, + 0x80000000UL, 0x3fc9f249UL, 0x33631553UL, 0x3e52aeb1UL, 0x00000000UL, + 0x3fc9a8d3UL, 0xde8795a6UL, 0xbe59a504UL, 0x00000000UL, 0x3fc95f79UL, + 0x076bf41eUL, 0x3e5122feUL, 0x80000000UL, 0x3fc9163cUL, 0x2914c8e7UL, + 0x3e3dd064UL, 0x00000000UL, 0x3fc8cd1dUL, 0x3a30eca3UL, 0xbe21b4aaUL, + 0x80000000UL, 0x3fc8841aUL, 0xb2a96650UL, 0xbe575444UL, 0x80000000UL, + 0x3fc83b34UL, 0x2376c0cbUL, 0xbe2a74c7UL, 0x80000000UL, 0x3fc7f26bUL, + 0xd8a0b653UL, 0xbe5181b6UL, 0x00000000UL, 0x3fc7a9bfUL, 0x32257882UL, + 0xbe4a78b4UL, 0x00000000UL, 0x3fc7612fUL, 0x1eee8bd9UL, 0xbe1bfe9dUL, + 0x80000000UL, 0x3fc718bbUL, 0x0c603cc4UL, 0x3e36fdc9UL, 0x80000000UL, + 0x3fc6d064UL, 0x3728b8cfUL, 0xbe1e542eUL, 0x80000000UL, 0x3fc68829UL, + 0xc79a4067UL, 0x3e5c380fUL, 0x00000000UL, 0x3fc6400bUL, 0xf69eac69UL, + 0x3e550a84UL, 0x80000000UL, 0x3fc5f808UL, 0xb7a780a4UL, 0x3e5d9224UL, + 0x80000000UL, 0x3fc5b022UL, 0xad9dfb1eUL, 0xbe55242fUL, 0x00000000UL, + 0x3fc56858UL, 0x659b18beUL, 0xbe4bfda3UL, 0x80000000UL, 0x3fc520a9UL, + 0x66ee3631UL, 0xbe57d769UL, 0x80000000UL, 0x3fc4d916UL, 0x1ec62819UL, + 0x3e2427f7UL, 0x80000000UL, 0x3fc4919fUL, 0xdec25369UL, 0xbe435431UL, + 0x00000000UL, 0x3fc44a44UL, 0xa8acfc4bUL, 0xbe3c62e8UL, 0x00000000UL, + 0x3fc40304UL, 0xcf1d3eabUL, 0xbdfba29fUL, 0x80000000UL, 0x3fc3bbdfUL, + 0x79aba3eaUL, 0xbdf1b7c8UL, 0x80000000UL, 0x3fc374d6UL, 0xb8d186daUL, + 0xbe5130cfUL, 0x80000000UL, 0x3fc32de8UL, 0x9d74f152UL, 0x3e2285b6UL, + 0x00000000UL, 0x3fc2e716UL, 0x50ae7ca9UL, 0xbe503920UL, 0x80000000UL, + 0x3fc2a05eUL, 0x6caed92eUL, 0xbe533924UL, 0x00000000UL, 0x3fc259c2UL, + 0x9cb5034eUL, 0xbe510e31UL, 0x80000000UL, 0x3fc21340UL, 0x12c4d378UL, + 0xbe540b43UL, 0x80000000UL, 0x3fc1ccd9UL, 0xcc418706UL, 0x3e59887aUL, + 0x00000000UL, 0x3fc1868eUL, 0x921f4106UL, 0xbe528e67UL, 0x80000000UL, + 0x3fc1405cUL, 0x3969441eUL, 0x3e5d8051UL, 0x00000000UL, 0x3fc0fa46UL, + 0xd941ef5bUL, 0x3e5f9079UL, 0x80000000UL, 0x3fc0b44aUL, 0x5a3e81b2UL, + 0xbe567691UL, 0x00000000UL, 0x3fc06e69UL, 0x9d66afe7UL, 0xbe4d43fbUL, + 0x00000000UL, 0x3fc028a2UL, 0x0a92a162UL, 0xbe52f394UL, 0x00000000UL, + 0x3fbfc5eaUL, 0x209897e5UL, 0x3e529e37UL, 0x00000000UL, 0x3fbf3ac5UL, + 0x8458bd7bUL, 0x3e582831UL, 0x00000000UL, 0x3fbeafd5UL, 0xb8d8b4b8UL, + 0xbe486b4aUL, 0x00000000UL, 0x3fbe2518UL, 0xe0a3b7b6UL, 0x3e5bafd2UL, + 0x00000000UL, 0x3fbd9a90UL, 0x2bf2710eUL, 0x3e383b2bUL, 0x00000000UL, + 0x3fbd103cUL, 0x73eb6ab7UL, 0xbe56d78dUL, 0x00000000UL, 0x3fbc861bUL, + 0x32ceaff5UL, 0xbe32dc5aUL, 0x00000000UL, 0x3fbbfc2eUL, 0xbee04cb7UL, + 0xbe4a71a4UL, 0x00000000UL, 0x3fbb7274UL, 0x35ae9577UL, 0x3e38142fUL, + 0x00000000UL, 0x3fbae8eeUL, 0xcbaddab4UL, 0xbe5490f0UL, 0x00000000UL, + 0x3fba5f9aUL, 0x95ce1114UL, 0x3e597c71UL, 0x00000000UL, 0x3fb9d67aUL, + 0x6d7c0f78UL, 0x3e3abc2dUL, 0x00000000UL, 0x3fb94d8dUL, 0x2841a782UL, + 0xbe566cbcUL, 0x00000000UL, 0x3fb8c4d2UL, 0x6ed429c6UL, 0xbe3cfff9UL, + 0x00000000UL, 0x3fb83c4aUL, 0xe4a49fbbUL, 0xbe552964UL, 0x00000000UL, + 0x3fb7b3f4UL, 0x2193d81eUL, 0xbe42fa72UL, 0x00000000UL, 0x3fb72bd0UL, + 0xdd70c122UL, 0x3e527a8cUL, 0x00000000UL, 0x3fb6a3dfUL, 0x03108a54UL, + 0xbe450393UL, 0x00000000UL, 0x3fb61c1fUL, 0x30ff7954UL, 0x3e565840UL, + 0x00000000UL, 0x3fb59492UL, 0xdedd460cUL, 0xbe5422b5UL, 0x00000000UL, + 0x3fb50d36UL, 0x950f9f45UL, 0xbe5313f6UL, 0x00000000UL, 0x3fb4860bUL, + 0x582cdcb1UL, 0x3e506d39UL, 0x00000000UL, 0x3fb3ff12UL, 0x7216d3a6UL, + 0x3e4aa719UL, 0x00000000UL, 0x3fb3784aUL, 0x57a423fdUL, 0x3e5a9b9fUL, + 0x00000000UL, 0x3fb2f1b4UL, 0x7a138b41UL, 0xbe50b418UL, 0x00000000UL, + 0x3fb26b4eUL, 0x2fbfd7eaUL, 0x3e23a53eUL, 0x00000000UL, 0x3fb1e519UL, + 0x18913ccbUL, 0x3e465fc1UL, 0x00000000UL, 0x3fb15f15UL, 0x7ea24e21UL, + 0x3e042843UL, 0x00000000UL, 0x3fb0d941UL, 0x7c6d9c77UL, 0x3e59f61eUL, + 0x00000000UL, 0x3fb0539eUL, 0x114efd44UL, 0x3e4ccab7UL, 0x00000000UL, + 0x3faf9c56UL, 0x1777f657UL, 0x3e552f65UL, 0x00000000UL, 0x3fae91d2UL, + 0xc317b86aUL, 0xbe5a61e0UL, 0x00000000UL, 0x3fad87acUL, 0xb7664efbUL, + 0xbe41f64eUL, 0x00000000UL, 0x3fac7de6UL, 0x5d3d03a9UL, 0x3e0807a0UL, + 0x00000000UL, 0x3fab7480UL, 0x743c38ebUL, 0xbe3726e1UL, 0x00000000UL, + 0x3faa6b78UL, 0x06a253f1UL, 0x3e5ad636UL, 0x00000000UL, 0x3fa962d0UL, + 0xa35f541bUL, 0x3e5a187aUL, 0x00000000UL, 0x3fa85a88UL, 0x4b86e446UL, + 0xbe508150UL, 0x00000000UL, 0x3fa7529cUL, 0x2589cacfUL, 0x3e52938aUL, + 0x00000000UL, 0x3fa64b10UL, 0xaf6b11f2UL, 0xbe3454cdUL, 0x00000000UL, + 0x3fa543e2UL, 0x97506fefUL, 0xbe5fdec5UL, 0x00000000UL, 0x3fa43d10UL, + 0xe75f7dd9UL, 0xbe388dd3UL, 0x00000000UL, 0x3fa3369cUL, 0xa4139632UL, + 0xbdea5177UL, 0x00000000UL, 0x3fa23086UL, 0x352d6f1eUL, 0xbe565ad6UL, + 0x00000000UL, 0x3fa12accUL, 0x77449eb7UL, 0xbe50d5c7UL, 0x00000000UL, + 0x3fa0256eUL, 0x7478da78UL, 0x3e404724UL, 0x00000000UL, 0x3f9e40dcUL, + 0xf59cef7fUL, 0xbe539d0aUL, 0x00000000UL, 0x3f9c3790UL, 0x1511d43cUL, + 0x3e53c2c8UL, 0x00000000UL, 0x3f9a2f00UL, 0x9b8bff3cUL, 0xbe43b3e1UL, + 0x00000000UL, 0x3f982724UL, 0xad1e22a5UL, 0x3e46f0bdUL, 0x00000000UL, + 0x3f962000UL, 0x130d9356UL, 0x3e475ba0UL, 0x00000000UL, 0x3f941994UL, + 0x8f86f883UL, 0xbe513d0bUL, 0x00000000UL, 0x3f9213dcUL, 0x914d0dc8UL, + 0xbe534335UL, 0x00000000UL, 0x3f900ed8UL, 0x2d73e5e7UL, 0xbe22ba75UL, + 0x00000000UL, 0x3f8c1510UL, 0xc5b7d70eUL, 0x3e599c5dUL, 0x00000000UL, + 0x3f880de0UL, 0x8a27857eUL, 0xbe3d28c8UL, 0x00000000UL, 0x3f840810UL, + 0xda767328UL, 0x3e531b3dUL, 0x00000000UL, 0x3f8003b0UL, 0x77bacaf3UL, + 0xbe5f04e3UL, 0x00000000UL, 0x3f780150UL, 0xdf4b0720UL, 0x3e5a8bffUL, + 0x00000000UL, 0x3f6ffc40UL, 0x34c48e71UL, 0xbe3fcd99UL, 0x00000000UL, + 0x3f5ff6c0UL, 0x1ad218afUL, 0xbe4c78a7UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x80000000UL +}; + +ALIGNED_(8) juint _log2_pow[] = +{ + 0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL +}; + +//registers, +// input: xmm0, xmm1 +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// rax, rdx, rcx, r8, r11 + +// Code generated by Intel C compiler for LIBM library + +void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp1, Register tmp2, Register tmp3, Register tmp4) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; + Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, L_2TAG_PACKET_14_0_2, L_2TAG_PACKET_15_0_2; + Label L_2TAG_PACKET_16_0_2, L_2TAG_PACKET_17_0_2, L_2TAG_PACKET_18_0_2, L_2TAG_PACKET_19_0_2; + Label L_2TAG_PACKET_20_0_2, L_2TAG_PACKET_21_0_2, L_2TAG_PACKET_22_0_2, L_2TAG_PACKET_23_0_2; + Label L_2TAG_PACKET_24_0_2, L_2TAG_PACKET_25_0_2, L_2TAG_PACKET_26_0_2, L_2TAG_PACKET_27_0_2; + Label L_2TAG_PACKET_28_0_2, L_2TAG_PACKET_29_0_2, L_2TAG_PACKET_30_0_2, L_2TAG_PACKET_31_0_2; + Label L_2TAG_PACKET_32_0_2, L_2TAG_PACKET_33_0_2, L_2TAG_PACKET_34_0_2, L_2TAG_PACKET_35_0_2; + Label L_2TAG_PACKET_36_0_2, L_2TAG_PACKET_37_0_2, L_2TAG_PACKET_38_0_2, L_2TAG_PACKET_39_0_2; + Label L_2TAG_PACKET_40_0_2, L_2TAG_PACKET_41_0_2, L_2TAG_PACKET_42_0_2, L_2TAG_PACKET_43_0_2; + Label L_2TAG_PACKET_44_0_2, L_2TAG_PACKET_45_0_2, L_2TAG_PACKET_46_0_2, L_2TAG_PACKET_47_0_2; + Label L_2TAG_PACKET_48_0_2, L_2TAG_PACKET_49_0_2, L_2TAG_PACKET_50_0_2, L_2TAG_PACKET_51_0_2; + Label L_2TAG_PACKET_52_0_2, L_2TAG_PACKET_53_0_2, L_2TAG_PACKET_54_0_2, L_2TAG_PACKET_55_0_2; + Label L_2TAG_PACKET_56_0_2; + Label B1_2, B1_3, B1_5, start; + + assert_different_registers(tmp1, tmp2, eax, ecx, edx); + jmp(start); + address HIGHSIGMASK = (address)_HIGHSIGMASK; + address LOG2_E = (address)_LOG2_E; + address coeff = (address)_coeff_pow; + address L_tbl = (address)_L_tbl_pow; + address HIGHMASK_Y = (address)_HIGHMASK_Y; + address T_exp = (address)_T_exp; + address e_coeff = (address)_e_coeff; + address coeff_h = (address)_coeff_h; + address HIGHMASK_LOG_X = (address)_HIGHMASK_LOG_X; + address HALFMASK = (address)_HALFMASK; + address log2 = (address)_log2_pow; + + + bind(start); + subq(rsp, 40); + movsd(Address(rsp, 8), xmm0); + movsd(Address(rsp, 16), xmm1); + + bind(B1_2); + pextrw(eax, xmm0, 3); + xorpd(xmm2, xmm2); + mov64(tmp2, 0x3ff0000000000000); + movdq(xmm2, tmp2); + movl(tmp1, 1069088768); + movdq(xmm7, tmp1); + xorpd(xmm1, xmm1); + mov64(tmp3, 0x77f0000000000000); + movdq(xmm1, tmp3); + movdqu(xmm3, xmm0); + movl(edx, 32752); + andl(edx, eax); + subl(edx, 16368); + movl(ecx, edx); + sarl(edx, 31); + addl(ecx, edx); + xorl(ecx, edx); + por(xmm0, xmm2); + movdqu(xmm6, ExternalAddress(HIGHSIGMASK)); //0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL + psrlq(xmm0, 27); + movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL + psrld(xmm0, 2); + addl(ecx, 16); + bsrl(ecx, ecx); + rcpps(xmm0, xmm0); + psllq(xmm3, 12); + movl(tmp4, 8192); + movdq(xmm4, tmp4); + psrlq(xmm3, 12); + subl(eax, 16); + cmpl(eax, 32736); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + movl(tmp1, 0); + + bind(L_2TAG_PACKET_1_0_2); + mulss(xmm0, xmm7); + movl(edx, -1); + subl(ecx, 4); + shll(edx); + shlq(edx, 32); + movdq(xmm5, edx); + por(xmm3, xmm1); + subl(eax, 16351); + cmpl(eax, 1); + jcc(Assembler::belowEqual, L_2TAG_PACKET_2_0_2); + paddd(xmm0, xmm4); + pand(xmm5, xmm3); + movdl(edx, xmm0); + psllq(xmm0, 29); + + bind(L_2TAG_PACKET_3_0_2); + subsd(xmm3, xmm5); + pand(xmm0, xmm6); + subl(eax, 1); + sarl(eax, 4); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + + bind(L_2TAG_PACKET_4_0_2); + mulsd(xmm3, xmm0); + movdqu(xmm1, ExternalAddress(coeff)); //0x6dc96112UL, 0xbf836578UL, 0xee241472UL, 0xbf9b0301UL + lea(tmp4, ExternalAddress(L_tbl)); + subsd(xmm5, xmm2); + movdqu(xmm4, ExternalAddress(16 + coeff)); //0x9f95985aUL, 0xbfb528dbUL, 0xb3841d2aUL, 0xbfd619b6UL + movl(ecx, eax); + sarl(eax, 31); + addl(ecx, eax); + xorl(eax, ecx); + addl(eax, 1); + bsrl(eax, eax); + unpcklpd(xmm5, xmm3); + movdqu(xmm6, ExternalAddress(32 + coeff)); //0x518775e3UL, 0x3f9004f2UL, 0xac8349bbUL, 0x3fa76c9bUL + addsd(xmm3, xmm5); + andl(edx, 16760832); + shrl(edx, 10); + addpd(xmm5, Address(tmp4, edx, Address::times_1, -3648)); + movdqu(xmm0, ExternalAddress(48 + coeff)); //0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, 0xbf5dabe1UL + pshufd(xmm2, xmm3, 68); + mulsd(xmm3, xmm3); + mulpd(xmm1, xmm2); + mulpd(xmm4, xmm2); + addsd(xmm5, xmm7); + mulsd(xmm2, xmm3); + addpd(xmm6, xmm1); + mulsd(xmm3, xmm3); + addpd(xmm0, xmm4); + movq(xmm1, Address(rsp, 16)); + movw(ecx, Address(rsp, 22)); + pshufd(xmm7, xmm5, 238); + movq(xmm4, ExternalAddress(HIGHMASK_Y)); //0x00000000UL, 0xfffffff8UL, 0x00000000UL, 0xffffffffUL + mulpd(xmm6, xmm2); + pshufd(xmm3, xmm3, 68); + mulpd(xmm0, xmm2); + shll(eax, 4); + subl(eax, 15872); + andl(ecx, 32752); + addl(eax, ecx); + mulpd(xmm3, xmm6); + cmpl(eax, 624); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_5_0_2); + xorpd(xmm6, xmm6); + movl(edx, 17080); + pinsrw(xmm6, edx, 3); + movdqu(xmm2, xmm1); + pand(xmm4, xmm1); + subsd(xmm1, xmm4); + mulsd(xmm4, xmm5); + addsd(xmm0, xmm7); + mulsd(xmm1, xmm5); + movdqu(xmm7, xmm6); + addsd(xmm6, xmm4); + lea(tmp4, ExternalAddress(T_exp)); + addpd(xmm3, xmm0); + movdl(edx, xmm6); + subsd(xmm6, xmm7); + pshufd(xmm0, xmm3, 238); + subsd(xmm4, xmm6); + addsd(xmm0, xmm3); + movl(ecx, edx); + andl(edx, 255); + addl(edx, edx); + movdqu(xmm5, Address(tmp4, edx, Address::times_8, 0)); + addsd(xmm4, xmm1); + mulsd(xmm2, xmm0); + movdqu(xmm7, ExternalAddress(e_coeff)); //0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL + movdqu(xmm3, ExternalAddress(16 + e_coeff)); //0x6fba4e77UL, 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL + shll(ecx, 12); + xorl(ecx, tmp1); + andl(rcx, -1048576); + movdq(xmm6, rcx); + addsd(xmm2, xmm4); + mov64(tmp2, 0x3fe62e42fefa39ef); + movdq(xmm1, tmp2); + pshufd(xmm0, xmm2, 68); + pshufd(xmm4, xmm2, 68); + mulsd(xmm1, xmm2); + pshufd(xmm6, xmm6, 17); + mulpd(xmm0, xmm0); + mulpd(xmm7, xmm4); + paddd(xmm5, xmm6); + mulsd(xmm1, xmm5); + pshufd(xmm6, xmm5, 238); + mulsd(xmm0, xmm0); + addpd(xmm3, xmm7); + addsd(xmm1, xmm6); + mulpd(xmm0, xmm3); + pshufd(xmm3, xmm0, 238); + mulsd(xmm0, xmm5); + mulsd(xmm3, xmm5); + addsd(xmm0, xmm1); + addsd(xmm0, xmm3); + addsd(xmm0, xmm5); + jmp(B1_5); + + bind(L_2TAG_PACKET_0_0_2); + addl(eax, 16); + movl(edx, 32752); + andl(edx, eax); + cmpl(edx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_6_0_2); + testl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_7_0_2); + + bind(L_2TAG_PACKET_8_0_2); + movq(xmm0, Address(rsp, 8)); + movq(xmm3, Address(rsp, 8)); + movdl(edx, xmm3); + psrlq(xmm3, 32); + movdl(ecx, xmm3); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_9_0_2); + xorpd(xmm3, xmm3); + movl(eax, 18416); + pinsrw(xmm3, eax, 3); + mulsd(xmm0, xmm3); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movdqu(xmm3, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 18416); + psrlq(xmm0, 27); + movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL + psrld(xmm0, 2); + rcpps(xmm0, xmm0); + psllq(xmm3, 12); + movdqu(xmm6, ExternalAddress(HIGHSIGMASK)); //0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL + psrlq(xmm3, 12); + mulss(xmm0, xmm7); + movl(edx, -1024); + movdl(xmm5, edx); + por(xmm3, xmm1); + paddd(xmm0, xmm4); + psllq(xmm5, 32); + movdl(edx, xmm0); + psllq(xmm0, 29); + pand(xmm5, xmm3); + movl(tmp1, 0); + pand(xmm0, xmm6); + subsd(xmm3, xmm5); + andl(eax, 32752); + subl(eax, 18416); + sarl(eax, 4); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + jmp(L_2TAG_PACKET_4_0_2); + + bind(L_2TAG_PACKET_10_0_2); + movq(xmm0, Address(rsp, 8)); + movq(xmm3, Address(rsp, 8)); + movdl(edx, xmm3); + psrlq(xmm3, 32); + movdl(ecx, xmm3); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_9_0_2); + xorpd(xmm3, xmm3); + movl(eax, 18416); + pinsrw(xmm3, eax, 3); + mulsd(xmm0, xmm3); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movdqu(xmm3, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 18416); + psrlq(xmm0, 27); + movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL + psrld(xmm0, 2); + rcpps(xmm0, xmm0); + psllq(xmm3, 12); + movdqu(xmm6, ExternalAddress(HIGHSIGMASK)); //0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL + psrlq(xmm3, 12); + mulss(xmm0, xmm7); + movl(edx, -1024); + movdl(xmm5, edx); + por(xmm3, xmm1); + paddd(xmm0, xmm4); + psllq(xmm5, 32); + movdl(edx, xmm0); + psllq(xmm0, 29); + pand(xmm5, xmm3); + movl(tmp1, INT_MIN); + pand(xmm0, xmm6); + subsd(xmm3, xmm5); + andl(eax, 32752); + subl(eax, 18416); + sarl(eax, 4); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + jmp(L_2TAG_PACKET_4_0_2); + + bind(L_2TAG_PACKET_5_0_2); + cmpl(eax, 0); + jcc(Assembler::less, L_2TAG_PACKET_11_0_2); + cmpl(eax, 752); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_12_0_2); + addsd(xmm0, xmm7); + movq(xmm2, ExternalAddress(HALFMASK)); //0xf8000000UL, 0xffffffffUL, 0xf8000000UL, 0xffffffffUL + addpd(xmm3, xmm0); + xorpd(xmm6, xmm6); + movl(eax, 17080); + pinsrw(xmm6, eax, 3); + pshufd(xmm0, xmm3, 238); + addsd(xmm0, xmm3); + movdqu(xmm3, xmm5); + addsd(xmm5, xmm0); + movdqu(xmm4, xmm2); + subsd(xmm3, xmm5); + movdqu(xmm7, xmm5); + pand(xmm5, xmm2); + movdqu(xmm2, xmm1); + pand(xmm4, xmm1); + subsd(xmm7, xmm5); + addsd(xmm0, xmm3); + subsd(xmm1, xmm4); + mulsd(xmm4, xmm5); + addsd(xmm0, xmm7); + mulsd(xmm2, xmm0); + movdqu(xmm7, xmm6); + mulsd(xmm1, xmm5); + addsd(xmm6, xmm4); + movdl(eax, xmm6); + subsd(xmm6, xmm7); + lea(tmp4, ExternalAddress(T_exp)); + addsd(xmm2, xmm1); + movdqu(xmm7, ExternalAddress(e_coeff)); //0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL + movdqu(xmm3, ExternalAddress(16 + e_coeff)); //0x6fba4e77UL, 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL + subsd(xmm4, xmm6); + pextrw(edx, xmm6, 3); + movl(ecx, eax); + andl(eax, 255); + addl(eax, eax); + movdqu(xmm5, Address(tmp4, rax, Address::times_8, 0)); + addsd(xmm2, xmm4); + sarl(ecx, 8); + movl(eax, ecx); + sarl(ecx, 1); + subl(eax, ecx); + shll(ecx, 20); + xorl(ecx, tmp1); + movdl(xmm6, ecx); + movq(xmm1, ExternalAddress(32 + e_coeff)); //0xfefa39efUL, 0x3fe62e42UL, 0x00000000UL, 0x00000000UL + andl(edx, 32767); + cmpl(edx, 16529); + jcc(Assembler::above, L_2TAG_PACKET_12_0_2); + pshufd(xmm0, xmm2, 68); + pshufd(xmm4, xmm2, 68); + mulpd(xmm0, xmm0); + mulpd(xmm7, xmm4); + pshufd(xmm6, xmm6, 17); + mulsd(xmm1, xmm2); + mulsd(xmm0, xmm0); + paddd(xmm5, xmm6); + addpd(xmm3, xmm7); + mulsd(xmm1, xmm5); + pshufd(xmm6, xmm5, 238); + mulpd(xmm0, xmm3); + addsd(xmm1, xmm6); + pshufd(xmm3, xmm0, 238); + mulsd(xmm0, xmm5); + mulsd(xmm3, xmm5); + shll(eax, 4); + xorpd(xmm4, xmm4); + addl(eax, 16368); + pinsrw(xmm4, eax, 3); + addsd(xmm0, xmm1); + addsd(xmm0, xmm3); + movdqu(xmm1, xmm0); + addsd(xmm0, xmm5); + mulsd(xmm0, xmm4); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_13_0_2); + cmpl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_14_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_6_0_2); + movq(xmm1, Address(rsp, 16)); + movq(xmm0, Address(rsp, 8)); + movdqu(xmm2, xmm0); + movdl(eax, xmm2); + psrlq(xmm2, 20); + movdl(edx, xmm2); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_15_0_2); + movdl(eax, xmm1); + psrlq(xmm1, 32); + movdl(edx, xmm1); + movl(ecx, edx); + addl(edx, edx); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_16_0_2); + addsd(xmm0, xmm0); + jmp(B1_5); + + bind(L_2TAG_PACKET_16_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + movl(Address(rsp, 0), 29); + jmp(L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_18_0_2); + movq(xmm0, Address(rsp, 16)); + addpd(xmm0, xmm0); + jmp(B1_5); + + bind(L_2TAG_PACKET_15_0_2); + movdl(eax, xmm1); + movdqu(xmm2, xmm1); + psrlq(xmm1, 32); + movdl(edx, xmm1); + movl(ecx, edx); + addl(edx, edx); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_19_0_2); + pextrw(eax, xmm2, 3); + andl(eax, 32752); + cmpl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_20_0_2); + movdl(eax, xmm2); + psrlq(xmm2, 20); + movdl(edx, xmm2); + orl(eax, edx); + jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_20_0_2); + pextrw(eax, xmm0, 3); + testl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_21_0_2); + testl(ecx, INT_MIN); + jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_23_0_2); + movq(xmm1, Address(rsp, 16)); + movdl(eax, xmm1); + testl(eax, 1); + jcc(Assembler::notEqual, L_2TAG_PACKET_24_0_2); + testl(eax, 2); + jcc(Assembler::notEqual, L_2TAG_PACKET_25_0_2); + jmp(L_2TAG_PACKET_24_0_2); + + bind(L_2TAG_PACKET_21_0_2); + shrl(ecx, 20); + andl(ecx, 2047); + cmpl(ecx, 1075); + jcc(Assembler::above, L_2TAG_PACKET_24_0_2); + jcc(Assembler::equal, L_2TAG_PACKET_26_0_2); + cmpl(ecx, 1074); + jcc(Assembler::above, L_2TAG_PACKET_23_0_2); + cmpl(ecx, 1023); + jcc(Assembler::below, L_2TAG_PACKET_24_0_2); + movq(xmm1, Address(rsp, 16)); + movl(eax, 17208); + xorpd(xmm3, xmm3); + pinsrw(xmm3, eax, 3); + movdqu(xmm4, xmm3); + addsd(xmm3, xmm1); + subsd(xmm4, xmm3); + addsd(xmm1, xmm4); + pextrw(eax, xmm1, 3); + andl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_24_0_2); + movdl(eax, xmm3); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_24_0_2); + + bind(L_2TAG_PACKET_25_0_2); + movq(xmm1, Address(rsp, 16)); + pextrw(eax, xmm1, 3); + andl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_27_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_27_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32768); + pinsrw(xmm0, eax, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_24_0_2); + movq(xmm1, Address(rsp, 16)); + pextrw(eax, xmm1, 3); + andl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32752); + pinsrw(xmm0, eax, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_26_0_2); + movq(xmm1, Address(rsp, 16)); + movdl(eax, xmm1); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_24_0_2); + jmp(L_2TAG_PACKET_25_0_2); + + bind(L_2TAG_PACKET_28_0_2); + movdl(eax, xmm1); + psrlq(xmm1, 20); + movdl(edx, xmm1); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_29_0_2); + movq(xmm0, Address(rsp, 16)); + addsd(xmm0, xmm0); + jmp(B1_5); + + bind(L_2TAG_PACKET_29_0_2); + movq(xmm0, Address(rsp, 8)); + pextrw(eax, xmm0, 3); + cmpl(eax, 49136); + jcc(Assembler::notEqual, L_2TAG_PACKET_30_0_2); + movdl(ecx, xmm0); + psrlq(xmm0, 20); + movdl(edx, xmm0); + orl(ecx, edx); + jcc(Assembler::notEqual, L_2TAG_PACKET_30_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32760); + pinsrw(xmm0, eax, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_30_0_2); + movq(xmm1, Address(rsp, 16)); + andl(eax, 32752); + subl(eax, 16368); + pextrw(edx, xmm1, 3); + xorpd(xmm0, xmm0); + xorl(eax, edx); + andl(eax, 32768); + jcc(Assembler::equal, L_2TAG_PACKET_31_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_31_0_2); + movl(ecx, 32752); + pinsrw(xmm0, ecx, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_32_0_2); + movdl(eax, xmm1); + cmpl(edx, 17184); + jcc(Assembler::above, L_2TAG_PACKET_33_0_2); + testl(eax, 1); + jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); + testl(eax, 2); + jcc(Assembler::equal, L_2TAG_PACKET_35_0_2); + jmp(L_2TAG_PACKET_36_0_2); + + bind(L_2TAG_PACKET_33_0_2); + testl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_35_0_2); + jmp(L_2TAG_PACKET_36_0_2); + + bind(L_2TAG_PACKET_7_0_2); + movq(xmm2, Address(rsp, 8)); + movdl(eax, xmm2); + psrlq(xmm2, 31); + movdl(ecx, xmm2); + orl(eax, ecx); + jcc(Assembler::equal, L_2TAG_PACKET_9_0_2); + movq(xmm1, Address(rsp, 16)); + pextrw(edx, xmm1, 3); + movdl(eax, xmm1); + movdqu(xmm2, xmm1); + psrlq(xmm2, 32); + movdl(ecx, xmm2); + addl(ecx, ecx); + orl(ecx, eax); + jcc(Assembler::equal, L_2TAG_PACKET_37_0_2); + andl(edx, 32752); + cmpl(edx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_28_0_2); + cmpl(edx, 17200); + jcc(Assembler::above, L_2TAG_PACKET_35_0_2); + cmpl(edx, 17184); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_32_0_2); + cmpl(edx, 16368); + jcc(Assembler::below, L_2TAG_PACKET_34_0_2); + movl(eax, 17208); + xorpd(xmm2, xmm2); + pinsrw(xmm2, eax, 3); + movdqu(xmm4, xmm2); + addsd(xmm2, xmm1); + subsd(xmm4, xmm2); + addsd(xmm1, xmm4); + pextrw(eax, xmm1, 3); + andl(eax, 32767); + jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); + movdl(eax, xmm2); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_35_0_2); + + bind(L_2TAG_PACKET_36_0_2); + xorpd(xmm1, xmm1); + movl(edx, 30704); + pinsrw(xmm1, edx, 3); + movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL + movq(xmm4, Address(rsp, 8)); + pextrw(eax, xmm4, 3); + movl(edx, 8192); + movdl(xmm4, edx); + andl(eax, 32767); + subl(eax, 16); + jcc(Assembler::less, L_2TAG_PACKET_10_0_2); + movl(edx, eax); + andl(edx, 32752); + subl(edx, 16368); + movl(ecx, edx); + sarl(edx, 31); + addl(ecx, edx); + xorl(ecx, edx); + addl(ecx, 16); + bsrl(ecx, ecx); + movl(tmp1, INT_MIN); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_34_0_2); + xorpd(xmm1, xmm1); + movl(eax, 32752); + pinsrw(xmm1, eax, 3); + xorpd(xmm0, xmm0); + mulsd(xmm0, xmm1); + movl(Address(rsp, 0), 28); + jmp(L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_35_0_2); + xorpd(xmm1, xmm1); + movl(edx, 30704); + pinsrw(xmm1, edx, 3); + movq(xmm2, ExternalAddress(LOG2_E)); //0x00000000UL, 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL + movq(xmm4, Address(rsp, 8)); + pextrw(eax, xmm4, 3); + movl(edx, 8192); + movdl(xmm4, edx); + andl(eax, 32767); + subl(eax, 16); + jcc(Assembler::less, L_2TAG_PACKET_8_0_2); + movl(edx, eax); + andl(edx, 32752); + subl(edx, 16368); + movl(ecx, edx); + sarl(edx, 31); + addl(ecx, edx); + xorl(ecx, edx); + addl(ecx, 16); + bsrl(ecx, ecx); + movl(tmp1, 0); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_19_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_22_0_2); + xorpd(xmm0, xmm0); + jmp(B1_5); + + bind(L_2TAG_PACKET_11_0_2); + addl(eax, 384); + cmpl(eax, 0); + jcc(Assembler::less, L_2TAG_PACKET_38_0_2); + mulsd(xmm5, xmm1); + addsd(xmm0, xmm7); + shrl(tmp1, 31); + addpd(xmm3, xmm0); + pshufd(xmm0, xmm3, 238); + addsd(xmm3, xmm0); + lea(tmp4, ExternalAddress(log2)); //0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, 0xbfe62e42UL + movq(xmm4, Address(tmp4, tmp1, Address::times_8, 0)); + mulsd(xmm1, xmm3); + xorpd(xmm0, xmm0); + movl(eax, 16368); + shll(tmp1, 15); + orl(eax, tmp1); + pinsrw(xmm0, eax, 3); + addsd(xmm5, xmm1); + mulsd(xmm5, xmm4); + addsd(xmm0, xmm5); + jmp(B1_5); + + bind(L_2TAG_PACKET_38_0_2); + + bind(L_2TAG_PACKET_37_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_39_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + movl(Address(rsp, 0), 26); + jmp(L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_9_0_2); + movq(xmm1, Address(rsp, 16)); + movdqu(xmm2, xmm1); + pextrw(eax, xmm1, 3); + andl(eax, 32752); + cmpl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_40_0_2); + movdl(eax, xmm2); + psrlq(xmm2, 20); + movdl(edx, xmm2); + orl(eax, edx); + jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_40_0_2); + movdl(eax, xmm1); + psrlq(xmm1, 32); + movdl(edx, xmm1); + movl(ecx, edx); + addl(edx, edx); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_39_0_2); + shrl(edx, 21); + cmpl(edx, 1075); + jcc(Assembler::above, L_2TAG_PACKET_41_0_2); + jcc(Assembler::equal, L_2TAG_PACKET_42_0_2); + cmpl(edx, 1023); + jcc(Assembler::below, L_2TAG_PACKET_41_0_2); + movq(xmm1, Address(rsp, 16)); + movl(eax, 17208); + xorpd(xmm3, xmm3); + pinsrw(xmm3, eax, 3); + movdqu(xmm4, xmm3); + addsd(xmm3, xmm1); + subsd(xmm4, xmm3); + addsd(xmm1, xmm4); + pextrw(eax, xmm1, 3); + andl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_41_0_2); + movdl(eax, xmm3); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_41_0_2); + + bind(L_2TAG_PACKET_43_0_2); + movq(xmm0, Address(rsp, 8)); + testl(ecx, INT_MIN); + jcc(Assembler::notEqual, L_2TAG_PACKET_44_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_42_0_2); + movq(xmm1, Address(rsp, 16)); + movdl(eax, xmm1); + testl(eax, 1); + jcc(Assembler::notEqual, L_2TAG_PACKET_43_0_2); + + bind(L_2TAG_PACKET_41_0_2); + testl(ecx, INT_MIN); + jcc(Assembler::equal, L_2TAG_PACKET_22_0_2); + xorpd(xmm0, xmm0); + + bind(L_2TAG_PACKET_44_0_2); + movl(eax, 16368); + xorpd(xmm1, xmm1); + pinsrw(xmm1, eax, 3); + divsd(xmm1, xmm0); + movdqu(xmm0, xmm1); + movl(Address(rsp, 0), 27); + jmp(L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_12_0_2); + movq(xmm2, Address(rsp, 8)); + movq(xmm6, Address(rsp, 16)); + pextrw(eax, xmm2, 3); + pextrw(edx, xmm6, 3); + movl(ecx, 32752); + andl(ecx, edx); + cmpl(ecx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_45_0_2); + andl(eax, 32752); + subl(eax, 16368); + xorl(edx, eax); + testl(edx, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_46_0_2); + + bind(L_2TAG_PACKET_47_0_2); + movl(eax, 32736); + pinsrw(xmm0, eax, 3); + shrl(tmp1, 16); + orl(eax, tmp1); + pinsrw(xmm1, eax, 3); + mulsd(xmm0, xmm1); + + bind(L_2TAG_PACKET_14_0_2); + movl(Address(rsp, 0), 24); + jmp(L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_46_0_2); + movl(eax, 16); + pinsrw(xmm0, eax, 3); + mulsd(xmm0, xmm0); + testl(tmp1, INT_MIN); + jcc(Assembler::equal, L_2TAG_PACKET_48_0_2); + mov64(tmp2, 0x8000000000000000); + movdq(xmm2, tmp2); + xorpd(xmm0, xmm2); + + bind(L_2TAG_PACKET_48_0_2); + movl(Address(rsp, 0), 25); + jmp(L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_13_0_2); + pextrw(ecx, xmm5, 3); + pextrw(edx, xmm4, 3); + movl(eax, -1); + andl(ecx, 32752); + subl(ecx, 16368); + andl(edx, 32752); + addl(edx, ecx); + movl(ecx, -31); + sarl(edx, 4); + subl(ecx, edx); + jcc(Assembler::lessEqual, L_2TAG_PACKET_49_0_2); + cmpl(ecx, 20); + jcc(Assembler::above, L_2TAG_PACKET_50_0_2); + shll(eax); + + bind(L_2TAG_PACKET_49_0_2); + movdl(xmm0, eax); + psllq(xmm0, 32); + pand(xmm0, xmm5); + subsd(xmm5, xmm0); + addsd(xmm5, xmm1); + mulsd(xmm0, xmm4); + mulsd(xmm5, xmm4); + addsd(xmm0, xmm5); + + bind(L_2TAG_PACKET_50_0_2); + jmp(L_2TAG_PACKET_48_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movw(ecx, Address(rsp, 22)); + movl(edx, INT_MIN); + movdl(xmm1, rdx); + xorpd(xmm7, xmm7); + paddd(xmm0, xmm4); + movdl(edx, xmm0); + psllq(xmm0, 29); + paddq(xmm1, xmm3); + pand(xmm5, xmm1); + andl(ecx, 32752); + cmpl(ecx, 16560); + jcc(Assembler::less, L_2TAG_PACKET_3_0_2); + pand(xmm0, xmm6); + subsd(xmm3, xmm5); + addl(eax, 16351); + shrl(eax, 4); + subl(eax, 1022); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + lea(r11, ExternalAddress(L_tbl)); + movq(xmm4, ExternalAddress(coeff_h)); //0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL + mulsd(xmm3, xmm0); + movq(xmm6, ExternalAddress(coeff_h)); //0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL + subsd(xmm5, xmm2); + movq(xmm1, ExternalAddress(8 + coeff_h)); //0x00000000UL, 0xbf5dabe1UL + pshufd(xmm2, xmm3, 68); + unpcklpd(xmm5, xmm3); + addsd(xmm3, xmm5); + movq(xmm0, ExternalAddress(8 + coeff_h)); //0x00000000UL, 0xbf5dabe1UL + andl(edx, 16760832); + shrl(edx, 10); + addpd(xmm7, Address(tmp4, edx, Address::times_1, -3648)); + mulsd(xmm4, xmm5); + mulsd(xmm0, xmm5); + mulsd(xmm6, xmm2); + mulsd(xmm1, xmm2); + movdqu(xmm2, xmm5); + mulsd(xmm4, xmm5); + addsd(xmm5, xmm0); + movdqu(xmm0, xmm7); + addsd(xmm2, xmm3); + addsd(xmm7, xmm5); + mulsd(xmm6, xmm2); + subsd(xmm0, xmm7); + movdqu(xmm2, xmm7); + addsd(xmm7, xmm4); + addsd(xmm0, xmm5); + subsd(xmm2, xmm7); + addsd(xmm4, xmm2); + pshufd(xmm2, xmm5, 238); + movdqu(xmm5, xmm7); + addsd(xmm7, xmm2); + addsd(xmm4, xmm0); + movdqu(xmm0, ExternalAddress(coeff)); //0x6dc96112UL, 0xbf836578UL, 0xee241472UL, 0xbf9b0301UL + subsd(xmm5, xmm7); + addsd(xmm6, xmm4); + movdqu(xmm4, xmm7); + addsd(xmm5, xmm2); + addsd(xmm7, xmm1); + movdqu(xmm2, ExternalAddress(64 + coeff)); //0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, 0xbf5dabe1UL + subsd(xmm4, xmm7); + addsd(xmm6, xmm5); + addsd(xmm4, xmm1); + pshufd(xmm5, xmm7, 238); + movapd(xmm1, xmm7); + addsd(xmm7, xmm5); + subsd(xmm1, xmm7); + addsd(xmm1, xmm5); + movdqu(xmm5, ExternalAddress(80 + coeff)); //0x9f95985aUL, 0xbfb528dbUL, 0xf8b5787dUL, 0x3ef2531eUL + pshufd(xmm3, xmm3, 68); + addsd(xmm6, xmm4); + addsd(xmm6, xmm1); + movdqu(xmm1, ExternalAddress(32 + coeff)); //0x9f95985aUL, 0xbfb528dbUL, 0xb3841d2aUL, 0xbfd619b6UL + mulpd(xmm0, xmm3); + mulpd(xmm2, xmm3); + pshufd(xmm4, xmm3, 68); + mulpd(xmm3, xmm3); + addpd(xmm0, xmm1); + addpd(xmm5, xmm2); + mulsd(xmm4, xmm3); + movq(xmm2, ExternalAddress(HIGHMASK_LOG_X)); //0xf8000000UL, 0xffffffffUL, 0x00000000UL, 0xfffff800UL + mulpd(xmm3, xmm3); + movq(xmm1, Address(rsp, 16)); + movw(ecx, Address(rsp, 22)); + mulpd(xmm0, xmm4); + pextrw(eax, xmm7, 3); + mulpd(xmm5, xmm4); + mulpd(xmm0, xmm3); + movq(xmm4, ExternalAddress(8 + HIGHMASK_Y)); //0x00000000UL, 0xffffffffUL + pand(xmm2, xmm7); + addsd(xmm5, xmm6); + subsd(xmm7, xmm2); + addpd(xmm5, xmm0); + andl(eax, 32752); + subl(eax, 16368); + andl(ecx, 32752); + cmpl(ecx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_45_0_2); + addl(ecx, eax); + cmpl(ecx, 16576); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_51_0_2); + pshufd(xmm0, xmm5, 238); + pand(xmm4, xmm1); + movdqu(xmm3, xmm1); + addsd(xmm5, xmm0); + subsd(xmm1, xmm4); + xorpd(xmm6, xmm6); + movl(edx, 17080); + pinsrw(xmm6, edx, 3); + addsd(xmm7, xmm5); + mulsd(xmm4, xmm2); + mulsd(xmm1, xmm2); + movdqu(xmm5, xmm6); + mulsd(xmm3, xmm7); + addsd(xmm6, xmm4); + addsd(xmm1, xmm3); + movdqu(xmm7, ExternalAddress(e_coeff)); //0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL + movdl(edx, xmm6); + subsd(xmm6, xmm5); + lea(tmp4, ExternalAddress(T_exp)); + movdqu(xmm3, ExternalAddress(16 + e_coeff)); //0x6fba4e77UL, 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL + movq(xmm2, ExternalAddress(32 + e_coeff)); //0xfefa39efUL, 0x3fe62e42UL, 0x00000000UL, 0x00000000UL + subsd(xmm4, xmm6); + movl(ecx, edx); + andl(edx, 255); + addl(edx, edx); + movdqu(xmm5, Address(tmp4, edx, Address::times_8, 0)); + addsd(xmm4, xmm1); + pextrw(edx, xmm6, 3); + shrl(ecx, 8); + movl(eax, ecx); + shrl(ecx, 1); + subl(eax, ecx); + shll(ecx, 20); + movdl(xmm6, ecx); + pshufd(xmm0, xmm4, 68); + pshufd(xmm1, xmm4, 68); + mulpd(xmm0, xmm0); + mulpd(xmm7, xmm1); + pshufd(xmm6, xmm6, 17); + mulsd(xmm2, xmm4); + andl(edx, 32767); + cmpl(edx, 16529); + jcc(Assembler::above, L_2TAG_PACKET_12_0_2); + mulsd(xmm0, xmm0); + paddd(xmm5, xmm6); + addpd(xmm3, xmm7); + mulsd(xmm2, xmm5); + pshufd(xmm6, xmm5, 238); + mulpd(xmm0, xmm3); + addsd(xmm2, xmm6); + pshufd(xmm3, xmm0, 238); + addl(eax, 1023); + shll(eax, 20); + orl(eax, tmp1); + movdl(xmm4, eax); + mulsd(xmm0, xmm5); + mulsd(xmm3, xmm5); + addsd(xmm0, xmm2); + psllq(xmm4, 32); + addsd(xmm0, xmm3); + movdqu(xmm1, xmm0); + addsd(xmm0, xmm5); + mulsd(xmm0, xmm4); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_13_0_2); + cmpl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_14_0_2); + + bind(L_2TAG_PACKET_52_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_45_0_2); + movq(xmm0, Address(rsp, 8)); + xorpd(xmm2, xmm2); + movl(eax, 49136); + pinsrw(xmm2, eax, 3); + addsd(xmm2, xmm0); + pextrw(eax, xmm2, 3); + cmpl(eax, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_53_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32760); + pinsrw(xmm0, eax, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_53_0_2); + movq(xmm1, Address(rsp, 16)); + movdl(edx, xmm1); + movdqu(xmm3, xmm1); + psrlq(xmm3, 20); + movdl(ecx, xmm3); + orl(ecx, edx); + jcc(Assembler::equal, L_2TAG_PACKET_54_0_2); + addsd(xmm1, xmm1); + movdqu(xmm0, xmm1); + jmp(B1_5); + + bind(L_2TAG_PACKET_51_0_2); + pextrw(eax, xmm1, 3); + pextrw(ecx, xmm2, 3); + xorl(eax, ecx); + testl(eax, 32768); + jcc(Assembler::equal, L_2TAG_PACKET_47_0_2); + jmp(L_2TAG_PACKET_46_0_2); + + bind(L_2TAG_PACKET_54_0_2); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + pextrw(edx, xmm1, 3); + xorpd(xmm0, xmm0); + subl(eax, 16368); + xorl(eax, edx); + testl(eax, 32768); + jcc(Assembler::equal, L_2TAG_PACKET_55_0_2); + jmp(B1_5); + + bind(L_2TAG_PACKET_55_0_2); + movl(edx, 32752); + pinsrw(xmm0, edx, 3); + jmp(B1_5); + + bind(L_2TAG_PACKET_17_0_2); + movq(Address(rsp, 24), xmm0); + + bind(B1_3); + movq(xmm0, Address(rsp, 24)); + + bind(L_2TAG_PACKET_56_0_2); + + bind(B1_5); + addq(rsp, 40); +} +#else +// The 32 bit code is at most SSE2 compliant +ALIGNED_(16) juint _static_const_table_pow[] = +{ + 0x00000000UL, 0xbfd61a00UL, 0x00000000UL, 0xbf5dabe1UL, 0xf8000000UL, + 0xffffffffUL, 0x00000000UL, 0xfffff800UL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0x00000000UL, 0x20000000UL, 0x3feff00aUL, 0x96621f95UL, + 0x3e5b1856UL, 0xe0000000UL, 0x3fefe019UL, 0xe5916f9eUL, 0xbe325278UL, + 0x00000000UL, 0x3fefd02fUL, 0x859a1062UL, 0x3e595fb7UL, 0xc0000000UL, + 0x3fefc049UL, 0xb245f18fUL, 0xbe529c38UL, 0xe0000000UL, 0x3fefb069UL, + 0xad2880a7UL, 0xbe501230UL, 0x60000000UL, 0x3fefa08fUL, 0xc8e72420UL, + 0x3e597bd1UL, 0x80000000UL, 0x3fef90baUL, 0xc30c4500UL, 0xbe5d6c75UL, + 0xe0000000UL, 0x3fef80eaUL, 0x02c63f43UL, 0x3e2e1318UL, 0xc0000000UL, + 0x3fef7120UL, 0xb3d4ccccUL, 0xbe44c52aUL, 0x00000000UL, 0x3fef615cUL, + 0xdbd91397UL, 0xbe4e7d6cUL, 0xa0000000UL, 0x3fef519cUL, 0x65c5cd68UL, + 0xbe522dc8UL, 0xa0000000UL, 0x3fef41e2UL, 0x46d1306cUL, 0xbe5a840eUL, + 0xe0000000UL, 0x3fef322dUL, 0xd2980e94UL, 0x3e5071afUL, 0xa0000000UL, + 0x3fef227eUL, 0x773abadeUL, 0xbe5891e5UL, 0xa0000000UL, 0x3fef12d4UL, + 0xdc6bf46bUL, 0xbe5cccbeUL, 0xe0000000UL, 0x3fef032fUL, 0xbc7247faUL, + 0xbe2bab83UL, 0x80000000UL, 0x3feef390UL, 0xbcaa1e46UL, 0xbe53bb3bUL, + 0x60000000UL, 0x3feee3f6UL, 0x5f6c682dUL, 0xbe54c619UL, 0x80000000UL, + 0x3feed461UL, 0x5141e368UL, 0xbe4b6d86UL, 0xe0000000UL, 0x3feec4d1UL, + 0xec678f76UL, 0xbe369af6UL, 0x80000000UL, 0x3feeb547UL, 0x41301f55UL, + 0xbe2d4312UL, 0x60000000UL, 0x3feea5c2UL, 0x676da6bdUL, 0xbe4d8dd0UL, + 0x60000000UL, 0x3fee9642UL, 0x57a891c4UL, 0x3e51f991UL, 0xa0000000UL, + 0x3fee86c7UL, 0xe4eb491eUL, 0x3e579bf9UL, 0x20000000UL, 0x3fee7752UL, + 0xfddc4a2cUL, 0xbe3356e6UL, 0xc0000000UL, 0x3fee67e1UL, 0xd75b5bf1UL, + 0xbe449531UL, 0x80000000UL, 0x3fee5876UL, 0xbd423b8eUL, 0x3df54fe4UL, + 0x60000000UL, 0x3fee4910UL, 0x330e51b9UL, 0x3e54289cUL, 0x80000000UL, + 0x3fee39afUL, 0x8651a95fUL, 0xbe55aad6UL, 0xa0000000UL, 0x3fee2a53UL, + 0x5e98c708UL, 0xbe2fc4a9UL, 0xe0000000UL, 0x3fee1afcUL, 0x0989328dUL, + 0x3e23958cUL, 0x40000000UL, 0x3fee0babUL, 0xee642abdUL, 0xbe425dd8UL, + 0xa0000000UL, 0x3fedfc5eUL, 0xc394d236UL, 0x3e526362UL, 0x20000000UL, + 0x3feded17UL, 0xe104aa8eUL, 0x3e4ce247UL, 0xc0000000UL, 0x3fedddd4UL, + 0x265a9be4UL, 0xbe5bb77aUL, 0x40000000UL, 0x3fedce97UL, 0x0ecac52fUL, + 0x3e4a7cb1UL, 0xe0000000UL, 0x3fedbf5eUL, 0x124cb3b8UL, 0x3e257024UL, + 0x80000000UL, 0x3fedb02bUL, 0xe6d4febeUL, 0xbe2033eeUL, 0x20000000UL, + 0x3feda0fdUL, 0x39cca00eUL, 0xbe3ddabcUL, 0xc0000000UL, 0x3fed91d3UL, + 0xef8a552aUL, 0xbe543390UL, 0x40000000UL, 0x3fed82afUL, 0xb8e85204UL, + 0x3e513850UL, 0xe0000000UL, 0x3fed738fUL, 0x3d59fe08UL, 0xbe5db728UL, + 0x40000000UL, 0x3fed6475UL, 0x3aa7ead1UL, 0x3e58804bUL, 0xc0000000UL, + 0x3fed555fUL, 0xf8a35ba9UL, 0xbe5298b0UL, 0x00000000UL, 0x3fed464fUL, + 0x9a88dd15UL, 0x3e5a8cdbUL, 0x40000000UL, 0x3fed3743UL, 0xb0b0a190UL, + 0x3e598635UL, 0x80000000UL, 0x3fed283cUL, 0xe2113295UL, 0xbe5c1119UL, + 0x80000000UL, 0x3fed193aUL, 0xafbf1728UL, 0xbe492e9cUL, 0x60000000UL, + 0x3fed0a3dUL, 0xe4a4ccf3UL, 0x3e19b90eUL, 0x20000000UL, 0x3fecfb45UL, + 0xba3cbeb8UL, 0x3e406b50UL, 0xc0000000UL, 0x3fecec51UL, 0x110f7dddUL, + 0x3e0d6806UL, 0x40000000UL, 0x3fecdd63UL, 0x7dd7d508UL, 0xbe5a8943UL, + 0x80000000UL, 0x3fecce79UL, 0x9b60f271UL, 0xbe50676aUL, 0x80000000UL, + 0x3fecbf94UL, 0x0b9ad660UL, 0x3e59174fUL, 0x60000000UL, 0x3fecb0b4UL, + 0x00823d9cUL, 0x3e5bbf72UL, 0x20000000UL, 0x3feca1d9UL, 0x38a6ec89UL, + 0xbe4d38f9UL, 0x80000000UL, 0x3fec9302UL, 0x3a0b7d8eUL, 0x3e53dbfdUL, + 0xc0000000UL, 0x3fec8430UL, 0xc6826b34UL, 0xbe27c5c9UL, 0xc0000000UL, + 0x3fec7563UL, 0x0c706381UL, 0xbe593653UL, 0x60000000UL, 0x3fec669bUL, + 0x7df34ec7UL, 0x3e461ab5UL, 0xe0000000UL, 0x3fec57d7UL, 0x40e5e7e8UL, + 0xbe5c3daeUL, 0x00000000UL, 0x3fec4919UL, 0x5602770fUL, 0xbe55219dUL, + 0xc0000000UL, 0x3fec3a5eUL, 0xec7911ebUL, 0x3e5a5d25UL, 0x60000000UL, + 0x3fec2ba9UL, 0xb39ea225UL, 0xbe53c00bUL, 0x80000000UL, 0x3fec1cf8UL, + 0x967a212eUL, 0x3e5a8ddfUL, 0x60000000UL, 0x3fec0e4cUL, 0x580798bdUL, + 0x3e5f53abUL, 0x00000000UL, 0x3febffa5UL, 0xb8282df6UL, 0xbe46b874UL, + 0x20000000UL, 0x3febf102UL, 0xe33a6729UL, 0x3e54963fUL, 0x00000000UL, + 0x3febe264UL, 0x3b53e88aUL, 0xbe3adce1UL, 0x60000000UL, 0x3febd3caUL, + 0xc2585084UL, 0x3e5cde9fUL, 0x80000000UL, 0x3febc535UL, 0xa335c5eeUL, + 0xbe39fd9cUL, 0x20000000UL, 0x3febb6a5UL, 0x7325b04dUL, 0x3e42ba15UL, + 0x60000000UL, 0x3feba819UL, 0x1564540fUL, 0x3e3a9f35UL, 0x40000000UL, + 0x3feb9992UL, 0x83fff592UL, 0xbe5465ceUL, 0xa0000000UL, 0x3feb8b0fUL, + 0xb9da63d3UL, 0xbe4b1a0aUL, 0x80000000UL, 0x3feb7c91UL, 0x6d6f1ea4UL, + 0x3e557657UL, 0x00000000UL, 0x3feb6e18UL, 0x5e80a1bfUL, 0x3e4ddbb6UL, + 0x00000000UL, 0x3feb5fa3UL, 0x1c9eacb5UL, 0x3e592877UL, 0xa0000000UL, + 0x3feb5132UL, 0x6d40beb3UL, 0xbe51858cUL, 0xa0000000UL, 0x3feb42c6UL, + 0xd740c67bUL, 0x3e427ad2UL, 0x40000000UL, 0x3feb345fUL, 0xa3e0cceeUL, + 0xbe5c2fc4UL, 0x40000000UL, 0x3feb25fcUL, 0x8e752b50UL, 0xbe3da3c2UL, + 0xc0000000UL, 0x3feb179dUL, 0xa892e7deUL, 0x3e1fb481UL, 0xc0000000UL, + 0x3feb0943UL, 0x21ed71e9UL, 0xbe365206UL, 0x20000000UL, 0x3feafaeeUL, + 0x0e1380a3UL, 0x3e5c5b7bUL, 0x20000000UL, 0x3feaec9dUL, 0x3c3d640eUL, + 0xbe5dbbd0UL, 0x60000000UL, 0x3feade50UL, 0x8f97a715UL, 0x3e3a8ec5UL, + 0x20000000UL, 0x3fead008UL, 0x23ab2839UL, 0x3e2fe98aUL, 0x40000000UL, + 0x3feac1c4UL, 0xf4bbd50fUL, 0x3e54d8f6UL, 0xe0000000UL, 0x3feab384UL, + 0x14757c4dUL, 0xbe48774cUL, 0xc0000000UL, 0x3feaa549UL, 0x7c7b0eeaUL, + 0x3e5b51bbUL, 0x20000000UL, 0x3fea9713UL, 0xf56f7013UL, 0x3e386200UL, + 0xe0000000UL, 0x3fea88e0UL, 0xbe428ebeUL, 0xbe514af5UL, 0xe0000000UL, + 0x3fea7ab2UL, 0x8d0e4496UL, 0x3e4f9165UL, 0x60000000UL, 0x3fea6c89UL, + 0xdbacc5d5UL, 0xbe5c063bUL, 0x20000000UL, 0x3fea5e64UL, 0x3f19d970UL, + 0xbe5a0c8cUL, 0x20000000UL, 0x3fea5043UL, 0x09ea3e6bUL, 0x3e5065dcUL, + 0x80000000UL, 0x3fea4226UL, 0x78df246cUL, 0x3e5e05f6UL, 0x40000000UL, + 0x3fea340eUL, 0x4057d4a0UL, 0x3e431b2bUL, 0x40000000UL, 0x3fea25faUL, + 0x82867bb5UL, 0x3e4b76beUL, 0xa0000000UL, 0x3fea17eaUL, 0x9436f40aUL, + 0xbe5aad39UL, 0x20000000UL, 0x3fea09dfUL, 0x4b5253b3UL, 0x3e46380bUL, + 0x00000000UL, 0x3fe9fbd8UL, 0x8fc52466UL, 0xbe386f9bUL, 0x20000000UL, + 0x3fe9edd5UL, 0x22d3f344UL, 0xbe538347UL, 0x60000000UL, 0x3fe9dfd6UL, + 0x1ac33522UL, 0x3e5dbc53UL, 0x00000000UL, 0x3fe9d1dcUL, 0xeabdff1dUL, + 0x3e40fc0cUL, 0xe0000000UL, 0x3fe9c3e5UL, 0xafd30e73UL, 0xbe585e63UL, + 0xe0000000UL, 0x3fe9b5f3UL, 0xa52f226aUL, 0xbe43e8f9UL, 0x20000000UL, + 0x3fe9a806UL, 0xecb8698dUL, 0xbe515b36UL, 0x80000000UL, 0x3fe99a1cUL, + 0xf2b4e89dUL, 0x3e48b62bUL, 0x20000000UL, 0x3fe98c37UL, 0x7c9a88fbUL, + 0x3e44414cUL, 0x00000000UL, 0x3fe97e56UL, 0xda015741UL, 0xbe5d13baUL, + 0xe0000000UL, 0x3fe97078UL, 0x5fdace06UL, 0x3e51b947UL, 0x00000000UL, + 0x3fe962a0UL, 0x956ca094UL, 0x3e518785UL, 0x40000000UL, 0x3fe954cbUL, + 0x01164c1dUL, 0x3e5d5b57UL, 0xc0000000UL, 0x3fe946faUL, 0xe63b3767UL, + 0xbe4f84e7UL, 0x40000000UL, 0x3fe9392eUL, 0xe57cc2a9UL, 0x3e34eda3UL, + 0xe0000000UL, 0x3fe92b65UL, 0x8c75b544UL, 0x3e5766a0UL, 0xc0000000UL, + 0x3fe91da1UL, 0x37d1d087UL, 0xbe5e2ab1UL, 0x80000000UL, 0x3fe90fe1UL, + 0xa953dc20UL, 0x3e5fa1f3UL, 0x80000000UL, 0x3fe90225UL, 0xdbd3f369UL, + 0x3e47d6dbUL, 0xa0000000UL, 0x3fe8f46dUL, 0x1c9be989UL, 0xbe5e2b0aUL, + 0xa0000000UL, 0x3fe8e6b9UL, 0x3c93d76aUL, 0x3e5c8618UL, 0xe0000000UL, + 0x3fe8d909UL, 0x2182fc9aUL, 0xbe41aa9eUL, 0x20000000UL, 0x3fe8cb5eUL, + 0xe6b3539dUL, 0xbe530d19UL, 0x60000000UL, 0x3fe8bdb6UL, 0x49e58cc3UL, + 0xbe3bb374UL, 0xa0000000UL, 0x3fe8b012UL, 0xa7cfeb8fUL, 0x3e56c412UL, + 0x00000000UL, 0x3fe8a273UL, 0x8d52bc19UL, 0x3e1429b8UL, 0x60000000UL, + 0x3fe894d7UL, 0x4dc32c6cUL, 0xbe48604cUL, 0xc0000000UL, 0x3fe8873fUL, + 0x0c868e56UL, 0xbe564ee5UL, 0x00000000UL, 0x3fe879acUL, 0x56aee828UL, + 0x3e5e2fd8UL, 0x60000000UL, 0x3fe86c1cUL, 0x7ceab8ecUL, 0x3e493365UL, + 0xc0000000UL, 0x3fe85e90UL, 0x78d4dadcUL, 0xbe4f7f25UL, 0x00000000UL, + 0x3fe85109UL, 0x0ccd8280UL, 0x3e31e7a2UL, 0x40000000UL, 0x3fe84385UL, + 0x34ba4e15UL, 0x3e328077UL, 0x80000000UL, 0x3fe83605UL, 0xa670975aUL, + 0xbe53eee5UL, 0xa0000000UL, 0x3fe82889UL, 0xf61b77b2UL, 0xbe43a20aUL, + 0xa0000000UL, 0x3fe81b11UL, 0x13e6643bUL, 0x3e5e5fe5UL, 0xc0000000UL, + 0x3fe80d9dUL, 0x82cc94e8UL, 0xbe5ff1f9UL, 0xa0000000UL, 0x3fe8002dUL, + 0x8a0c9c5dUL, 0xbe42b0e7UL, 0x60000000UL, 0x3fe7f2c1UL, 0x22a16f01UL, + 0x3e5d9ea0UL, 0x20000000UL, 0x3fe7e559UL, 0xc38cd451UL, 0x3e506963UL, + 0xc0000000UL, 0x3fe7d7f4UL, 0x9902bc71UL, 0x3e4503d7UL, 0x40000000UL, + 0x3fe7ca94UL, 0xdef2a3c0UL, 0x3e3d98edUL, 0xa0000000UL, 0x3fe7bd37UL, + 0xed49abb0UL, 0x3e24c1ffUL, 0xe0000000UL, 0x3fe7afdeUL, 0xe3b0be70UL, + 0xbe40c467UL, 0x00000000UL, 0x3fe7a28aUL, 0xaf9f193cUL, 0xbe5dff6cUL, + 0xe0000000UL, 0x3fe79538UL, 0xb74cf6b6UL, 0xbe258ed0UL, 0xa0000000UL, + 0x3fe787ebUL, 0x1d9127c7UL, 0x3e345fb0UL, 0x40000000UL, 0x3fe77aa2UL, + 0x1028c21dUL, 0xbe4619bdUL, 0xa0000000UL, 0x3fe76d5cUL, 0x7cb0b5e4UL, + 0x3e40f1a2UL, 0xe0000000UL, 0x3fe7601aUL, 0x2b1bc4adUL, 0xbe32e8bbUL, + 0xe0000000UL, 0x3fe752dcUL, 0x6839f64eUL, 0x3e41f57bUL, 0xc0000000UL, + 0x3fe745a2UL, 0xc4121f7eUL, 0xbe52c40aUL, 0x60000000UL, 0x3fe7386cUL, + 0xd6852d72UL, 0xbe5c4e6bUL, 0xc0000000UL, 0x3fe72b39UL, 0x91d690f7UL, + 0xbe57f88fUL, 0xe0000000UL, 0x3fe71e0aUL, 0x627a2159UL, 0xbe4425d5UL, + 0xc0000000UL, 0x3fe710dfUL, 0x50a54033UL, 0x3e422b7eUL, 0x60000000UL, + 0x3fe703b8UL, 0x3b0b5f91UL, 0x3e5d3857UL, 0xe0000000UL, 0x3fe6f694UL, + 0x84d628a2UL, 0xbe51f090UL, 0x00000000UL, 0x3fe6e975UL, 0x306d8894UL, + 0xbe414d83UL, 0xe0000000UL, 0x3fe6dc58UL, 0x30bf24aaUL, 0xbe4650caUL, + 0x80000000UL, 0x3fe6cf40UL, 0xd4628d69UL, 0xbe5db007UL, 0xc0000000UL, + 0x3fe6c22bUL, 0xa2aae57bUL, 0xbe31d279UL, 0xc0000000UL, 0x3fe6b51aUL, + 0x860edf7eUL, 0xbe2d4c4aUL, 0x80000000UL, 0x3fe6a80dUL, 0xf3559341UL, + 0xbe5f7e98UL, 0xe0000000UL, 0x3fe69b03UL, 0xa885899eUL, 0xbe5c2011UL, + 0xe0000000UL, 0x3fe68dfdUL, 0x2bdc6d37UL, 0x3e224a82UL, 0xa0000000UL, + 0x3fe680fbUL, 0xc12ad1b9UL, 0xbe40cf56UL, 0x00000000UL, 0x3fe673fdUL, + 0x1bcdf659UL, 0xbdf52f2dUL, 0x00000000UL, 0x3fe66702UL, 0x5df10408UL, + 0x3e5663e0UL, 0xc0000000UL, 0x3fe65a0aUL, 0xa4070568UL, 0xbe40b12fUL, + 0x00000000UL, 0x3fe64d17UL, 0x71c54c47UL, 0x3e5f5e8bUL, 0x00000000UL, + 0x3fe64027UL, 0xbd4b7e83UL, 0x3e42ead6UL, 0xa0000000UL, 0x3fe6333aUL, + 0x61598bd2UL, 0xbe4c48d4UL, 0xc0000000UL, 0x3fe62651UL, 0x6f538d61UL, + 0x3e548401UL, 0xa0000000UL, 0x3fe6196cUL, 0x14344120UL, 0xbe529af6UL, + 0x00000000UL, 0x3fe60c8bUL, 0x5982c587UL, 0xbe3e1e4fUL, 0x00000000UL, + 0x3fe5ffadUL, 0xfe51d4eaUL, 0xbe4c897aUL, 0x80000000UL, 0x3fe5f2d2UL, + 0xfd46ebe1UL, 0x3e552e00UL, 0xa0000000UL, 0x3fe5e5fbUL, 0xa4695699UL, + 0x3e5ed471UL, 0x60000000UL, 0x3fe5d928UL, 0x80d118aeUL, 0x3e456b61UL, + 0xa0000000UL, 0x3fe5cc58UL, 0x304c330bUL, 0x3e54dc29UL, 0x80000000UL, + 0x3fe5bf8cUL, 0x0af2dedfUL, 0xbe3aa9bdUL, 0xe0000000UL, 0x3fe5b2c3UL, + 0x15fc9258UL, 0xbe479a37UL, 0xc0000000UL, 0x3fe5a5feUL, 0x9292c7eaUL, + 0x3e188650UL, 0x20000000UL, 0x3fe5993dUL, 0x33b4d380UL, 0x3e5d6d93UL, + 0x20000000UL, 0x3fe58c7fUL, 0x02fd16c7UL, 0x3e2fe961UL, 0xa0000000UL, + 0x3fe57fc4UL, 0x4a05edb6UL, 0xbe4d55b4UL, 0xa0000000UL, 0x3fe5730dUL, + 0x3d443abbUL, 0xbe5e6954UL, 0x00000000UL, 0x3fe5665aUL, 0x024acfeaUL, + 0x3e50e61bUL, 0x00000000UL, 0x3fe559aaUL, 0xcc9edd09UL, 0xbe325403UL, + 0x60000000UL, 0x3fe54cfdUL, 0x1fe26950UL, 0x3e5d500eUL, 0x60000000UL, + 0x3fe54054UL, 0x6c5ae164UL, 0xbe4a79b4UL, 0xc0000000UL, 0x3fe533aeUL, + 0x154b0287UL, 0xbe401571UL, 0xa0000000UL, 0x3fe5270cUL, 0x0673f401UL, + 0xbe56e56bUL, 0xe0000000UL, 0x3fe51a6dUL, 0x751b639cUL, 0x3e235269UL, + 0xa0000000UL, 0x3fe50dd2UL, 0x7c7b2bedUL, 0x3ddec887UL, 0xc0000000UL, + 0x3fe5013aUL, 0xafab4e17UL, 0x3e5e7575UL, 0x60000000UL, 0x3fe4f4a6UL, + 0x2e308668UL, 0x3e59aed6UL, 0x80000000UL, 0x3fe4e815UL, 0xf33e2a76UL, + 0xbe51f184UL, 0xe0000000UL, 0x3fe4db87UL, 0x839f3e3eUL, 0x3e57db01UL, + 0xc0000000UL, 0x3fe4cefdUL, 0xa9eda7bbUL, 0x3e535e0fUL, 0x00000000UL, + 0x3fe4c277UL, 0x2a8f66a5UL, 0x3e5ce451UL, 0xc0000000UL, 0x3fe4b5f3UL, + 0x05192456UL, 0xbe4e8518UL, 0xc0000000UL, 0x3fe4a973UL, 0x4aa7cd1dUL, + 0x3e46784aUL, 0x40000000UL, 0x3fe49cf7UL, 0x8e23025eUL, 0xbe5749f2UL, + 0x00000000UL, 0x3fe4907eUL, 0x18d30215UL, 0x3e360f39UL, 0x20000000UL, + 0x3fe48408UL, 0x63dcf2f3UL, 0x3e5e00feUL, 0xc0000000UL, 0x3fe47795UL, + 0x46182d09UL, 0xbe5173d9UL, 0xa0000000UL, 0x3fe46b26UL, 0x8f0e62aaUL, + 0xbe48f281UL, 0xe0000000UL, 0x3fe45ebaUL, 0x5775c40cUL, 0xbe56aad4UL, + 0x60000000UL, 0x3fe45252UL, 0x0fe25f69UL, 0x3e48bd71UL, 0x40000000UL, + 0x3fe445edUL, 0xe9989ec5UL, 0x3e590d97UL, 0x80000000UL, 0x3fe4398bUL, + 0xb3d9ffe3UL, 0x3e479dbcUL, 0x20000000UL, 0x3fe42d2dUL, 0x388e4d2eUL, + 0xbe5eed80UL, 0xe0000000UL, 0x3fe420d1UL, 0x6f797c18UL, 0x3e554b4cUL, + 0x20000000UL, 0x3fe4147aUL, 0x31048bb4UL, 0xbe5b1112UL, 0x80000000UL, + 0x3fe40825UL, 0x2efba4f9UL, 0x3e48ebc7UL, 0x40000000UL, 0x3fe3fbd4UL, + 0x50201119UL, 0x3e40b701UL, 0x40000000UL, 0x3fe3ef86UL, 0x0a4db32cUL, + 0x3e551de8UL, 0xa0000000UL, 0x3fe3e33bUL, 0x0c9c148bUL, 0xbe50c1f6UL, + 0x20000000UL, 0x3fe3d6f4UL, 0xc9129447UL, 0x3e533fa0UL, 0x00000000UL, + 0x3fe3cab0UL, 0xaae5b5a0UL, 0xbe22b68eUL, 0x20000000UL, 0x3fe3be6fUL, + 0x02305e8aUL, 0xbe54fc08UL, 0x60000000UL, 0x3fe3b231UL, 0x7f908258UL, + 0x3e57dc05UL, 0x00000000UL, 0x3fe3a5f7UL, 0x1a09af78UL, 0x3e08038bUL, + 0xe0000000UL, 0x3fe399bfUL, 0x490643c1UL, 0xbe5dbe42UL, 0xe0000000UL, + 0x3fe38d8bUL, 0x5e8ad724UL, 0xbe3c2b72UL, 0x20000000UL, 0x3fe3815bUL, + 0xc67196b6UL, 0x3e1713cfUL, 0xa0000000UL, 0x3fe3752dUL, 0x6182e429UL, + 0xbe3ec14cUL, 0x40000000UL, 0x3fe36903UL, 0xab6eb1aeUL, 0x3e5a2cc5UL, + 0x40000000UL, 0x3fe35cdcUL, 0xfe5dc064UL, 0xbe5c5878UL, 0x40000000UL, + 0x3fe350b8UL, 0x0ba6b9e4UL, 0x3e51619bUL, 0x80000000UL, 0x3fe34497UL, + 0x857761aaUL, 0x3e5fff53UL, 0x00000000UL, 0x3fe3387aUL, 0xf872d68cUL, + 0x3e484f4dUL, 0xa0000000UL, 0x3fe32c5fUL, 0x087e97c2UL, 0x3e52842eUL, + 0x80000000UL, 0x3fe32048UL, 0x73d6d0c0UL, 0xbe503edfUL, 0x80000000UL, + 0x3fe31434UL, 0x0c1456a1UL, 0xbe5f72adUL, 0xa0000000UL, 0x3fe30823UL, + 0x83a1a4d5UL, 0xbe5e65ccUL, 0xe0000000UL, 0x3fe2fc15UL, 0x855a7390UL, + 0xbe506438UL, 0x40000000UL, 0x3fe2f00bUL, 0xa2898287UL, 0x3e3d22a2UL, + 0xe0000000UL, 0x3fe2e403UL, 0x8b56f66fUL, 0xbe5aa5fdUL, 0x80000000UL, + 0x3fe2d7ffUL, 0x52db119aUL, 0x3e3a2e3dUL, 0x60000000UL, 0x3fe2cbfeUL, + 0xe2ddd4c0UL, 0xbe586469UL, 0x40000000UL, 0x3fe2c000UL, 0x6b01bf10UL, + 0x3e352b9dUL, 0x40000000UL, 0x3fe2b405UL, 0xb07a1cdfUL, 0x3e5c5cdaUL, + 0x80000000UL, 0x3fe2a80dUL, 0xc7b5f868UL, 0xbe5668b3UL, 0xc0000000UL, + 0x3fe29c18UL, 0x185edf62UL, 0xbe563d66UL, 0x00000000UL, 0x3fe29027UL, + 0xf729e1ccUL, 0x3e59a9a0UL, 0x80000000UL, 0x3fe28438UL, 0x6433c727UL, + 0xbe43cc89UL, 0x00000000UL, 0x3fe2784dUL, 0x41782631UL, 0xbe30750cUL, + 0xa0000000UL, 0x3fe26c64UL, 0x914911b7UL, 0xbe58290eUL, 0x40000000UL, + 0x3fe2607fUL, 0x3dcc73e1UL, 0xbe4269cdUL, 0x00000000UL, 0x3fe2549dUL, + 0x2751bf70UL, 0xbe5a6998UL, 0xc0000000UL, 0x3fe248bdUL, 0x4248b9fbUL, + 0xbe4ddb00UL, 0x80000000UL, 0x3fe23ce1UL, 0xf35cf82fUL, 0x3e561b71UL, + 0x60000000UL, 0x3fe23108UL, 0x8e481a2dUL, 0x3e518fb9UL, 0x60000000UL, + 0x3fe22532UL, 0x5ab96edcUL, 0xbe5fafc5UL, 0x40000000UL, 0x3fe2195fUL, + 0x80943911UL, 0xbe07f819UL, 0x40000000UL, 0x3fe20d8fUL, 0x386f2d6cUL, + 0xbe54ba8bUL, 0x40000000UL, 0x3fe201c2UL, 0xf29664acUL, 0xbe5eb815UL, + 0x20000000UL, 0x3fe1f5f8UL, 0x64f03390UL, 0x3e5e320cUL, 0x20000000UL, + 0x3fe1ea31UL, 0x747ff696UL, 0x3e5ef0a5UL, 0x40000000UL, 0x3fe1de6dUL, + 0x3e9ceb51UL, 0xbe5f8d27UL, 0x20000000UL, 0x3fe1d2acUL, 0x4ae0b55eUL, + 0x3e5faa21UL, 0x20000000UL, 0x3fe1c6eeUL, 0x28569a5eUL, 0x3e598a4fUL, + 0x20000000UL, 0x3fe1bb33UL, 0x54b33e07UL, 0x3e46130aUL, 0x20000000UL, + 0x3fe1af7bUL, 0x024f1078UL, 0xbe4dbf93UL, 0x00000000UL, 0x3fe1a3c6UL, + 0xb0783bfaUL, 0x3e419248UL, 0xe0000000UL, 0x3fe19813UL, 0x2f02b836UL, + 0x3e4e02b7UL, 0xc0000000UL, 0x3fe18c64UL, 0x28dec9d4UL, 0x3e09064fUL, + 0x80000000UL, 0x3fe180b8UL, 0x45cbf406UL, 0x3e5b1f46UL, 0x40000000UL, + 0x3fe1750fUL, 0x03d9964cUL, 0x3e5b0a79UL, 0x00000000UL, 0x3fe16969UL, + 0x8b5b882bUL, 0xbe238086UL, 0xa0000000UL, 0x3fe15dc5UL, 0x73bad6f8UL, + 0xbdf1fca4UL, 0x20000000UL, 0x3fe15225UL, 0x5385769cUL, 0x3e5e8d76UL, + 0xa0000000UL, 0x3fe14687UL, 0x1676dc6bUL, 0x3e571d08UL, 0x20000000UL, + 0x3fe13aedUL, 0xa8c41c7fUL, 0xbe598a25UL, 0x60000000UL, 0x3fe12f55UL, + 0xc4e1aaf0UL, 0x3e435277UL, 0xa0000000UL, 0x3fe123c0UL, 0x403638e1UL, + 0xbe21aa7cUL, 0xc0000000UL, 0x3fe1182eUL, 0x557a092bUL, 0xbdd0116bUL, + 0xc0000000UL, 0x3fe10c9fUL, 0x7d779f66UL, 0x3e4a61baUL, 0xc0000000UL, + 0x3fe10113UL, 0x2b09c645UL, 0xbe5d586eUL, 0x20000000UL, 0x3fe0ea04UL, + 0xea2cad46UL, 0x3e5aa97cUL, 0x20000000UL, 0x3fe0d300UL, 0x23190e54UL, + 0x3e50f1a7UL, 0xa0000000UL, 0x3fe0bc07UL, 0x1379a5a6UL, 0xbe51619dUL, + 0x60000000UL, 0x3fe0a51aUL, 0x926a3d4aUL, 0x3e5cf019UL, 0xa0000000UL, + 0x3fe08e38UL, 0xa8c24358UL, 0x3e35241eUL, 0x20000000UL, 0x3fe07762UL, + 0x24317e7aUL, 0x3e512cfaUL, 0x00000000UL, 0x3fe06097UL, 0xfd9cf274UL, + 0xbe55bef3UL, 0x00000000UL, 0x3fe049d7UL, 0x3689b49dUL, 0xbe36d26dUL, + 0x40000000UL, 0x3fe03322UL, 0xf72ef6c4UL, 0xbe54cd08UL, 0xa0000000UL, + 0x3fe01c78UL, 0x23702d2dUL, 0xbe5900bfUL, 0x00000000UL, 0x3fe005daUL, + 0x3f59c14cUL, 0x3e57d80bUL, 0x40000000UL, 0x3fdfde8dUL, 0xad67766dUL, + 0xbe57fad4UL, 0x40000000UL, 0x3fdfb17cUL, 0x644f4ae7UL, 0x3e1ee43bUL, + 0x40000000UL, 0x3fdf8481UL, 0x903234d2UL, 0x3e501a86UL, 0x40000000UL, + 0x3fdf579cUL, 0xafe9e509UL, 0xbe267c3eUL, 0x00000000UL, 0x3fdf2acdUL, + 0xb7dfda0bUL, 0xbe48149bUL, 0x40000000UL, 0x3fdefe13UL, 0x3b94305eUL, + 0x3e5f4ea7UL, 0x80000000UL, 0x3fded16fUL, 0x5d95da61UL, 0xbe55c198UL, + 0x00000000UL, 0x3fdea4e1UL, 0x406960c9UL, 0xbdd99a19UL, 0x00000000UL, + 0x3fde7868UL, 0xd22f3539UL, 0x3e470c78UL, 0x80000000UL, 0x3fde4c04UL, + 0x83eec535UL, 0xbe3e1232UL, 0x40000000UL, 0x3fde1fb6UL, 0x3dfbffcbUL, + 0xbe4b7d71UL, 0x40000000UL, 0x3fddf37dUL, 0x7e1be4e0UL, 0xbe5b8f8fUL, + 0x40000000UL, 0x3fddc759UL, 0x46dae887UL, 0xbe350458UL, 0x80000000UL, + 0x3fdd9b4aUL, 0xed6ecc49UL, 0xbe5f0045UL, 0x80000000UL, 0x3fdd6f50UL, + 0x2e9e883cUL, 0x3e2915daUL, 0x80000000UL, 0x3fdd436bUL, 0xf0bccb32UL, + 0x3e4a68c9UL, 0x80000000UL, 0x3fdd179bUL, 0x9bbfc779UL, 0xbe54a26aUL, + 0x00000000UL, 0x3fdcebe0UL, 0x7cea33abUL, 0x3e43c6b7UL, 0x40000000UL, + 0x3fdcc039UL, 0xe740fd06UL, 0x3e5526c2UL, 0x40000000UL, 0x3fdc94a7UL, + 0x9eadeb1aUL, 0xbe396d8dUL, 0xc0000000UL, 0x3fdc6929UL, 0xf0a8f95aUL, + 0xbe5c0ab2UL, 0x80000000UL, 0x3fdc3dc0UL, 0x6ee2693bUL, 0x3e0992e6UL, + 0xc0000000UL, 0x3fdc126bUL, 0x5ac6b581UL, 0xbe2834b6UL, 0x40000000UL, + 0x3fdbe72bUL, 0x8cc226ffUL, 0x3e3596a6UL, 0x00000000UL, 0x3fdbbbffUL, + 0xf92a74bbUL, 0x3e3c5813UL, 0x00000000UL, 0x3fdb90e7UL, 0x479664c0UL, + 0xbe50d644UL, 0x00000000UL, 0x3fdb65e3UL, 0x5004975bUL, 0xbe55258fUL, + 0x00000000UL, 0x3fdb3af3UL, 0xe4b23194UL, 0xbe588407UL, 0xc0000000UL, + 0x3fdb1016UL, 0xe65d4d0aUL, 0x3e527c26UL, 0x80000000UL, 0x3fdae54eUL, + 0x814fddd6UL, 0x3e5962a2UL, 0x40000000UL, 0x3fdaba9aUL, 0xe19d0913UL, + 0xbe562f4eUL, 0x80000000UL, 0x3fda8ff9UL, 0x43cfd006UL, 0xbe4cfdebUL, + 0x40000000UL, 0x3fda656cUL, 0x686f0a4eUL, 0x3e5e47a8UL, 0xc0000000UL, + 0x3fda3af2UL, 0x7200d410UL, 0x3e5e1199UL, 0xc0000000UL, 0x3fda108cUL, + 0xabd2266eUL, 0x3e5ee4d1UL, 0x40000000UL, 0x3fd9e63aUL, 0x396f8f2cUL, + 0x3e4dbffbUL, 0x00000000UL, 0x3fd9bbfbUL, 0xe32b25ddUL, 0x3e5c3a54UL, + 0x40000000UL, 0x3fd991cfUL, 0x431e4035UL, 0xbe457925UL, 0x80000000UL, + 0x3fd967b6UL, 0x7bed3dd3UL, 0x3e40c61dUL, 0x00000000UL, 0x3fd93db1UL, + 0xd7449365UL, 0x3e306419UL, 0x80000000UL, 0x3fd913beUL, 0x1746e791UL, + 0x3e56fcfcUL, 0x40000000UL, 0x3fd8e9dfUL, 0xf3a9028bUL, 0xbe5041b9UL, + 0xc0000000UL, 0x3fd8c012UL, 0x56840c50UL, 0xbe26e20aUL, 0x40000000UL, + 0x3fd89659UL, 0x19763102UL, 0xbe51f466UL, 0x80000000UL, 0x3fd86cb2UL, + 0x7032de7cUL, 0xbe4d298aUL, 0x80000000UL, 0x3fd8431eUL, 0xdeb39fabUL, + 0xbe4361ebUL, 0x40000000UL, 0x3fd8199dUL, 0x5d01cbe0UL, 0xbe5425b3UL, + 0x80000000UL, 0x3fd7f02eUL, 0x3ce99aa9UL, 0x3e146fa8UL, 0x80000000UL, + 0x3fd7c6d2UL, 0xd1a262b9UL, 0xbe5a1a69UL, 0xc0000000UL, 0x3fd79d88UL, + 0x8606c236UL, 0x3e423a08UL, 0x80000000UL, 0x3fd77451UL, 0x8fd1e1b7UL, + 0x3e5a6a63UL, 0xc0000000UL, 0x3fd74b2cUL, 0xe491456aUL, 0x3e42c1caUL, + 0x40000000UL, 0x3fd7221aUL, 0x4499a6d7UL, 0x3e36a69aUL, 0x00000000UL, + 0x3fd6f91aUL, 0x5237df94UL, 0xbe0f8f02UL, 0x00000000UL, 0x3fd6d02cUL, + 0xb6482c6eUL, 0xbe5abcf7UL, 0x00000000UL, 0x3fd6a750UL, 0x1919fd61UL, + 0xbe57ade2UL, 0x00000000UL, 0x3fd67e86UL, 0xaa7a994dUL, 0xbe3f3fbdUL, + 0x00000000UL, 0x3fd655ceUL, 0x67db014cUL, 0x3e33c550UL, 0x00000000UL, + 0x3fd62d28UL, 0xa82856b7UL, 0xbe1409d1UL, 0xc0000000UL, 0x3fd60493UL, + 0x1e6a300dUL, 0x3e55d899UL, 0x80000000UL, 0x3fd5dc11UL, 0x1222bd5cUL, + 0xbe35bfc0UL, 0xc0000000UL, 0x3fd5b3a0UL, 0x6e8dc2d3UL, 0x3e5d4d79UL, + 0x00000000UL, 0x3fd58b42UL, 0xe0e4ace6UL, 0xbe517303UL, 0x80000000UL, + 0x3fd562f4UL, 0xb306e0a8UL, 0x3e5edf0fUL, 0xc0000000UL, 0x3fd53ab8UL, + 0x6574bc54UL, 0x3e5ee859UL, 0x80000000UL, 0x3fd5128eUL, 0xea902207UL, + 0x3e5f6188UL, 0xc0000000UL, 0x3fd4ea75UL, 0x9f911d79UL, 0x3e511735UL, + 0x80000000UL, 0x3fd4c26eUL, 0xf9c77397UL, 0xbe5b1643UL, 0x40000000UL, + 0x3fd49a78UL, 0x15fc9258UL, 0x3e479a37UL, 0x80000000UL, 0x3fd47293UL, + 0xd5a04dd9UL, 0xbe426e56UL, 0xc0000000UL, 0x3fd44abfUL, 0xe04042f5UL, + 0x3e56f7c6UL, 0x40000000UL, 0x3fd422fdUL, 0x1d8bf2c8UL, 0x3e5d8810UL, + 0x00000000UL, 0x3fd3fb4cUL, 0x88a8ddeeUL, 0xbe311454UL, 0xc0000000UL, + 0x3fd3d3abUL, 0x3e3b5e47UL, 0xbe5d1b72UL, 0x40000000UL, 0x3fd3ac1cUL, + 0xc2ab5d59UL, 0x3e31b02bUL, 0xc0000000UL, 0x3fd3849dUL, 0xd4e34b9eUL, + 0x3e51cb2fUL, 0x40000000UL, 0x3fd35d30UL, 0x177204fbUL, 0xbe2b8cd7UL, + 0x80000000UL, 0x3fd335d3UL, 0xfcd38c82UL, 0xbe4356e1UL, 0x80000000UL, + 0x3fd30e87UL, 0x64f54accUL, 0xbe4e6224UL, 0x00000000UL, 0x3fd2e74cUL, + 0xaa7975d9UL, 0x3e5dc0feUL, 0x80000000UL, 0x3fd2c021UL, 0x516dab3fUL, + 0xbe50ffa3UL, 0x40000000UL, 0x3fd29907UL, 0x2bfb7313UL, 0x3e5674a2UL, + 0xc0000000UL, 0x3fd271fdUL, 0x0549fc99UL, 0x3e385d29UL, 0xc0000000UL, + 0x3fd24b04UL, 0x55b63073UL, 0xbe500c6dUL, 0x00000000UL, 0x3fd2241cUL, + 0x3f91953aUL, 0x3e389977UL, 0xc0000000UL, 0x3fd1fd43UL, 0xa1543f71UL, + 0xbe3487abUL, 0xc0000000UL, 0x3fd1d67bUL, 0x4ec8867cUL, 0x3df6a2dcUL, + 0x00000000UL, 0x3fd1afc4UL, 0x4328e3bbUL, 0x3e41d9c0UL, 0x80000000UL, + 0x3fd1891cUL, 0x2e1cda84UL, 0x3e3bdd87UL, 0x40000000UL, 0x3fd16285UL, + 0x4b5331aeUL, 0xbe53128eUL, 0x00000000UL, 0x3fd13bfeUL, 0xb9aec164UL, + 0xbe52ac98UL, 0xc0000000UL, 0x3fd11586UL, 0xd91e1316UL, 0xbe350630UL, + 0x80000000UL, 0x3fd0ef1fUL, 0x7cacc12cUL, 0x3e3f5219UL, 0x40000000UL, + 0x3fd0c8c8UL, 0xbce277b7UL, 0x3e3d30c0UL, 0x00000000UL, 0x3fd0a281UL, + 0x2a63447dUL, 0xbe541377UL, 0x80000000UL, 0x3fd07c49UL, 0xfac483b5UL, + 0xbe5772ecUL, 0xc0000000UL, 0x3fd05621UL, 0x36b8a570UL, 0xbe4fd4bdUL, + 0xc0000000UL, 0x3fd03009UL, 0xbae505f7UL, 0xbe450388UL, 0x80000000UL, + 0x3fd00a01UL, 0x3e35aeadUL, 0xbe5430fcUL, 0x80000000UL, 0x3fcfc811UL, + 0x707475acUL, 0x3e38806eUL, 0x80000000UL, 0x3fcf7c3fUL, 0xc91817fcUL, + 0xbe40cceaUL, 0x80000000UL, 0x3fcf308cUL, 0xae05d5e9UL, 0xbe4919b8UL, + 0x80000000UL, 0x3fcee4f8UL, 0xae6cc9e6UL, 0xbe530b94UL, 0x00000000UL, + 0x3fce9983UL, 0x1efe3e8eUL, 0x3e57747eUL, 0x00000000UL, 0x3fce4e2dUL, + 0xda78d9bfUL, 0xbe59a608UL, 0x00000000UL, 0x3fce02f5UL, 0x8abe2c2eUL, + 0x3e4a35adUL, 0x00000000UL, 0x3fcdb7dcUL, 0x1495450dUL, 0xbe0872ccUL, + 0x80000000UL, 0x3fcd6ce1UL, 0x86ee0ba0UL, 0xbe4f59a0UL, 0x00000000UL, + 0x3fcd2205UL, 0xe81ca888UL, 0x3e5402c3UL, 0x00000000UL, 0x3fccd747UL, + 0x3b4424b9UL, 0x3e5dfdc3UL, 0x80000000UL, 0x3fcc8ca7UL, 0xd305b56cUL, + 0x3e202da6UL, 0x00000000UL, 0x3fcc4226UL, 0x399a6910UL, 0xbe482a1cUL, + 0x80000000UL, 0x3fcbf7c2UL, 0x747f7938UL, 0xbe587372UL, 0x80000000UL, + 0x3fcbad7cUL, 0x6fc246a0UL, 0x3e50d83dUL, 0x00000000UL, 0x3fcb6355UL, + 0xee9e9be5UL, 0xbe5c35bdUL, 0x80000000UL, 0x3fcb194aUL, 0x8416c0bcUL, + 0x3e546d4fUL, 0x00000000UL, 0x3fcacf5eUL, 0x49f7f08fUL, 0x3e56da76UL, + 0x00000000UL, 0x3fca858fUL, 0x5dc30de2UL, 0x3e5f390cUL, 0x00000000UL, + 0x3fca3bdeUL, 0x950583b6UL, 0xbe5e4169UL, 0x80000000UL, 0x3fc9f249UL, + 0x33631553UL, 0x3e52aeb1UL, 0x00000000UL, 0x3fc9a8d3UL, 0xde8795a6UL, + 0xbe59a504UL, 0x00000000UL, 0x3fc95f79UL, 0x076bf41eUL, 0x3e5122feUL, + 0x80000000UL, 0x3fc9163cUL, 0x2914c8e7UL, 0x3e3dd064UL, 0x00000000UL, + 0x3fc8cd1dUL, 0x3a30eca3UL, 0xbe21b4aaUL, 0x80000000UL, 0x3fc8841aUL, + 0xb2a96650UL, 0xbe575444UL, 0x80000000UL, 0x3fc83b34UL, 0x2376c0cbUL, + 0xbe2a74c7UL, 0x80000000UL, 0x3fc7f26bUL, 0xd8a0b653UL, 0xbe5181b6UL, + 0x00000000UL, 0x3fc7a9bfUL, 0x32257882UL, 0xbe4a78b4UL, 0x00000000UL, + 0x3fc7612fUL, 0x1eee8bd9UL, 0xbe1bfe9dUL, 0x80000000UL, 0x3fc718bbUL, + 0x0c603cc4UL, 0x3e36fdc9UL, 0x80000000UL, 0x3fc6d064UL, 0x3728b8cfUL, + 0xbe1e542eUL, 0x80000000UL, 0x3fc68829UL, 0xc79a4067UL, 0x3e5c380fUL, + 0x00000000UL, 0x3fc6400bUL, 0xf69eac69UL, 0x3e550a84UL, 0x80000000UL, + 0x3fc5f808UL, 0xb7a780a4UL, 0x3e5d9224UL, 0x80000000UL, 0x3fc5b022UL, + 0xad9dfb1eUL, 0xbe55242fUL, 0x00000000UL, 0x3fc56858UL, 0x659b18beUL, + 0xbe4bfda3UL, 0x80000000UL, 0x3fc520a9UL, 0x66ee3631UL, 0xbe57d769UL, + 0x80000000UL, 0x3fc4d916UL, 0x1ec62819UL, 0x3e2427f7UL, 0x80000000UL, + 0x3fc4919fUL, 0xdec25369UL, 0xbe435431UL, 0x00000000UL, 0x3fc44a44UL, + 0xa8acfc4bUL, 0xbe3c62e8UL, 0x00000000UL, 0x3fc40304UL, 0xcf1d3eabUL, + 0xbdfba29fUL, 0x80000000UL, 0x3fc3bbdfUL, 0x79aba3eaUL, 0xbdf1b7c8UL, + 0x80000000UL, 0x3fc374d6UL, 0xb8d186daUL, 0xbe5130cfUL, 0x80000000UL, + 0x3fc32de8UL, 0x9d74f152UL, 0x3e2285b6UL, 0x00000000UL, 0x3fc2e716UL, + 0x50ae7ca9UL, 0xbe503920UL, 0x80000000UL, 0x3fc2a05eUL, 0x6caed92eUL, + 0xbe533924UL, 0x00000000UL, 0x3fc259c2UL, 0x9cb5034eUL, 0xbe510e31UL, + 0x80000000UL, 0x3fc21340UL, 0x12c4d378UL, 0xbe540b43UL, 0x80000000UL, + 0x3fc1ccd9UL, 0xcc418706UL, 0x3e59887aUL, 0x00000000UL, 0x3fc1868eUL, + 0x921f4106UL, 0xbe528e67UL, 0x80000000UL, 0x3fc1405cUL, 0x3969441eUL, + 0x3e5d8051UL, 0x00000000UL, 0x3fc0fa46UL, 0xd941ef5bUL, 0x3e5f9079UL, + 0x80000000UL, 0x3fc0b44aUL, 0x5a3e81b2UL, 0xbe567691UL, 0x00000000UL, + 0x3fc06e69UL, 0x9d66afe7UL, 0xbe4d43fbUL, 0x00000000UL, 0x3fc028a2UL, + 0x0a92a162UL, 0xbe52f394UL, 0x00000000UL, 0x3fbfc5eaUL, 0x209897e5UL, + 0x3e529e37UL, 0x00000000UL, 0x3fbf3ac5UL, 0x8458bd7bUL, 0x3e582831UL, + 0x00000000UL, 0x3fbeafd5UL, 0xb8d8b4b8UL, 0xbe486b4aUL, 0x00000000UL, + 0x3fbe2518UL, 0xe0a3b7b6UL, 0x3e5bafd2UL, 0x00000000UL, 0x3fbd9a90UL, + 0x2bf2710eUL, 0x3e383b2bUL, 0x00000000UL, 0x3fbd103cUL, 0x73eb6ab7UL, + 0xbe56d78dUL, 0x00000000UL, 0x3fbc861bUL, 0x32ceaff5UL, 0xbe32dc5aUL, + 0x00000000UL, 0x3fbbfc2eUL, 0xbee04cb7UL, 0xbe4a71a4UL, 0x00000000UL, + 0x3fbb7274UL, 0x35ae9577UL, 0x3e38142fUL, 0x00000000UL, 0x3fbae8eeUL, + 0xcbaddab4UL, 0xbe5490f0UL, 0x00000000UL, 0x3fba5f9aUL, 0x95ce1114UL, + 0x3e597c71UL, 0x00000000UL, 0x3fb9d67aUL, 0x6d7c0f78UL, 0x3e3abc2dUL, + 0x00000000UL, 0x3fb94d8dUL, 0x2841a782UL, 0xbe566cbcUL, 0x00000000UL, + 0x3fb8c4d2UL, 0x6ed429c6UL, 0xbe3cfff9UL, 0x00000000UL, 0x3fb83c4aUL, + 0xe4a49fbbUL, 0xbe552964UL, 0x00000000UL, 0x3fb7b3f4UL, 0x2193d81eUL, + 0xbe42fa72UL, 0x00000000UL, 0x3fb72bd0UL, 0xdd70c122UL, 0x3e527a8cUL, + 0x00000000UL, 0x3fb6a3dfUL, 0x03108a54UL, 0xbe450393UL, 0x00000000UL, + 0x3fb61c1fUL, 0x30ff7954UL, 0x3e565840UL, 0x00000000UL, 0x3fb59492UL, + 0xdedd460cUL, 0xbe5422b5UL, 0x00000000UL, 0x3fb50d36UL, 0x950f9f45UL, + 0xbe5313f6UL, 0x00000000UL, 0x3fb4860bUL, 0x582cdcb1UL, 0x3e506d39UL, + 0x00000000UL, 0x3fb3ff12UL, 0x7216d3a6UL, 0x3e4aa719UL, 0x00000000UL, + 0x3fb3784aUL, 0x57a423fdUL, 0x3e5a9b9fUL, 0x00000000UL, 0x3fb2f1b4UL, + 0x7a138b41UL, 0xbe50b418UL, 0x00000000UL, 0x3fb26b4eUL, 0x2fbfd7eaUL, + 0x3e23a53eUL, 0x00000000UL, 0x3fb1e519UL, 0x18913ccbUL, 0x3e465fc1UL, + 0x00000000UL, 0x3fb15f15UL, 0x7ea24e21UL, 0x3e042843UL, 0x00000000UL, + 0x3fb0d941UL, 0x7c6d9c77UL, 0x3e59f61eUL, 0x00000000UL, 0x3fb0539eUL, + 0x114efd44UL, 0x3e4ccab7UL, 0x00000000UL, 0x3faf9c56UL, 0x1777f657UL, + 0x3e552f65UL, 0x00000000UL, 0x3fae91d2UL, 0xc317b86aUL, 0xbe5a61e0UL, + 0x00000000UL, 0x3fad87acUL, 0xb7664efbUL, 0xbe41f64eUL, 0x00000000UL, + 0x3fac7de6UL, 0x5d3d03a9UL, 0x3e0807a0UL, 0x00000000UL, 0x3fab7480UL, + 0x743c38ebUL, 0xbe3726e1UL, 0x00000000UL, 0x3faa6b78UL, 0x06a253f1UL, + 0x3e5ad636UL, 0x00000000UL, 0x3fa962d0UL, 0xa35f541bUL, 0x3e5a187aUL, + 0x00000000UL, 0x3fa85a88UL, 0x4b86e446UL, 0xbe508150UL, 0x00000000UL, + 0x3fa7529cUL, 0x2589cacfUL, 0x3e52938aUL, 0x00000000UL, 0x3fa64b10UL, + 0xaf6b11f2UL, 0xbe3454cdUL, 0x00000000UL, 0x3fa543e2UL, 0x97506fefUL, + 0xbe5fdec5UL, 0x00000000UL, 0x3fa43d10UL, 0xe75f7dd9UL, 0xbe388dd3UL, + 0x00000000UL, 0x3fa3369cUL, 0xa4139632UL, 0xbdea5177UL, 0x00000000UL, + 0x3fa23086UL, 0x352d6f1eUL, 0xbe565ad6UL, 0x00000000UL, 0x3fa12accUL, + 0x77449eb7UL, 0xbe50d5c7UL, 0x00000000UL, 0x3fa0256eUL, 0x7478da78UL, + 0x3e404724UL, 0x00000000UL, 0x3f9e40dcUL, 0xf59cef7fUL, 0xbe539d0aUL, + 0x00000000UL, 0x3f9c3790UL, 0x1511d43cUL, 0x3e53c2c8UL, 0x00000000UL, + 0x3f9a2f00UL, 0x9b8bff3cUL, 0xbe43b3e1UL, 0x00000000UL, 0x3f982724UL, + 0xad1e22a5UL, 0x3e46f0bdUL, 0x00000000UL, 0x3f962000UL, 0x130d9356UL, + 0x3e475ba0UL, 0x00000000UL, 0x3f941994UL, 0x8f86f883UL, 0xbe513d0bUL, + 0x00000000UL, 0x3f9213dcUL, 0x914d0dc8UL, 0xbe534335UL, 0x00000000UL, + 0x3f900ed8UL, 0x2d73e5e7UL, 0xbe22ba75UL, 0x00000000UL, 0x3f8c1510UL, + 0xc5b7d70eUL, 0x3e599c5dUL, 0x00000000UL, 0x3f880de0UL, 0x8a27857eUL, + 0xbe3d28c8UL, 0x00000000UL, 0x3f840810UL, 0xda767328UL, 0x3e531b3dUL, + 0x00000000UL, 0x3f8003b0UL, 0x77bacaf3UL, 0xbe5f04e3UL, 0x00000000UL, + 0x3f780150UL, 0xdf4b0720UL, 0x3e5a8bffUL, 0x00000000UL, 0x3f6ffc40UL, + 0x34c48e71UL, 0xbe3fcd99UL, 0x00000000UL, 0x3f5ff6c0UL, 0x1ad218afUL, + 0xbe4c78a7UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x80000000UL, + 0x00000000UL, 0xfffff800UL, 0x00000000UL, 0xfffff800UL, 0x00000000UL, + 0x3ff72000UL, 0x161bb241UL, 0xbf5dabe1UL, 0x6dc96112UL, 0xbf836578UL, + 0xee241472UL, 0xbf9b0301UL, 0x9f95985aUL, 0xbfb528dbUL, 0xb3841d2aUL, + 0xbfd619b6UL, 0x518775e3UL, 0x3f9004f2UL, 0xac8349bbUL, 0x3fa76c9bUL, + 0x486ececcUL, 0x3fc4635eUL, 0x161bb241UL, 0xbf5dabe1UL, 0x9f95985aUL, + 0xbfb528dbUL, 0xf8b5787dUL, 0x3ef2531eUL, 0x486ececbUL, 0x3fc4635eUL, + 0x412055ccUL, 0xbdd61bb2UL, 0x00000000UL, 0xfffffff8UL, 0x00000000UL, + 0xffffffffUL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x3b700000UL, + 0xfa5abcbfUL, 0x3ff00b1aUL, 0xa7609f71UL, 0xbc84f6b2UL, 0xa9fb3335UL, + 0x3ff0163dUL, 0x9ab8cdb7UL, 0x3c9b6129UL, 0x143b0281UL, 0x3ff02168UL, + 0x0fc54eb6UL, 0xbc82bf31UL, 0x3e778061UL, 0x3ff02c9aUL, 0x535b085dUL, + 0xbc719083UL, 0x2e11bbccUL, 0x3ff037d4UL, 0xeeade11aUL, 0x3c656811UL, + 0xe86e7f85UL, 0x3ff04315UL, 0x1977c96eUL, 0xbc90a31cUL, 0x72f654b1UL, + 0x3ff04e5fUL, 0x3aa0d08cUL, 0x3c84c379UL, 0xd3158574UL, 0x3ff059b0UL, + 0xa475b465UL, 0x3c8d73e2UL, 0x0e3c1f89UL, 0x3ff0650aUL, 0x5799c397UL, + 0xbc95cb7bUL, 0x29ddf6deUL, 0x3ff0706bUL, 0xe2b13c27UL, 0xbc8c91dfUL, + 0x2b72a836UL, 0x3ff07bd4UL, 0x54458700UL, 0x3c832334UL, 0x18759bc8UL, + 0x3ff08745UL, 0x4bb284ffUL, 0x3c6186beUL, 0xf66607e0UL, 0x3ff092bdUL, + 0x800a3fd1UL, 0xbc968063UL, 0xcac6f383UL, 0x3ff09e3eUL, 0x18316136UL, + 0x3c914878UL, 0x9b1f3919UL, 0x3ff0a9c7UL, 0x873d1d38UL, 0x3c85d16cUL, + 0x6cf9890fUL, 0x3ff0b558UL, 0x4adc610bUL, 0x3c98a62eUL, 0x45e46c85UL, + 0x3ff0c0f1UL, 0x06d21cefUL, 0x3c94f989UL, 0x2b7247f7UL, 0x3ff0cc92UL, + 0x16e24f71UL, 0x3c901edcUL, 0x23395decUL, 0x3ff0d83bUL, 0xe43f316aUL, + 0xbc9bc14dUL, 0x32d3d1a2UL, 0x3ff0e3ecUL, 0x27c57b52UL, 0x3c403a17UL, + 0x5fdfa9c5UL, 0x3ff0efa5UL, 0xbc54021bUL, 0xbc949db9UL, 0xaffed31bUL, + 0x3ff0fb66UL, 0xc44ebd7bUL, 0xbc6b9bedUL, 0x28d7233eUL, 0x3ff10730UL, + 0x1692fdd5UL, 0x3c8d46ebUL, 0xd0125b51UL, 0x3ff11301UL, 0x39449b3aUL, + 0xbc96c510UL, 0xab5e2ab6UL, 0x3ff11edbUL, 0xf703fb72UL, 0xbc9ca454UL, + 0xc06c31ccUL, 0x3ff12abdUL, 0xb36ca5c7UL, 0xbc51b514UL, 0x14f204abUL, + 0x3ff136a8UL, 0xba48dcf0UL, 0xbc67108fUL, 0xaea92de0UL, 0x3ff1429aUL, + 0x9af1369eUL, 0xbc932fbfUL, 0x934f312eUL, 0x3ff14e95UL, 0x39bf44abUL, + 0xbc8b91e8UL, 0xc8a58e51UL, 0x3ff15a98UL, 0xb9eeab0aUL, 0x3c82406aUL, + 0x5471c3c2UL, 0x3ff166a4UL, 0x82ea1a32UL, 0x3c58f23bUL, 0x3c7d517bUL, + 0x3ff172b8UL, 0xb9d78a76UL, 0xbc819041UL, 0x8695bbc0UL, 0x3ff17ed4UL, + 0xe2ac5a64UL, 0x3c709e3fUL, 0x388c8deaUL, 0x3ff18af9UL, 0xd1970f6cUL, + 0xbc911023UL, 0x58375d2fUL, 0x3ff19726UL, 0x85f17e08UL, 0x3c94aaddUL, + 0xeb6fcb75UL, 0x3ff1a35bUL, 0x7b4968e4UL, 0x3c8e5b4cUL, 0xf8138a1cUL, + 0x3ff1af99UL, 0xa4b69280UL, 0x3c97bf85UL, 0x84045cd4UL, 0x3ff1bbe0UL, + 0x352ef607UL, 0xbc995386UL, 0x95281c6bUL, 0x3ff1c82fUL, 0x8010f8c9UL, + 0x3c900977UL, 0x3168b9aaUL, 0x3ff1d487UL, 0x00a2643cUL, 0x3c9e016eUL, + 0x5eb44027UL, 0x3ff1e0e7UL, 0x088cb6deUL, 0xbc96fdd8UL, 0x22fcd91dUL, + 0x3ff1ed50UL, 0x027bb78cUL, 0xbc91df98UL, 0x8438ce4dUL, 0x3ff1f9c1UL, + 0xa097af5cUL, 0xbc9bf524UL, 0x88628cd6UL, 0x3ff2063bUL, 0x814a8495UL, + 0x3c8dc775UL, 0x3578a819UL, 0x3ff212beUL, 0x2cfcaac9UL, 0x3c93592dUL, + 0x917ddc96UL, 0x3ff21f49UL, 0x9494a5eeUL, 0x3c82a97eUL, 0xa27912d1UL, + 0x3ff22bddUL, 0x5577d69fUL, 0x3c8d34fbUL, 0x6e756238UL, 0x3ff2387aUL, + 0xb6c70573UL, 0x3c99b07eUL, 0xfb82140aUL, 0x3ff2451fUL, 0x911ca996UL, + 0x3c8acfccUL, 0x4fb2a63fUL, 0x3ff251ceUL, 0xbef4f4a4UL, 0x3c8ac155UL, + 0x711ece75UL, 0x3ff25e85UL, 0x4ac31b2cUL, 0x3c93e1a2UL, 0x65e27cddUL, + 0x3ff26b45UL, 0x9940e9d9UL, 0x3c82bd33UL, 0x341ddf29UL, 0x3ff2780eUL, + 0x05f9e76cUL, 0x3c9e067cUL, 0xe1f56381UL, 0x3ff284dfUL, 0x8c3f0d7eUL, + 0xbc9a4c3aUL, 0x7591bb70UL, 0x3ff291baUL, 0x28401cbdUL, 0xbc82cc72UL, + 0xf51fdee1UL, 0x3ff29e9dUL, 0xafad1255UL, 0x3c8612e8UL, 0x66d10f13UL, + 0x3ff2ab8aUL, 0x191690a7UL, 0xbc995743UL, 0xd0dad990UL, 0x3ff2b87fUL, + 0xd6381aa4UL, 0xbc410adcUL, 0x39771b2fUL, 0x3ff2c57eUL, 0xa6eb5124UL, + 0xbc950145UL, 0xa6e4030bUL, 0x3ff2d285UL, 0x54db41d5UL, 0x3c900247UL, + 0x1f641589UL, 0x3ff2df96UL, 0xfbbce198UL, 0x3c9d16cfUL, 0xa93e2f56UL, + 0x3ff2ecafUL, 0x45d52383UL, 0x3c71ca0fUL, 0x4abd886bUL, 0x3ff2f9d2UL, + 0x532bda93UL, 0xbc653c55UL, 0x0a31b715UL, 0x3ff306feUL, 0xd23182e4UL, + 0x3c86f46aUL, 0xedeeb2fdUL, 0x3ff31432UL, 0xf3f3fcd1UL, 0x3c8959a3UL, + 0xfc4cd831UL, 0x3ff32170UL, 0x8e18047cUL, 0x3c8a9ce7UL, 0x3ba8ea32UL, + 0x3ff32eb8UL, 0x3cb4f318UL, 0xbc9c45e8UL, 0xb26416ffUL, 0x3ff33c08UL, + 0x843659a6UL, 0x3c932721UL, 0x66e3fa2dUL, 0x3ff34962UL, 0x930881a4UL, + 0xbc835a75UL, 0x5f929ff1UL, 0x3ff356c5UL, 0x5c4e4628UL, 0xbc8b5ceeUL, + 0xa2de883bUL, 0x3ff36431UL, 0xa06cb85eUL, 0xbc8c3144UL, 0x373aa9cbUL, + 0x3ff371a7UL, 0xbf42eae2UL, 0xbc963aeaUL, 0x231e754aUL, 0x3ff37f26UL, + 0x9eceb23cUL, 0xbc99f5caUL, 0x6d05d866UL, 0x3ff38caeUL, 0x3c9904bdUL, + 0xbc9e958dUL, 0x1b7140efUL, 0x3ff39a40UL, 0xfc8e2934UL, 0xbc99a9a5UL, + 0x34e59ff7UL, 0x3ff3a7dbUL, 0xd661f5e3UL, 0xbc75e436UL, 0xbfec6cf4UL, + 0x3ff3b57fUL, 0xe26fff18UL, 0x3c954c66UL, 0xc313a8e5UL, 0x3ff3c32dUL, + 0x375d29c3UL, 0xbc9efff8UL, 0x44ede173UL, 0x3ff3d0e5UL, 0x8c284c71UL, + 0x3c7fe8d0UL, 0x4c123422UL, 0x3ff3dea6UL, 0x11f09ebcUL, 0x3c8ada09UL, + 0xdf1c5175UL, 0x3ff3ec70UL, 0x7b8c9bcaUL, 0xbc8af663UL, 0x04ac801cUL, + 0x3ff3fa45UL, 0xf956f9f3UL, 0xbc97d023UL, 0xc367a024UL, 0x3ff40822UL, + 0xb6f4d048UL, 0x3c8bddf8UL, 0x21f72e2aUL, 0x3ff4160aUL, 0x1c309278UL, + 0xbc5ef369UL, 0x2709468aUL, 0x3ff423fbUL, 0xc0b314ddUL, 0xbc98462dUL, + 0xd950a897UL, 0x3ff431f5UL, 0xe35f7999UL, 0xbc81c7ddUL, 0x3f84b9d4UL, + 0x3ff43ffaUL, 0x9704c003UL, 0x3c8880beUL, 0x6061892dUL, 0x3ff44e08UL, + 0x04ef80d0UL, 0x3c489b7aUL, 0x42a7d232UL, 0x3ff45c20UL, 0x82fb1f8eUL, + 0xbc686419UL, 0xed1d0057UL, 0x3ff46a41UL, 0xd1648a76UL, 0x3c9c944bUL, + 0x668b3237UL, 0x3ff4786dUL, 0xed445733UL, 0xbc9c20f0UL, 0xb5c13cd0UL, + 0x3ff486a2UL, 0xb69062f0UL, 0x3c73c1a3UL, 0xe192aed2UL, 0x3ff494e1UL, + 0x5e499ea0UL, 0xbc83b289UL, 0xf0d7d3deUL, 0x3ff4a32aUL, 0xf3d1be56UL, + 0x3c99cb62UL, 0xea6db7d7UL, 0x3ff4b17dUL, 0x7f2897f0UL, 0xbc8125b8UL, + 0xd5362a27UL, 0x3ff4bfdaUL, 0xafec42e2UL, 0x3c7d4397UL, 0xb817c114UL, + 0x3ff4ce41UL, 0x690abd5dUL, 0x3c905e29UL, 0x99fddd0dUL, 0x3ff4dcb2UL, + 0xbc6a7833UL, 0x3c98ecdbUL, 0x81d8abffUL, 0x3ff4eb2dUL, 0x2e5d7a52UL, + 0xbc95257dUL, 0x769d2ca7UL, 0x3ff4f9b2UL, 0xd25957e3UL, 0xbc94b309UL, + 0x7f4531eeUL, 0x3ff50841UL, 0x49b7465fUL, 0x3c7a249bUL, 0xa2cf6642UL, + 0x3ff516daUL, 0x69bd93efUL, 0xbc8f7685UL, 0xe83f4eefUL, 0x3ff5257dUL, + 0x43efef71UL, 0xbc7c998dUL, 0x569d4f82UL, 0x3ff5342bUL, 0x1db13cadUL, + 0xbc807abeUL, 0xf4f6ad27UL, 0x3ff542e2UL, 0x192d5f7eUL, 0x3c87926dUL, + 0xca5d920fUL, 0x3ff551a4UL, 0xefede59bUL, 0xbc8d689cUL, 0xdde910d2UL, + 0x3ff56070UL, 0x168eebf0UL, 0xbc90fb6eUL, 0x36b527daUL, 0x3ff56f47UL, + 0x011d93adUL, 0x3c99bb2cUL, 0xdbe2c4cfUL, 0x3ff57e27UL, 0x8a57b9c4UL, + 0xbc90b98cUL, 0xd497c7fdUL, 0x3ff58d12UL, 0x5b9a1de8UL, 0x3c8295e1UL, + 0x27ff07ccUL, 0x3ff59c08UL, 0xe467e60fUL, 0xbc97e2ceUL, 0xdd485429UL, + 0x3ff5ab07UL, 0x054647adUL, 0x3c96324cUL, 0xfba87a03UL, 0x3ff5ba11UL, + 0x4c233e1aUL, 0xbc9b77a1UL, 0x8a5946b7UL, 0x3ff5c926UL, 0x816986a2UL, + 0x3c3c4b1bUL, 0x90998b93UL, 0x3ff5d845UL, 0xa8b45643UL, 0xbc9cd6a7UL, + 0x15ad2148UL, 0x3ff5e76fUL, 0x3080e65eUL, 0x3c9ba6f9UL, 0x20dceb71UL, + 0x3ff5f6a3UL, 0xe3cdcf92UL, 0xbc89eaddUL, 0xb976dc09UL, 0x3ff605e1UL, + 0x9b56de47UL, 0xbc93e242UL, 0xe6cdf6f4UL, 0x3ff6152aUL, 0x4ab84c27UL, + 0x3c9e4b3eUL, 0xb03a5585UL, 0x3ff6247eUL, 0x7e40b497UL, 0xbc9383c1UL, + 0x1d1929fdUL, 0x3ff633ddUL, 0xbeb964e5UL, 0x3c984710UL, 0x34ccc320UL, + 0x3ff64346UL, 0x759d8933UL, 0xbc8c483cUL, 0xfebc8fb7UL, 0x3ff652b9UL, + 0xc9a73e09UL, 0xbc9ae3d5UL, 0x82552225UL, 0x3ff66238UL, 0x87591c34UL, + 0xbc9bb609UL, 0xc70833f6UL, 0x3ff671c1UL, 0x586c6134UL, 0xbc8e8732UL, + 0xd44ca973UL, 0x3ff68155UL, 0x44f73e65UL, 0x3c6038aeUL, 0xb19e9538UL, + 0x3ff690f4UL, 0x9aeb445dUL, 0x3c8804bdUL, 0x667f3bcdUL, 0x3ff6a09eUL, + 0x13b26456UL, 0xbc9bdd34UL, 0xfa75173eUL, 0x3ff6b052UL, 0x2c9a9d0eUL, + 0x3c7a38f5UL, 0x750bdabfUL, 0x3ff6c012UL, 0x67ff0b0dUL, 0xbc728956UL, + 0xddd47645UL, 0x3ff6cfdcUL, 0xb6f17309UL, 0x3c9c7aa9UL, 0x3c651a2fUL, + 0x3ff6dfb2UL, 0x683c88abUL, 0xbc6bbe3aUL, 0x98593ae5UL, 0x3ff6ef92UL, + 0x9e1ac8b2UL, 0xbc90b974UL, 0xf9519484UL, 0x3ff6ff7dUL, 0x25860ef6UL, + 0xbc883c0fUL, 0x66f42e87UL, 0x3ff70f74UL, 0xd45aa65fUL, 0x3c59d644UL, + 0xe8ec5f74UL, 0x3ff71f75UL, 0x86887a99UL, 0xbc816e47UL, 0x86ead08aUL, + 0x3ff72f82UL, 0x2cd62c72UL, 0xbc920aa0UL, 0x48a58174UL, 0x3ff73f9aUL, + 0x6c65d53cUL, 0xbc90a8d9UL, 0x35d7cbfdUL, 0x3ff74fbdUL, 0x618a6e1cUL, + 0x3c9047fdUL, 0x564267c9UL, 0x3ff75febUL, 0x57316dd3UL, 0xbc902459UL, + 0xb1ab6e09UL, 0x3ff77024UL, 0x169147f8UL, 0x3c9b7877UL, 0x4fde5d3fUL, + 0x3ff78069UL, 0x0a02162dUL, 0x3c9866b8UL, 0x38ac1cf6UL, 0x3ff790b9UL, + 0x62aadd3eUL, 0x3c9349a8UL, 0x73eb0187UL, 0x3ff7a114UL, 0xee04992fUL, + 0xbc841577UL, 0x0976cfdbUL, 0x3ff7b17bUL, 0x8468dc88UL, 0xbc9bebb5UL, + 0x0130c132UL, 0x3ff7c1edUL, 0xd1164dd6UL, 0x3c9f124cUL, 0x62ff86f0UL, + 0x3ff7d26aUL, 0xfb72b8b4UL, 0x3c91bddbUL, 0x36cf4e62UL, 0x3ff7e2f3UL, + 0xba15797eUL, 0x3c705d02UL, 0x8491c491UL, 0x3ff7f387UL, 0xcf9311aeUL, + 0xbc807f11UL, 0x543e1a12UL, 0x3ff80427UL, 0x626d972bUL, 0xbc927c86UL, + 0xadd106d9UL, 0x3ff814d2UL, 0x0d151d4dUL, 0x3c946437UL, 0x994cce13UL, + 0x3ff82589UL, 0xd41532d8UL, 0xbc9d4c1dUL, 0x1eb941f7UL, 0x3ff8364cUL, + 0x31df2bd5UL, 0x3c999b9aUL, 0x4623c7adUL, 0x3ff8471aUL, 0xa341cdfbUL, + 0xbc88d684UL, 0x179f5b21UL, 0x3ff857f4UL, 0xf8b216d0UL, 0xbc5ba748UL, + 0x9b4492edUL, 0x3ff868d9UL, 0x9bd4f6baUL, 0xbc9fc6f8UL, 0xd931a436UL, + 0x3ff879caUL, 0xd2db47bdUL, 0x3c85d2d7UL, 0xd98a6699UL, 0x3ff88ac7UL, + 0xf37cb53aUL, 0x3c9994c2UL, 0xa478580fUL, 0x3ff89bd0UL, 0x4475202aUL, + 0x3c9d5395UL, 0x422aa0dbUL, 0x3ff8ace5UL, 0x56864b27UL, 0x3c96e9f1UL, + 0xbad61778UL, 0x3ff8be05UL, 0xfc43446eUL, 0x3c9ecb5eUL, 0x16b5448cUL, + 0x3ff8cf32UL, 0x32e9e3aaUL, 0xbc70d55eUL, 0x5e0866d9UL, 0x3ff8e06aUL, + 0x6fc9b2e6UL, 0xbc97114aUL, 0x99157736UL, 0x3ff8f1aeUL, 0xa2e3976cUL, + 0x3c85cc13UL, 0xd0282c8aUL, 0x3ff902feUL, 0x85fe3fd2UL, 0x3c9592caUL, + 0x0b91ffc6UL, 0x3ff9145bUL, 0x2e582524UL, 0xbc9dd679UL, 0x53aa2fe2UL, + 0x3ff925c3UL, 0xa639db7fUL, 0xbc83455fUL, 0xb0cdc5e5UL, 0x3ff93737UL, + 0x81b57ebcUL, 0xbc675fc7UL, 0x2b5f98e5UL, 0x3ff948b8UL, 0x797d2d99UL, + 0xbc8dc3d6UL, 0xcbc8520fUL, 0x3ff95a44UL, 0x96a5f039UL, 0xbc764b7cUL, + 0x9a7670b3UL, 0x3ff96bddUL, 0x7f19c896UL, 0xbc5ba596UL, 0x9fde4e50UL, + 0x3ff97d82UL, 0x7c1b85d1UL, 0xbc9d185bUL, 0xe47a22a2UL, 0x3ff98f33UL, + 0xa24c78ecUL, 0x3c7cabdaUL, 0x70ca07baUL, 0x3ff9a0f1UL, 0x91cee632UL, + 0xbc9173bdUL, 0x4d53fe0dUL, 0x3ff9b2bbUL, 0x4df6d518UL, 0xbc9dd84eUL, + 0x82a3f090UL, 0x3ff9c491UL, 0xb071f2beUL, 0x3c7c7c46UL, 0x194bb8d5UL, + 0x3ff9d674UL, 0xa3dd8233UL, 0xbc9516beUL, 0x19e32323UL, 0x3ff9e863UL, + 0x78e64c6eUL, 0x3c7824caUL, 0x8d07f29eUL, 0x3ff9fa5eUL, 0xaaf1faceUL, + 0xbc84a9ceUL, 0x7b5de565UL, 0x3ffa0c66UL, 0x5d1cd533UL, 0xbc935949UL, + 0xed8eb8bbUL, 0x3ffa1e7aUL, 0xee8be70eUL, 0x3c9c6618UL, 0xec4a2d33UL, + 0x3ffa309bUL, 0x7ddc36abUL, 0x3c96305cUL, 0x80460ad8UL, 0x3ffa42c9UL, + 0x589fb120UL, 0xbc9aa780UL, 0xb23e255dUL, 0x3ffa5503UL, 0xdb8d41e1UL, + 0xbc9d2f6eUL, 0x8af46052UL, 0x3ffa674aUL, 0x30670366UL, 0x3c650f56UL, + 0x1330b358UL, 0x3ffa799eUL, 0xcac563c7UL, 0x3c9bcb7eUL, 0x53c12e59UL, + 0x3ffa8bfeUL, 0xb2ba15a9UL, 0xbc94f867UL, 0x5579fdbfUL, 0x3ffa9e6bUL, + 0x0ef7fd31UL, 0x3c90fac9UL, 0x21356ebaUL, 0x3ffab0e5UL, 0xdae94545UL, + 0x3c889c31UL, 0xbfd3f37aUL, 0x3ffac36bUL, 0xcae76cd0UL, 0xbc8f9234UL, + 0x3a3c2774UL, 0x3ffad5ffUL, 0xb6b1b8e5UL, 0x3c97ef3bUL, 0x995ad3adUL, + 0x3ffae89fUL, 0x345dcc81UL, 0x3c97a1cdUL, 0xe622f2ffUL, 0x3ffafb4cUL, + 0x0f315ecdUL, 0xbc94b2fcUL, 0x298db666UL, 0x3ffb0e07UL, 0x4c80e425UL, + 0xbc9bdef5UL, 0x6c9a8952UL, 0x3ffb20ceUL, 0x4a0756ccUL, 0x3c94dd02UL, + 0xb84f15fbUL, 0x3ffb33a2UL, 0x3084d708UL, 0xbc62805eUL, 0x15b749b1UL, + 0x3ffb4684UL, 0xe9df7c90UL, 0xbc7f763dUL, 0x8de5593aUL, 0x3ffb5972UL, + 0xbbba6de3UL, 0xbc9c71dfUL, 0x29f1c52aUL, 0x3ffb6c6eUL, 0x52883f6eUL, + 0x3c92a8f3UL, 0xf2fb5e47UL, 0x3ffb7f76UL, 0x7e54ac3bUL, 0xbc75584fUL, + 0xf22749e4UL, 0x3ffb928cUL, 0x54cb65c6UL, 0xbc9b7216UL, 0x30a1064aUL, + 0x3ffba5b0UL, 0x0e54292eUL, 0xbc9efcd3UL, 0xb79a6f1fUL, 0x3ffbb8e0UL, + 0xc9696205UL, 0xbc3f52d1UL, 0x904bc1d2UL, 0x3ffbcc1eUL, 0x7a2d9e84UL, + 0x3c823dd0UL, 0xc3f3a207UL, 0x3ffbdf69UL, 0x60ea5b53UL, 0xbc3c2623UL, + 0x5bd71e09UL, 0x3ffbf2c2UL, 0x3f6b9c73UL, 0xbc9efdcaUL, 0x6141b33dUL, + 0x3ffc0628UL, 0xa1fbca34UL, 0xbc8d8a5aUL, 0xdd85529cUL, 0x3ffc199bUL, + 0x895048ddUL, 0x3c811065UL, 0xd9fa652cUL, 0x3ffc2d1cUL, 0x17c8a5d7UL, + 0xbc96e516UL, 0x5fffd07aUL, 0x3ffc40abUL, 0xe083c60aUL, 0x3c9b4537UL, + 0x78fafb22UL, 0x3ffc5447UL, 0x2493b5afUL, 0x3c912f07UL, 0x2e57d14bUL, + 0x3ffc67f1UL, 0xff483cadUL, 0x3c92884dUL, 0x8988c933UL, 0x3ffc7ba8UL, + 0xbe255559UL, 0xbc8e76bbUL, 0x9406e7b5UL, 0x3ffc8f6dUL, 0x48805c44UL, + 0x3c71acbcUL, 0x5751c4dbUL, 0x3ffca340UL, 0xd10d08f5UL, 0xbc87f2beUL, + 0xdcef9069UL, 0x3ffcb720UL, 0xd1e949dbUL, 0x3c7503cbUL, 0x2e6d1675UL, + 0x3ffccb0fUL, 0x86009092UL, 0xbc7d220fUL, 0x555dc3faUL, 0x3ffcdf0bUL, + 0x53829d72UL, 0xbc8dd83bUL, 0x5b5bab74UL, 0x3ffcf315UL, 0xb86dff57UL, + 0xbc9a08e9UL, 0x4a07897cUL, 0x3ffd072dUL, 0x43797a9cUL, 0xbc9cbc37UL, + 0x2b08c968UL, 0x3ffd1b53UL, 0x219a36eeUL, 0x3c955636UL, 0x080d89f2UL, + 0x3ffd2f87UL, 0x719d8578UL, 0xbc9d487bUL, 0xeacaa1d6UL, 0x3ffd43c8UL, + 0xbf5a1614UL, 0x3c93db53UL, 0xdcfba487UL, 0x3ffd5818UL, 0xd75b3707UL, + 0x3c82ed02UL, 0xe862e6d3UL, 0x3ffd6c76UL, 0x4a8165a0UL, 0x3c5fe87aUL, + 0x16c98398UL, 0x3ffd80e3UL, 0x8beddfe8UL, 0xbc911ec1UL, 0x71ff6075UL, + 0x3ffd955dUL, 0xbb9af6beUL, 0x3c9a052dUL, 0x03db3285UL, 0x3ffda9e6UL, + 0x696db532UL, 0x3c9c2300UL, 0xd63a8315UL, 0x3ffdbe7cUL, 0x926b8be4UL, + 0xbc9b76f1UL, 0xf301b460UL, 0x3ffdd321UL, 0x78f018c3UL, 0x3c92da57UL, + 0x641c0658UL, 0x3ffde7d5UL, 0x8e79ba8fUL, 0xbc9ca552UL, 0x337b9b5fUL, + 0x3ffdfc97UL, 0x4f184b5cUL, 0xbc91a5cdUL, 0x6b197d17UL, 0x3ffe1167UL, + 0xbd5c7f44UL, 0xbc72b529UL, 0x14f5a129UL, 0x3ffe2646UL, 0x817a1496UL, + 0xbc97b627UL, 0x3b16ee12UL, 0x3ffe3b33UL, 0x31fdc68bUL, 0xbc99f4a4UL, + 0xe78b3ff6UL, 0x3ffe502eUL, 0x80a9cc8fUL, 0x3c839e89UL, 0x24676d76UL, + 0x3ffe6539UL, 0x7522b735UL, 0xbc863ff8UL, 0xfbc74c83UL, 0x3ffe7a51UL, + 0xca0c8de2UL, 0x3c92d522UL, 0x77cdb740UL, 0x3ffe8f79UL, 0x80b054b1UL, + 0xbc910894UL, 0xa2a490daUL, 0x3ffea4afUL, 0x179c2893UL, 0xbc9e9c23UL, + 0x867cca6eUL, 0x3ffeb9f4UL, 0x2293e4f2UL, 0x3c94832fUL, 0x2d8e67f1UL, + 0x3ffecf48UL, 0xb411ad8cUL, 0xbc9c93f3UL, 0xa2188510UL, 0x3ffee4aaUL, + 0xa487568dUL, 0x3c91c68dUL, 0xee615a27UL, 0x3ffefa1bUL, 0x86a4b6b0UL, + 0x3c9dc7f4UL, 0x1cb6412aUL, 0x3fff0f9cUL, 0x65181d45UL, 0xbc932200UL, + 0x376bba97UL, 0x3fff252bUL, 0xbf0d8e43UL, 0x3c93a1a5UL, 0x48dd7274UL, + 0x3fff3ac9UL, 0x3ed837deUL, 0xbc795a5aUL, 0x5b6e4540UL, 0x3fff5076UL, + 0x2dd8a18bUL, 0x3c99d3e1UL, 0x798844f8UL, 0x3fff6632UL, 0x3539343eUL, + 0x3c9fa37bUL, 0xad9cbe14UL, 0x3fff7bfdUL, 0xd006350aUL, 0xbc9dbb12UL, + 0x02243c89UL, 0x3fff91d8UL, 0xa779f689UL, 0xbc612ea8UL, 0x819e90d8UL, + 0x3fffa7c1UL, 0xf3a5931eUL, 0x3c874853UL, 0x3692d514UL, 0x3fffbdbaUL, + 0x15098eb6UL, 0xbc796773UL, 0x2b8f71f1UL, 0x3fffd3c2UL, 0x966579e7UL, + 0x3c62eb74UL, 0x6b2a23d9UL, 0x3fffe9d9UL, 0x7442fde3UL, 0x3c74a603UL, + 0xe78a6731UL, 0x3f55d87fUL, 0xd704a0c0UL, 0x3fac6b08UL, 0x6fba4e77UL, + 0x3f83b2abUL, 0xff82c58fUL, 0x3fcebfbdUL, 0xfefa39efUL, 0x3fe62e42UL, + 0x00000000UL, 0x00000000UL, 0xfefa39efUL, 0x3fe62e42UL, 0xfefa39efUL, + 0xbfe62e42UL, 0xf8000000UL, 0xffffffffUL, 0xf8000000UL, 0xffffffffUL, + 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x00000000UL + +}; + +//registers, +// input: xmm0, xmm1 +// scratch: xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7 +// eax, edx, ecx, ebx + +// Code generated by Intel C compiler for LIBM library + +void MacroAssembler::fast_pow(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; + Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, L_2TAG_PACKET_14_0_2, L_2TAG_PACKET_15_0_2; + Label L_2TAG_PACKET_16_0_2, L_2TAG_PACKET_17_0_2, L_2TAG_PACKET_18_0_2, L_2TAG_PACKET_19_0_2; + Label L_2TAG_PACKET_20_0_2, L_2TAG_PACKET_21_0_2, L_2TAG_PACKET_22_0_2, L_2TAG_PACKET_23_0_2; + Label L_2TAG_PACKET_24_0_2, L_2TAG_PACKET_25_0_2, L_2TAG_PACKET_26_0_2, L_2TAG_PACKET_27_0_2; + Label L_2TAG_PACKET_28_0_2, L_2TAG_PACKET_29_0_2, L_2TAG_PACKET_30_0_2, L_2TAG_PACKET_31_0_2; + Label L_2TAG_PACKET_32_0_2, L_2TAG_PACKET_33_0_2, L_2TAG_PACKET_34_0_2, L_2TAG_PACKET_35_0_2; + Label L_2TAG_PACKET_36_0_2, L_2TAG_PACKET_37_0_2, L_2TAG_PACKET_38_0_2, L_2TAG_PACKET_39_0_2; + Label L_2TAG_PACKET_40_0_2, L_2TAG_PACKET_41_0_2, L_2TAG_PACKET_42_0_2, L_2TAG_PACKET_43_0_2; + Label L_2TAG_PACKET_44_0_2, L_2TAG_PACKET_45_0_2, L_2TAG_PACKET_46_0_2, L_2TAG_PACKET_47_0_2; + Label L_2TAG_PACKET_48_0_2, L_2TAG_PACKET_49_0_2, L_2TAG_PACKET_50_0_2, L_2TAG_PACKET_51_0_2; + Label L_2TAG_PACKET_52_0_2, L_2TAG_PACKET_53_0_2, L_2TAG_PACKET_54_0_2, L_2TAG_PACKET_55_0_2; + Label L_2TAG_PACKET_56_0_2, L_2TAG_PACKET_57_0_2, L_2TAG_PACKET_58_0_2, start; + + assert_different_registers(tmp, eax, ecx, edx); + + address static_const_table_pow = (address)_static_const_table_pow; + + bind(start); + subl(rsp, 120); + movl(Address(rsp, 64), tmp); + lea(tmp, ExternalAddress(static_const_table_pow)); + movsd(xmm0, Address(rsp, 128)); + movsd(xmm1, Address(rsp, 136)); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movl(ecx, 1069088768); + movdl(xmm7, ecx); + movsd(Address(rsp, 16), xmm1); + xorpd(xmm1, xmm1); + movl(edx, 30704); + pinsrw(xmm1, edx, 3); + movsd(Address(rsp, 8), xmm0); + movdqu(xmm3, xmm0); + movl(edx, 8192); + movdl(xmm4, edx); + movdqu(xmm6, Address(tmp, 8240)); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + psllq(xmm0, 5); + movsd(xmm2, Address(tmp, 8256)); + psrlq(xmm0, 34); + movl(edx, eax); + andl(edx, 32752); + subl(edx, 16368); + movl(ecx, edx); + sarl(edx, 31); + addl(ecx, edx); + xorl(ecx, edx); + rcpss(xmm0, xmm0); + psllq(xmm3, 12); + addl(ecx, 16); + bsrl(ecx, ecx); + psrlq(xmm3, 12); + movl(Address(rsp, 24), rsi); + subl(eax, 16); + cmpl(eax, 32736); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_0_0_2); + movl(rsi, 0); + + bind(L_2TAG_PACKET_1_0_2); + mulss(xmm0, xmm7); + movl(edx, -1); + subl(ecx, 4); + shll(edx); + movdl(xmm5, edx); + por(xmm3, xmm1); + subl(eax, 16351); + cmpl(eax, 1); + jcc(Assembler::belowEqual, L_2TAG_PACKET_2_0_2); + paddd(xmm0, xmm4); + psllq(xmm5, 32); + movdl(edx, xmm0); + psllq(xmm0, 29); + pand(xmm5, xmm3); + + bind(L_2TAG_PACKET_3_0_2); + pand(xmm0, xmm6); + subsd(xmm3, xmm5); + subl(eax, 1); + sarl(eax, 4); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + + bind(L_2TAG_PACKET_4_0_2); + mulsd(xmm3, xmm0); + movdqu(xmm1, Address(tmp, 8272)); + subsd(xmm5, xmm2); + movdqu(xmm4, Address(tmp, 8288)); + movl(ecx, eax); + sarl(eax, 31); + addl(ecx, eax); + xorl(eax, ecx); + addl(eax, 1); + bsrl(eax, eax); + unpcklpd(xmm5, xmm3); + movdqu(xmm6, Address(tmp, 8304)); + addsd(xmm3, xmm5); + andl(edx, 16760832); + shrl(edx, 10); + addpd(xmm5, Address(tmp, edx, Address::times_1, -3616)); + movdqu(xmm0, Address(tmp, 8320)); + pshufd(xmm2, xmm3, 68); + mulsd(xmm3, xmm3); + mulpd(xmm1, xmm2); + mulpd(xmm4, xmm2); + addsd(xmm5, xmm7); + mulsd(xmm2, xmm3); + addpd(xmm6, xmm1); + mulsd(xmm3, xmm3); + addpd(xmm0, xmm4); + movsd(xmm1, Address(rsp, 16)); + movzwl(ecx, Address(rsp, 22)); + pshufd(xmm7, xmm5, 238); + movsd(xmm4, Address(tmp, 8368)); + mulpd(xmm6, xmm2); + pshufd(xmm3, xmm3, 68); + mulpd(xmm0, xmm2); + shll(eax, 4); + subl(eax, 15872); + andl(ecx, 32752); + addl(eax, ecx); + mulpd(xmm3, xmm6); + cmpl(eax, 624); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_5_0_2); + xorpd(xmm6, xmm6); + movl(edx, 17080); + pinsrw(xmm6, edx, 3); + movdqu(xmm2, xmm1); + pand(xmm4, xmm1); + subsd(xmm1, xmm4); + mulsd(xmm4, xmm5); + addsd(xmm0, xmm7); + mulsd(xmm1, xmm5); + movdqu(xmm7, xmm6); + addsd(xmm6, xmm4); + addpd(xmm3, xmm0); + movdl(edx, xmm6); + subsd(xmm6, xmm7); + pshufd(xmm0, xmm3, 238); + subsd(xmm4, xmm6); + addsd(xmm0, xmm3); + movl(ecx, edx); + andl(edx, 255); + addl(edx, edx); + movdqu(xmm5, Address(tmp, edx, Address::times_8, 8384)); + addsd(xmm4, xmm1); + mulsd(xmm2, xmm0); + movdqu(xmm7, Address(tmp, 12480)); + movdqu(xmm3, Address(tmp, 12496)); + shll(ecx, 12); + xorl(ecx, rsi); + andl(ecx, -1048576); + movdl(xmm6, ecx); + addsd(xmm2, xmm4); + movsd(xmm1, Address(tmp, 12512)); + pshufd(xmm0, xmm2, 68); + pshufd(xmm4, xmm2, 68); + mulpd(xmm0, xmm0); + movl(rsi, Address(rsp, 24)); + mulpd(xmm7, xmm4); + pshufd(xmm6, xmm6, 17); + mulsd(xmm1, xmm2); + mulsd(xmm0, xmm0); + paddd(xmm5, xmm6); + addpd(xmm3, xmm7); + mulsd(xmm1, xmm5); + pshufd(xmm6, xmm5, 238); + mulpd(xmm0, xmm3); + addsd(xmm1, xmm6); + pshufd(xmm3, xmm0, 238); + mulsd(xmm0, xmm5); + mulsd(xmm3, xmm5); + addsd(xmm0, xmm1); + addsd(xmm0, xmm3); + addsd(xmm0, xmm5); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_7_0_2); + movsd(xmm0, Address(rsp, 128)); + movsd(xmm1, Address(rsp, 136)); + mulsd(xmm0, xmm1); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_0_0_2); + addl(eax, 16); + movl(edx, 32752); + andl(edx, eax); + cmpl(edx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_8_0_2); + testl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_9_0_2); + + bind(L_2TAG_PACKET_10_0_2); + movl(ecx, Address(rsp, 16)); + xorl(edx, edx); + testl(ecx, ecx); + movl(ecx, 1); + cmovl(Assembler::notEqual, edx, ecx); + orl(edx, Address(rsp, 20)); + cmpl(edx, 1072693248); + jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); + movsd(xmm0, Address(rsp, 8)); + movsd(xmm3, Address(rsp, 8)); + movdl(edx, xmm3); + psrlq(xmm3, 32); + movdl(ecx, xmm3); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_11_0_2); + xorpd(xmm3, xmm3); + movl(eax, 18416); + pinsrw(xmm3, eax, 3); + mulsd(xmm0, xmm3); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movdqu(xmm3, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 18416); + psllq(xmm0, 5); + movsd(xmm2, Address(tmp, 8256)); + psrlq(xmm0, 34); + rcpss(xmm0, xmm0); + psllq(xmm3, 12); + movdqu(xmm6, Address(tmp, 8240)); + psrlq(xmm3, 12); + mulss(xmm0, xmm7); + movl(edx, -1024); + movdl(xmm5, edx); + por(xmm3, xmm1); + paddd(xmm0, xmm4); + psllq(xmm5, 32); + movdl(edx, xmm0); + psllq(xmm0, 29); + pand(xmm5, xmm3); + movl(rsi, 0); + pand(xmm0, xmm6); + subsd(xmm3, xmm5); + andl(eax, 32752); + subl(eax, 18416); + sarl(eax, 4); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + jmp(L_2TAG_PACKET_4_0_2); + + bind(L_2TAG_PACKET_12_0_2); + movl(ecx, Address(rsp, 16)); + xorl(edx, edx); + testl(ecx, ecx); + movl(ecx, 1); + cmovl(Assembler::notEqual, edx, ecx); + orl(edx, Address(rsp, 20)); + cmpl(edx, 1072693248); + jcc(Assembler::equal, L_2TAG_PACKET_7_0_2); + movsd(xmm0, Address(rsp, 8)); + movsd(xmm3, Address(rsp, 8)); + movdl(edx, xmm3); + psrlq(xmm3, 32); + movdl(ecx, xmm3); + orl(edx, ecx); + cmpl(edx, 0); + jcc(Assembler::equal, L_2TAG_PACKET_11_0_2); + xorpd(xmm3, xmm3); + movl(eax, 18416); + pinsrw(xmm3, eax, 3); + mulsd(xmm0, xmm3); + xorpd(xmm2, xmm2); + movl(eax, 16368); + pinsrw(xmm2, eax, 3); + movdqu(xmm3, xmm0); + pextrw(eax, xmm0, 3); + por(xmm0, xmm2); + movl(ecx, 18416); + psllq(xmm0, 5); + movsd(xmm2, Address(tmp, 8256)); + psrlq(xmm0, 34); + rcpss(xmm0, xmm0); + psllq(xmm3, 12); + movdqu(xmm6, Address(tmp, 8240)); + psrlq(xmm3, 12); + mulss(xmm0, xmm7); + movl(edx, -1024); + movdl(xmm5, edx); + por(xmm3, xmm1); + paddd(xmm0, xmm4); + psllq(xmm5, 32); + movdl(edx, xmm0); + psllq(xmm0, 29); + pand(xmm5, xmm3); + movl(rsi, INT_MIN); + pand(xmm0, xmm6); + subsd(xmm3, xmm5); + andl(eax, 32752); + subl(eax, 18416); + sarl(eax, 4); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + jmp(L_2TAG_PACKET_4_0_2); + + bind(L_2TAG_PACKET_5_0_2); + cmpl(eax, 0); + jcc(Assembler::less, L_2TAG_PACKET_13_0_2); + cmpl(eax, 752); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_14_0_2); + + bind(L_2TAG_PACKET_15_0_2); + addsd(xmm0, xmm7); + movsd(xmm2, Address(tmp, 12544)); + addpd(xmm3, xmm0); + xorpd(xmm6, xmm6); + movl(eax, 17080); + pinsrw(xmm6, eax, 3); + pshufd(xmm0, xmm3, 238); + addsd(xmm0, xmm3); + movdqu(xmm3, xmm5); + addsd(xmm5, xmm0); + movdqu(xmm4, xmm2); + subsd(xmm3, xmm5); + movdqu(xmm7, xmm5); + pand(xmm5, xmm2); + movdqu(xmm2, xmm1); + pand(xmm4, xmm1); + subsd(xmm7, xmm5); + addsd(xmm0, xmm3); + subsd(xmm1, xmm4); + mulsd(xmm4, xmm5); + addsd(xmm0, xmm7); + mulsd(xmm2, xmm0); + movdqu(xmm7, xmm6); + mulsd(xmm1, xmm5); + addsd(xmm6, xmm4); + movdl(eax, xmm6); + subsd(xmm6, xmm7); + addsd(xmm2, xmm1); + movdqu(xmm7, Address(tmp, 12480)); + movdqu(xmm3, Address(tmp, 12496)); + subsd(xmm4, xmm6); + pextrw(edx, xmm6, 3); + movl(ecx, eax); + andl(eax, 255); + addl(eax, eax); + movdqu(xmm5, Address(tmp, eax, Address::times_8, 8384)); + addsd(xmm2, xmm4); + sarl(ecx, 8); + movl(eax, ecx); + sarl(ecx, 1); + subl(eax, ecx); + shll(ecx, 20); + xorl(ecx, rsi); + movdl(xmm6, ecx); + movsd(xmm1, Address(tmp, 12512)); + andl(edx, 32767); + cmpl(edx, 16529); + jcc(Assembler::above, L_2TAG_PACKET_14_0_2); + pshufd(xmm0, xmm2, 68); + pshufd(xmm4, xmm2, 68); + mulpd(xmm0, xmm0); + mulpd(xmm7, xmm4); + pshufd(xmm6, xmm6, 17); + mulsd(xmm1, xmm2); + mulsd(xmm0, xmm0); + paddd(xmm5, xmm6); + addpd(xmm3, xmm7); + mulsd(xmm1, xmm5); + pshufd(xmm6, xmm5, 238); + mulpd(xmm0, xmm3); + addsd(xmm1, xmm6); + pshufd(xmm3, xmm0, 238); + mulsd(xmm0, xmm5); + mulsd(xmm3, xmm5); + shll(eax, 4); + xorpd(xmm4, xmm4); + addl(eax, 16368); + pinsrw(xmm4, eax, 3); + addsd(xmm0, xmm1); + movl(rsi, Address(rsp, 24)); + addsd(xmm0, xmm3); + movdqu(xmm1, xmm0); + addsd(xmm0, xmm5); + mulsd(xmm0, xmm4); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_16_0_2); + cmpl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_18_0_2); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_8_0_2); + movsd(xmm1, Address(rsp, 16)); + movsd(xmm0, Address(rsp, 8)); + movdqu(xmm2, xmm0); + movdl(eax, xmm2); + psrlq(xmm2, 20); + movdl(edx, xmm2); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_19_0_2); + addsd(xmm0, xmm0); + movdl(eax, xmm1); + psrlq(xmm1, 32); + movdl(edx, xmm1); + movl(ecx, edx); + addl(edx, edx); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_20_0_2); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_20_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + movl(edx, 29); + jmp(L_2TAG_PACKET_21_0_2); + + bind(L_2TAG_PACKET_22_0_2); + movsd(xmm0, Address(rsp, 16)); + addpd(xmm0, xmm0); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_19_0_2); + movdl(eax, xmm1); + movdqu(xmm2, xmm1); + psrlq(xmm1, 32); + movdl(edx, xmm1); + movl(ecx, edx); + addl(edx, edx); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_23_0_2); + pextrw(eax, xmm2, 3); + andl(eax, 32752); + cmpl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_24_0_2); + movdl(eax, xmm2); + psrlq(xmm2, 20); + movdl(edx, xmm2); + orl(eax, edx); + jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); + + bind(L_2TAG_PACKET_24_0_2); + pextrw(eax, xmm0, 3); + testl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_25_0_2); + testl(ecx, INT_MIN); + jcc(Assembler::notEqual, L_2TAG_PACKET_26_0_2); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_27_0_2); + movsd(xmm1, Address(rsp, 16)); + movdl(eax, xmm1); + testl(eax, 1); + jcc(Assembler::notEqual, L_2TAG_PACKET_28_0_2); + testl(eax, 2); + jcc(Assembler::notEqual, L_2TAG_PACKET_29_0_2); + jmp(L_2TAG_PACKET_28_0_2); + + bind(L_2TAG_PACKET_25_0_2); + shrl(ecx, 20); + andl(ecx, 2047); + cmpl(ecx, 1075); + jcc(Assembler::above, L_2TAG_PACKET_28_0_2); + jcc(Assembler::equal, L_2TAG_PACKET_30_0_2); + cmpl(ecx, 1074); + jcc(Assembler::above, L_2TAG_PACKET_27_0_2); + cmpl(ecx, 1023); + jcc(Assembler::below, L_2TAG_PACKET_28_0_2); + movsd(xmm1, Address(rsp, 16)); + movl(eax, 17208); + xorpd(xmm3, xmm3); + pinsrw(xmm3, eax, 3); + movdqu(xmm4, xmm3); + addsd(xmm3, xmm1); + subsd(xmm4, xmm3); + addsd(xmm1, xmm4); + pextrw(eax, xmm1, 3); + andl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_28_0_2); + movdl(eax, xmm3); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_28_0_2); + + bind(L_2TAG_PACKET_29_0_2); + movsd(xmm1, Address(rsp, 16)); + pextrw(eax, xmm1, 3); + andl(eax, 32768); + jcc(Assembler::equal, L_2TAG_PACKET_18_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32768); + pinsrw(xmm0, eax, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_28_0_2); + movsd(xmm1, Address(rsp, 16)); + pextrw(eax, xmm1, 3); + andl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_26_0_2); + + bind(L_2TAG_PACKET_31_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32752); + pinsrw(xmm0, eax, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_30_0_2); + movsd(xmm1, Address(rsp, 16)); + movdl(eax, xmm1); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_28_0_2); + jmp(L_2TAG_PACKET_29_0_2); + + bind(L_2TAG_PACKET_32_0_2); + movdl(eax, xmm1); + psrlq(xmm1, 20); + movdl(edx, xmm1); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_33_0_2); + movsd(xmm0, Address(rsp, 16)); + addsd(xmm0, xmm0); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_33_0_2); + movsd(xmm0, Address(rsp, 8)); + pextrw(eax, xmm0, 3); + cmpl(eax, 49136); + jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); + movdl(ecx, xmm0); + psrlq(xmm0, 20); + movdl(edx, xmm0); + orl(ecx, edx); + jcc(Assembler::notEqual, L_2TAG_PACKET_34_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32760); + pinsrw(xmm0, eax, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_34_0_2); + movsd(xmm1, Address(rsp, 16)); + andl(eax, 32752); + subl(eax, 16368); + pextrw(edx, xmm1, 3); + xorpd(xmm0, xmm0); + xorl(eax, edx); + andl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); + movl(ecx, 32752); + pinsrw(xmm0, ecx, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_35_0_2); + movdl(eax, xmm1); + cmpl(edx, 17184); + jcc(Assembler::above, L_2TAG_PACKET_36_0_2); + testl(eax, 1); + jcc(Assembler::notEqual, L_2TAG_PACKET_37_0_2); + testl(eax, 2); + jcc(Assembler::equal, L_2TAG_PACKET_38_0_2); + jmp(L_2TAG_PACKET_39_0_2); + + bind(L_2TAG_PACKET_36_0_2); + testl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_38_0_2); + jmp(L_2TAG_PACKET_39_0_2); + + bind(L_2TAG_PACKET_9_0_2); + movsd(xmm2, Address(rsp, 8)); + movdl(eax, xmm2); + psrlq(xmm2, 31); + movdl(ecx, xmm2); + orl(eax, ecx); + jcc(Assembler::equal, L_2TAG_PACKET_11_0_2); + movsd(xmm1, Address(rsp, 16)); + pextrw(edx, xmm1, 3); + movdl(eax, xmm1); + movdqu(xmm2, xmm1); + psrlq(xmm2, 32); + movdl(ecx, xmm2); + addl(ecx, ecx); + orl(ecx, eax); + jcc(Assembler::equal, L_2TAG_PACKET_40_0_2); + andl(edx, 32752); + cmpl(edx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_32_0_2); + cmpl(edx, 17200); + jcc(Assembler::above, L_2TAG_PACKET_38_0_2); + cmpl(edx, 17184); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_35_0_2); + cmpl(edx, 16368); + jcc(Assembler::below, L_2TAG_PACKET_37_0_2); + movl(eax, 17208); + xorpd(xmm2, xmm2); + pinsrw(xmm2, eax, 3); + movdqu(xmm4, xmm2); + addsd(xmm2, xmm1); + subsd(xmm4, xmm2); + addsd(xmm1, xmm4); + pextrw(eax, xmm1, 3); + andl(eax, 32767); + jcc(Assembler::notEqual, L_2TAG_PACKET_37_0_2); + movdl(eax, xmm2); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_38_0_2); + + bind(L_2TAG_PACKET_39_0_2); + xorpd(xmm1, xmm1); + movl(edx, 30704); + pinsrw(xmm1, edx, 3); + movsd(xmm2, Address(tmp, 8256)); + movsd(xmm4, Address(rsp, 8)); + pextrw(eax, xmm4, 3); + movl(edx, 8192); + movdl(xmm4, edx); + andl(eax, 32767); + subl(eax, 16); + jcc(Assembler::less, L_2TAG_PACKET_12_0_2); + movl(edx, eax); + andl(edx, 32752); + subl(edx, 16368); + movl(ecx, edx); + sarl(edx, 31); + addl(ecx, edx); + xorl(ecx, edx); + addl(ecx, 16); + bsrl(ecx, ecx); + movl(rsi, INT_MIN); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_37_0_2); + xorpd(xmm1, xmm1); + movl(eax, 32752); + pinsrw(xmm1, eax, 3); + xorpd(xmm0, xmm0); + mulsd(xmm0, xmm1); + movl(edx, 28); + jmp(L_2TAG_PACKET_21_0_2); + + bind(L_2TAG_PACKET_38_0_2); + xorpd(xmm1, xmm1); + movl(edx, 30704); + pinsrw(xmm1, edx, 3); + movsd(xmm2, Address(tmp, 8256)); + movsd(xmm4, Address(rsp, 8)); + pextrw(eax, xmm4, 3); + movl(edx, 8192); + movdl(xmm4, edx); + andl(eax, 32767); + subl(eax, 16); + jcc(Assembler::less, L_2TAG_PACKET_10_0_2); + movl(edx, eax); + andl(edx, 32752); + subl(edx, 16368); + movl(ecx, edx); + sarl(edx, 31); + addl(ecx, edx); + xorl(ecx, edx); + addl(ecx, 16); + bsrl(ecx, ecx); + movl(rsi, 0); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_23_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_26_0_2); + xorpd(xmm0, xmm0); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_13_0_2); + addl(eax, 384); + cmpl(eax, 0); + jcc(Assembler::less, L_2TAG_PACKET_41_0_2); + mulsd(xmm5, xmm1); + addsd(xmm0, xmm7); + shrl(rsi, 31); + addpd(xmm3, xmm0); + pshufd(xmm0, xmm3, 238); + addsd(xmm3, xmm0); + movsd(xmm4, Address(tmp, rsi, Address::times_8, 12528)); + mulsd(xmm1, xmm3); + xorpd(xmm0, xmm0); + movl(eax, 16368); + shll(rsi, 15); + orl(eax, rsi); + pinsrw(xmm0, eax, 3); + addsd(xmm5, xmm1); + movl(rsi, Address(rsp, 24)); + mulsd(xmm5, xmm4); + addsd(xmm0, xmm5); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_41_0_2); + movl(rsi, Address(rsp, 24)); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_40_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_42_0_2); + xorpd(xmm0, xmm0); + movl(eax, 16368); + pinsrw(xmm0, eax, 3); + movl(edx, 26); + jmp(L_2TAG_PACKET_21_0_2); + + bind(L_2TAG_PACKET_11_0_2); + movsd(xmm1, Address(rsp, 16)); + movdqu(xmm2, xmm1); + pextrw(eax, xmm1, 3); + andl(eax, 32752); + cmpl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_43_0_2); + movdl(eax, xmm2); + psrlq(xmm2, 20); + movdl(edx, xmm2); + orl(eax, edx); + jcc(Assembler::notEqual, L_2TAG_PACKET_22_0_2); + + bind(L_2TAG_PACKET_43_0_2); + movdl(eax, xmm1); + psrlq(xmm1, 32); + movdl(edx, xmm1); + movl(ecx, edx); + addl(edx, edx); + orl(eax, edx); + jcc(Assembler::equal, L_2TAG_PACKET_42_0_2); + shrl(edx, 21); + cmpl(edx, 1075); + jcc(Assembler::above, L_2TAG_PACKET_44_0_2); + jcc(Assembler::equal, L_2TAG_PACKET_45_0_2); + cmpl(edx, 1023); + jcc(Assembler::below, L_2TAG_PACKET_44_0_2); + movsd(xmm1, Address(rsp, 16)); + movl(eax, 17208); + xorpd(xmm3, xmm3); + pinsrw(xmm3, eax, 3); + movdqu(xmm4, xmm3); + addsd(xmm3, xmm1); + subsd(xmm4, xmm3); + addsd(xmm1, xmm4); + pextrw(eax, xmm1, 3); + andl(eax, 32752); + jcc(Assembler::notEqual, L_2TAG_PACKET_44_0_2); + movdl(eax, xmm3); + andl(eax, 1); + jcc(Assembler::equal, L_2TAG_PACKET_44_0_2); + + bind(L_2TAG_PACKET_46_0_2); + movsd(xmm0, Address(rsp, 8)); + testl(ecx, INT_MIN); + jcc(Assembler::notEqual, L_2TAG_PACKET_47_0_2); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_45_0_2); + movsd(xmm1, Address(rsp, 16)); + movdl(eax, xmm1); + testl(eax, 1); + jcc(Assembler::notEqual, L_2TAG_PACKET_46_0_2); + + bind(L_2TAG_PACKET_44_0_2); + testl(ecx, INT_MIN); + jcc(Assembler::equal, L_2TAG_PACKET_26_0_2); + xorpd(xmm0, xmm0); + + bind(L_2TAG_PACKET_47_0_2); + movl(eax, 16368); + xorpd(xmm1, xmm1); + pinsrw(xmm1, eax, 3); + divsd(xmm1, xmm0); + movdqu(xmm0, xmm1); + movl(edx, 27); + jmp(L_2TAG_PACKET_21_0_2); + + bind(L_2TAG_PACKET_14_0_2); + movsd(xmm2, Address(rsp, 8)); + movsd(xmm6, Address(rsp, 16)); + pextrw(eax, xmm2, 3); + pextrw(edx, xmm6, 3); + movl(ecx, 32752); + andl(ecx, edx); + cmpl(ecx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_48_0_2); + andl(eax, 32752); + subl(eax, 16368); + xorl(edx, eax); + testl(edx, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_49_0_2); + + bind(L_2TAG_PACKET_50_0_2); + movl(eax, 32736); + pinsrw(xmm0, eax, 3); + shrl(rsi, 16); + orl(eax, rsi); + pinsrw(xmm1, eax, 3); + movl(rsi, Address(rsp, 24)); + mulsd(xmm0, xmm1); + + bind(L_2TAG_PACKET_17_0_2); + movl(edx, 24); + + bind(L_2TAG_PACKET_21_0_2); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_49_0_2); + movl(eax, 16); + pinsrw(xmm0, eax, 3); + mulsd(xmm0, xmm0); + testl(rsi, INT_MIN); + jcc(Assembler::equal, L_2TAG_PACKET_51_0_2); + movsd(xmm2, Address(tmp, 12560)); + xorpd(xmm0, xmm2); + + bind(L_2TAG_PACKET_51_0_2); + movl(rsi, Address(rsp, 24)); + movl(edx, 25); + jmp(L_2TAG_PACKET_21_0_2); + + bind(L_2TAG_PACKET_16_0_2); + pextrw(ecx, xmm5, 3); + pextrw(edx, xmm4, 3); + movl(eax, -1); + andl(ecx, 32752); + subl(ecx, 16368); + andl(edx, 32752); + addl(edx, ecx); + movl(ecx, -31); + sarl(edx, 4); + subl(ecx, edx); + jcc(Assembler::lessEqual, L_2TAG_PACKET_52_0_2); + cmpl(ecx, 20); + jcc(Assembler::above, L_2TAG_PACKET_53_0_2); + shll(eax); + + bind(L_2TAG_PACKET_52_0_2); + movdl(xmm0, eax); + psllq(xmm0, 32); + pand(xmm0, xmm5); + subsd(xmm5, xmm0); + addsd(xmm5, xmm1); + mulsd(xmm0, xmm4); + mulsd(xmm5, xmm4); + addsd(xmm0, xmm5); + + bind(L_2TAG_PACKET_53_0_2); + movl(edx, 25); + jmp(L_2TAG_PACKET_21_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movzwl(ecx, Address(rsp, 22)); + movl(edx, INT_MIN); + movdl(xmm1, edx); + xorpd(xmm7, xmm7); + paddd(xmm0, xmm4); + psllq(xmm5, 32); + movdl(edx, xmm0); + psllq(xmm0, 29); + paddq(xmm1, xmm3); + pand(xmm5, xmm1); + andl(ecx, 32752); + cmpl(ecx, 16560); + jcc(Assembler::below, L_2TAG_PACKET_3_0_2); + pand(xmm0, xmm6); + subsd(xmm3, xmm5); + addl(eax, 16351); + shrl(eax, 4); + subl(eax, 1022); + cvtsi2sdl(xmm7, eax); + mulpd(xmm5, xmm0); + movsd(xmm4, Address(tmp, 0)); + mulsd(xmm3, xmm0); + movsd(xmm6, Address(tmp, 0)); + subsd(xmm5, xmm2); + movsd(xmm1, Address(tmp, 8)); + pshufd(xmm2, xmm3, 68); + unpcklpd(xmm5, xmm3); + addsd(xmm3, xmm5); + movsd(xmm0, Address(tmp, 8)); + andl(edx, 16760832); + shrl(edx, 10); + addpd(xmm7, Address(tmp, edx, Address::times_1, -3616)); + mulsd(xmm4, xmm5); + mulsd(xmm0, xmm5); + mulsd(xmm6, xmm2); + mulsd(xmm1, xmm2); + movdqu(xmm2, xmm5); + mulsd(xmm4, xmm5); + addsd(xmm5, xmm0); + movdqu(xmm0, xmm7); + addsd(xmm2, xmm3); + addsd(xmm7, xmm5); + mulsd(xmm6, xmm2); + subsd(xmm0, xmm7); + movdqu(xmm2, xmm7); + addsd(xmm7, xmm4); + addsd(xmm0, xmm5); + subsd(xmm2, xmm7); + addsd(xmm4, xmm2); + pshufd(xmm2, xmm5, 238); + movdqu(xmm5, xmm7); + addsd(xmm7, xmm2); + addsd(xmm4, xmm0); + movdqu(xmm0, Address(tmp, 8272)); + subsd(xmm5, xmm7); + addsd(xmm6, xmm4); + movdqu(xmm4, xmm7); + addsd(xmm5, xmm2); + addsd(xmm7, xmm1); + movdqu(xmm2, Address(tmp, 8336)); + subsd(xmm4, xmm7); + addsd(xmm6, xmm5); + addsd(xmm4, xmm1); + pshufd(xmm5, xmm7, 238); + movdqu(xmm1, xmm7); + addsd(xmm7, xmm5); + subsd(xmm1, xmm7); + addsd(xmm1, xmm5); + movdqu(xmm5, Address(tmp, 8352)); + pshufd(xmm3, xmm3, 68); + addsd(xmm6, xmm4); + addsd(xmm6, xmm1); + movdqu(xmm1, Address(tmp, 8304)); + mulpd(xmm0, xmm3); + mulpd(xmm2, xmm3); + pshufd(xmm4, xmm3, 68); + mulpd(xmm3, xmm3); + addpd(xmm0, xmm1); + addpd(xmm5, xmm2); + mulsd(xmm4, xmm3); + movsd(xmm2, Address(tmp, 16)); + mulpd(xmm3, xmm3); + movsd(xmm1, Address(rsp, 16)); + movzwl(ecx, Address(rsp, 22)); + mulpd(xmm0, xmm4); + pextrw(eax, xmm7, 3); + mulpd(xmm5, xmm4); + mulpd(xmm0, xmm3); + movsd(xmm4, Address(tmp, 8376)); + pand(xmm2, xmm7); + addsd(xmm5, xmm6); + subsd(xmm7, xmm2); + addpd(xmm5, xmm0); + andl(eax, 32752); + subl(eax, 16368); + andl(ecx, 32752); + cmpl(ecx, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_48_0_2); + addl(ecx, eax); + cmpl(ecx, 16576); + jcc(Assembler::aboveEqual, L_2TAG_PACKET_54_0_2); + pshufd(xmm0, xmm5, 238); + pand(xmm4, xmm1); + movdqu(xmm3, xmm1); + addsd(xmm5, xmm0); + subsd(xmm1, xmm4); + xorpd(xmm6, xmm6); + movl(edx, 17080); + pinsrw(xmm6, edx, 3); + addsd(xmm7, xmm5); + mulsd(xmm4, xmm2); + mulsd(xmm1, xmm2); + movdqu(xmm5, xmm6); + mulsd(xmm3, xmm7); + addsd(xmm6, xmm4); + addsd(xmm1, xmm3); + movdqu(xmm7, Address(tmp, 12480)); + movdl(edx, xmm6); + subsd(xmm6, xmm5); + movdqu(xmm3, Address(tmp, 12496)); + movsd(xmm2, Address(tmp, 12512)); + subsd(xmm4, xmm6); + movl(ecx, edx); + andl(edx, 255); + addl(edx, edx); + movdqu(xmm5, Address(tmp, edx, Address::times_8, 8384)); + addsd(xmm4, xmm1); + pextrw(edx, xmm6, 3); + shrl(ecx, 8); + movl(eax, ecx); + shrl(ecx, 1); + subl(eax, ecx); + shll(ecx, 20); + movdl(xmm6, ecx); + pshufd(xmm0, xmm4, 68); + pshufd(xmm1, xmm4, 68); + mulpd(xmm0, xmm0); + mulpd(xmm7, xmm1); + pshufd(xmm6, xmm6, 17); + mulsd(xmm2, xmm4); + andl(edx, 32767); + cmpl(edx, 16529); + jcc(Assembler::above, L_2TAG_PACKET_14_0_2); + mulsd(xmm0, xmm0); + paddd(xmm5, xmm6); + addpd(xmm3, xmm7); + mulsd(xmm2, xmm5); + pshufd(xmm6, xmm5, 238); + mulpd(xmm0, xmm3); + addsd(xmm2, xmm6); + pshufd(xmm3, xmm0, 238); + addl(eax, 1023); + shll(eax, 20); + orl(eax, rsi); + movdl(xmm4, eax); + mulsd(xmm0, xmm5); + mulsd(xmm3, xmm5); + addsd(xmm0, xmm2); + psllq(xmm4, 32); + addsd(xmm0, xmm3); + movdqu(xmm1, xmm0); + addsd(xmm0, xmm5); + movl(rsi, Address(rsp, 24)); + mulsd(xmm0, xmm4); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_16_0_2); + cmpl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_17_0_2); + + bind(L_2TAG_PACKET_55_0_2); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_6_0_2); + + bind(L_2TAG_PACKET_48_0_2); + movl(rsi, Address(rsp, 24)); + + bind(L_2TAG_PACKET_56_0_2); + movsd(xmm0, Address(rsp, 8)); + movsd(xmm1, Address(rsp, 16)); + addsd(xmm1, xmm1); + xorpd(xmm2, xmm2); + movl(eax, 49136); + pinsrw(xmm2, eax, 3); + addsd(xmm2, xmm0); + pextrw(eax, xmm2, 3); + cmpl(eax, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_57_0_2); + xorpd(xmm0, xmm0); + movl(eax, 32760); + pinsrw(xmm0, eax, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_57_0_2); + movdl(edx, xmm1); + movdqu(xmm3, xmm1); + psrlq(xmm3, 20); + movdl(ecx, xmm3); + orl(ecx, edx); + jcc(Assembler::equal, L_2TAG_PACKET_58_0_2); + addsd(xmm1, xmm1); + movdqu(xmm0, xmm1); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_58_0_2); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + pextrw(edx, xmm1, 3); + xorpd(xmm0, xmm0); + subl(eax, 16368); + xorl(eax, edx); + testl(eax, 32768); + jcc(Assembler::notEqual, L_2TAG_PACKET_18_0_2); + movl(edx, 32752); + pinsrw(xmm0, edx, 3); + jmp(L_2TAG_PACKET_18_0_2); + + bind(L_2TAG_PACKET_54_0_2); + pextrw(eax, xmm1, 3); + pextrw(ecx, xmm2, 3); + xorl(eax, ecx); + testl(eax, 32768); + jcc(Assembler::equal, L_2TAG_PACKET_50_0_2); + jmp(L_2TAG_PACKET_49_0_2); + + bind(L_2TAG_PACKET_6_0_2); + movl(tmp, Address(rsp, 64)); + +} +#endif diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_sha.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_sha.cpp index bbc96156fe5..a0910f395bb 100644 --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86_sha.cpp +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_sha.cpp @@ -493,3 +493,543 @@ void MacroAssembler::fast_sha256(XMMRegister msg, XMMRegister state0, XMMRegiste bind(done_hash); } + +#ifdef _LP64 +/* + The algorithm below is based on Intel publication: + "Fast SHA-256 Implementations on Intelë Architecture Processors" by Jim Guilford, Kirk Yap and Vinodh Gopal. + The assembly code was originally provided by Sean Gulley and in many places preserves + the original assembly NAMES and comments to simplify matching Java assembly with its original. + The Java version was substantially redesigned to replace 1200 assembly instruction with + much shorter run-time generator of the same code in memory. +*/ + +void MacroAssembler::sha256_AVX2_one_round_compute( + Register reg_old_h, + Register reg_a, + Register reg_b, + Register reg_c, + Register reg_d, + Register reg_e, + Register reg_f, + Register reg_g, + Register reg_h, + int iter) { + const Register& reg_y0 = r13; + const Register& reg_y1 = r14; + const Register& reg_y2 = r15; + const Register& reg_y3 = rcx; + const Register& reg_T1 = r12; + //;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RND iter ;;;;;;;;;;;;;;;;;;;;;;;;;;; + if (iter%4 > 0) { + addl(reg_old_h, reg_y2); // reg_h = k + w + reg_h + S0 + S1 + CH = t1 + S0; -- + } + movl(reg_y2, reg_f); // reg_y2 = reg_f ; CH + rorxd(reg_y0, reg_e, 25); // reg_y0 = reg_e >> 25 ; S1A + rorxd(reg_y1, reg_e, 11); // reg_y1 = reg_e >> 11 ; S1B + xorl(reg_y2, reg_g); // reg_y2 = reg_f^reg_g ; CH + + xorl(reg_y0, reg_y1); // reg_y0 = (reg_e>>25) ^ (reg_h>>11) ; S1 + rorxd(reg_y1, reg_e, 6); // reg_y1 = (reg_e >> 6) ; S1 + andl(reg_y2, reg_e); // reg_y2 = (reg_f^reg_g)®_e ; CH + + if (iter%4 > 0) { + addl(reg_old_h, reg_y3); // reg_h = t1 + S0 + MAJ ; -- + } + + xorl(reg_y0, reg_y1); // reg_y0 = (reg_e>>25) ^ (reg_e>>11) ^ (reg_e>>6) ; S1 + rorxd(reg_T1, reg_a, 13); // reg_T1 = reg_a >> 13 ; S0B + xorl(reg_y2, reg_g); // reg_y2 = CH = ((reg_f^reg_g)®_e)^reg_g ; CH + rorxd(reg_y1, reg_a, 22); // reg_y1 = reg_a >> 22 ; S0A + movl(reg_y3, reg_a); // reg_y3 = reg_a ; MAJA + + xorl(reg_y1, reg_T1); // reg_y1 = (reg_a>>22) ^ (reg_a>>13) ; S0 + rorxd(reg_T1, reg_a, 2); // reg_T1 = (reg_a >> 2) ; S0 + addl(reg_h, Address(rsp, rdx, Address::times_1, 4*iter)); // reg_h = k + w + reg_h ; -- + orl(reg_y3, reg_c); // reg_y3 = reg_a|reg_c ; MAJA + + xorl(reg_y1, reg_T1); // reg_y1 = (reg_a>>22) ^ (reg_a>>13) ^ (reg_a>>2) ; S0 + movl(reg_T1, reg_a); // reg_T1 = reg_a ; MAJB + andl(reg_y3, reg_b); // reg_y3 = (reg_a|reg_c)®_b ; MAJA + andl(reg_T1, reg_c); // reg_T1 = reg_a®_c ; MAJB + addl(reg_y2, reg_y0); // reg_y2 = S1 + CH ; -- + + + addl(reg_d, reg_h); // reg_d = k + w + reg_h + reg_d ; -- + orl(reg_y3, reg_T1); // reg_y3 = MAJ = (reg_a|reg_c)®_b)|(reg_a®_c) ; MAJ + addl(reg_h, reg_y1); // reg_h = k + w + reg_h + S0 ; -- + + addl(reg_d, reg_y2); // reg_d = k + w + reg_h + reg_d + S1 + CH = reg_d + t1 ; -- + + + if (iter%4 == 3) { + addl(reg_h, reg_y2); // reg_h = k + w + reg_h + S0 + S1 + CH = t1 + S0; -- + addl(reg_h, reg_y3); // reg_h = t1 + S0 + MAJ ; -- + } +} + +void MacroAssembler::sha256_AVX2_four_rounds_compute_first(int start) { + sha256_AVX2_one_round_compute(rax, rax, rbx, rdi, rsi, r8, r9, r10, r11, start + 0); + sha256_AVX2_one_round_compute(r11, r11, rax, rbx, rdi, rsi, r8, r9, r10, start + 1); + sha256_AVX2_one_round_compute(r10, r10, r11, rax, rbx, rdi, rsi, r8, r9, start + 2); + sha256_AVX2_one_round_compute(r9, r9, r10, r11, rax, rbx, rdi, rsi, r8, start + 3); +} + +void MacroAssembler::sha256_AVX2_four_rounds_compute_last(int start) { + sha256_AVX2_one_round_compute(r8, r8, r9, r10, r11, rax, rbx, rdi, rsi, start + 0); + sha256_AVX2_one_round_compute(rsi, rsi, r8, r9, r10, r11, rax, rbx, rdi, start + 1); + sha256_AVX2_one_round_compute(rdi, rdi, rsi, r8, r9, r10, r11, rax, rbx, start + 2); + sha256_AVX2_one_round_compute(rbx, rbx, rdi, rsi, r8, r9, r10, r11, rax, start + 3); +} + +void MacroAssembler::sha256_AVX2_one_round_and_sched( + XMMRegister xmm_0, /* == ymm4 on 0, 1, 2, 3 iterations, then rotate 4 registers left on 4, 8, 12 iterations */ + XMMRegister xmm_1, /* ymm5 */ /* full cycle is 16 iterations */ + XMMRegister xmm_2, /* ymm6 */ + XMMRegister xmm_3, /* ymm7 */ + Register reg_a, /* == rax on 0 iteration, then rotate 8 register right on each next iteration */ + Register reg_b, /* rbx */ /* full cycle is 8 iterations */ + Register reg_c, /* rdi */ + Register reg_d, /* rsi */ + Register reg_e, /* r8 */ + Register reg_f, /* r9d */ + Register reg_g, /* r10d */ + Register reg_h, /* r11d */ + int iter) +{ + movl(rcx, reg_a); // rcx = reg_a ; MAJA + rorxd(r13, reg_e, 25); // r13 = reg_e >> 25 ; S1A + rorxd(r14, reg_e, 11); // r14 = reg_e >> 11 ; S1B + addl(reg_h, Address(rsp, rdx, Address::times_1, 4*iter)); + orl(rcx, reg_c); // rcx = reg_a|reg_c ; MAJA + + movl(r15, reg_f); // r15 = reg_f ; CH + rorxd(r12, reg_a, 13); // r12 = reg_a >> 13 ; S0B + xorl(r13, r14); // r13 = (reg_e>>25) ^ (reg_e>>11) ; S1 + xorl(r15, reg_g); // r15 = reg_f^reg_g ; CH + + rorxd(r14, reg_e, 6); // r14 = (reg_e >> 6) ; S1 + andl(r15, reg_e); // r15 = (reg_f^reg_g)®_e ; CH + + xorl(r13, r14); // r13 = (reg_e>>25) ^ (reg_e>>11) ^ (reg_e>>6) ; S1 + rorxd(r14, reg_a, 22); // r14 = reg_a >> 22 ; S0A + addl(reg_d, reg_h); // reg_d = k + w + reg_h + reg_d ; -- + + andl(rcx, reg_b); // rcx = (reg_a|reg_c)®_b ; MAJA + xorl(r14, r12); // r14 = (reg_a>>22) ^ (reg_a>>13) ; S0 + + rorxd(r12, reg_a, 2); // r12 = (reg_a >> 2) ; S0 + xorl(r15, reg_g); // r15 = CH = ((reg_f^reg_g)®_e)^reg_g ; CH + + xorl(r14, r12); // r14 = (reg_a>>22) ^ (reg_a>>13) ^ (reg_a>>2) ; S0 + movl(r12, reg_a); // r12 = reg_a ; MAJB + andl(r12, reg_c); // r12 = reg_a®_c ; MAJB + addl(r15, r13); // r15 = S1 + CH ; -- + + orl(rcx, r12); // rcx = MAJ = (reg_a|reg_c)®_b)|(reg_a®_c) ; MAJ + addl(reg_h, r14); // reg_h = k + w + reg_h + S0 ; -- + addl(reg_d, r15); // reg_d = k + w + reg_h + reg_d + S1 + CH = reg_d + t1 ; -- + + addl(reg_h, r15); // reg_h = k + w + reg_h + S0 + S1 + CH = t1 + S0; -- + addl(reg_h, rcx); // reg_h = t1 + S0 + MAJ ; -- + + if (iter%4 == 0) { + vpalignr(xmm0, xmm_3, xmm_2, 4, AVX_256bit); // ymm0 = W[-7] + vpaddd(xmm0, xmm0, xmm_0, AVX_256bit); // ymm0 = W[-7] + W[-16]; y1 = (e >> 6) ; S1 + vpalignr(xmm1, xmm_1, xmm_0, 4, AVX_256bit); // ymm1 = W[-15] + vpsrld(xmm2, xmm1, 7, AVX_256bit); + vpslld(xmm3, xmm1, 32-7, AVX_256bit); + vpor(xmm3, xmm3, xmm2, AVX_256bit); // ymm3 = W[-15] ror 7 + vpsrld(xmm2, xmm1,18, AVX_256bit); + } else if (iter%4 == 1 ) { + vpsrld(xmm8, xmm1, 3, AVX_256bit); // ymm8 = W[-15] >> 3 + vpslld(xmm1, xmm1, 32-18, AVX_256bit); + vpxor(xmm3, xmm3, xmm1, AVX_256bit); + vpxor(xmm3, xmm3, xmm2, AVX_256bit); // ymm3 = W[-15] ror 7 ^ W[-15] ror 18 + vpxor(xmm1, xmm3, xmm8, AVX_256bit); // ymm1 = s0 + vpshufd(xmm2, xmm_3, 0xFA, AVX_256bit); // 11111010b ; ymm2 = W[-2] {BBAA} + vpaddd(xmm0, xmm0, xmm1, AVX_256bit); // ymm0 = W[-16] + W[-7] + s0 + vpsrld(xmm8, xmm2, 10, AVX_256bit); // ymm8 = W[-2] >> 10 {BBAA} + } else if (iter%4 == 2) { + vpsrlq(xmm3, xmm2, 19, AVX_256bit); // ymm3 = W[-2] ror 19 {xBxA} + vpsrlq(xmm2, xmm2, 17, AVX_256bit); // ymm2 = W[-2] ror 17 {xBxA} + vpxor(xmm2, xmm2, xmm3, AVX_256bit); + vpxor(xmm8, xmm8, xmm2, AVX_256bit); // ymm8 = s1 {xBxA} + vpshufb(xmm8, xmm8, xmm10, AVX_256bit); // ymm8 = s1 {00BA} + vpaddd(xmm0, xmm0, xmm8, AVX_256bit); // ymm0 = {..., ..., W[1], W[0]} + vpshufd(xmm2, xmm0, 0x50, AVX_256bit); // 01010000b ; ymm2 = W[-2] {DDCC} + } else if (iter%4 == 3) { + vpsrld(xmm11, xmm2, 10, AVX_256bit); // ymm11 = W[-2] >> 10 {DDCC} + vpsrlq(xmm3, xmm2, 19, AVX_256bit); // ymm3 = W[-2] ror 19 {xDxC} + vpsrlq(xmm2, xmm2, 17, AVX_256bit); // ymm2 = W[-2] ror 17 {xDxC} + vpxor(xmm2, xmm2, xmm3, AVX_256bit); + vpxor(xmm11, xmm11, xmm2, AVX_256bit); // ymm11 = s1 {xDxC} + vpshufb(xmm11, xmm11, xmm12, AVX_256bit); // ymm11 = s1 {DC00} + vpaddd(xmm_0, xmm11, xmm0, AVX_256bit); // xmm_0 = {W[3], W[2], W[1], W[0]} + } +} + +void MacroAssembler::addm(int disp, Register r1, Register r2) { + addl(r2, Address(r1, disp)); + movl(Address(r1, disp), r2); +} + +void MacroAssembler::sha256_AVX2(XMMRegister msg, XMMRegister state0, XMMRegister state1, XMMRegister msgtmp0, + XMMRegister msgtmp1, XMMRegister msgtmp2, XMMRegister msgtmp3, XMMRegister msgtmp4, + Register buf, Register state, Register ofs, Register limit, Register rsp, + bool multi_block, XMMRegister shuf_mask) { + + Label loop0, loop1, loop2, loop3, + last_block_enter, do_last_block, only_one_block, done_hash, + compute_size, compute_size_end, + compute_size1, compute_size_end1; + + address K256_W = StubRoutines::x86::k256_W_addr(); + address pshuffle_byte_flip_mask = StubRoutines::x86::pshuffle_byte_flip_mask_addr(); + address pshuffle_byte_flip_mask_addr = 0; + +const XMMRegister& SHUF_00BA = xmm10; // ymm10: shuffle xBxA -> 00BA +const XMMRegister& SHUF_DC00 = xmm12; // ymm12: shuffle xDxC -> DC00 +const XMMRegister& BYTE_FLIP_MASK = xmm13; // ymm13 + +const XMMRegister& X_BYTE_FLIP_MASK = xmm13; //XMM version of BYTE_FLIP_MASK + +const Register& NUM_BLKS = r8; // 3rd arg +const Register& CTX = rdx; // 2nd arg +const Register& INP = rcx; // 1st arg + +const Register& c = rdi; +const Register& d = rsi; +const Register& e = r8; // clobbers NUM_BLKS +const Register& y3 = rcx; // clobbers INP + +const Register& TBL = rbp; +const Register& SRND = CTX; // SRND is same register as CTX + +const Register& a = rax; +const Register& b = rbx; +const Register& f = r9; +const Register& g = r10; +const Register& h = r11; + +const Register& T1 = r12; +const Register& y0 = r13; +const Register& y1 = r14; +const Register& y2 = r15; + + +enum { + _XFER_SIZE = 2*64*4, // 2 blocks, 64 rounds, 4 bytes/round +#ifndef _WIN64 + _XMM_SAVE_SIZE = 0, +#else + _XMM_SAVE_SIZE = 8*16, +#endif + _INP_END_SIZE = 8, + _INP_SIZE = 8, + _CTX_SIZE = 8, + _RSP_SIZE = 8, + + _XFER = 0, + _XMM_SAVE = _XFER + _XFER_SIZE, + _INP_END = _XMM_SAVE + _XMM_SAVE_SIZE, + _INP = _INP_END + _INP_END_SIZE, + _CTX = _INP + _INP_SIZE, + _RSP = _CTX + _CTX_SIZE, + STACK_SIZE = _RSP + _RSP_SIZE +}; + +#ifndef _WIN64 + push(rcx); // linux: this is limit, need at the end + push(rdx); // linux: this is ofs +#else + push(r8); // win64: this is ofs + push(r9); // win64: this is limit, we need them again at the very and +#endif + + + push(rbx); +#ifdef _WIN64 + push(rsi); + push(rdi); +#endif + push(rbp); + push(r12); + push(r13); + push(r14); + push(r15); + + movq(rax, rsp); + subq(rsp, STACK_SIZE); + andq(rsp, -32); + movq(Address(rsp, _RSP), rax); + +#ifndef _WIN64 + // copy linux params to win64 params, therefore the rest of code will be the same for both + movq(r9, rcx); + movq(r8, rdx); + movq(rdx, rsi); + movq(rcx, rdi); +#endif + + // setting original assembly ABI + /** message to encrypt in INP */ + lea(INP, Address(rcx, 0)); // rcx == message (buf) ;; linux: INP = buf = rdi + /** digest in CTX */ + movq(CTX, rdx); // rdx = digest (state) ;; linux: CTX = state = rsi + + /** NUM_BLK is the length of message, need to set it from ofs and limit */ + if (multi_block) { + + // Win64: cannot directly update NUM_BLKS, since NUM_BLKS = ofs = r8 + // on entry r8 = ofs + // on exit r8 = NUM_BLKS + + xorq(rax, rax); + + bind(compute_size); + cmpptr(r8, r9); // assume the original ofs <= limit ;; linux: cmp rcx, rdx + jccb(Assembler::aboveEqual, compute_size_end); + addq(r8, 64); //;; linux: ofs = rdx + addq(rax, 64); + jmpb(compute_size); + + bind(compute_size_end); + movq(NUM_BLKS, rax); // NUM_BLK (r8) ;; linux: NUM_BLK = rdx + + cmpq(NUM_BLKS, 0); + jcc(Assembler::equal, done_hash); + + } else { + xorq(NUM_BLKS, NUM_BLKS); + addq(NUM_BLKS, 64); + }//if (!multi_block) + + lea(NUM_BLKS, Address(INP, NUM_BLKS, Address::times_1, -64)); // pointer to the last block + movq(Address(rsp, _INP_END), NUM_BLKS); // + + cmpptr(INP, NUM_BLKS); //cmp INP, NUM_BLKS + jcc(Assembler::equal, only_one_block); //je only_one_block + + // load initial digest + movl(a, Address(CTX, 4*0)); + movl(b, Address(CTX, 4*1)); + movl(c, Address(CTX, 4*2)); + movl(d, Address(CTX, 4*3)); + movl(e, Address(CTX, 4*4)); + movl(f, Address(CTX, 4*5)); + movl(g, Address(CTX, 4*6)); + movl(h, Address(CTX, 4*7)); + + pshuffle_byte_flip_mask_addr = pshuffle_byte_flip_mask; + vmovdqu(BYTE_FLIP_MASK, ExternalAddress(pshuffle_byte_flip_mask_addr +0)); //[PSHUFFLE_BYTE_FLIP_MASK wrt rip] + vmovdqu(SHUF_00BA, ExternalAddress(pshuffle_byte_flip_mask_addr + 32)); //[_SHUF_00BA wrt rip] + vmovdqu(SHUF_DC00, ExternalAddress(pshuffle_byte_flip_mask_addr + 64)); //[_SHUF_DC00 wrt rip] + + movq(Address(rsp, _CTX), CTX); // store + +bind(loop0); + lea(TBL, ExternalAddress(K256_W)); + + // assume buffers not aligned + + // Load first 16 dwords from two blocks + vmovdqu(xmm0, Address(INP, 0*32)); + vmovdqu(xmm1, Address(INP, 1*32)); + vmovdqu(xmm2, Address(INP, 2*32)); + vmovdqu(xmm3, Address(INP, 3*32)); + + // byte swap data + vpshufb(xmm0, xmm0, BYTE_FLIP_MASK, AVX_256bit); + vpshufb(xmm1, xmm1, BYTE_FLIP_MASK, AVX_256bit); + vpshufb(xmm2, xmm2, BYTE_FLIP_MASK, AVX_256bit); + vpshufb(xmm3, xmm3, BYTE_FLIP_MASK, AVX_256bit); + + // transpose data into high/low halves + vperm2i128(xmm4, xmm0, xmm2, 0x20); + vperm2i128(xmm5, xmm0, xmm2, 0x31); + vperm2i128(xmm6, xmm1, xmm3, 0x20); + vperm2i128(xmm7, xmm1, xmm3, 0x31); + +bind(last_block_enter); + addq(INP, 64); + movq(Address(rsp, _INP), INP); + + //;; schedule 48 input dwords, by doing 3 rounds of 12 each + xorq(SRND, SRND); + +align(16); +bind(loop1); + vpaddd(xmm9, xmm4, Address(TBL, SRND, Address::times_1, 0*32), AVX_256bit); + vmovdqu(Address(rsp, SRND, Address::times_1, _XFER + 0*32), xmm9); + sha256_AVX2_one_round_and_sched(xmm4, xmm5, xmm6, xmm7, rax, rbx, rdi, rsi, r8, r9, r10, r11, 0); + sha256_AVX2_one_round_and_sched(xmm4, xmm5, xmm6, xmm7, r11, rax, rbx, rdi, rsi, r8, r9, r10, 1); + sha256_AVX2_one_round_and_sched(xmm4, xmm5, xmm6, xmm7, r10, r11, rax, rbx, rdi, rsi, r8, r9, 2); + sha256_AVX2_one_round_and_sched(xmm4, xmm5, xmm6, xmm7, r9, r10, r11, rax, rbx, rdi, rsi, r8, 3); + + vpaddd(xmm9, xmm5, Address(TBL, SRND, Address::times_1, 1*32), AVX_256bit); + vmovdqu(Address(rsp, SRND, Address::times_1, _XFER + 1*32), xmm9); + sha256_AVX2_one_round_and_sched(xmm5, xmm6, xmm7, xmm4, r8, r9, r10, r11, rax, rbx, rdi, rsi, 8+0); + sha256_AVX2_one_round_and_sched(xmm5, xmm6, xmm7, xmm4, rsi, r8, r9, r10, r11, rax, rbx, rdi, 8+1); + sha256_AVX2_one_round_and_sched(xmm5, xmm6, xmm7, xmm4, rdi, rsi, r8, r9, r10, r11, rax, rbx, 8+2); + sha256_AVX2_one_round_and_sched(xmm5, xmm6, xmm7, xmm4, rbx, rdi, rsi, r8, r9, r10, r11, rax, 8+3); + + vpaddd(xmm9, xmm6, Address(TBL, SRND, Address::times_1, 2*32), AVX_256bit); + vmovdqu(Address(rsp, SRND, Address::times_1, _XFER + 2*32), xmm9); + sha256_AVX2_one_round_and_sched(xmm6, xmm7, xmm4, xmm5, rax, rbx, rdi, rsi, r8, r9, r10, r11, 16+0); + sha256_AVX2_one_round_and_sched(xmm6, xmm7, xmm4, xmm5, r11, rax, rbx, rdi, rsi, r8, r9, r10, 16+1); + sha256_AVX2_one_round_and_sched(xmm6, xmm7, xmm4, xmm5, r10, r11, rax, rbx, rdi, rsi, r8, r9, 16+2); + sha256_AVX2_one_round_and_sched(xmm6, xmm7, xmm4, xmm5, r9, r10, r11, rax, rbx, rdi, rsi, r8, 16+3); + + vpaddd(xmm9, xmm7, Address(TBL, SRND, Address::times_1, 3*32), AVX_256bit); + vmovdqu(Address(rsp, SRND, Address::times_1, _XFER + 3*32), xmm9); + + sha256_AVX2_one_round_and_sched(xmm7, xmm4, xmm5, xmm6, r8, r9, r10, r11, rax, rbx, rdi, rsi, 24+0); + sha256_AVX2_one_round_and_sched(xmm7, xmm4, xmm5, xmm6, rsi, r8, r9, r10, r11, rax, rbx, rdi, 24+1); + sha256_AVX2_one_round_and_sched(xmm7, xmm4, xmm5, xmm6, rdi, rsi, r8, r9, r10, r11, rax, rbx, 24+2); + sha256_AVX2_one_round_and_sched(xmm7, xmm4, xmm5, xmm6, rbx, rdi, rsi, r8, r9, r10, r11, rax, 24+3); + + addq(SRND, 4*32); + cmpq(SRND, 3 * 4*32); + jcc(Assembler::below, loop1); + +bind(loop2); + // Do last 16 rounds with no scheduling + vpaddd(xmm9, xmm4, Address(TBL, SRND, Address::times_1, 0*32), AVX_256bit); + vmovdqu(Address(rsp, SRND, Address::times_1, _XFER + 0*32), xmm9); + sha256_AVX2_four_rounds_compute_first(0); + + vpaddd(xmm9, xmm5, Address(TBL, SRND, Address::times_1, 1*32), AVX_256bit); + vmovdqu(Address(rsp, SRND, Address::times_1, _XFER + 1*32), xmm9); + sha256_AVX2_four_rounds_compute_last(0 + 8); + + addq(SRND, 2*32); + + vmovdqu(xmm4, xmm6); + vmovdqu(xmm5, xmm7); + + cmpq(SRND, 4 * 4*32); + jcc(Assembler::below, loop2); + + movq(CTX, Address(rsp, _CTX)); + movq(INP, Address(rsp, _INP)); + + addm(4*0, CTX, a); + addm(4*1, CTX, b); + addm(4*2, CTX, c); + addm(4*3, CTX, d); + addm(4*4, CTX, e); + addm(4*5, CTX, f); + addm(4*6, CTX, g); + addm(4*7, CTX, h); + + cmpq(INP, Address(rsp, _INP_END)); + jcc(Assembler::above, done_hash); + + //Do second block using previously scheduled results + xorq(SRND, SRND); +align(16); +bind(loop3); + sha256_AVX2_four_rounds_compute_first(4); + sha256_AVX2_four_rounds_compute_last(4+8); + + addq(SRND, 2*32); + cmpq(SRND, 4 * 4*32); + jcc(Assembler::below, loop3); + + movq(CTX, Address(rsp, _CTX)); + movq(INP, Address(rsp, _INP)); + addq(INP, 64); + + addm(4*0, CTX, a); + addm(4*1, CTX, b); + addm(4*2, CTX, c); + addm(4*3, CTX, d); + addm(4*4, CTX, e); + addm(4*5, CTX, f); + addm(4*6, CTX, g); + addm(4*7, CTX, h); + + cmpq(INP, Address(rsp, _INP_END)); + jcc(Assembler::below, loop0); + jccb(Assembler::above, done_hash); + +bind(do_last_block); + lea(TBL, ExternalAddress(K256_W)); + + movdqu(xmm4, Address(INP, 0*16)); + movdqu(xmm5, Address(INP, 1*16)); + movdqu(xmm6, Address(INP, 2*16)); + movdqu(xmm7, Address(INP, 3*16)); + + vpshufb(xmm4, xmm4, xmm13, AVX_128bit); + vpshufb(xmm5, xmm5, xmm13, AVX_128bit); + vpshufb(xmm6, xmm6, xmm13, AVX_128bit); + vpshufb(xmm7, xmm7, xmm13, AVX_128bit); + + jmp(last_block_enter); + +bind(only_one_block); + + // load initial digest ;; table should be preloaded with following values + movl(a, Address(CTX, 4*0)); // 0x6a09e667 + movl(b, Address(CTX, 4*1)); // 0xbb67ae85 + movl(c, Address(CTX, 4*2)); // 0x3c6ef372 + movl(d, Address(CTX, 4*3)); // 0xa54ff53a + movl(e, Address(CTX, 4*4)); // 0x510e527f + movl(f, Address(CTX, 4*5)); // 0x9b05688c + movl(g, Address(CTX, 4*6)); // 0x1f83d9ab + movl(h, Address(CTX, 4*7)); // 0x5be0cd19 + + + pshuffle_byte_flip_mask_addr = pshuffle_byte_flip_mask; + vmovdqu(BYTE_FLIP_MASK, ExternalAddress(pshuffle_byte_flip_mask_addr + 0)); //[PSHUFFLE_BYTE_FLIP_MASK wrt rip] + vmovdqu(SHUF_00BA, ExternalAddress(pshuffle_byte_flip_mask_addr + 32)); //[_SHUF_00BA wrt rip] + vmovdqu(SHUF_DC00, ExternalAddress(pshuffle_byte_flip_mask_addr + 64)); //[_SHUF_DC00 wrt rip] + + movq(Address(rsp, _CTX), CTX); + jmpb(do_last_block); + +bind(done_hash); + + movq(rsp, Address(rsp, _RSP)); + + pop(r15); + pop(r14); + pop(r13); + pop(r12); + pop(rbp); +#ifdef _WIN64 + pop(rdi); + pop(rsi); +#endif + pop(rbx); + +#ifdef _WIN64 + pop(r9); + pop(r8); +#else + pop(rdx); + pop(rcx); +#endif + + if (multi_block) { +#ifdef _WIN64 +const Register& limit_end = r9; +const Register& ofs_end = r8; +#else +const Register& limit_end = rcx; +const Register& ofs_end = rdx; +#endif + movq(rax, ofs_end); + +bind(compute_size1); + cmpptr(rax, limit_end); // assume the original ofs <= limit + jccb(Assembler::aboveEqual, compute_size_end1); + addq(rax, 64); + jmpb(compute_size1); + +bind(compute_size_end1); + } +} +#endif //#ifdef _LP64 diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_sin.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_sin.cpp new file mode 100644 index 00000000000..68547eebfdd --- /dev/null +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_sin.cpp @@ -0,0 +1,2448 @@ +/* +* Copyright (c) 2016, Intel Corporation. +* Intel Math Library (LIBM) Source Code +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +* +*/ + +#include "precompiled.hpp" +#include "asm/assembler.hpp" +#include "asm/assembler.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "stubRoutines_x86.hpp" +#include "macroAssembler_x86.hpp" + +#ifdef _MSC_VER +#define ALIGNED_(x) __declspec(align(x)) +#else +#define ALIGNED_(x) __attribute__ ((aligned(x))) +#endif + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - SIN() +// --------------------- +// +// 1. RANGE REDUCTION +// +// We perform an initial range reduction from X to r with +// +// X =~= N * pi/32 + r +// +// so that |r| <= pi/64 + epsilon. We restrict inputs to those +// where |N| <= 932560. Beyond this, the range reduction is +// insufficiently accurate. For extremely small inputs, +// denormalization can occur internally, impacting performance. +// This means that the main path is actually only taken for +// 2^-252 <= |X| < 90112. +// +// To avoid branches, we perform the range reduction to full +// accuracy each time. +// +// X - N * (P_1 + P_2 + P_3) +// +// where P_1 and P_2 are 32-bit numbers (so multiplication by N +// is exact) and P_3 is a 53-bit number. Together, these +// approximate pi well enough for all cases in the restricted +// range. +// +// The main reduction sequence is: +// +// y = 32/pi * x +// N = integer(y) +// (computed by adding and subtracting off SHIFTER) +// +// m_1 = N * P_1 +// m_2 = N * P_2 +// r_1 = x - m_1 +// r = r_1 - m_2 +// (this r can be used for most of the calculation) +// +// c_1 = r_1 - r +// m_3 = N * P_3 +// c_2 = c_1 - m_2 +// c = c_2 - m_3 +// +// 2. MAIN ALGORITHM +// +// The algorithm uses a table lookup based on B = M * pi / 32 +// where M = N mod 64. The stored values are: +// sigma closest power of 2 to cos(B) +// C_hl 53-bit cos(B) - sigma +// S_hi + S_lo 2 * 53-bit sin(B) +// +// The computation is organized as follows: +// +// sin(B + r + c) = [sin(B) + sigma * r] + +// r * (cos(B) - sigma) + +// sin(B) * [cos(r + c) - 1] + +// cos(B) * [sin(r + c) - r] +// +// which is approximately: +// +// [S_hi + sigma * r] + +// C_hl * r + +// S_lo + S_hi * [(cos(r) - 1) - r * c] + +// (C_hl + sigma) * [(sin(r) - r) + c] +// +// and this is what is actually computed. We separate this sum +// into four parts: +// +// hi + med + pols + corr +// +// where +// +// hi = S_hi + sigma r +// med = C_hl * r +// pols = S_hi * (cos(r) - 1) + (C_hl + sigma) * (sin(r) - r) +// corr = S_lo + c * ((C_hl + sigma) - S_hi * r) +// +// 3. POLYNOMIAL +// +// The polynomial S_hi * (cos(r) - 1) + (C_hl + sigma) * +// (sin(r) - r) can be rearranged freely, since it is quite +// small, so we exploit parallelism to the fullest. +// +// psc4 = SC_4 * r_1 +// msc4 = psc4 * r +// r2 = r * r +// msc2 = SC_2 * r2 +// r4 = r2 * r2 +// psc3 = SC_3 + msc4 +// psc1 = SC_1 + msc2 +// msc3 = r4 * psc3 +// sincospols = psc1 + msc3 +// pols = sincospols * +// +// +// 4. CORRECTION TERM +// +// This is where the "c" component of the range reduction is +// taken into account; recall that just "r" is used for most of +// the calculation. +// +// -c = m_3 - c_2 +// -d = S_hi * r - (C_hl + sigma) +// corr = -c * -d + S_lo +// +// 5. COMPENSATED SUMMATIONS +// +// The two successive compensated summations add up the high +// and medium parts, leaving just the low parts to add up at +// the end. +// +// rs = sigma * r +// res_int = S_hi + rs +// k_0 = S_hi - res_int +// k_2 = k_0 + rs +// med = C_hl * r +// res_hi = res_int + med +// k_1 = res_int - res_hi +// k_3 = k_1 + med +// +// 6. FINAL SUMMATION +// +// We now add up all the small parts: +// +// res_lo = pols(hi) + pols(lo) + corr + k_1 + k_3 +// +// Now the overall result is just: +// +// res_hi + res_lo +// +// 7. SMALL ARGUMENTS +// +// If |x| < SNN (SNN meaning the smallest normal number), we +// simply perform 0.1111111 cdots 1111 * x. For SNN <= |x|, we +// do 2^-55 * (2^55 * x - x). +// +// Special cases: +// sin(NaN) = quiet NaN, and raise invalid exception +// sin(INF) = NaN and raise invalid exception +// sin(+/-0) = +/-0 +// +/******************************************************************************/ + +#ifdef _LP64 +// The 64 bit code is at most SSE2 compliant +ALIGNED_(16) juint StubRoutines::x86::_ONEHALF[] = +{ + 0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_P_2[] = +{ + 0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_SC_4[] = +{ + 0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_Ctable[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, 0xbf73b92eUL, + 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, + 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, + 0xc0000000UL, 0xbc626d19UL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, + 0xbfa60beaUL, 0x2ed59f06UL, 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, + 0x00000000UL, 0x3ff00000UL, 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, + 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, 0x00000000UL, 0x3ff00000UL, + 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, 0x20000000UL, + 0x3c5e0d89UL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, 0xbfc59267UL, + 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, + 0x3ff00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, + 0x20000000UL, 0x3c68076aUL, 0x00000000UL, 0x3ff00000UL, 0x99fcef32UL, + 0x3fca8279UL, 0x667f3bcdUL, 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, + 0x00000000UL, 0x3fe00000UL, 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, + 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, 0x00000000UL, 0x3fe00000UL, + 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, 0xe0000000UL, + 0x3c39f630UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, 0xbf9d4a2cUL, + 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, + 0x3fe00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0x3fed906bUL, + 0x20000000UL, 0x3c7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x76acf82dUL, + 0x3fa4a031UL, 0x56c62ddaUL, 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, + 0x00000000UL, 0x3fd00000UL, 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, + 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, 0x00000000UL, 0x3fd00000UL, + 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, 0x40000000UL, + 0xbc887df6UL, 0x00000000UL, 0x3fc00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, + 0x40000000UL, 0xbc887df6UL, 0x00000000UL, 0xbfc00000UL, 0x0e5967d5UL, + 0x3fac1d1fUL, 0xcff75cb0UL, 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, + 0x00000000UL, 0xbfd00000UL, 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, + 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, 0x00000000UL, 0xbfd00000UL, + 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, 0x3fed906bUL, 0x20000000UL, + 0x3c7457e6UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, 0x3f9d4a2cUL, + 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, + 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, + 0xe0000000UL, 0x3c39f630UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, + 0xbfc133ccUL, 0x6b151741UL, 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, + 0x00000000UL, 0xbfe00000UL, 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, + 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, 0x00000000UL, 0xbfe00000UL, + 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, 0x20000000UL, + 0x3c68076aUL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, 0x3fc59267UL, + 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, + 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, + 0x20000000UL, 0x3c5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, + 0x3fb37ca1UL, 0xa6aea963UL, 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, + 0x00000000UL, 0xbff00000UL, 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, + 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, 0x00000000UL, 0xbff00000UL, + 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, 0xc0000000UL, + 0xbc626d19UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, 0x3f73b92eUL, + 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, + 0xbff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, + 0x3f73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, + 0x00000000UL, 0xbff00000UL, 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, + 0xbfc8f8b8UL, 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0xbff00000UL, + 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, + 0x3c75d28dUL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, 0x3fb37ca1UL, + 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, 0x3c672cedUL, 0x00000000UL, + 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0xbfde2b5dUL, + 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, + 0x3fc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, + 0x00000000UL, 0xbff00000UL, 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, + 0xbfe44cf3UL, 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0xbff00000UL, + 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, + 0x3c8bdd34UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, 0xbfc133ccUL, + 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, 0x3c82c5e1UL, 0x00000000UL, + 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0xbfea9b66UL, + 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, + 0x3f9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, + 0x00000000UL, 0xbfe00000UL, 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, + 0xbfed906bUL, 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0xbfe00000UL, + 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, + 0xbc8760b1UL, 0x00000000UL, 0xbfd00000UL, 0x0e5967d5UL, 0x3fac1d1fUL, + 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, 0xbc756217UL, 0x00000000UL, + 0xbfd00000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0xbfefd88dUL, + 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0xbfc00000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, + 0xbfefd88dUL, 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0x3fc00000UL, + 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, + 0xbc756217UL, 0x00000000UL, 0x3fd00000UL, 0x76acf82dUL, 0x3fa4a031UL, + 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, 0xbc8760b1UL, 0x00000000UL, + 0x3fd00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0xbfed906bUL, + 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, + 0xbf9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, + 0x00000000UL, 0x3fe00000UL, 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, + 0xbfea9b66UL, 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0x3fe00000UL, + 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, + 0x3c82c5e1UL, 0x00000000UL, 0x3fe00000UL, 0x99fcef32UL, 0x3fca8279UL, + 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, 0x3c8bdd34UL, 0x00000000UL, + 0x3fe00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0xbfe44cf3UL, + 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, + 0xbfc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, + 0x00000000UL, 0x3ff00000UL, 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, + 0xbfde2b5dUL, 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0x3ff00000UL, + 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, + 0x3c672cedUL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, 0xbfa60beaUL, + 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, 0x3c75d28dUL, 0x00000000UL, + 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0xbfc8f8b8UL, + 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, + 0xbf73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, + 0x00000000UL, 0x3ff00000UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_SC_2[] = +{ + 0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_SC_3[] = +{ + 0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL +}; + +ALIGNED_(16) juint StubRoutines::x86::_SC_1[] = +{ + 0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_PI_INV_TABLE[] = +{ + 0x00000000UL, 0x00000000UL, 0xa2f9836eUL, 0x4e441529UL, 0xfc2757d1UL, + 0xf534ddc0UL, 0xdb629599UL, 0x3c439041UL, 0xfe5163abUL, 0xdebbc561UL, + 0xb7246e3aUL, 0x424dd2e0UL, 0x06492eeaUL, 0x09d1921cUL, 0xfe1deb1cUL, + 0xb129a73eUL, 0xe88235f5UL, 0x2ebb4484UL, 0xe99c7026UL, 0xb45f7e41UL, + 0x3991d639UL, 0x835339f4UL, 0x9c845f8bUL, 0xbdf9283bUL, 0x1ff897ffUL, + 0xde05980fUL, 0xef2f118bUL, 0x5a0a6d1fUL, 0x6d367ecfUL, 0x27cb09b7UL, + 0x4f463f66UL, 0x9e5fea2dUL, 0x7527bac7UL, 0xebe5f17bUL, 0x3d0739f7UL, + 0x8a5292eaUL, 0x6bfb5fb1UL, 0x1f8d5d08UL, 0x56033046UL, 0xfc7b6babUL, + 0xf0cfbc21UL +}; + +ALIGNED_(8) juint StubRoutines::x86::_PI_4[] = +{ + 0x40000000UL, 0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL +}; + +ALIGNED_(8) juint StubRoutines::x86::_PI32INV[] = +{ + 0x6dc9c883UL, 0x40245f30UL +}; + +ALIGNED_(8) juint _SHIFTER[] = +{ + 0x00000000UL, 0x43380000UL +}; + +ALIGNED_(8) juint StubRoutines::x86::_SIGN_MASK[] = +{ + 0x00000000UL, 0x80000000UL +}; + +ALIGNED_(8) juint StubRoutines::x86::_P_3[] = +{ + 0x2e037073UL, 0x3b63198aUL +}; + +ALIGNED_(8) juint _ALL_ONES[] = +{ + 0xffffffffUL, 0x3fefffffUL +}; + +ALIGNED_(8) juint _TWO_POW_55[] = +{ + 0x00000000UL, 0x43600000UL +}; + +ALIGNED_(8) juint _TWO_POW_M55[] = +{ + 0x00000000UL, 0x3c800000UL +}; + +ALIGNED_(8) juint StubRoutines::x86::_P_1[] = +{ + 0x54400000UL, 0x3fb921fbUL +}; + +ALIGNED_(8) juint StubRoutines::x86::_NEG_ZERO[] = +{ + 0x00000000UL, 0x80000000UL +}; + +void MacroAssembler::fast_sin(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ebx, Register ecx, Register edx, Register tmp1, Register tmp2, Register tmp3, Register tmp4) { + Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1; + Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; + Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; + Label L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1; + Label L_2TAG_PACKET_12_0_1, B1_1, B1_2, B1_4, start; + + assert_different_registers(tmp1, tmp2, tmp3, tmp4, eax, ebx, ecx, edx); + address ONEHALF = StubRoutines::x86::_ONEHALF_addr(); + address P_2 = StubRoutines::x86::_P_2_addr(); + address SC_4 = StubRoutines::x86::_SC_4_addr(); + address Ctable = StubRoutines::x86::_Ctable_addr(); + address SC_2 = StubRoutines::x86::_SC_2_addr(); + address SC_3 = StubRoutines::x86::_SC_3_addr(); + address SC_1 = StubRoutines::x86::_SC_1_addr(); + address PI_INV_TABLE = StubRoutines::x86::_PI_INV_TABLE_addr(); + address PI_4 = (address)StubRoutines::x86::_PI_4_addr(); + address PI32INV = (address)StubRoutines::x86::_PI32INV_addr(); + address SHIFTER = (address)_SHIFTER; + address SIGN_MASK = (address)StubRoutines::x86::_SIGN_MASK_addr(); + address P_3 = (address)StubRoutines::x86::_P_3_addr(); + address ALL_ONES = (address)_ALL_ONES; + address TWO_POW_55 = (address)_TWO_POW_55; + address TWO_POW_M55 = (address)_TWO_POW_M55; + address P_1 = (address)StubRoutines::x86::_P_1_addr(); + address NEG_ZERO = (address)StubRoutines::x86::_NEG_ZERO_addr(); + + bind(start); + push(rbx); + subq(rsp, 16); + movsd(Address(rsp, 8), xmm0); + movl(eax, Address(rsp, 12)); + movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL + movq(xmm2, ExternalAddress(SHIFTER)); //0x00000000UL, 0x43380000UL + andl(eax, 2147418112); + subl(eax, 808452096); + cmpl(eax, 281346048); + jcc(Assembler::above, L_2TAG_PACKET_0_0_1); + mulsd(xmm1, xmm0); + movdqu(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL + movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL + pand(xmm4, xmm0); + por(xmm5, xmm4); + addpd(xmm1, xmm5); + cvttsd2sil(edx, xmm1); + cvtsi2sdl(xmm1, edx); + movdqu(xmm6, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL + mov64(r8, 0x3fb921fb54400000); + movdq(xmm3, r8); + movdqu(xmm5, ExternalAddress(SC_4)); //0xa556c734UL, 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL + pshufd(xmm4, xmm0, 68); + mulsd(xmm3, xmm1); + if (VM_Version::supports_sse3()) { + movddup(xmm1, xmm1); + } + else { + movlhps(xmm1, xmm1); + } + andl(edx, 63); + shll(edx, 5); + lea(rax, ExternalAddress(Ctable)); + addq(rax, rdx); + mulpd(xmm6, xmm1); + mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL + subsd(xmm4, xmm3); + movq(xmm7, Address(rax, 8)); + subsd(xmm0, xmm3); + if (VM_Version::supports_sse3()) { + movddup(xmm3, xmm4); + } + else { + movdqu(xmm3, xmm4); + movlhps(xmm3, xmm3); + } + subsd(xmm4, xmm6); + pshufd(xmm0, xmm0, 68); + movdqu(xmm2, Address(rax, 0)); + mulpd(xmm5, xmm0); + subpd(xmm0, xmm6); + mulsd(xmm7, xmm4); + subsd(xmm3, xmm4); + mulpd(xmm5, xmm0); + mulpd(xmm0, xmm0); + subsd(xmm3, xmm6); + movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL + subsd(xmm1, xmm3); + movq(xmm3, Address(rax, 24)); + addsd(xmm2, xmm3); + subsd(xmm7, xmm2); + mulsd(xmm2, xmm4); + mulpd(xmm6, xmm0); + mulsd(xmm3, xmm4); + mulpd(xmm2, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL + mulsd(xmm4, Address(rax, 0)); + addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL + mulpd(xmm5, xmm0); + movdqu(xmm0, xmm3); + addsd(xmm3, Address(rax, 8)); + mulpd(xmm1, xmm7); + movdqu(xmm7, xmm4); + addsd(xmm4, xmm3); + addpd(xmm6, xmm5); + movq(xmm5, Address(rax, 8)); + subsd(xmm5, xmm3); + subsd(xmm3, xmm4); + addsd(xmm1, Address(rax, 16)); + mulpd(xmm6, xmm2); + addsd(xmm5, xmm0); + addsd(xmm3, xmm7); + addsd(xmm1, xmm5); + addsd(xmm1, xmm3); + addsd(xmm1, xmm6); + unpckhpd(xmm6, xmm6); + movdqu(xmm0, xmm4); + addsd(xmm1, xmm6); + addsd(xmm0, xmm1); + jmp(B1_4); + + bind(L_2TAG_PACKET_0_0_1); + jcc(Assembler::greater, L_2TAG_PACKET_1_0_1); + shrl(eax, 20); + cmpl(eax, 3325); + jcc(Assembler::notEqual, L_2TAG_PACKET_2_0_1); + mulsd(xmm0, ExternalAddress(ALL_ONES)); //0xffffffffUL, 0x3fefffffUL + jmp(B1_4); + + bind(L_2TAG_PACKET_2_0_1); + movq(xmm3, ExternalAddress(TWO_POW_55)); //0x00000000UL, 0x43600000UL + mulsd(xmm3, xmm0); + subsd(xmm3, xmm0); + mulsd(xmm3, ExternalAddress(TWO_POW_M55)); //0x00000000UL, 0x3c800000UL + jmp(B1_4); + + bind(L_2TAG_PACKET_1_0_1); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + cmpl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_3_0_1); + pextrw(ecx, xmm0, 3); + andl(ecx, 32752); + subl(ecx, 16224); + shrl(ecx, 7); + andl(ecx, 65532); + lea(r11, ExternalAddress(PI_INV_TABLE)); + addq(rcx, r11); + movdq(rax, xmm0); + movl(r10, Address(rcx, 20)); + movl(r8, Address(rcx, 24)); + movl(edx, eax); + shrq(rax, 21); + orl(eax, INT_MIN); + shrl(eax, 11); + movl(r9, r10); + imulq(r10, rdx); + imulq(r9, rax); + imulq(r8, rax); + movl(rsi, Address(rcx, 16)); + movl(rdi, Address(rcx, 12)); + movl(r11, r10); + shrq(r10, 32); + addq(r9, r10); + addq(r11, r8); + movl(r8, r11); + shrq(r11, 32); + addq(r9, r11); + movl(r10, rsi); + imulq(rsi, rdx); + imulq(r10, rax); + movl(r11, rdi); + imulq(rdi, rdx); + movl(ebx, rsi); + shrq(rsi, 32); + addq(r9, rbx); + movl(ebx, r9); + shrq(r9, 32); + addq(r10, rsi); + addq(r10, r9); + shlq(rbx, 32); + orq(r8, rbx); + imulq(r11, rax); + movl(r9, Address(rcx, 8)); + movl(rsi, Address(rcx, 4)); + movl(ebx, rdi); + shrq(rdi, 32); + addq(r10, rbx); + movl(ebx, r10); + shrq(r10, 32); + addq(r11, rdi); + addq(r11, r10); + movq(rdi, r9); + imulq(r9, rdx); + imulq(rdi, rax); + movl(r10, r9); + shrq(r9, 32); + addq(r11, r10); + movl(r10, r11); + shrq(r11, 32); + addq(rdi, r9); + addq(rdi, r11); + movq(r9, rsi); + imulq(rsi, rdx); + imulq(r9, rax); + shlq(r10, 32); + orq(r10, rbx); + movl(eax, Address(rcx, 0)); + movl(r11, rsi); + shrq(rsi, 32); + addq(rdi, r11); + movl(r11, rdi); + shrq(rdi, 32); + addq(r9, rsi); + addq(r9, rdi); + imulq(rdx, rax); + pextrw(ebx, xmm0, 3); + lea(rdi, ExternalAddress(PI_INV_TABLE)); + subq(rcx, rdi); + addl(ecx, ecx); + addl(ecx, ecx); + addl(ecx, ecx); + addl(ecx, 19); + movl(rsi, 32768); + andl(rsi, ebx); + shrl(ebx, 4); + andl(ebx, 2047); + subl(ebx, 1023); + subl(ecx, ebx); + addq(r9, rdx); + movl(edx, ecx); + addl(edx, 32); + cmpl(ecx, 1); + jcc(Assembler::less, L_2TAG_PACKET_4_0_1); + negl(ecx); + addl(ecx, 29); + shll(r9); + movl(rdi, r9); + andl(r9, 536870911); + testl(r9, 268435456); + jcc(Assembler::notEqual, L_2TAG_PACKET_5_0_1); + shrl(r9); + movl(ebx, 0); + shlq(r9, 32); + orq(r9, r11); + + bind(L_2TAG_PACKET_6_0_1); + + bind(L_2TAG_PACKET_7_0_1); + + cmpq(r9, 0); + jcc(Assembler::equal, L_2TAG_PACKET_8_0_1); + + bind(L_2TAG_PACKET_9_0_1); + bsrq(r11, r9); + movl(ecx, 29); + subl(ecx, r11); + jcc(Assembler::lessEqual, L_2TAG_PACKET_10_0_1); + shlq(r9); + movq(rax, r10); + shlq(r10); + addl(edx, ecx); + negl(ecx); + addl(ecx, 64); + shrq(rax); + shrq(r8); + orq(r9, rax); + orq(r10, r8); + + bind(L_2TAG_PACKET_11_0_1); + cvtsi2sdq(xmm0, r9); + shrq(r10, 1); + cvtsi2sdq(xmm3, r10); + xorpd(xmm4, xmm4); + shll(edx, 4); + negl(edx); + addl(edx, 16368); + orl(edx, rsi); + xorl(edx, ebx); + pinsrw(xmm4, edx, 3); + movq(xmm2, ExternalAddress(PI_4)); //0x40000000UL, 0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL + movq(xmm6, ExternalAddress(8 + PI_4)); //0x3fe921fbUL, 0x18469899UL, 0x3e64442dUL + xorpd(xmm5, xmm5); + subl(edx, 1008); + pinsrw(xmm5, edx, 3); + mulsd(xmm0, xmm4); + shll(rsi, 16); + sarl(rsi, 31); + mulsd(xmm3, xmm5); + movdqu(xmm1, xmm0); + mulsd(xmm0, xmm2); + shrl(rdi, 29); + addsd(xmm1, xmm3); + mulsd(xmm3, xmm2); + addl(rdi, rsi); + xorl(rdi, rsi); + mulsd(xmm6, xmm1); + movl(eax, rdi); + addsd(xmm6, xmm3); + movdqu(xmm2, xmm0); + addsd(xmm0, xmm6); + subsd(xmm2, xmm0); + addsd(xmm6, xmm2); + + bind(L_2TAG_PACKET_12_0_1); + movq(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x40245f30UL + mulsd(xmm1, xmm0); + movq(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL + movq(xmm4, ExternalAddress(SIGN_MASK)); //0x00000000UL, 0x80000000UL + pand(xmm4, xmm0); + por(xmm5, xmm4); + addpd(xmm1, xmm5); + cvttsd2sil(edx, xmm1); + cvtsi2sdl(xmm1, edx); + movq(xmm3, ExternalAddress(P_1)); //0x54400000UL, 0x3fb921fbUL + movdqu(xmm2, ExternalAddress(P_2)); //0x1a600000UL, 0x3d90b461UL, 0x1a600000UL, 0x3d90b461UL + mulsd(xmm3, xmm1); + unpcklpd(xmm1, xmm1); + shll(eax, 3); + addl(edx, 1865216); + movdqu(xmm4, xmm0); + addl(edx, eax); + andl(edx, 63); + movdqu(xmm5, ExternalAddress(SC_4)); //0x54400000UL, 0x3fb921fbUL + lea(rax, ExternalAddress(Ctable)); + shll(edx, 5); + addq(rax, rdx); + mulpd(xmm2, xmm1); + subsd(xmm0, xmm3); + mulsd(xmm1, ExternalAddress(P_3)); //0x2e037073UL, 0x3b63198aUL + subsd(xmm4, xmm3); + movq(xmm7, Address(rax, 8)); + unpcklpd(xmm0, xmm0); + movdqu(xmm3, xmm4); + subsd(xmm4, xmm2); + mulpd(xmm5, xmm0); + subpd(xmm0, xmm2); + mulsd(xmm7, xmm4); + subsd(xmm3, xmm4); + mulpd(xmm5, xmm0); + mulpd(xmm0, xmm0); + subsd(xmm3, xmm2); + movdqu(xmm2, Address(rax, 0)); + subsd(xmm1, xmm3); + movq(xmm3, Address(rax, 24)); + addsd(xmm2, xmm3); + subsd(xmm7, xmm2); + subsd(xmm1, xmm6); + movdqu(xmm6, ExternalAddress(SC_2)); //0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL + mulsd(xmm2, xmm4); + mulpd(xmm6, xmm0); + mulsd(xmm3, xmm4); + mulpd(xmm2, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm5, ExternalAddress(SC_3)); //0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL + mulsd(xmm4, Address(rax, 0)); + addpd(xmm6, ExternalAddress(SC_1)); //0x55555555UL, 0xbfc55555UL, 0x00000000UL, 0xbfe00000UL + mulpd(xmm5, xmm0); + movdqu(xmm0, xmm3); + addsd(xmm3, Address(rax, 8)); + mulpd(xmm1, xmm7); + movdqu(xmm7, xmm4); + addsd(xmm4, xmm3); + addpd(xmm6, xmm5); + movq(xmm5, Address(rax, 8)); + subsd(xmm5, xmm3); + subsd(xmm3, xmm4); + addsd(xmm1, Address(rax, 16)); + mulpd(xmm6, xmm2); + addsd(xmm5, xmm0); + addsd(xmm3, xmm7); + addsd(xmm1, xmm5); + addsd(xmm1, xmm3); + addsd(xmm1, xmm6); + unpckhpd(xmm6, xmm6); + movdqu(xmm0, xmm4); + addsd(xmm1, xmm6); + addsd(xmm0, xmm1); + jmp(B1_4); + + bind(L_2TAG_PACKET_8_0_1); + addl(edx, 64); + movq(r9, r10); + movq(r10, r8); + movl(r8, 0); + cmpq(r9, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_9_0_1); + addl(edx, 64); + movq(r9, r10); + movq(r10, r8); + cmpq(r9, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_9_0_1); + xorpd(xmm0, xmm0); + xorpd(xmm6, xmm6); + jmp(L_2TAG_PACKET_12_0_1); + + bind(L_2TAG_PACKET_10_0_1); + jcc(Assembler::equal, L_2TAG_PACKET_11_0_1); + negl(ecx); + shrq(r10); + movq(rax, r9); + shrq(r9); + subl(edx, ecx); + negl(ecx); + addl(ecx, 64); + shlq(rax); + orq(r10, rax); + jmp(L_2TAG_PACKET_11_0_1); + + bind(L_2TAG_PACKET_4_0_1); + negl(ecx); + shlq(r9, 32); + orq(r9, r11); + shlq(r9); + movq(rdi, r9); + testl(r9, INT_MIN); + jcc(Assembler::notEqual, L_2TAG_PACKET_13_0_1); + shrl(r9); + movl(ebx, 0); + shrq(rdi, 3); + jmp(L_2TAG_PACKET_7_0_1); + + bind(L_2TAG_PACKET_5_0_1); + shrl(r9); + movl(ebx, 536870912); + shrl(ebx); + shlq(r9, 32); + orq(r9, r11); + shlq(rbx, 32); + addl(rdi, 536870912); + movl(rcx, 0); + movl(r11, 0); + subq(rcx, r8); + sbbq(r11, r10); + sbbq(rbx, r9); + movq(r8, rcx); + movq(r10, r11); + movq(r9, rbx); + movl(ebx, 32768); + jmp(L_2TAG_PACKET_6_0_1); + + bind(L_2TAG_PACKET_13_0_1); + shrl(r9); + mov64(rbx, 0x100000000); + shrq(rbx); + movl(rcx, 0); + movl(r11, 0); + subq(rcx, r8); + sbbq(r11, r10); + sbbq(rbx, r9); + movq(r8, rcx); + movq(r10, r11); + movq(r9, rbx); + movl(ebx, 32768); + shrq(rdi, 3); + addl(rdi, 536870912); + jmp(L_2TAG_PACKET_7_0_1); + + bind(L_2TAG_PACKET_3_0_1); + movq(xmm0, Address(rsp, 8)); + mulsd(xmm0, ExternalAddress(NEG_ZERO)); //0x00000000UL, 0x80000000UL + movq(Address(rsp, 0), xmm0); + + bind(L_2TAG_PACKET_14_0_1); + + bind(B1_4); + addq(rsp, 16); + pop(rbx); +} +#else +// The 32 bit code is at most SSE2 compliant +ALIGNED_(8) juint _zero_none[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL +}; + +ALIGNED_(4) juint __4onpi_d[] = +{ + 0x6dc9c883UL, 0x3ff45f30UL +}; + +ALIGNED_(4) juint _TWO_32H[] = +{ + 0x00000000UL, 0x41f80000UL +}; + +ALIGNED_(4) juint _pi04_3d[] = +{ + 0x54442d00UL, 0x3fe921fbUL, 0x98cc5180UL, 0x3ce84698UL, 0xcbb5bf6cUL, + 0xb9dfc8f8UL +}; + +ALIGNED_(4) juint _pi04_5d[] = +{ + 0x54400000UL, 0x3fe921fbUL, 0x1a600000UL, 0x3dc0b461UL, 0x2e000000UL, + 0x3b93198aUL, 0x25200000UL, 0x396b839aUL, 0x533e63a0UL, 0x37027044UL +}; + +ALIGNED_(4) juint _SCALE[] = +{ + 0x00000000UL, 0x32600000UL +}; + +ALIGNED_(4) juint _zeros[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x80000000UL +}; + +ALIGNED_(4) juint _pi04_2d[] = +{ + 0x54400000UL, 0x3fe921fbUL, 0x1a626331UL, 0x3dc0b461UL +}; + +ALIGNED_(4) juint _TWO_12H[] = +{ + 0x00000000UL, 0x40b80000UL +}; + +ALIGNED_(2) jushort __4onpi_31l[] = +{ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x836e, 0xa2f9, + 0x40d8, 0x0000, 0x0000, 0x0000, 0x2a50, 0x9c88, 0x40b7, 0x0000, 0x0000, 0x0000, + 0xabe8, 0xfe13, 0x4099, 0x0000, 0x0000, 0x0000, 0x6ee0, 0xfa9a, 0x4079, 0x0000, + 0x0000, 0x0000, 0x9580, 0xdb62, 0x4058, 0x0000, 0x0000, 0x0000, 0x1c82, 0xc9e2, + 0x403d, 0x0000, 0x0000, 0x0000, 0xb1c0, 0xff28, 0x4019, 0x0000, 0x0000, 0x0000, + 0xef14, 0xaf7a, 0x3ffe, 0x0000, 0x0000, 0x0000, 0x48dc, 0xc36e, 0x3fdf, 0x0000, + 0x0000, 0x0000, 0x3740, 0xe909, 0x3fbe, 0x0000, 0x0000, 0x0000, 0x924a, 0xb801, + 0x3fa2, 0x0000, 0x0000, 0x0000, 0x3a32, 0xdd41, 0x3f83, 0x0000, 0x0000, 0x0000, + 0x8778, 0x873f, 0x3f62, 0x0000, 0x0000, 0x0000, 0x1298, 0xb1cb, 0x3f44, 0x0000, + 0x0000, 0x0000, 0xa208, 0x9cfb, 0x3f26, 0x0000, 0x0000, 0x0000, 0xbaec, 0xd7d4, + 0x3f06, 0x0000, 0x0000, 0x0000, 0xd338, 0x8909, 0x3ee7, 0x0000, 0x0000, 0x0000, + 0x68b8, 0xe04d, 0x3ec7, 0x0000, 0x0000, 0x0000, 0x4e64, 0xdf90, 0x3eaa, 0x0000, + 0x0000, 0x0000, 0xc1a8, 0xeb1c, 0x3e89, 0x0000, 0x0000, 0x0000, 0x2720, 0xce7d, + 0x3e6a, 0x0000, 0x0000, 0x0000, 0x77b8, 0x8bf1, 0x3e4b, 0x0000, 0x0000, 0x0000, + 0xec7e, 0xe4a0, 0x3e2e, 0x0000, 0x0000, 0x0000, 0xffbc, 0xf12f, 0x3e0f, 0x0000, + 0x0000, 0x0000, 0xfdc0, 0xb301, 0x3deb, 0x0000, 0x0000, 0x0000, 0xc5ac, 0x9788, + 0x3dd1, 0x0000, 0x0000, 0x0000, 0x47da, 0x829b, 0x3db2, 0x0000, 0x0000, 0x0000, + 0xd9e4, 0xa6cf, 0x3d93, 0x0000, 0x0000, 0x0000, 0x36e8, 0xf961, 0x3d73, 0x0000, + 0x0000, 0x0000, 0xf668, 0xf463, 0x3d54, 0x0000, 0x0000, 0x0000, 0x5168, 0xf2ff, + 0x3d35, 0x0000, 0x0000, 0x0000, 0x758e, 0xea4f, 0x3d17, 0x0000, 0x0000, 0x0000, + 0xf17a, 0xebe5, 0x3cf8, 0x0000, 0x0000, 0x0000, 0x9cfa, 0x9e83, 0x3cd9, 0x0000, + 0x0000, 0x0000, 0xa4ba, 0xe294, 0x3cba, 0x0000, 0x0000, 0x0000, 0xd7ec, 0x9afe, + 0x3c9a, 0x0000, 0x0000, 0x0000, 0xae80, 0x8fc6, 0x3c79, 0x0000, 0x0000, 0x0000, + 0x3304, 0x8560, 0x3c5c, 0x0000, 0x0000, 0x0000, 0x6d70, 0xdf8f, 0x3c3b, 0x0000, + 0x0000, 0x0000, 0x3ef0, 0xafc3, 0x3c1e, 0x0000, 0x0000, 0x0000, 0xd0d8, 0x826b, + 0x3bfe, 0x0000, 0x0000, 0x0000, 0x1c80, 0xed4f, 0x3bdd, 0x0000, 0x0000, 0x0000, + 0x730c, 0xb0af, 0x3bc1, 0x0000, 0x0000, 0x0000, 0x6660, 0xc219, 0x3ba2, 0x0000, + 0x0000, 0x0000, 0x940c, 0xabe2, 0x3b83, 0x0000, 0x0000, 0x0000, 0xdffc, 0x8408, + 0x3b64, 0x0000, 0x0000, 0x0000, 0x6b98, 0xc402, 0x3b45, 0x0000, 0x0000, 0x0000, + 0x1818, 0x9cc4, 0x3b26, 0x0000, 0x0000, 0x0000, 0x5390, 0xaab6, 0x3b05, 0x0000, + 0x0000, 0x0000, 0xb070, 0xd464, 0x3ae9, 0x0000, 0x0000, 0x0000, 0x231a, 0x9ef0, + 0x3aca, 0x0000, 0x0000, 0x0000, 0x0670, 0xd1f1, 0x3aaa, 0x0000, 0x0000, 0x0000, + 0x7738, 0xd9f3, 0x3a8a, 0x0000, 0x0000, 0x0000, 0xa834, 0x8092, 0x3a6c, 0x0000, + 0x0000, 0x0000, 0xb45c, 0xce23, 0x3a4d, 0x0000, 0x0000, 0x0000, 0x36e8, 0xb0e5, + 0x3a2d, 0x0000, 0x0000, 0x0000, 0xd156, 0xaf44, 0x3a10, 0x0000, 0x0000, 0x0000, + 0x9f52, 0x8c82, 0x39f1, 0x0000, 0x0000, 0x0000, 0x829c, 0xff83, 0x39d1, 0x0000, + 0x0000, 0x0000, 0x7d06, 0xefc6, 0x39b3, 0x0000, 0x0000, 0x0000, 0x93e0, 0xb0b7, + 0x3992, 0x0000, 0x0000, 0x0000, 0xedde, 0xc193, 0x3975, 0x0000, 0x0000, 0x0000, + 0xbbc0, 0xcf49, 0x3952, 0x0000, 0x0000, 0x0000, 0xbdf0, 0xd63c, 0x3937, 0x0000, + 0x0000, 0x0000, 0x1f34, 0x9f3a, 0x3918, 0x0000, 0x0000, 0x0000, 0x3f8e, 0xe579, + 0x38f9, 0x0000, 0x0000, 0x0000, 0x90c8, 0xc3f8, 0x38d9, 0x0000, 0x0000, 0x0000, + 0x48c0, 0xf8f8, 0x38b7, 0x0000, 0x0000, 0x0000, 0xed56, 0xafa6, 0x389c, 0x0000, + 0x0000, 0x0000, 0x8218, 0xb969, 0x387d, 0x0000, 0x0000, 0x0000, 0x1852, 0xec57, + 0x385e, 0x0000, 0x0000, 0x0000, 0x670c, 0xd674, 0x383e, 0x0000, 0x0000, 0x0000, + 0xad40, 0xc2c4, 0x3820, 0x0000, 0x0000, 0x0000, 0x2e80, 0xa696, 0x3801, 0x0000, + 0x0000, 0x0000, 0xd800, 0xc467, 0x37dc, 0x0000, 0x0000, 0x0000, 0x3c72, 0xc5ae, + 0x37c3, 0x0000, 0x0000, 0x0000, 0xb006, 0xac69, 0x37a4, 0x0000, 0x0000, 0x0000, + 0x34a0, 0x8cdf, 0x3782, 0x0000, 0x0000, 0x0000, 0x9ed2, 0xd25e, 0x3766, 0x0000, + 0x0000, 0x0000, 0x6fec, 0xaaaa, 0x3747, 0x0000, 0x0000, 0x0000, 0x6040, 0xfb5c, + 0x3726, 0x0000, 0x0000, 0x0000, 0x764c, 0xa3fc, 0x3708, 0x0000, 0x0000, 0x0000, + 0xb254, 0x954e, 0x36e9, 0x0000, 0x0000, 0x0000, 0x3e1c, 0xf5dc, 0x36ca, 0x0000, + 0x0000, 0x0000, 0x7b06, 0xc635, 0x36ac, 0x0000, 0x0000, 0x0000, 0xa8ba, 0xd738, + 0x368d, 0x0000, 0x0000, 0x0000, 0x06cc, 0xb24e, 0x366d, 0x0000, 0x0000, 0x0000, + 0x7108, 0xac76, 0x364f, 0x0000, 0x0000, 0x0000, 0x2324, 0xa7cb, 0x3630, 0x0000, + 0x0000, 0x0000, 0xac40, 0xef15, 0x360f, 0x0000, 0x0000, 0x0000, 0xae46, 0xd516, + 0x35f2, 0x0000, 0x0000, 0x0000, 0x615e, 0xe003, 0x35d3, 0x0000, 0x0000, 0x0000, + 0x0cf0, 0xefe7, 0x35b1, 0x0000, 0x0000, 0x0000, 0xfb50, 0xf98c, 0x3595, 0x0000, + 0x0000, 0x0000, 0x0abc, 0xf333, 0x3575, 0x0000, 0x0000, 0x0000, 0xdd60, 0xca3f, + 0x3555, 0x0000, 0x0000, 0x0000, 0x7eb6, 0xd87f, 0x3538, 0x0000, 0x0000, 0x0000, + 0x44f4, 0xb291, 0x3519, 0x0000, 0x0000, 0x0000, 0xff80, 0xc982, 0x34f6, 0x0000, + 0x0000, 0x0000, 0x9de0, 0xd9b8, 0x34db, 0x0000, 0x0000, 0x0000, 0xcd42, 0x9366, + 0x34bc, 0x0000, 0x0000, 0x0000, 0xbef0, 0xfaee, 0x349d, 0x0000, 0x0000, 0x0000, + 0xdac4, 0xb6f1, 0x347d, 0x0000, 0x0000, 0x0000, 0xf140, 0x94de, 0x345d, 0x0000, + 0x0000, 0x0000, 0xa218, 0x8b4b, 0x343e, 0x0000, 0x0000, 0x0000, 0x6380, 0xa135, + 0x341e, 0x0000, 0x0000, 0x0000, 0xb184, 0x8cb2, 0x3402, 0x0000, 0x0000, 0x0000, + 0x196e, 0xdc61, 0x33e3, 0x0000, 0x0000, 0x0000, 0x0c00, 0xde05, 0x33c4, 0x0000, + 0x0000, 0x0000, 0xef9a, 0xbd38, 0x33a5, 0x0000, 0x0000, 0x0000, 0xc1a0, 0xdf00, + 0x3385, 0x0000, 0x0000, 0x0000, 0x1090, 0x9973, 0x3365, 0x0000, 0x0000, 0x0000, + 0x4882, 0x8301, 0x3348, 0x0000, 0x0000, 0x0000, 0x7abe, 0xadc7, 0x3329, 0x0000, + 0x0000, 0x0000, 0x7cba, 0xec2b, 0x330a, 0x0000, 0x0000, 0x0000, 0xa520, 0x8f21, + 0x32e9, 0x0000, 0x0000, 0x0000, 0x710c, 0x8d36, 0x32cc, 0x0000, 0x0000, 0x0000, + 0x5212, 0xc6ed, 0x32ad, 0x0000, 0x0000, 0x0000, 0x7308, 0xfd76, 0x328d, 0x0000, + 0x0000, 0x0000, 0x5014, 0xd548, 0x326f, 0x0000, 0x0000, 0x0000, 0xd3f2, 0xb499, + 0x3250, 0x0000, 0x0000, 0x0000, 0x7f74, 0xa606, 0x3230, 0x0000, 0x0000, 0x0000, + 0xf0a8, 0xd720, 0x3212, 0x0000, 0x0000, 0x0000, 0x185c, 0xe20f, 0x31f2, 0x0000, + 0x0000, 0x0000, 0xa5a8, 0x8738, 0x31d4, 0x0000, 0x0000, 0x0000, 0xdd74, 0xcafb, + 0x31b4, 0x0000, 0x0000, 0x0000, 0x98b6, 0xbd8e, 0x3196, 0x0000, 0x0000, 0x0000, + 0xe9de, 0x977f, 0x3177, 0x0000, 0x0000, 0x0000, 0x67c0, 0x818d, 0x3158, 0x0000, + 0x0000, 0x0000, 0xe52a, 0x9322, 0x3139, 0x0000, 0x0000, 0x0000, 0xe568, 0x9b6c, + 0x3119, 0x0000, 0x0000, 0x0000, 0x2358, 0xaa0a, 0x30fa, 0x0000, 0x0000, 0x0000, + 0xe480, 0xe13b, 0x30d9, 0x0000, 0x0000, 0x0000, 0x3024, 0x90a1, 0x30bd, 0x0000, + 0x0000, 0x0000, 0x9620, 0xda30, 0x309d, 0x0000, 0x0000, 0x0000, 0x898a, 0xb388, + 0x307f, 0x0000, 0x0000, 0x0000, 0xb24c, 0xc891, 0x3060, 0x0000, 0x0000, 0x0000, + 0x8056, 0xf98b, 0x3041, 0x0000, 0x0000, 0x0000, 0x72a4, 0xa1ea, 0x3021, 0x0000, + 0x0000, 0x0000, 0x6af8, 0x9488, 0x3001, 0x0000, 0x0000, 0x0000, 0xe00c, 0xdfcb, + 0x2fe4, 0x0000, 0x0000, 0x0000, 0xeeec, 0xc941, 0x2fc4, 0x0000, 0x0000, 0x0000, + 0x53e0, 0xe70f, 0x2fa4, 0x0000, 0x0000, 0x0000, 0x8f60, 0x9c07, 0x2f85, 0x0000, + 0x0000, 0x0000, 0xb328, 0xc3e7, 0x2f68, 0x0000, 0x0000, 0x0000, 0x9404, 0xf8c7, + 0x2f48, 0x0000, 0x0000, 0x0000, 0x38e0, 0xc99f, 0x2f29, 0x0000, 0x0000, 0x0000, + 0x9778, 0xd984, 0x2f09, 0x0000, 0x0000, 0x0000, 0xe700, 0xd142, 0x2eea, 0x0000, + 0x0000, 0x0000, 0xd904, 0x9443, 0x2ecd, 0x0000, 0x0000, 0x0000, 0xd4ba, 0xae7e, + 0x2eae, 0x0000, 0x0000, 0x0000, 0x8e5e, 0x8524, 0x2e8f, 0x0000, 0x0000, 0x0000, + 0xb550, 0xc9ed, 0x2e6e, 0x0000, 0x0000, 0x0000, 0x53b8, 0x8648, 0x2e51, 0x0000, + 0x0000, 0x0000, 0xdae4, 0x87f9, 0x2e32, 0x0000, 0x0000, 0x0000, 0x2942, 0xd966, + 0x2e13, 0x0000, 0x0000, 0x0000, 0x4f28, 0xcf3c, 0x2df3, 0x0000, 0x0000, 0x0000, + 0xfa40, 0xc4ef, 0x2dd1, 0x0000, 0x0000, 0x0000, 0x4424, 0xbca7, 0x2db5, 0x0000, + 0x0000, 0x0000, 0x2e62, 0xcdc5, 0x2d97, 0x0000, 0x0000, 0x0000, 0xed88, 0x996b, + 0x2d78, 0x0000, 0x0000, 0x0000, 0x7c30, 0xd97d, 0x2d56, 0x0000, 0x0000, 0x0000, + 0xed26, 0xbf6e, 0x2d3a, 0x0000, 0x0000, 0x0000, 0x2918, 0x921b, 0x2d1a, 0x0000, + 0x0000, 0x0000, 0x4e24, 0xe84e, 0x2cfb, 0x0000, 0x0000, 0x0000, 0x6dc0, 0x92ec, + 0x2cdd, 0x0000, 0x0000, 0x0000, 0x4f2c, 0xacf8, 0x2cbd, 0x0000, 0x0000, 0x0000, + 0xc634, 0xf094, 0x2c9e, 0x0000, 0x0000, 0x0000, 0xdc70, 0xe5d3, 0x2c7e, 0x0000, + 0x0000, 0x0000, 0x2180, 0xa600, 0x2c5b, 0x0000, 0x0000, 0x0000, 0x8480, 0xd680, + 0x2c3c, 0x0000, 0x0000, 0x0000, 0x8b24, 0xd63b, 0x2c22, 0x0000, 0x0000, 0x0000, + 0x02e0, 0xaa47, 0x2c00, 0x0000, 0x0000, 0x0000, 0x9ad0, 0xee84, 0x2be3, 0x0000, + 0x0000, 0x0000, 0xf7dc, 0xf699, 0x2bc6, 0x0000, 0x0000, 0x0000, 0xddde, 0xe490, + 0x2ba7, 0x0000, 0x0000, 0x0000, 0x34a0, 0xb4fd, 0x2b85, 0x0000, 0x0000, 0x0000, + 0x91b4, 0x8ef6, 0x2b68, 0x0000, 0x0000, 0x0000, 0xa3e0, 0xa2a7, 0x2b47, 0x0000, + 0x0000, 0x0000, 0xcce4, 0x82b3, 0x2b2a, 0x0000, 0x0000, 0x0000, 0xe4be, 0x8207, + 0x2b0c, 0x0000, 0x0000, 0x0000, 0x1d92, 0xab43, 0x2aed, 0x0000, 0x0000, 0x0000, + 0xe818, 0xf9f6, 0x2acd, 0x0000, 0x0000, 0x0000, 0xff12, 0xba80, 0x2aaf, 0x0000, + 0x0000, 0x0000, 0x5254, 0x8529, 0x2a90, 0x0000, 0x0000, 0x0000, 0x1b88, 0xe032, + 0x2a71, 0x0000, 0x0000, 0x0000, 0x3248, 0xd86d, 0x2a50, 0x0000, 0x0000, 0x0000, + 0x3140, 0xc9d5, 0x2a2e, 0x0000, 0x0000, 0x0000, 0x14e6, 0xbd47, 0x2a14, 0x0000, + 0x0000, 0x0000, 0x5c10, 0xe544, 0x29f4, 0x0000, 0x0000, 0x0000, 0x9f50, 0x90b6, + 0x29d4, 0x0000, 0x0000, 0x0000, 0x9850, 0xab55, 0x29b6, 0x0000, 0x0000, 0x0000, + 0x2750, 0x9d07, 0x2998, 0x0000, 0x0000, 0x0000, 0x6700, 0x8bbb, 0x2973, 0x0000, + 0x0000, 0x0000, 0x5dba, 0xed31, 0x295a, 0x0000, 0x0000, 0x0000, 0x61dc, 0x85fe, + 0x293a, 0x0000, 0x0000, 0x0000, 0x9ba2, 0xd6b4, 0x291c, 0x0000, 0x0000, 0x0000, + 0x2d30, 0xe3a5, 0x28fb, 0x0000, 0x0000, 0x0000, 0x6630, 0xb566, 0x28dd, 0x0000, + 0x0000, 0x0000, 0x5ad4, 0xa829, 0x28bf, 0x0000, 0x0000, 0x0000, 0x89d8, 0xe290, + 0x28a0, 0x0000, 0x0000, 0x0000, 0x3916, 0xc428, 0x2881, 0x0000, 0x0000, 0x0000, + 0x0490, 0xbea4, 0x2860, 0x0000, 0x0000, 0x0000, 0xee06, 0x80ee, 0x2843, 0x0000, + 0x0000, 0x0000, 0xfc00, 0xf327, 0x2820, 0x0000, 0x0000, 0x0000, 0xea40, 0xa871, + 0x2800, 0x0000, 0x0000, 0x0000, 0x63d8, 0x9c26, 0x27e4, 0x0000, 0x0000, 0x0000, + 0x07ba, 0xc0c9, 0x27c7, 0x0000, 0x0000, 0x0000, 0x3fa2, 0x9797, 0x27a8, 0x0000, + 0x0000, 0x0000, 0x21c6, 0xfeca, 0x2789, 0x0000, 0x0000, 0x0000, 0xde40, 0x860d, + 0x2768, 0x0000, 0x0000, 0x0000, 0x9cc8, 0x98ce, 0x2749, 0x0000, 0x0000, 0x0000, + 0x3778, 0xa31c, 0x272a, 0x0000, 0x0000, 0x0000, 0xe778, 0xf6e2, 0x270b, 0x0000, + 0x0000, 0x0000, 0x59b8, 0xf841, 0x26ed, 0x0000, 0x0000, 0x0000, 0x02e0, 0xad04, + 0x26cd, 0x0000, 0x0000, 0x0000, 0x5a92, 0x9380, 0x26b0, 0x0000, 0x0000, 0x0000, + 0xc740, 0x8886, 0x268d, 0x0000, 0x0000, 0x0000, 0x0680, 0xfaf8, 0x266c, 0x0000, + 0x0000, 0x0000, 0xfb60, 0x897f, 0x2653, 0x0000, 0x0000, 0x0000, 0x8760, 0xf903, + 0x2634, 0x0000, 0x0000, 0x0000, 0xad2a, 0xc2c8, 0x2615, 0x0000, 0x0000, 0x0000, + 0x2d86, 0x8aef, 0x25f6, 0x0000, 0x0000, 0x0000, 0x1ef4, 0xe627, 0x25d6, 0x0000, + 0x0000, 0x0000, 0x09e4, 0x8020, 0x25b7, 0x0000, 0x0000, 0x0000, 0x7548, 0xd227, + 0x2598, 0x0000, 0x0000, 0x0000, 0x75dc, 0xfb5b, 0x2579, 0x0000, 0x0000, 0x0000, + 0xea84, 0xc8b6, 0x255a, 0x0000, 0x0000, 0x0000, 0xe4d0, 0x8145, 0x253b, 0x0000, + 0x0000, 0x0000, 0x3640, 0x9768, 0x251c, 0x0000, 0x0000, 0x0000, 0x246a, 0xccec, + 0x24fe, 0x0000, 0x0000, 0x0000, 0x51d0, 0xa075, 0x24dd, 0x0000, 0x0000, 0x0000, + 0x4638, 0xa385, 0x24bf, 0x0000, 0x0000, 0x0000, 0xd788, 0xd776, 0x24a1, 0x0000, + 0x0000, 0x0000, 0x1370, 0x8997, 0x2482, 0x0000, 0x0000, 0x0000, 0x1e88, 0x9b67, + 0x2462, 0x0000, 0x0000, 0x0000, 0x6c08, 0xd975, 0x2444, 0x0000, 0x0000, 0x0000, + 0xfdb0, 0xcfc0, 0x2422, 0x0000, 0x0000, 0x0000, 0x3100, 0xc026, 0x2406, 0x0000, + 0x0000, 0x0000, 0xc5b4, 0xae64, 0x23e6, 0x0000, 0x0000, 0x0000, 0x2280, 0xf687, + 0x23c3, 0x0000, 0x0000, 0x0000, 0x2de0, 0x9006, 0x23a9, 0x0000, 0x0000, 0x0000, + 0x24bc, 0xf631, 0x238a, 0x0000, 0x0000, 0x0000, 0xb8d4, 0xa975, 0x236b, 0x0000, + 0x0000, 0x0000, 0xd9a4, 0xb949, 0x234b, 0x0000, 0x0000, 0x0000, 0xb54e, 0xbd39, + 0x232d, 0x0000, 0x0000, 0x0000, 0x4aac, 0x9a52, 0x230e, 0x0000, 0x0000, 0x0000, + 0xbbbc, 0xd085, 0x22ef, 0x0000, 0x0000, 0x0000, 0xdf18, 0xc633, 0x22cf, 0x0000, + 0x0000, 0x0000, 0x16d0, 0xeca5, 0x22af, 0x0000, 0x0000, 0x0000, 0xf2a0, 0xdf6f, + 0x228e, 0x0000, 0x0000, 0x0000, 0x8c44, 0xe86b, 0x2272, 0x0000, 0x0000, 0x0000, + 0x35c0, 0xbbf4, 0x2253, 0x0000, 0x0000, 0x0000, 0x0c40, 0xdafb, 0x2230, 0x0000, + 0x0000, 0x0000, 0x92dc, 0x9935, 0x2216, 0x0000, 0x0000, 0x0000, 0x0ca0, 0xbda6, + 0x21f3, 0x0000, 0x0000, 0x0000, 0x5958, 0xa6fd, 0x21d6, 0x0000, 0x0000, 0x0000, + 0xa3dc, 0x9d7f, 0x21b9, 0x0000, 0x0000, 0x0000, 0x79dc, 0xfcb5, 0x2199, 0x0000, + 0x0000, 0x0000, 0xf264, 0xcebb, 0x217b, 0x0000, 0x0000, 0x0000, 0x0abe, 0x8308, + 0x215c, 0x0000, 0x0000, 0x0000, 0x30ae, 0xb463, 0x213d, 0x0000, 0x0000, 0x0000, + 0x6228, 0xb040, 0x211c, 0x0000, 0x0000, 0x0000, 0xc9b2, 0xf43b, 0x20ff, 0x0000, + 0x0000, 0x0000, 0x3d8e, 0xa4b3, 0x20e0, 0x0000, 0x0000, 0x0000, 0x84e6, 0x8dab, + 0x20c1, 0x0000, 0x0000, 0x0000, 0xa124, 0x9b74, 0x20a1, 0x0000, 0x0000, 0x0000, + 0xc276, 0xd497, 0x2083, 0x0000, 0x0000, 0x0000, 0x6354, 0xa466, 0x2063, 0x0000, + 0x0000, 0x0000, 0x8654, 0xaf0a, 0x2044, 0x0000, 0x0000, 0x0000, 0x1d20, 0xfa5c, + 0x2024, 0x0000, 0x0000, 0x0000, 0xbcd0, 0xf3f0, 0x2004, 0x0000, 0x0000, 0x0000, + 0xedf0, 0xf0b6, 0x1fe7, 0x0000, 0x0000, 0x0000, 0x45bc, 0x9182, 0x1fc9, 0x0000, + 0x0000, 0x0000, 0xe254, 0xdc85, 0x1faa, 0x0000, 0x0000, 0x0000, 0xb898, 0xe9b1, + 0x1f8a, 0x0000, 0x0000, 0x0000, 0x0ebe, 0xe6f0, 0x1f6c, 0x0000, 0x0000, 0x0000, + 0xa9b8, 0xf584, 0x1f4c, 0x0000, 0x0000, 0x0000, 0x12e8, 0xdf6b, 0x1f2e, 0x0000, + 0x0000, 0x0000, 0x9f9e, 0xcd55, 0x1f0f, 0x0000, 0x0000, 0x0000, 0x05a0, 0xec3a, + 0x1eef, 0x0000, 0x0000, 0x0000, 0xd8e0, 0x96f8, 0x1ed1, 0x0000, 0x0000, 0x0000, + 0x3bd4, 0xccc6, 0x1eb1, 0x0000, 0x0000, 0x0000, 0x4910, 0xb87b, 0x1e93, 0x0000, + 0x0000, 0x0000, 0xbefc, 0xd40b, 0x1e73, 0x0000, 0x0000, 0x0000, 0x317e, 0xa406, + 0x1e55, 0x0000, 0x0000, 0x0000, 0x6bb2, 0xc2b2, 0x1e36, 0x0000, 0x0000, 0x0000, + 0xb87e, 0xbb78, 0x1e17, 0x0000, 0x0000, 0x0000, 0xa03c, 0xdbbd, 0x1df7, 0x0000, + 0x0000, 0x0000, 0x5b6c, 0xe3c8, 0x1dd9, 0x0000, 0x0000, 0x0000, 0x8968, 0xca8e, + 0x1dba, 0x0000, 0x0000, 0x0000, 0xc024, 0xe6ab, 0x1d9a, 0x0000, 0x0000, 0x0000, + 0x4110, 0xd4eb, 0x1d7a, 0x0000, 0x0000, 0x0000, 0xa168, 0xbdb5, 0x1d5d, 0x0000, + 0x0000, 0x0000, 0x012e, 0xa5fa, 0x1d3e, 0x0000, 0x0000, 0x0000, 0x6838, 0x9c1f, + 0x1d1e, 0x0000, 0x0000, 0x0000, 0xa158, 0xaa76, 0x1d00, 0x0000, 0x0000, 0x0000, + 0x090a, 0xbd95, 0x1ce1, 0x0000, 0x0000, 0x0000, 0xf73e, 0x8b6d, 0x1cc2, 0x0000, + 0x0000, 0x0000, 0x5fda, 0xbcbf, 0x1ca3, 0x0000, 0x0000, 0x0000, 0xdbe8, 0xb89f, + 0x1c84, 0x0000, 0x0000, 0x0000, 0x6e4c, 0x96c7, 0x1c64, 0x0000, 0x0000, 0x0000, + 0x19c2, 0xf2a4, 0x1c46, 0x0000, 0x0000, 0x0000, 0xb800, 0xf855, 0x1c1e, 0x0000, + 0x0000, 0x0000, 0x87fc, 0x85ff, 0x1c08, 0x0000, 0x0000, 0x0000, 0x1418, 0x839f, + 0x1be9, 0x0000, 0x0000, 0x0000, 0x6186, 0xd9d8, 0x1bca, 0x0000, 0x0000, 0x0000, + 0xf500, 0xabaa, 0x1ba6, 0x0000, 0x0000, 0x0000, 0x7b36, 0xdafe, 0x1b8c, 0x0000, + 0x0000, 0x0000, 0xf394, 0xe6d8, 0x1b6c, 0x0000, 0x0000, 0x0000, 0x6efc, 0x9e55, + 0x1b4e, 0x0000, 0x0000, 0x0000, 0x5e10, 0xc523, 0x1b2e, 0x0000, 0x0000, 0x0000, + 0x8210, 0xb6f9, 0x1b0d, 0x0000, 0x0000, 0x0000, 0x9ab0, 0x96e3, 0x1af1, 0x0000, + 0x0000, 0x0000, 0x3864, 0x92e7, 0x1ad1, 0x0000, 0x0000, 0x0000, 0x9878, 0xdc65, + 0x1ab1, 0x0000, 0x0000, 0x0000, 0xfa20, 0xd6cb, 0x1a94, 0x0000, 0x0000, 0x0000, + 0x6c00, 0xa4e4, 0x1a70, 0x0000, 0x0000, 0x0000, 0xab40, 0xb41b, 0x1a53, 0x0000, + 0x0000, 0x0000, 0x43a4, 0x8ede, 0x1a37, 0x0000, 0x0000, 0x0000, 0x22e0, 0x9314, + 0x1a15, 0x0000, 0x0000, 0x0000, 0x6170, 0xb949, 0x19f8, 0x0000, 0x0000, 0x0000, + 0x6b00, 0xe056, 0x19d8, 0x0000, 0x0000, 0x0000, 0x9ba8, 0xa94c, 0x19b9, 0x0000, + 0x0000, 0x0000, 0xfaa0, 0xaa16, 0x199b, 0x0000, 0x0000, 0x0000, 0x899a, 0xf627, + 0x197d, 0x0000, 0x0000, 0x0000, 0x9f20, 0xfb70, 0x195d, 0x0000, 0x0000, 0x0000, + 0xa4b8, 0xc176, 0x193e, 0x0000, 0x0000, 0x0000, 0xb21c, 0x85c3, 0x1920, 0x0000, + 0x0000, 0x0000, 0x50d2, 0x9b19, 0x1901, 0x0000, 0x0000, 0x0000, 0xd4b0, 0xb708, + 0x18e0, 0x0000, 0x0000, 0x0000, 0xfb88, 0xf510, 0x18c1, 0x0000, 0x0000, 0x0000, + 0x31ec, 0xdc8d, 0x18a3, 0x0000, 0x0000, 0x0000, 0x3c00, 0xbff9, 0x1885, 0x0000, + 0x0000, 0x0000, 0x5020, 0xc30b, 0x1862, 0x0000, 0x0000, 0x0000, 0xd4f0, 0xda0c, + 0x1844, 0x0000, 0x0000, 0x0000, 0x20d2, 0x99a5, 0x1828, 0x0000, 0x0000, 0x0000, + 0x852e, 0xd159, 0x1809, 0x0000, 0x0000, 0x0000, 0x7cd8, 0x97a1, 0x17e9, 0x0000, + 0x0000, 0x0000, 0x423a, 0x997b, 0x17cb, 0x0000, 0x0000, 0x0000, 0xc1c0, 0xbe7d, + 0x17a8, 0x0000, 0x0000, 0x0000, 0xe8bc, 0xdcdd, 0x178d, 0x0000, 0x0000, 0x0000, + 0x8b28, 0xae06, 0x176e, 0x0000, 0x0000, 0x0000, 0x102e, 0xb8d4, 0x174f, 0x0000, + 0x0000, 0x0000, 0xaa00, 0xaa5c, 0x172f, 0x0000, 0x0000, 0x0000, 0x51f0, 0x9fc0, + 0x170e, 0x0000, 0x0000, 0x0000, 0xf858, 0xe181, 0x16f2, 0x0000, 0x0000, 0x0000, + 0x91a8, 0x8162, 0x16d3, 0x0000, 0x0000, 0x0000, 0x5f40, 0xcb6f, 0x16b1, 0x0000, + 0x0000, 0x0000, 0xbb50, 0xe55f, 0x1693, 0x0000, 0x0000, 0x0000, 0xacd2, 0xd895, + 0x1676, 0x0000, 0x0000, 0x0000, 0xef30, 0x97bf, 0x1654, 0x0000, 0x0000, 0x0000, + 0xf700, 0xb3d7, 0x1633, 0x0000, 0x0000, 0x0000, 0x3454, 0xa7b5, 0x1619, 0x0000, + 0x0000, 0x0000, 0x6b00, 0xa929, 0x15f6, 0x0000, 0x0000, 0x0000, 0x9f04, 0x89f7, + 0x15db, 0x0000, 0x0000, 0x0000, 0xad78, 0xd985, 0x15bc, 0x0000, 0x0000, 0x0000, + 0xa46a, 0xae3f, 0x159d, 0x0000, 0x0000, 0x0000, 0x63a0, 0xd0da, 0x157c, 0x0000, + 0x0000, 0x0000, 0x5e90, 0x817d, 0x155e, 0x0000, 0x0000, 0x0000, 0x1494, 0xb13f, + 0x1540, 0x0000, 0x0000, 0x0000, 0x0090, 0x9c40, 0x1521, 0x0000, 0x0000, 0x0000, + 0xdd70, 0xcc86, 0x1500, 0x0000, 0x0000, 0x0000, 0x64f8, 0xdb6f, 0x14e1, 0x0000, + 0x0000, 0x0000, 0xe22c, 0xac17, 0x14c3, 0x0000, 0x0000, 0x0000, 0x60e0, 0xa9ad, + 0x14a3, 0x0000, 0x0000, 0x0000, 0x4640, 0xd658, 0x1481, 0x0000, 0x0000, 0x0000, + 0x6490, 0xa181, 0x1467, 0x0000, 0x0000, 0x0000, 0x1df4, 0xaaa2, 0x1447, 0x0000, + 0x0000, 0x0000, 0xb94a, 0x8f61, 0x1429, 0x0000, 0x0000, 0x0000, 0x5198, 0x9d83, + 0x1409, 0x0000, 0x0000, 0x0000, 0x0f7a, 0xa818, 0x13eb, 0x0000, 0x0000, 0x0000, + 0xc45e, 0xc06c, 0x13cc, 0x0000, 0x0000, 0x0000, 0x4ec0, 0xfa29, 0x13a8, 0x0000, + 0x0000, 0x0000, 0x6418, 0x8cad, 0x138c, 0x0000, 0x0000, 0x0000, 0xbcc8, 0xe7d1, + 0x136f, 0x0000, 0x0000, 0x0000, 0xc934, 0xf9b0, 0x134f, 0x0000, 0x0000, 0x0000, + 0x6ce0, 0x98df, 0x1331, 0x0000, 0x0000, 0x0000, 0x3516, 0xe5e9, 0x1312, 0x0000, + 0x0000, 0x0000, 0xc6c0, 0xef8b, 0x12ef, 0x0000, 0x0000, 0x0000, 0xaf02, 0x913d, + 0x12d4, 0x0000, 0x0000, 0x0000, 0xd230, 0xe1d5, 0x12b5, 0x0000, 0x0000, 0x0000, + 0xfba8, 0xc232, 0x1295, 0x0000, 0x0000, 0x0000, 0x7ba4, 0xabeb, 0x1277, 0x0000, + 0x0000, 0x0000, 0x6e5c, 0xc692, 0x1258, 0x0000, 0x0000, 0x0000, 0x76a2, 0x9756, + 0x1239, 0x0000, 0x0000, 0x0000, 0xe180, 0xe423, 0x1214, 0x0000, 0x0000, 0x0000, + 0x8c3c, 0x90f8, 0x11fb, 0x0000, 0x0000, 0x0000, 0x9f3c, 0x9fd2, 0x11dc, 0x0000, + 0x0000, 0x0000, 0x53e0, 0xb73e, 0x11bd, 0x0000, 0x0000, 0x0000, 0x45be, 0x88d6, + 0x119e, 0x0000, 0x0000, 0x0000, 0x111a, 0x8bc0, 0x117f, 0x0000, 0x0000, 0x0000, + 0xe26a, 0xd7ff, 0x1160, 0x0000, 0x0000, 0x0000, 0xfb60, 0xdd8d, 0x113f, 0x0000, + 0x0000, 0x0000, 0x9370, 0xc108, 0x1120, 0x0000, 0x0000, 0x0000, 0x9654, 0x8baf, + 0x1103, 0x0000, 0x0000, 0x0000, 0xd6ec, 0xd6b9, 0x10e4, 0x0000, 0x0000, 0x0000, + 0x23e4, 0xd7b7, 0x10c4, 0x0000, 0x0000, 0x0000, 0x1aa6, 0xa847, 0x10a6, 0x0000, + 0x0000, 0x0000, 0xbee6, 0x9fef, 0x1087, 0x0000, 0x0000, 0x0000, 0x26d0, 0xa6eb, + 0x1066, 0x0000, 0x0000, 0x0000, 0x5b86, 0xa880, 0x1049, 0x0000, 0x0000, 0x0000, + 0x125c, 0xd971, 0x1029, 0x0000, 0x0000, 0x0000, 0x1f78, 0x9d18, 0x100a, 0x0000, + 0x0000, 0x0000, 0x0e84, 0xb15b, 0x0feb, 0x0000, 0x0000, 0x0000, 0xd0c0, 0xc150, + 0x0fcc, 0x0000, 0x0000, 0x0000, 0xa330, 0xc40c, 0x0fad, 0x0000, 0x0000, 0x0000, + 0x5202, 0xfc2c, 0x0f8f, 0x0000, 0x0000, 0x0000, 0x3f7c, 0xecf5, 0x0f6f, 0x0000, + 0x0000, 0x0000, 0xef44, 0xfdfd, 0x0f50, 0x0000, 0x0000, 0x0000, 0x3f6c, 0xab1b, + 0x0f31, 0x0000, 0x0000, 0x0000, 0xf658, 0x89ec, 0x0f11, 0x0000, 0x0000, 0x0000, + 0xbfc8, 0x9ba8, 0x0ef4, 0x0000, 0x0000, 0x0000, 0x3d40, 0xbe21, 0x0ed5, 0x0000, + 0x0000, 0x0000, 0xbbc4, 0xc70d, 0x0eb6, 0x0000, 0x0000, 0x0000, 0x5158, 0xdb16, + 0x0e96, 0x0000, 0x0000, 0x0000, 0xb5a8, 0xa8d8, 0x0e78, 0x0000, 0x0000, 0x0000, + 0xcccc, 0xb40e, 0x0e58, 0x0000, 0x0000, 0x0000, 0x448c, 0xcb62, 0x0e3a, 0x0000, + 0x0000, 0x0000, 0xf12a, 0x8aed, 0x0e1b, 0x0000, 0x0000, 0x0000, 0x79d0, 0xc59c, + 0x0dfb, 0x0000, 0x0000, 0x0000, 0x06b4, 0xcdc9, 0x0ddd, 0x0000, 0x0000, 0x0000, + 0xae70, 0xa979, 0x0dbe, 0x0000, 0x0000, 0x0000, 0x317c, 0xa8fb, 0x0d9e, 0x0000, + 0x0000, 0x0000, 0x5fe0, 0x8a50, 0x0d7d, 0x0000, 0x0000, 0x0000, 0x70b6, 0xfdfa, + 0x0d61, 0x0000, 0x0000, 0x0000, 0x1640, 0x9dc7, 0x0d41, 0x0000, 0x0000, 0x0000, + 0x9a9c, 0xdc50, 0x0d23, 0x0000, 0x0000, 0x0000, 0x4fcc, 0x9a9b, 0x0d04, 0x0000, + 0x0000, 0x0000, 0x7e48, 0x8f77, 0x0ce5, 0x0000, 0x0000, 0x0000, 0x84e4, 0xd4b9, + 0x0cc6, 0x0000, 0x0000, 0x0000, 0x84e0, 0xbd10, 0x0ca6, 0x0000, 0x0000, 0x0000, + 0x1b0a, 0xc8d9, 0x0c88, 0x0000, 0x0000, 0x0000, 0x6a48, 0xfc81, 0x0c68, 0x0000, + 0x0000, 0x0000, 0x070a, 0xbef6, 0x0c4a, 0x0000, 0x0000, 0x0000, 0x8a70, 0xf096, + 0x0c2b, 0x0000, 0x0000, 0x0000, 0xecc2, 0xc994, 0x0c0c, 0x0000, 0x0000, 0x0000, + 0x1540, 0x9537, 0x0bea, 0x0000, 0x0000, 0x0000, 0x1b02, 0xab5b, 0x0bce, 0x0000, + 0x0000, 0x0000, 0x5dc0, 0xb0c8, 0x0bad, 0x0000, 0x0000, 0x0000, 0xc928, 0xe034, + 0x0b8f, 0x0000, 0x0000, 0x0000, 0x2d12, 0xb4b0, 0x0b71, 0x0000, 0x0000, 0x0000, + 0x8fc2, 0xbb94, 0x0b52, 0x0000, 0x0000, 0x0000, 0xe236, 0xe22f, 0x0b33, 0x0000, + 0x0000, 0x0000, 0xb97c, 0xbe9e, 0x0b13, 0x0000, 0x0000, 0x0000, 0xe1a6, 0xe16d, + 0x0af5, 0x0000, 0x0000, 0x0000, 0xd330, 0xbaf0, 0x0ad6, 0x0000, 0x0000, 0x0000, + 0xc0bc, 0xbbd0, 0x0ab7, 0x0000, 0x0000, 0x0000, 0x8e66, 0xdd9b, 0x0a98, 0x0000, + 0x0000, 0x0000, 0xc95c, 0xf799, 0x0a79, 0x0000, 0x0000, 0x0000, 0xdac0, 0xbe4c, + 0x0a55, 0x0000, 0x0000, 0x0000, 0xafc0, 0xc378, 0x0a37, 0x0000, 0x0000, 0x0000, + 0xa880, 0xe341, 0x0a19, 0x0000, 0x0000, 0x0000, 0xc242, 0x81f6, 0x09fd, 0x0000, + 0x0000, 0x0000, 0x7470, 0xc777, 0x09de, 0x0000, 0x0000, 0x0000, 0x62bc, 0xb684, + 0x09be, 0x0000, 0x0000, 0x0000, 0x43ac, 0x8c58, 0x099f, 0x0000, 0x0000, 0x0000, + 0xcc3c, 0xf9ac, 0x0981, 0x0000, 0x0000, 0x0000, 0x1526, 0xb670, 0x0962, 0x0000, + 0x0000, 0x0000, 0xc9fe, 0xdf50, 0x0943, 0x0000, 0x0000, 0x0000, 0x6ae6, 0xc065, + 0x0924, 0x0000, 0x0000, 0x0000, 0xb114, 0xcf29, 0x0905, 0x0000, 0x0000, 0x0000, + 0xd388, 0x922a, 0x08e4, 0x0000, 0x0000, 0x0000, 0xcf54, 0xb926, 0x08c7, 0x0000, + 0x0000, 0x0000, 0x3826, 0xe855, 0x08a8, 0x0000, 0x0000, 0x0000, 0xe7c8, 0x829b, + 0x0888, 0x0000, 0x0000, 0x0000, 0x546c, 0xa903, 0x086a, 0x0000, 0x0000, 0x0000, + 0x8768, 0x99cc, 0x0849, 0x0000, 0x0000, 0x0000, 0x00ac, 0xf529, 0x082b, 0x0000, + 0x0000, 0x0000, 0x2658, 0x9f0b, 0x080c, 0x0000, 0x0000, 0x0000, 0xfe5c, 0x9e21, + 0x07ee, 0x0000, 0x0000, 0x0000, 0x6da2, 0x9910, 0x07cf, 0x0000, 0x0000, 0x0000, + 0x9220, 0xf9b3, 0x07b0, 0x0000, 0x0000, 0x0000, 0x3d90, 0xa541, 0x0791, 0x0000, + 0x0000, 0x0000, 0x6e4c, 0xe7cc, 0x0771, 0x0000, 0x0000, 0x0000, 0xa8fa, 0xe80a, + 0x0753, 0x0000, 0x0000, 0x0000, 0x4e14, 0xc3a7, 0x0734, 0x0000, 0x0000, 0x0000, + 0xf7e0, 0xbad9, 0x0712, 0x0000, 0x0000, 0x0000, 0xfea0, 0xeff2, 0x06f5, 0x0000, + 0x0000, 0x0000, 0xcef6, 0xbd48, 0x06d7, 0x0000, 0x0000, 0x0000, 0x7544, 0xf559, + 0x06b7, 0x0000, 0x0000, 0x0000, 0x2388, 0xf655, 0x0698, 0x0000, 0x0000, 0x0000, + 0xe900, 0xad56, 0x0676, 0x0000, 0x0000, 0x0000, 0x2cc0, 0x8437, 0x0659, 0x0000, + 0x0000, 0x0000, 0x3068, 0xc544, 0x063b, 0x0000, 0x0000, 0x0000, 0xdc70, 0xe73c, + 0x061b, 0x0000, 0x0000, 0x0000, 0xee50, 0x9d49, 0x05fc, 0x0000, 0x0000, 0x0000, + 0x93d2, 0x81f6, 0x05df, 0x0000, 0x0000, 0x0000, 0x941c, 0xadff, 0x05bf, 0x0000, + 0x0000, 0x0000, 0x2ce2, 0x8e45, 0x05a1, 0x0000, 0x0000, 0x0000, 0x4a60, 0x95fd, + 0x0581, 0x0000, 0x0000, 0x0000, 0x79f8, 0xb83a, 0x0563, 0x0000, 0x0000, 0x0000, + 0xcb58, 0xa1f5, 0x0543, 0x0000, 0x0000, 0x0000, 0x2a3a, 0xdc36, 0x0525, 0x0000, + 0x0000, 0x0000, 0x14ee, 0x890e, 0x0506, 0x0000, 0x0000, 0x0000, 0x8f20, 0xc432, + 0x04e3, 0x0000, 0x0000, 0x0000, 0x8440, 0xb21d, 0x04c6, 0x0000, 0x0000, 0x0000, + 0x5430, 0xf698, 0x04a7, 0x0000, 0x0000, 0x0000, 0x04ae, 0x8b20, 0x048a, 0x0000, + 0x0000, 0x0000, 0x04d0, 0xe872, 0x046b, 0x0000, 0x0000, 0x0000, 0xc78e, 0x8893, + 0x044c, 0x0000, 0x0000, 0x0000, 0x0f78, 0x9895, 0x042b, 0x0000, 0x0000, 0x0000, + 0x11d4, 0xdf2e, 0x040d, 0x0000, 0x0000, 0x0000, 0xe84c, 0x89d5, 0x03ef, 0x0000, + 0x0000, 0x0000, 0xf7be, 0x8a67, 0x03d0, 0x0000, 0x0000, 0x0000, 0x95d0, 0xc906, + 0x03b1, 0x0000, 0x0000, 0x0000, 0x64ce, 0xd96c, 0x0392, 0x0000, 0x0000, 0x0000, + 0x97ba, 0xa16f, 0x0373, 0x0000, 0x0000, 0x0000, 0x463c, 0xc51a, 0x0354, 0x0000, + 0x0000, 0x0000, 0xef0a, 0xe93e, 0x0335, 0x0000, 0x0000, 0x0000, 0x526a, 0xa466, + 0x0316, 0x0000, 0x0000, 0x0000, 0x4140, 0xa94d, 0x02f5, 0x0000, 0x0000, 0x0000, + 0xb4ec, 0xce68, 0x02d8, 0x0000, 0x0000, 0x0000, 0x4fa2, 0x8490, 0x02b9, 0x0000, + 0x0000, 0x0000, 0x4e60, 0xca98, 0x0298, 0x0000, 0x0000, 0x0000, 0x08dc, 0xe09c, + 0x027a, 0x0000, 0x0000, 0x0000, 0x2b90, 0xc7e3, 0x025c, 0x0000, 0x0000, 0x0000, + 0x5a7c, 0xf8ef, 0x023c, 0x0000, 0x0000, 0x0000, 0x5022, 0x9d58, 0x021e, 0x0000, + 0x0000, 0x0000, 0x553a, 0xe242, 0x01ff, 0x0000, 0x0000, 0x0000, 0x7e6e, 0xb54d, + 0x01e0, 0x0000, 0x0000, 0x0000, 0xd2d4, 0xa88c, 0x01c1, 0x0000, 0x0000, 0x0000, + 0x75b6, 0xfe6d, 0x01a2, 0x0000, 0x0000, 0x0000, 0x3bb2, 0xf04c, 0x0183, 0x0000, + 0x0000, 0x0000, 0xc2d0, 0xc046, 0x0163, 0x0000, 0x0000, 0x0000, 0x250c, 0xf9d6, + 0x0145, 0x0000, 0x0000, 0x0000, 0xb7b4, 0x8a0d, 0x0126, 0x0000, 0x0000, 0x0000, + 0x1a72, 0xe4f5, 0x0107, 0x0000, 0x0000, 0x0000, 0x825c, 0xa9b8, 0x00e8, 0x0000, + 0x0000, 0x0000, 0x6c90, 0xc9ad, 0x00c6, 0x0000, 0x0000, 0x0000, 0x4d00, 0xd1bb, + 0x00aa, 0x0000, 0x0000, 0x0000, 0xa4a0, 0xee01, 0x0087, 0x0000, 0x0000, 0x0000, + 0x89a8, 0xbe9f, 0x006b, 0x0000, 0x0000, 0x0000, 0x038e, 0xc80c, 0x004d, 0x0000, + 0x0000, 0x0000, 0xfe26, 0x8384, 0x002e, 0x0000, 0x0000, 0x0000, 0xcd90, 0xca57, + 0x000e, 0x0000 +}; + +void MacroAssembler::libm_reduce_pi04l(Register eax, Register ecx, Register edx, Register ebx, Register esi, Register edi, Register ebp, Register esp) { + Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12; + Label B1_13, B1_14, B1_15; + + assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp); + + address zero_none = (address)_zero_none; + address _4onpi_d = (address)__4onpi_d; + address TWO_32H = (address)_TWO_32H; + address pi04_3d = (address)_pi04_3d; + address pi04_5d = (address)_pi04_5d; + address SCALE = (address)_SCALE; + address zeros = (address)_zeros; + address pi04_2d = (address)_pi04_2d; + address TWO_12H = (address)_TWO_12H; + address _4onpi_31l = (address)__4onpi_31l; + + bind(B1_1); + push(ebp); + movl(ebp, esp); + andl(esp, -16); + push(esi); + push(edi); + push(ebx); + subl(esp, 20); + movzwl(ebx, Address(ebp, 16)); + andl(ebx, 32767); + movl(eax, Address(ebp, 20)); + cmpl(ebx, 16413); + movl(esi, Address(ebp, 24)); + movl(Address(esp, 4), eax); + jcc(Assembler::greaterEqual, B1_8); + + bind(B1_2); + fld_x(Address(ebp, 8)); + fld_d(ExternalAddress(_4onpi_d)); //0x6dc9c883UL, 0x3ff45f30UL + fmul(1); + fstp_x(Address(esp, 8)); + movzwl(ecx, Address(esp, 16)); + negl(ecx); + addl(ecx, 30); + movl(eax, Address(esp, 12)); + shrl(eax); + cmpl(Address(esp, 4), 0); + jcc(Assembler::notEqual, B1_4); + + bind(B1_3); + lea(ecx, Address(eax, 1)); + andl(ecx, -2); + jmp(B1_5); + + bind(B1_4); + movl(ecx, eax); + addl(eax, Address(esp, 4)); + movl(edx, eax); + andl(edx, 1); + addl(ecx, edx); + + bind(B1_5); + fld_d(ExternalAddress(TWO_32H)); //0x00000000UL, 0x41f80000UL + cmpl(ebx, 16400); + movl(Address(esp, 0), ecx); + fild_s(Address(esp, 0)); + jcc(Assembler::greaterEqual, B1_7); + + bind(B1_6); + fld_d(ExternalAddress(pi04_3d)); //0x54442d00UL, 0x3fe921fbUL + fmul(1); + fsubp(3); + fxch(1); + fmul(2); + fld_s(2); + fadd(1); + fsubrp(1); + fld_s(0); + fxch(1); + fsuba(3); + fld_d(ExternalAddress(8 + pi04_3d)); //0x98cc5180UL, 0x3ce84698UL + fmul(3); + fsuba(2); + fxch(1); + fsub(2); + fsubrp(1); + faddp(3); + fld_d(ExternalAddress(16 + pi04_3d)); //0xcbb5bf6cUL, 0xb9dfc8f8UL + fmulp(2); + fld_s(1); + fsubr(1); + fsuba(1); + fxch(2); + fsubp(1); + faddp(2); + fxch(1); + jmp(B1_15); + + bind(B1_7); + fld_d(ExternalAddress(pi04_5d)); //0x54400000UL, 0x3fe921fbUL + fmul(1); + fsubp(3); + fxch(1); + fmul(2); + fld_s(2); + fadd(1); + fsubrp(1); + fld_s(0); + fxch(1); + fsuba(3); + fld_d(ExternalAddress(8 + pi04_5d)); //0x1a600000UL, 0x3dc0b461UL + fmul(3); + fsuba(2); + fxch(1); + fsub(2); + fsubrp(1); + faddp(3); + fld_d(ExternalAddress(16 + pi04_5d)); //0x2e000000UL, 0x3b93198aUL + fmul(2); + fld_s(0); + fsubr(2); + fsuba(2); + fxch(1); + fsubp(2); + fxch(1); + faddp(3); + fld_d(ExternalAddress(24 + pi04_5d)); //0x25200000UL, 0x396b839aUL + fmul(2); + fld_s(0); + fsubr(2); + fsuba(2); + fxch(1); + fsubp(2); + fxch(1); + faddp(3); + fld_d(ExternalAddress(32 + pi04_5d)); //0x533e63a0UL, 0x37027044UL + fmulp(2); + fld_s(1); + fsubr(1); + fsuba(1); + fxch(2); + fsubp(1); + faddp(2); + fxch(1); + jmp(B1_15); + + bind(B1_8); + fld_x(Address(ebp, 8)); + addl(ebx, -16417); + fmul_d(as_Address(ExternalAddress(SCALE))); //0x00000000UL, 0x32600000UL + movl(eax, -2078209981); + imull(ebx); + addl(edx, ebx); + movl(ecx, ebx); + sarl(edx, 4); + sarl(ecx, 31); + subl(edx, ecx); + movl(eax, edx); + shll(eax, 5); + fstp_x(Address(ebp, 8)); + fld_x(Address(ebp, 8)); + subl(eax, edx); + movl(Address(ebp, 8), 0); + subl(ebx, eax); + fld_x(Address(ebp, 8)); + cmpl(ebx, 17); + fsuba(1); + jcc(Assembler::less, B1_10); + + bind(B1_9); + lea(eax, Address(noreg, edx, Address::times_8)); + lea(ecx, Address(eax, edx, Address::times_4)); + incl(edx); + fld_x(Address(_4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); + fmul(2); + fld_x(Address(12 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); + fmul(2); + fld_s(0); + fadd(2); + fsuba(2); + fxch(1); + faddp(2); + fld_s(1); + fadd(1); + fstp_x(Address(esp, 8)); + andl(Address(esp, 8), -16777216); + fld_x(Address(esp, 8)); + fsubp(1); + jmp(B1_11); + + bind(B1_10); + fld_d(ExternalAddress(zeros)); //0x00000000UL, 0x00000000UL + fld_s(0); + + bind(B1_11); + fld_s(0); + lea(eax, Address(noreg, edx, Address::times_8)); + fld_s(3); + lea(edx, Address(eax, edx, Address::times_4)); + fld_x(Address(_4onpi_31l, RelocationHolder::none).plus_disp(edx, Address::times_1)); + fmul(6); + movl(Address(esp, 0), edx); + fadda(2); + fxch(2); + fsuba(3); + fxch(2); + faddp(3); + fxch(2); + faddp(3); + fld_x(Address(12 + _4onpi_31l, RelocationHolder::none).plus_disp(edx, Address::times_1)); + fmula(2); + fld_s(2); + fadd(2); + fld_s(0); + fxch(1); + fsubra(3); + fxch(3); + fchs(); + faddp(4); + fxch(3); + faddp(4); + fxch(2); + fadd(3); + fxch(2); + fmul(5); + fadda(2); + fld_s(4); + fld_x(Address(24 + _4onpi_31l, RelocationHolder::none).plus_disp(edx, Address::times_1)); + fmula(1); + fxch(1); + fadda(4); + fxch(4); + fstp_x(Address(esp, 8)); + movzwl(ebx, Address(esp, 16)); + andl(ebx, 32767); + cmpl(ebx, 16415); + jcc(Assembler::greaterEqual, B1_13); + + bind(B1_12); + negl(ebx); + addl(ebx, 30); + movl(ecx, ebx); + movl(eax, Address(esp, 12)); + shrl(eax); + shll(eax); + movl(Address(esp, 12), eax); + movl(Address(esp, 8), 0); + shrl(eax); + jmp(B1_14); + + bind(B1_13); + negl(ebx); + addl(ebx, 30); + movl(ecx, ebx); + movl(edx, Address(esp, 8)); + shrl(edx); + shll(edx); + negl(ecx); + movl(eax, Address(esp, 12)); + shll(eax); + movl(ecx, ebx); + movl(Address(esp, 8), edx); + shrl(edx); + orl(eax, edx); + + bind(B1_14); + fld_x(Address(esp, 8)); + addl(eax, Address(esp, 4)); + fsubp(3); + fmul(6); + fld_s(4); + movl(edx, eax); + andl(edx, 1); + fadd(3); + movl(ecx, Address(esp, 0)); + fsuba(3); + fxch(3); + faddp(5); + fld_s(1); + fxch(3); + fadd_d(Address(zero_none, RelocationHolder::none).plus_disp(edx, Address::times_8)); + fadda(3); + fsub(3); + faddp(2); + fxch(1); + faddp(4); + fld_s(2); + fadd(2); + fsuba(2); + fxch(3); + faddp(2); + fxch(1); + faddp(3); + fld_s(0); + fadd(2); + fsuba(2); + fxch(1); + faddp(2); + fxch(1); + faddp(2); + fld_s(2); + fld_x(Address(36 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); + fmula(1); + fld_s(1); + fadd(3); + fsuba(3); + fxch(2); + faddp(3); + fxch(2); + faddp(3); + fxch(1); + fmul(4); + fld_s(0); + fadd(2); + fsuba(2); + fxch(1); + faddp(2); + fxch(1); + faddp(2); + fld_s(2); + fld_x(Address(48 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); + fmula(1); + fld_s(1); + fadd(3); + fsuba(3); + fxch(2); + faddp(3); + fxch(2); + faddp(3); + fld_s(3); + fxch(2); + fmul(5); + fld_x(Address(60 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); + fmula(3); + fxch(3); + faddp(1); + fld_s(0); + fadd(2); + fsuba(2); + fxch(1); + faddp(2); + fxch(1); + faddp(3); + fld_s(3); + fxch(2); + fmul(5); + fld_x(Address(72 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); + fmula(3); + fxch(3); + faddp(1); + fld_s(0); + fadd(2); + fsuba(2); + fxch(1); + faddp(2); + fxch(1); + faddp(3); + fxch(1); + fmulp(4); + fld_x(Address(84 + _4onpi_31l, RelocationHolder::none).plus_disp(ecx, Address::times_1)); + fmulp(3); + fxch(2); + faddp(3); + fld_s(2); + fadd(2); + fld_d(ExternalAddress(TWO_32H)); //0x00000000UL, 0x41f80000UL + fmul(1); + fadda(1); + fsubp(1); + fsuba(2); + fxch(3); + faddp(2); + faddp(1); + fld_d(ExternalAddress(pi04_2d)); //0x54400000UL, 0x3fe921fbUL + fld_s(0); + fmul(2); + fxch(2); + fadd(3); + fxch(1); + fmulp(3); + fmul_d(as_Address(ExternalAddress(8 + pi04_2d))); //0x1a626331UL, 0x3dc0b461UL + faddp(1); + + bind(B1_15); + fld_d(ExternalAddress(TWO_12H)); //0x00000000UL, 0x40b80000UL + fld_s(2); + fadd(2); + fmula(1); + fstp_x(Address(esp, 8)); + fld_x(Address(esp, 8)); + fadd(1); + fsubrp(1); + fst_d(Address(esi, 0)); + fsubp(2); + faddp(1); + fstp_d(Address(esi, 8)); + addl(esp, 20); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); +} + +ALIGNED_(16) juint StubRoutines::x86::_L_2il0floatpacket_0[] = +{ + 0xffffffffUL, 0x7fffffffUL, 0x00000000UL, 0x00000000UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_Pi4Inv[] = +{ + 0x6dc9c883UL, 0x3ff45f30UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_Pi4x3[] = +{ + 0x54443000UL, 0xbfe921fbUL, 0x3b39a000UL, 0x3d373dcbUL, 0xe0e68948UL, + 0xba845c06UL +}; + +ALIGNED_(16) juint StubRoutines::x86::_Pi4x4[] = +{ + 0x54400000UL, 0xbfe921fbUL, 0x1a600000UL, 0xbdc0b461UL, 0x2e000000UL, + 0xbb93198aUL, 0x252049c1UL, 0xb96b839aUL +}; + +ALIGNED_(16) jushort _SP[] = +{ + 0xaaab, 0xaaaa, 0xaaaa, 0xaaaa, 0xbffc, 0x0000, 0x8887, 0x8888, 0x8888, 0x8888, + 0x3ff8, 0x0000, 0xc527, 0x0d00, 0x00d0, 0xd00d, 0xbff2, 0x0000, 0x45f6, 0xb616, + 0x1d2a, 0xb8ef, 0x3fec, 0x0000, 0x825b, 0x3997, 0x2b3f, 0xd732, 0xbfe5, 0x0000, + 0xbf33, 0x8bb4, 0x2fda, 0xb092, 0x3fde, 0x0000, 0x44a6, 0xed1a, 0x29ef, 0xd73e, + 0xbfd6, 0x0000, 0x8610, 0x307f, 0x62a1, 0xc921, 0x3fce, 0x0000 +}; + +ALIGNED_(16) jushort _CP[] = +{ + 0x0000, 0x0000, 0x0000, 0x8000, 0xbffe, 0x0000, 0xaaa5, 0xaaaa, 0xaaaa, 0xaaaa, + 0x3ffa, 0x0000, 0x9c2f, 0x0b60, 0x60b6, 0xb60b, 0xbff5, 0x0000, 0xf024, 0x0cac, + 0x00d0, 0xd00d, 0x3fef, 0x0000, 0x03fe, 0x3f65, 0x7dbb, 0x93f2, 0xbfe9, 0x0000, + 0xd84d, 0xadee, 0xc698, 0x8f76, 0x3fe2, 0x0000, 0xdaba, 0xfe79, 0xea36, 0xc9c9, + 0xbfda, 0x0000, 0x3ac6, 0x0ba0, 0x07ce, 0xd585, 0x3fd2, 0x0000 +}; + +ALIGNED_(16) juint StubRoutines::x86::_ones[] = +{ + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xbff00000UL +}; + +void MacroAssembler::libm_sincos_huge(XMMRegister xmm0, XMMRegister xmm1, Register eax, Register ecx, Register edx, Register ebx, Register esi, Register edi, Register ebp, Register esp) { + Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12; + Label B1_13, B1_14, B1_15, B1_16, B1_17, B1_18, B1_19, B1_20, B1_21, B1_22, B1_23; + Label B1_24, B1_25, B1_26, B1_27, B1_28, B1_29, B1_30, B1_31, B1_32, B1_33, B1_34; + Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_44, B1_45, B1_46; + + assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp); + + address L_2il0floatpacket_0 = StubRoutines::x86::_L_2il0floatpacket_0_addr(); + address Pi4Inv = StubRoutines::x86::_Pi4Inv_addr(); + address Pi4x3 = StubRoutines::x86::_Pi4x3_addr(); + address Pi4x4 = StubRoutines::x86::_Pi4x4_addr(); + address ones = StubRoutines::x86::_ones_addr(); + address CP = (address)_CP; + address SP = (address)_SP; + + bind(B1_1); + push(ebp); + movl(ebp, esp); + andl(esp, -64); + push(esi); + push(edi); + push(ebx); + subl(esp, 52); + movl(eax, Address(ebp, 16)); + movl(edx, Address(ebp, 20)); + movl(Address(esp, 32), eax); + movl(Address(esp, 36), edx); + + bind(B1_2); + fnstcw(Address(esp, 30)); + + bind(B1_3); + movsd(xmm1, Address(ebp, 8)); + movl(esi, Address(ebp, 12)); + movl(eax, esi); + andl(eax, 2147483647); + andps(xmm1, ExternalAddress(L_2il0floatpacket_0)); //0xffffffffUL, 0x7fffffffUL, 0x00000000UL, 0x00000000UL + shrl(esi, 31); + movl(Address(esp, 40), eax); + cmpl(eax, 1104150528); + movsd(Address(ebp, 8), xmm1); + jcc(Assembler::aboveEqual, B1_11); + + bind(B1_4); + movsd(xmm0, ExternalAddress(Pi4Inv)); //0x6dc9c883UL, 0x3ff45f30UL + mulsd(xmm0, xmm1); + movzwl(edx, Address(esp, 30)); + movl(eax, edx); + andl(eax, 768); + movsd(Address(esp, 0), xmm0); + cmpl(eax, 768); + jcc(Assembler::equal, B1_42); + + bind(B1_5); + orl(edx, -64768); + movw(Address(esp, 28), edx); + + bind(B1_6); + fldcw(Address(esp, 28)); + + bind(B1_7); + movsd(xmm1, Address(ebp, 8)); + movl(ebx, 1); + + bind(B1_8); + movl(Address(esp, 12), ebx); + movl(ebx, Address(esp, 4)); + movl(eax, ebx); + movl(Address(esp, 8), esi); + movl(esi, ebx); + shrl(esi, 20); + andl(eax, 1048575); + movl(ecx, esi); + orl(eax, 1048576); + negl(ecx); + movl(edx, eax); + addl(ecx, 19); + addl(esi, 13); + movl(Address(esp, 24), ecx); + shrl(edx); + movl(ecx, esi); + shll(eax); + movl(ecx, Address(esp, 24)); + movl(esi, Address(esp, 0)); + shrl(esi); + orl(eax, esi); + cmpl(ebx, 1094713344); + movsd(Address(esp, 16), xmm1); + fld_d(Address(esp, 16)); + cmov32(Assembler::below, eax, edx); + movl(esi, Address(esp, 8)); + lea(edx, Address(eax, 1)); + movl(ebx, edx); + andl(ebx, -2); + movl(Address(esp, 16), ebx); + fild_s(Address(esp, 16)); + movl(ebx, Address(esp, 12)); + cmpl(Address(esp, 40), 1094713344); + jcc(Assembler::aboveEqual, B1_10); + + bind(B1_9); + fld_d(ExternalAddress(Pi4x3)); //0x54443000UL, 0xbfe921fbUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(8 + Pi4x3)); //0x3b39a000UL, 0x3d373dcbUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(16 + Pi4x3)); //0xe0e68948UL, 0xba845c06UL + fmulp(1); + faddp(1); + jmp(B1_17); + + bind(B1_10); + fld_d(ExternalAddress(Pi4x4)); //0x54400000UL, 0xbfe921fbUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(8 + Pi4x4)); //0x1a600000UL, 0xbdc0b461UL + fmul(1); + faddp(2); + fld_d(ExternalAddress(16 + Pi4x4)); //0x2e000000UL, 0xbb93198aUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(24 + Pi4x4)); //0x252049c1UL, 0xb96b839aUL + fmulp(1); + faddp(1); + jmp(B1_17); + + bind(B1_11); + movzwl(edx, Address(esp, 30)); + movl(eax, edx); + andl(eax, 768); + cmpl(eax, 768); + jcc(Assembler::equal, B1_43); + bind(B1_12); + orl(edx, -64768); + movw(Address(esp, 28), edx); + + bind(B1_13); + fldcw(Address(esp, 28)); + + bind(B1_14); + movsd(xmm1, Address(ebp, 8)); + movl(ebx, 1); + + bind(B1_15); + movsd(Address(esp, 16), xmm1); + fld_d(Address(esp, 16)); + addl(esp, -32); + lea(eax, Address(esp, 32)); + fstp_x(Address(esp, 0)); + movl(Address(esp, 12), 0); + movl(Address(esp, 16), eax); + call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_reduce_pi04l()))); + + bind(B1_46); + addl(esp, 32); + + bind(B1_16); + fld_d(Address(esp, 0)); + lea(edx, Address(eax, 1)); + fld_d(Address(esp, 8)); + faddp(1); + + bind(B1_17); + movl(ecx, edx); + addl(eax, 3); + shrl(ecx, 2); + andl(ecx, 1); + shrl(eax, 2); + xorl(esi, ecx); + movl(ecx, Address(esp, 36)); + andl(eax, 1); + andl(ecx, 3); + cmpl(ecx, 3); + jcc(Assembler::notEqual, B1_25); + + bind(B1_18); + fld_x(ExternalAddress(84 + SP)); //0x8610, 0x307f, 0x62 + fld_s(1); + fmul((2)); + testb(edx, 2); + fmula((1)); + fld_x(ExternalAddress(72 + SP)); //0x44a6, 0xed1a, 0x29 + faddp(2); + fmula(1); + fld_x(ExternalAddress(60 + SP)); //0xbf33, 0x8bb4, 0x2f + faddp(2); + fmula(1); + fld_x(ExternalAddress(48 + SP)); //0x825b, 0x3997, 0x2b + faddp(2); + fmula(1); + fld_x(ExternalAddress(36 + SP)); //0x45f6, 0xb616, 0x1d + faddp(2); + fmula(1); + fld_x(ExternalAddress(24 + SP)); //0xc527, 0x0d00, 0x00 + faddp(2); + fmula(1); + fld_x(ExternalAddress(12 + SP)); //0x8887, 0x8888, 0x88 + faddp(2); + fmula(1); + fld_x(ExternalAddress(SP)); //0xaaab, 0xaaaa, 0xaa + faddp(2); + fmula(1); + fld_x(ExternalAddress(84 + CP)); //0x3ac6, 0x0ba0, 0x07 + fmul(1); + fld_x(ExternalAddress(72 + CP)); //0xdaba, 0xfe79, 0xea + faddp(1); + fmul(1); + fld_x(ExternalAddress(62 + CP)); //0xd84d, 0xadee, 0xc6 + faddp(1); + fmul(1); + fld_x(ExternalAddress(48 + CP)); //0x03fe, 0x3f65, 0x7d + faddp(1); + fmul(1); + fld_x(ExternalAddress(36 + CP)); //0xf024, 0x0cac, 0x00 + faddp(1); + fmul(1); + fld_x(ExternalAddress(24 + CP)); //0x9c2f, 0x0b60, 0x60 + faddp(1); + fmul(1); + fld_x(ExternalAddress(12 + CP)); //0xaaa5, 0xaaaa, 0xaa + faddp(1); + fmul(1); + fld_x(ExternalAddress(CP)); //0x0000, 0x0000, 0x00 + faddp(1); + fmulp(1); + fld_d(Address(ones, RelocationHolder::none).plus_disp(esi, Address::times_8)); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + jcc(Assembler::equal, B1_22); + + bind(B1_19); + fmulp(4); + testl(ebx, ebx); + fxch(2); + fmul(3); + movl(eax, Address(esp, 2)); + faddp(3); + fxch(2); + fstp_d(Address(eax, 0)); + fmula(1); + faddp(1); + fstp_d(Address(eax, 8)); + jcc(Assembler::equal, B1_21); + + bind(B1_20); + fldcw(Address(esp, 30)); + + bind(B1_21); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_22); + fxch(1); + fmulp(4); + testl(ebx, ebx); + fxch(2); + fmul(3); + movl(eax, Address(esp, 32)); + faddp(3); + fxch(2); + fstp_d(Address(eax, 8)); + fmula(1); + faddp(1); + fstp_d(Address(eax, 0)); + jcc(Assembler::equal, B1_24); + + bind(B1_23); + fldcw(Address(esp, 30)); + + bind(B1_24); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_25); + testb(Address(esp, 36), 2); + jcc(Assembler::equal, B1_33); + + bind(B1_26); + fld_s(0); + testb(edx, 2); + fmul(1); + fld_s(0); + fmul(1); + jcc(Assembler::equal, B1_30); + + bind(B1_27); + fstp_d(2); + fld_x(ExternalAddress(84 + CP)); //0x3ac6, 0x0ba0, 0x07 + testl(ebx, ebx); + fmul(2); + fld_x(ExternalAddress(72 + CP)); //0xdaba, 0xfe79, 0xea + fmul(3); + fld_x(ExternalAddress(60 + CP)); //0xd84d, 0xadee, 0xc6 + movl(eax, Address(rsp, 32)); + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(48 + CP)); //0x03fe, 0x3f65, 0x7d + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(36 + CP)); //0xf024, 0x0cac, 0x00 + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(24 + CP)); //0x9c2f, 0x0b60, 0x60 + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(12 + CP)); //0xaaa5, 0xaaaa, 0xaa + faddp(2); + fxch(1); + fmulp(3); + fld_x(ExternalAddress(CP)); //0x0000, 0x0000, 0x00 + faddp(1); + fmulp(1); + faddp(1); + fld_d(Address(ones, RelocationHolder::none).plus_disp(rsi, Address::times_8)); + fmula(1); + faddp(1); + fstp_d(Address(eax, 8)); + jcc(Assembler::equal, B1_29); + + bind(B1_28); + fldcw(Address(esp, 30)); + + bind(B1_29); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_30); + fld_x(ExternalAddress(84 + SP)); //0x8610, 0x307f, 0x62 + testl(ebx, ebx); + fmul(1); + fld_x(ExternalAddress(72 + SP)); //0x44a6, 0xed1a, 0x29 + fmul(2); + fld_x(ExternalAddress(60 + SP)); //0xbf33, 0x8bb4, 0x2f + movl(eax, Address(rsp, 32)); + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(48 + SP)); //0x825b, 0x3997, 0x2b + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(36 + SP)); //0x45f6, 0xb616, 0x1d + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(24 + SP)); //0xc527, 0x0d00, 0x00 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(12 + SP)); //0x8887, 0x8888, 0x88 + faddp(2); + fxch(1); + fmulp(2); + fld_x(ExternalAddress(SP)); //0xaaab, 0xaaaa, 0xaa + faddp(1); + fmulp(2); + faddp(1); + fld_d(Address(ones, RelocationHolder::none).plus_disp(rsi, Address::times_8)); + fmulp(2); + fmul(1); + faddp(1); + fstp_d(Address(eax, 8)); + jcc(Assembler::equal, B1_32); + + bind(B1_31); + fldcw(Address(esp, 30)); + + bind(B1_32); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_33); + testb(Address(esp, 36), 1); + jcc(Assembler::equal, B1_41); + + bind(B1_34); + fld_s(0); + testb(edx, 2); + fmul(1); + fld_s(0); + fmul(1); + jcc(Assembler::equal, B1_38); + + bind(B1_35); + fld_x(ExternalAddress(84 + SP)); //0x8610, 0x307f, 0x62 + testl(ebx, ebx); + fmul(1); + fld_x(ExternalAddress(72 + SP)); //0x44a6, 0xed1a, 0x29 + fmul(2); + fld_x(ExternalAddress(60 + SP)); //0xbf33, 0x8bb4, 0x2f + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(48 + SP)); //0x825b, 0x3997, 0x2b + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(36 + SP)); //0x45f6, 0xb616, 0x1d + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(24 + SP)); //0xc527, 0x0d00, 0x00 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(12 + SP)); //0x8887, 0x8888, 0x88 + faddp(2); + fxch(1); + fmulp(2); + fld_x(ExternalAddress(SP)); //0xaaab, 0xaaaa, 0xaa + faddp(1); + fmulp(2); + faddp(1); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmulp(2); + fmul(1); + movl(eax, Address(esp, 32)); + faddp(1); + fstp_d(Address(eax, 0)); + jcc(Assembler::equal, B1_37); + + bind(B1_36); + fldcw(Address(esp, 30)); + + bind(B1_37); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_38); + fstp_d(2); + fld_x(ExternalAddress(84 + CP)); //0x3ac6, 0x0ba0, 0x07 + testl(ebx, ebx); + fmul(2); + fld_x(ExternalAddress(72 + CP)); //0xdaba, 0xfe79, 0xea + fmul(3); + fld_x(ExternalAddress(60 + CP)); //0xd84d, 0xadee, 0xc6 + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(48 + CP)); //0x03fe, 0x3f65, 0x7d + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(36 + CP)); //0xf024, 0x0cac, 0x00 + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(24 + CP)); //0x9c2f, 0x0b60, 0x60 + faddp(2); + fxch(1); + fmul(3); + fld_x(ExternalAddress(12 + CP)); //0xaaa5, 0xaaaa, 0xaa + faddp(2); + fxch(1); + fmulp(3); + fld_x(ExternalAddress(CP)); //0x0000, 0x0000, 0x00 + faddp(1); + fmulp(1); + faddp(1); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmula(1); + movl(eax, Address(esp, 32)); + faddp(1); + fstp_d(Address(eax, 0)); + jcc(Assembler::equal, B1_40); + + bind(B1_39); + fldcw(Address(esp, 30)); + bind(B1_40); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + bind(B1_41); + fstp_d(0); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + bind(B1_42); + xorl(ebx, ebx); + jmp(B1_8); + bind(B1_43); + xorl(ebx, ebx); + jmp(B1_15); +} + +ALIGNED_(16) juint _static_const_table_sin[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, 0xbf73b92eUL, + 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, + 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, + 0xc0000000UL, 0xbc626d19UL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, + 0xbfa60beaUL, 0x2ed59f06UL, 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, + 0x00000000UL, 0x3ff00000UL, 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, + 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, 0x00000000UL, 0x3ff00000UL, + 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, 0x20000000UL, + 0x3c5e0d89UL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, 0xbfc59267UL, + 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, + 0x3ff00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, + 0x20000000UL, 0x3c68076aUL, 0x00000000UL, 0x3ff00000UL, 0x99fcef32UL, + 0x3fca8279UL, 0x667f3bcdUL, 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, + 0x00000000UL, 0x3fe00000UL, 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, + 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, 0x00000000UL, 0x3fe00000UL, + 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, 0xe0000000UL, + 0x3c39f630UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, 0xbf9d4a2cUL, + 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, + 0x3fe00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0x3fed906bUL, + 0x20000000UL, 0x3c7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x76acf82dUL, + 0x3fa4a031UL, 0x56c62ddaUL, 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, + 0x00000000UL, 0x3fd00000UL, 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, + 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, 0x00000000UL, 0x3fd00000UL, + 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, 0x40000000UL, + 0xbc887df6UL, 0x00000000UL, 0x3fc00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0x3fefd88dUL, + 0x40000000UL, 0xbc887df6UL, 0x00000000UL, 0xbfc00000UL, 0x0e5967d5UL, + 0x3fac1d1fUL, 0xcff75cb0UL, 0x3fef6297UL, 0x20000000UL, 0x3c756217UL, + 0x00000000UL, 0xbfd00000UL, 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, + 0x3fee9f41UL, 0xe0000000UL, 0x3c8760b1UL, 0x00000000UL, 0xbfd00000UL, + 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, 0x3fed906bUL, 0x20000000UL, + 0x3c7457e6UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, 0x3f9d4a2cUL, + 0xf180bdb1UL, 0x3fec38b2UL, 0x80000000UL, 0xbc76e0b1UL, 0x00000000UL, + 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0x3fea9b66UL, + 0xe0000000UL, 0x3c39f630UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, + 0xbfc133ccUL, 0x6b151741UL, 0x3fe8bc80UL, 0x20000000UL, 0xbc82c5e1UL, + 0x00000000UL, 0xbfe00000UL, 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, + 0x3fe6a09eUL, 0x20000000UL, 0xbc8bdd34UL, 0x00000000UL, 0xbfe00000UL, + 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, 0x3fe44cf3UL, 0x20000000UL, + 0x3c68076aUL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, 0x3fc59267UL, + 0x39ae68c8UL, 0x3fe1c73bUL, 0x20000000UL, 0x3c8b25ddUL, 0x00000000UL, + 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0x3fde2b5dUL, + 0x20000000UL, 0x3c5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, + 0x3fb37ca1UL, 0xa6aea963UL, 0x3fd87de2UL, 0xe0000000UL, 0xbc672cedUL, + 0x00000000UL, 0xbff00000UL, 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, + 0x3fd29406UL, 0xa0000000UL, 0xbc75d28dUL, 0x00000000UL, 0xbff00000UL, + 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, 0x3fc8f8b8UL, 0xc0000000UL, + 0xbc626d19UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, 0x3f73b92eUL, + 0xbc29b42cUL, 0x3fb917a6UL, 0xe0000000UL, 0xbc3e2718UL, 0x00000000UL, + 0xbff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x176d6d31UL, + 0x3f73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, + 0x00000000UL, 0xbff00000UL, 0x011469fbUL, 0x3f93ad06UL, 0x3c69a60bUL, + 0xbfc8f8b8UL, 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0xbff00000UL, + 0x939d225aUL, 0x3fa60beaUL, 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, + 0x3c75d28dUL, 0x00000000UL, 0xbff00000UL, 0x866b95cfUL, 0x3fb37ca1UL, + 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, 0x3c672cedUL, 0x00000000UL, + 0xbff00000UL, 0x73fa1279UL, 0x3fbe3a68UL, 0x3806f63bUL, 0xbfde2b5dUL, + 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0xbff00000UL, 0x5bc57974UL, + 0x3fc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, + 0x00000000UL, 0xbff00000UL, 0x53aba2fdUL, 0x3fcd0dfeUL, 0x25091dd6UL, + 0xbfe44cf3UL, 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0xbff00000UL, + 0x99fcef32UL, 0xbfca8279UL, 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, + 0x3c8bdd34UL, 0x00000000UL, 0xbfe00000UL, 0x94247758UL, 0xbfc133ccUL, + 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, 0x3c82c5e1UL, 0x00000000UL, + 0xbfe00000UL, 0x9ae68c87UL, 0xbfac73b3UL, 0x290ea1a3UL, 0xbfea9b66UL, + 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0xbfe00000UL, 0x7f909c4eUL, + 0x3f9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, + 0x00000000UL, 0xbfe00000UL, 0x65455a75UL, 0x3fbe0875UL, 0xcf328d46UL, + 0xbfed906bUL, 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0xbfe00000UL, + 0x76acf82dUL, 0xbfa4a031UL, 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, + 0xbc8760b1UL, 0x00000000UL, 0xbfd00000UL, 0x0e5967d5UL, 0x3fac1d1fUL, + 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, 0xbc756217UL, 0x00000000UL, + 0xbfd00000UL, 0x0f592f50UL, 0x3f9ba165UL, 0xa3d12526UL, 0xbfefd88dUL, + 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0xbfc00000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0xbff00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x0f592f50UL, 0xbf9ba165UL, 0xa3d12526UL, + 0xbfefd88dUL, 0x40000000UL, 0x3c887df6UL, 0x00000000UL, 0x3fc00000UL, + 0x0e5967d5UL, 0xbfac1d1fUL, 0xcff75cb0UL, 0xbfef6297UL, 0x20000000UL, + 0xbc756217UL, 0x00000000UL, 0x3fd00000UL, 0x76acf82dUL, 0x3fa4a031UL, + 0x56c62ddaUL, 0xbfee9f41UL, 0xe0000000UL, 0xbc8760b1UL, 0x00000000UL, + 0x3fd00000UL, 0x65455a75UL, 0xbfbe0875UL, 0xcf328d46UL, 0xbfed906bUL, + 0x20000000UL, 0xbc7457e6UL, 0x00000000UL, 0x3fe00000UL, 0x7f909c4eUL, + 0xbf9d4a2cUL, 0xf180bdb1UL, 0xbfec38b2UL, 0x80000000UL, 0x3c76e0b1UL, + 0x00000000UL, 0x3fe00000UL, 0x9ae68c87UL, 0x3fac73b3UL, 0x290ea1a3UL, + 0xbfea9b66UL, 0xe0000000UL, 0xbc39f630UL, 0x00000000UL, 0x3fe00000UL, + 0x94247758UL, 0x3fc133ccUL, 0x6b151741UL, 0xbfe8bc80UL, 0x20000000UL, + 0x3c82c5e1UL, 0x00000000UL, 0x3fe00000UL, 0x99fcef32UL, 0x3fca8279UL, + 0x667f3bcdUL, 0xbfe6a09eUL, 0x20000000UL, 0x3c8bdd34UL, 0x00000000UL, + 0x3fe00000UL, 0x53aba2fdUL, 0xbfcd0dfeUL, 0x25091dd6UL, 0xbfe44cf3UL, + 0x20000000UL, 0xbc68076aUL, 0x00000000UL, 0x3ff00000UL, 0x5bc57974UL, + 0xbfc59267UL, 0x39ae68c8UL, 0xbfe1c73bUL, 0x20000000UL, 0xbc8b25ddUL, + 0x00000000UL, 0x3ff00000UL, 0x73fa1279UL, 0xbfbe3a68UL, 0x3806f63bUL, + 0xbfde2b5dUL, 0x20000000UL, 0xbc5e0d89UL, 0x00000000UL, 0x3ff00000UL, + 0x866b95cfUL, 0xbfb37ca1UL, 0xa6aea963UL, 0xbfd87de2UL, 0xe0000000UL, + 0x3c672cedUL, 0x00000000UL, 0x3ff00000UL, 0x939d225aUL, 0xbfa60beaUL, + 0x2ed59f06UL, 0xbfd29406UL, 0xa0000000UL, 0x3c75d28dUL, 0x00000000UL, + 0x3ff00000UL, 0x011469fbUL, 0xbf93ad06UL, 0x3c69a60bUL, 0xbfc8f8b8UL, + 0xc0000000UL, 0x3c626d19UL, 0x00000000UL, 0x3ff00000UL, 0x176d6d31UL, + 0xbf73b92eUL, 0xbc29b42cUL, 0xbfb917a6UL, 0xe0000000UL, 0x3c3e2718UL, + 0x00000000UL, 0x3ff00000UL, 0x55555555UL, 0xbfc55555UL, 0x00000000UL, + 0xbfe00000UL, 0x11111111UL, 0x3f811111UL, 0x55555555UL, 0x3fa55555UL, + 0x1a01a01aUL, 0xbf2a01a0UL, 0x16c16c17UL, 0xbf56c16cUL, 0xa556c734UL, + 0x3ec71de3UL, 0x1a01a01aUL, 0x3efa01a0UL, 0x1a600000UL, 0x3d90b461UL, + 0x1a600000UL, 0x3d90b461UL, 0x54400000UL, 0x3fb921fbUL, 0x00000000UL, + 0x00000000UL, 0x2e037073UL, 0x3b63198aUL, 0x00000000UL, 0x00000000UL, + 0x6dc9c883UL, 0x40245f30UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x43380000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x43600000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x3c800000UL, 0x00000000UL, + 0x00000000UL, 0xffffffffUL, 0x3fefffffUL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x80000000UL, 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x3fe00000UL, + 0x00000000UL, 0x3fe00000UL +}; + +void MacroAssembler::fast_sin(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ebx, Register edx) { + + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, start; + assert_different_registers(eax, ebx, edx); + address static_const_table_sin = (address)_static_const_table_sin; + + bind(start); + subl(rsp, 120); + movl(Address(rsp, 56), ebx); + lea(ebx, ExternalAddress(static_const_table_sin)); + movsd(xmm0, Address(rsp, 128)); + pextrw(eax, xmm0, 3); + andl(eax, 32767); + subl(eax, 12336); + cmpl(eax, 4293); + jcc(Assembler::above, L_2TAG_PACKET_0_0_2); + movsd(xmm1, Address(ebx, 2160)); + mulsd(xmm1, xmm0); + movsd(xmm5, Address(ebx, 2272)); + movdqu(xmm4, Address(ebx, 2256)); + pand(xmm4, xmm0); + por(xmm5, xmm4); + movsd(xmm3, Address(ebx, 2128)); + movdqu(xmm2, Address(ebx, 2112)); + addpd(xmm1, xmm5); + cvttsd2sil(edx, xmm1); + cvtsi2sdl(xmm1, edx); + mulsd(xmm3, xmm1); + unpcklpd(xmm1, xmm1); + addl(edx, 1865216); + movdqu(xmm4, xmm0); + andl(edx, 63); + movdqu(xmm5, Address(ebx, 2096)); + lea(eax, Address(ebx, 0)); + shll(edx, 5); + addl(eax, edx); + mulpd(xmm2, xmm1); + subsd(xmm0, xmm3); + mulsd(xmm1, Address(ebx, 2144)); + subsd(xmm4, xmm3); + movsd(xmm7, Address(eax, 8)); + unpcklpd(xmm0, xmm0); + movapd(xmm3, xmm4); + subsd(xmm4, xmm2); + mulpd(xmm5, xmm0); + subpd(xmm0, xmm2); + movdqu(xmm6, Address(ebx, 2064)); + mulsd(xmm7, xmm4); + subsd(xmm3, xmm4); + mulpd(xmm5, xmm0); + mulpd(xmm0, xmm0); + subsd(xmm3, xmm2); + movdqu(xmm2, Address(eax, 0)); + subsd(xmm1, xmm3); + movsd(xmm3, Address(eax, 24)); + addsd(xmm2, xmm3); + subsd(xmm7, xmm2); + mulsd(xmm2, xmm4); + mulpd(xmm6, xmm0); + mulsd(xmm3, xmm4); + mulpd(xmm2, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm5, Address(ebx, 2080)); + mulsd(xmm4, Address(eax, 0)); + addpd(xmm6, Address(ebx, 2048)); + mulpd(xmm5, xmm0); + movapd(xmm0, xmm3); + addsd(xmm3, Address(eax, 8)); + mulpd(xmm1, xmm7); + movapd(xmm7, xmm4); + addsd(xmm4, xmm3); + addpd(xmm6, xmm5); + movsd(xmm5, Address(eax, 8)); + subsd(xmm5, xmm3); + subsd(xmm3, xmm4); + addsd(xmm1, Address(eax, 16)); + mulpd(xmm6, xmm2); + addsd(xmm5, xmm0); + addsd(xmm3, xmm7); + addsd(xmm1, xmm5); + addsd(xmm1, xmm3); + addsd(xmm1, xmm6); + unpckhpd(xmm6, xmm6); + addsd(xmm1, xmm6); + addsd(xmm4, xmm1); + movsd(Address(rsp, 0), xmm4); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_0_0_2); + jcc(Assembler::greater, L_2TAG_PACKET_2_0_2); + shrl(eax, 4); + cmpl(eax, 268434685); + jcc(Assembler::notEqual, L_2TAG_PACKET_3_0_2); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_3_0_2); + movsd(xmm3, Address(ebx, 2192)); + mulsd(xmm3, xmm0); + subsd(xmm3, xmm0); + mulsd(xmm3, Address(ebx, 2208)); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movl(eax, Address(rsp, 132)); + andl(eax, 2146435072); + cmpl(eax, 2146435072); + jcc(Assembler::equal, L_2TAG_PACKET_4_0_2); + subl(rsp, 32); + movsd(Address(rsp, 0), xmm0); + lea(eax, Address(rsp, 40)); + movl(Address(rsp, 8), eax); + movl(eax, 2); + movl(Address(rsp, 12), eax); + call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_sin_cos_huge()))); + addl(rsp, 32); + fld_d(Address(rsp, 16)); + jmp(L_2TAG_PACKET_1_0_2); + bind(L_2TAG_PACKET_4_0_2); + fld_d(Address(rsp, 128)); + fmul_d(Address(ebx, 2240)); + bind(L_2TAG_PACKET_1_0_2); + movl(ebx, Address(rsp, 56)); +} +#endif diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp new file mode 100644 index 00000000000..18fe151cd33 --- /dev/null +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86_tan.cpp @@ -0,0 +1,2144 @@ +/* +* Copyright (c) 2016, Intel Corporation. +* Intel Math Library (LIBM) Source Code +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +* +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +* or visit www.oracle.com if you need additional information or have any +* questions. +* +*/ + +#include "precompiled.hpp" +#include "asm/assembler.hpp" +#include "asm/assembler.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "macroAssembler_x86.hpp" + +#ifdef _MSC_VER +#define ALIGNED_(x) __declspec(align(x)) +#else +#define ALIGNED_(x) __attribute__ ((aligned(x))) +#endif + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - TAN() +// --------------------- +// +// Polynomials coefficients and other constants. +// +// Note that in this algorithm, there is a different polynomial for +// each breakpoint, so there are 32 sets of polynomial coefficients +// as well as 32 instances of the other constants. +// +// The polynomial coefficients and constants are offset from the start +// of the main block as follows: +// +// 0: c8 | c0 +// 16: c9 | c1 +// 32: c10 | c2 +// 48: c11 | c3 +// 64: c12 | c4 +// 80: c13 | c5 +// 96: c14 | c6 +// 112: c15 | c7 +// 128: T_hi +// 136: T_lo +// 144: Sigma +// 152: T_hl +// 160: Tau +// 168: Mask +// 176: (end of block) +// +// The total table size is therefore 5632 bytes. +// +// Note that c0 and c1 are always zero. We could try storing +// other constants here, and just loading the low part of the +// SIMD register in these cases, after ensuring the high part +// is zero. +// +// The higher terms of the polynomial are computed in the *low* +// part of the SIMD register. This is so we can overlap the +// multiplication by r^8 and the unpacking of the other part. +// +// The constants are: +// T_hi + T_lo = accurate constant term in power series +// Sigma + T_hl = accurate coefficient of r in power series (Sigma=1 bit) +// Tau = multiplier for the reciprocal, always -1 or 0 +// +// The basic reconstruction formula using these constants is: +// +// High = tau * recip_hi + t_hi +// Med = (sgn * r + t_hl * r)_hi +// Low = (sgn * r + t_hl * r)_lo + +// tau * recip_lo + T_lo + (T_hl + sigma) * c + pol +// +// where pol = c0 + c1 * r + c2 * r^2 + ... + c15 * r^15 +// +// (c0 = c1 = 0, but using them keeps SIMD regularity) +// +// We then do a compensated sum High + Med, add the low parts together +// and then do the final sum. +// +// Here recip_hi + recip_lo is an accurate reciprocal of the remainder +// modulo pi/2 +// +// Special cases: +// tan(NaN) = quiet NaN, and raise invalid exception +// tan(INF) = NaN and raise invalid exception +// tan(+/-0) = +/-0 +// +/******************************************************************************/ + +#ifdef _LP64 +// The 64 bit code is at most SSE2 compliant +ALIGNED_(16) juint _ONEHALF_tan[] = +{ + 0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL +}; + +ALIGNED_(16) juint _MUL16[] = +{ + 0x00000000UL, 0x40300000UL, 0x00000000UL, 0x3ff00000UL +}; + +ALIGNED_(16) juint _sign_mask_tan[] = +{ + 0x00000000UL, 0x80000000UL, 0x00000000UL, 0x80000000UL +}; + +ALIGNED_(16) juint _PI32INV_tan[] = +{ + 0x6dc9c883UL, 0x3fe45f30UL, 0x6dc9c883UL, 0x40245f30UL +}; + +ALIGNED_(16) juint _P_1_tan[] = +{ + 0x54444000UL, 0x3fb921fbUL, 0x54440000UL, 0x3fb921fbUL +}; + +ALIGNED_(16) juint _P_2_tan[] = +{ + 0x67674000UL, 0xbd32e7b9UL, 0x4c4c0000UL, 0x3d468c23UL +}; + +ALIGNED_(16) juint _P_3_tan[] = +{ + 0x3707344aUL, 0x3aa8a2e0UL, 0x03707345UL, 0x3ae98a2eUL +}; + +ALIGNED_(16) juint _Ctable_tan[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x882c10faUL, + 0x3f9664f4UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x55e6c23dUL, 0x3f8226e3UL, 0x55555555UL, + 0x3fd55555UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x0e157de0UL, 0x3f6d6d3dUL, 0x11111111UL, 0x3fc11111UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x452b75e3UL, 0x3f57da36UL, + 0x1ba1ba1cUL, 0x3faba1baUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x4e435f9bUL, + 0x3f953f83UL, 0x00000000UL, 0x00000000UL, 0x3c6e8e46UL, 0x3f9b74eaUL, + 0x00000000UL, 0x00000000UL, 0xda5b7511UL, 0x3f85ad63UL, 0xdc230b9bUL, + 0x3fb97558UL, 0x26cb3788UL, 0x3f881308UL, 0x76fc4985UL, 0x3fd62ac9UL, + 0x77bb08baUL, 0x3f757c85UL, 0xb6247521UL, 0x3fb1381eUL, 0x5922170cUL, + 0x3f754e95UL, 0x8746482dUL, 0x3fc27f83UL, 0x11055b30UL, 0x3f64e391UL, + 0x3e666320UL, 0x3fa3e609UL, 0x0de9dae3UL, 0x3f6301dfUL, 0x1f1dca06UL, + 0x3fafa8aeUL, 0x8c5b2da2UL, 0x3fb936bbUL, 0x4e88f7a5UL, 0x3c587d05UL, + 0x00000000UL, 0x3ff00000UL, 0xa8935dd9UL, 0x3f83dde2UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x5a279ea3UL, 0x3faa3407UL, + 0x00000000UL, 0x00000000UL, 0x432d65faUL, 0x3fa70153UL, 0x00000000UL, + 0x00000000UL, 0x891a4602UL, 0x3f9d03efUL, 0xd62ca5f8UL, 0x3fca77d9UL, + 0xb35f4628UL, 0x3f97a265UL, 0x433258faUL, 0x3fd8cf51UL, 0xb58fd909UL, + 0x3f8f88e3UL, 0x01771ceaUL, 0x3fc2b154UL, 0xf3562f8eUL, 0x3f888f57UL, + 0xc028a723UL, 0x3fc7370fUL, 0x20b7f9f0UL, 0x3f80f44cUL, 0x214368e9UL, + 0x3fb6dfaaUL, 0x28891863UL, 0x3f79b4b6UL, 0x172dbbf0UL, 0x3fb6cb8eUL, + 0xe0553158UL, 0x3fc975f5UL, 0x593fe814UL, 0x3c2ef5d3UL, 0x00000000UL, + 0x3ff00000UL, 0x03dec550UL, 0x3fa44203UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x9314533eUL, 0x3fbb8ec5UL, 0x00000000UL, + 0x00000000UL, 0x09aa36d0UL, 0x3fb6d3f4UL, 0x00000000UL, 0x00000000UL, + 0xdcb427fdUL, 0x3fb13950UL, 0xd87ab0bbUL, 0x3fd5335eUL, 0xce0ae8a5UL, + 0x3fabb382UL, 0x79143126UL, 0x3fddba41UL, 0x5f2b28d4UL, 0x3fa552f1UL, + 0x59f21a6dUL, 0x3fd015abUL, 0x22c27d95UL, 0x3fa0e984UL, 0xe19fc6aaUL, + 0x3fd0576cUL, 0x8f2c2950UL, 0x3f9a4898UL, 0xc0b3f22cUL, 0x3fc59462UL, + 0x1883a4b8UL, 0x3f94b61cUL, 0x3f838640UL, 0x3fc30eb8UL, 0x355c63dcUL, + 0x3fd36a08UL, 0x1dce993dUL, 0xbc6d704dUL, 0x00000000UL, 0x3ff00000UL, + 0x2b82ab63UL, 0x3fb78e92UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x56f37042UL, 0x3fccfc56UL, 0x00000000UL, 0x00000000UL, + 0xaa563951UL, 0x3fc90125UL, 0x00000000UL, 0x00000000UL, 0x3d0e7c5dUL, + 0x3fc50533UL, 0x9bed9b2eUL, 0x3fdf0ed9UL, 0x5fe7c47cUL, 0x3fc1f250UL, + 0x96c125e5UL, 0x3fe2edd9UL, 0x5a02bbd8UL, 0x3fbe5c71UL, 0x86362c20UL, + 0x3fda08b7UL, 0x4b4435edUL, 0x3fb9d342UL, 0x4b494091UL, 0x3fd911bdUL, + 0xb56658beUL, 0x3fb5e4c7UL, 0x93a2fd76UL, 0x3fd3c092UL, 0xda271794UL, + 0x3fb29910UL, 0x3303df2bUL, 0x3fd189beUL, 0x99fcef32UL, 0x3fda8279UL, + 0xb68c1467UL, 0x3c708b2fUL, 0x00000000UL, 0x3ff00000UL, 0x980c4337UL, + 0x3fc5f619UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0xcc03e501UL, 0x3fdff10fUL, 0x00000000UL, 0x00000000UL, 0x44a4e845UL, + 0x3fddb63bUL, 0x00000000UL, 0x00000000UL, 0x3768ad9fUL, 0x3fdb72a4UL, + 0x3dd01ccaUL, 0x3fe5fdb9UL, 0xa61d2811UL, 0x3fd972b2UL, 0x5645ad0bUL, + 0x3fe977f9UL, 0xd013b3abUL, 0x3fd78ca3UL, 0xbf0bf914UL, 0x3fe4f192UL, + 0x4d53e730UL, 0x3fd5d060UL, 0x3f8b9000UL, 0x3fe49933UL, 0xe2b82f08UL, + 0x3fd4322aUL, 0x5936a835UL, 0x3fe27ae1UL, 0xb1c61c9bUL, 0x3fd2b3fbUL, + 0xef478605UL, 0x3fe1659eUL, 0x190834ecUL, 0x3fe11ab7UL, 0xcdb625eaUL, + 0xbc8e564bUL, 0x00000000UL, 0x3ff00000UL, 0xb07217e3UL, 0x3fd248f1UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x2b2c49d0UL, + 0x3ff2de9cUL, 0x00000000UL, 0x00000000UL, 0x2655bc98UL, 0x3ff33e58UL, + 0x00000000UL, 0x00000000UL, 0xff691fa2UL, 0x3ff3972eUL, 0xe93463bdUL, + 0x3feeed87UL, 0x070e10a0UL, 0x3ff3f5b2UL, 0xf4d790a4UL, 0x3ff20c10UL, + 0xa04e8ea3UL, 0x3ff4541aUL, 0x386accd3UL, 0x3ff1369eUL, 0x222a66ddUL, + 0x3ff4b521UL, 0x22a9777eUL, 0x3ff20817UL, 0x52a04a6eUL, 0x3ff5178fUL, + 0xddaa0031UL, 0x3ff22137UL, 0x4447d47cUL, 0x3ff57c01UL, 0x1e9c7f1dUL, + 0x3ff29311UL, 0x2ab7f990UL, 0x3fe561b8UL, 0x209c7df1UL, 0x3c87a8c5UL, + 0x00000000UL, 0x3ff00000UL, 0x4170bcc6UL, 0x3fdc92d8UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xc7ab4d5aUL, 0x40085e24UL, + 0x00000000UL, 0x00000000UL, 0xe93ea75dUL, 0x400b963dUL, 0x00000000UL, + 0x00000000UL, 0x94a7f25aUL, 0x400f37e2UL, 0x4b6261cbUL, 0x3ff5f984UL, + 0x5a9dd812UL, 0x4011aab0UL, 0x74c30018UL, 0x3ffaf5a5UL, 0x7f2ce8e3UL, + 0x4013fe8bUL, 0xfe8e54faUL, 0x3ffd7334UL, 0x670d618dUL, 0x4016a10cUL, + 0x4db97058UL, 0x4000e012UL, 0x24df44ddUL, 0x40199c5fUL, 0x697d6eceUL, + 0x4003006eUL, 0x83298b82UL, 0x401cfc4dUL, 0x19d490d6UL, 0x40058c19UL, + 0x2ae42850UL, 0x3fea4300UL, 0x118e20e6UL, 0xbc7a6db8UL, 0x00000000UL, + 0x40000000UL, 0xe33345b8UL, 0xbfd4e526UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x65965966UL, 0x40219659UL, 0x00000000UL, + 0x00000000UL, 0x882c10faUL, 0x402664f4UL, 0x00000000UL, 0x00000000UL, + 0x83cd3723UL, 0x402c8342UL, 0x00000000UL, 0x40000000UL, 0x55e6c23dUL, + 0x403226e3UL, 0x55555555UL, 0x40055555UL, 0x34451939UL, 0x40371c96UL, + 0xaaaaaaabUL, 0x400aaaaaUL, 0x0e157de0UL, 0x403d6d3dUL, 0x11111111UL, + 0x40111111UL, 0xa738201fUL, 0x4042bbceUL, 0x05b05b06UL, 0x4015b05bUL, + 0x452b75e3UL, 0x4047da36UL, 0x1ba1ba1cUL, 0x401ba1baUL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x40000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x4f48b8d3UL, 0xbf33eaf9UL, 0x00000000UL, 0x00000000UL, + 0x0cf7586fUL, 0x3f20b8eaUL, 0x00000000UL, 0x00000000UL, 0xd0258911UL, + 0xbf0abaf3UL, 0x23e49fe9UL, 0xbfab5a8cUL, 0x2d53222eUL, 0x3ef60d15UL, + 0x21169451UL, 0x3fa172b2UL, 0xbb254dbcUL, 0xbee1d3b5UL, 0xdbf93b8eUL, + 0xbf84c7dbUL, 0x05b4630bUL, 0x3ecd3364UL, 0xee9aada7UL, 0x3f743924UL, + 0x794a8297UL, 0xbeb7b7b9UL, 0xe015f797UL, 0xbf5d41f5UL, 0xe41a4a56UL, + 0x3ea35dfbUL, 0xe4c2a251UL, 0x3f49a2abUL, 0x5af9e000UL, 0xbfce49ceUL, + 0x8c743719UL, 0x3d1eb860UL, 0x00000000UL, 0x00000000UL, 0x1b4863cfUL, + 0x3fd78294UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, + 0x535ad890UL, 0xbf2b9320UL, 0x00000000UL, 0x00000000UL, 0x018fdf1fUL, + 0x3f16d61dUL, 0x00000000UL, 0x00000000UL, 0x0359f1beUL, 0xbf0139e4UL, + 0xa4317c6dUL, 0xbfa67e17UL, 0x82672d0fUL, 0x3eebb405UL, 0x2f1b621eUL, + 0x3f9f455bUL, 0x51ccf238UL, 0xbed55317UL, 0xf437b9acUL, 0xbf804beeUL, + 0xc791a2b5UL, 0x3ec0e993UL, 0x919a1db2UL, 0x3f7080c2UL, 0x336a5b0eUL, + 0xbeaa48a2UL, 0x0a268358UL, 0xbf55a443UL, 0xdfd978e4UL, 0x3e94b61fUL, + 0xd7767a58UL, 0x3f431806UL, 0x2aea0000UL, 0xbfc9bbe8UL, 0x7723ea61UL, + 0xbd3a2369UL, 0x00000000UL, 0x00000000UL, 0xdf7796ffUL, 0x3fd6e642UL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0xb9ff07ceUL, + 0xbf231c78UL, 0x00000000UL, 0x00000000UL, 0xa5517182UL, 0x3f0ff0e0UL, + 0x00000000UL, 0x00000000UL, 0x790b4cbcUL, 0xbef66191UL, 0x848a46c6UL, + 0xbfa21ac0UL, 0xb16435faUL, 0x3ee1d3ecUL, 0x2a1aa832UL, 0x3f9c71eaUL, + 0xfdd299efUL, 0xbec9dd1aUL, 0x3f8dbaafUL, 0xbf793363UL, 0x309fc6eaUL, + 0x3eb415d6UL, 0xbee60471UL, 0x3f6b83baUL, 0x94a0a697UL, 0xbe9dae11UL, + 0x3e5c67b3UL, 0xbf4fd07bUL, 0x9a8f3e3eUL, 0x3e86bd75UL, 0xa4beb7a4UL, + 0x3f3d1eb1UL, 0x29cfc000UL, 0xbfc549ceUL, 0xbf159358UL, 0xbd397b33UL, + 0x00000000UL, 0x00000000UL, 0x871fee6cUL, 0x3fd666f0UL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x7d98a556UL, 0xbf1a3958UL, + 0x00000000UL, 0x00000000UL, 0x9d88dc01UL, 0x3f0704c2UL, 0x00000000UL, + 0x00000000UL, 0x73742a2bUL, 0xbeed054aUL, 0x58844587UL, 0xbf9c2a13UL, + 0x55688a79UL, 0x3ed7a326UL, 0xee33f1d6UL, 0x3f9a48f4UL, 0xa8dc9888UL, + 0xbebf8939UL, 0xaad4b5b8UL, 0xbf72f746UL, 0x9102efa1UL, 0x3ea88f82UL, + 0xdabc29cfUL, 0x3f678228UL, 0x9289afb8UL, 0xbe90f456UL, 0x741fb4edUL, + 0xbf46f3a3UL, 0xa97f6663UL, 0x3e79b4bfUL, 0xca89ff3fUL, 0x3f36db70UL, + 0xa8a2a000UL, 0xbfc0ee13UL, 0x3da24be1UL, 0xbd338b9fUL, 0x00000000UL, + 0x00000000UL, 0x11cd6c69UL, 0x3fd601fdUL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0xfffffff8UL, 0x1a154b97UL, 0xbf116b01UL, 0x00000000UL, + 0x00000000UL, 0x2d427630UL, 0x3f0147bfUL, 0x00000000UL, 0x00000000UL, + 0xb93820c8UL, 0xbee264d4UL, 0xbb6cbb18UL, 0xbf94ab8cUL, 0x888d4d92UL, + 0x3ed0568bUL, 0x60730f7cUL, 0x3f98b19bUL, 0xe4b1fb11UL, 0xbeb2f950UL, + 0x22cf9f74UL, 0xbf6b21cdUL, 0x4a3ff0a6UL, 0x3e9f499eUL, 0xfd2b83ceUL, + 0x3f64aad7UL, 0x637b73afUL, 0xbe83487cUL, 0xe522591aUL, 0xbf3fc092UL, + 0xa158e8bcUL, 0x3e6e3aaeUL, 0xe5e82ffaUL, 0x3f329d2fUL, 0xd636a000UL, + 0xbfb9477fUL, 0xc2c2d2bcUL, 0xbd135ef9UL, 0x00000000UL, 0x00000000UL, + 0xf2fdb123UL, 0x3fd5b566UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, + 0xfffffff8UL, 0xc41acb64UL, 0xbf05448dUL, 0x00000000UL, 0x00000000UL, + 0xdbb03d6fUL, 0x3efb7ad2UL, 0x00000000UL, 0x00000000UL, 0x9e42962dUL, + 0xbed5aea5UL, 0x2579f8efUL, 0xbf8b2398UL, 0x288a1ed9UL, 0x3ec81441UL, + 0xb0198dc5UL, 0x3f979a3aUL, 0x2fdfe253UL, 0xbea57cd3UL, 0x5766336fUL, + 0xbf617caaUL, 0x600944c3UL, 0x3e954ed6UL, 0xa4e0aaf8UL, 0x3f62c646UL, + 0x6b8fb29cUL, 0xbe74e3a3UL, 0xdc4c0409UL, 0xbf33f952UL, 0x9bffe365UL, + 0x3e6301ecUL, 0xb8869e44UL, 0x3f2fc566UL, 0xe1e04000UL, 0xbfb0cc62UL, + 0x016b907fUL, 0xbd119cbcUL, 0x00000000UL, 0x00000000UL, 0xe6b9d8faUL, + 0x3fd57fb3UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, + 0x5daf22a6UL, 0xbef429d7UL, 0x00000000UL, 0x00000000UL, 0x06bca545UL, + 0x3ef7a27dUL, 0x00000000UL, 0x00000000UL, 0x7211c19aUL, 0xbec41c3eUL, + 0x956ed53eUL, 0xbf7ae3f4UL, 0xee750e72UL, 0x3ec3901bUL, 0x91d443f5UL, + 0x3f96f713UL, 0x36661e6cUL, 0xbe936e09UL, 0x506f9381UL, 0xbf5122e8UL, + 0xcb6dd43fUL, 0x3e9041b9UL, 0x6698b2ffUL, 0x3f61b0c7UL, 0x576bf12bUL, + 0xbe625a8aUL, 0xe5a0e9dcUL, 0xbf23499dUL, 0x110384ddUL, 0x3e5b1c2cUL, + 0x68d43db6UL, 0x3f2cb899UL, 0x6ecac000UL, 0xbfa0c414UL, 0xcd7dd58cUL, + 0x3d13500fUL, 0x00000000UL, 0x00000000UL, 0x85a2c8fbUL, 0x3fd55fe0UL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x2bf70ebeUL, 0x3ef66a8fUL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0xd644267fUL, 0x3ec22805UL, 0x16c16c17UL, 0x3f96c16cUL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xc4e09162UL, + 0x3e8d6db2UL, 0xbc011567UL, 0x3f61566aUL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x1f79955cUL, 0x3e57da4eUL, 0x9334ef0bUL, + 0x3f2bbd77UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x55555555UL, 0x3fd55555UL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x5daf22a6UL, 0x3ef429d7UL, + 0x00000000UL, 0x00000000UL, 0x06bca545UL, 0x3ef7a27dUL, 0x00000000UL, + 0x00000000UL, 0x7211c19aUL, 0x3ec41c3eUL, 0x956ed53eUL, 0x3f7ae3f4UL, + 0xee750e72UL, 0x3ec3901bUL, 0x91d443f5UL, 0x3f96f713UL, 0x36661e6cUL, + 0x3e936e09UL, 0x506f9381UL, 0x3f5122e8UL, 0xcb6dd43fUL, 0x3e9041b9UL, + 0x6698b2ffUL, 0x3f61b0c7UL, 0x576bf12bUL, 0x3e625a8aUL, 0xe5a0e9dcUL, + 0x3f23499dUL, 0x110384ddUL, 0x3e5b1c2cUL, 0x68d43db6UL, 0x3f2cb899UL, + 0x6ecac000UL, 0x3fa0c414UL, 0xcd7dd58cUL, 0xbd13500fUL, 0x00000000UL, + 0x00000000UL, 0x85a2c8fbUL, 0x3fd55fe0UL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0xfffffff8UL, 0xc41acb64UL, 0x3f05448dUL, 0x00000000UL, + 0x00000000UL, 0xdbb03d6fUL, 0x3efb7ad2UL, 0x00000000UL, 0x00000000UL, + 0x9e42962dUL, 0x3ed5aea5UL, 0x2579f8efUL, 0x3f8b2398UL, 0x288a1ed9UL, + 0x3ec81441UL, 0xb0198dc5UL, 0x3f979a3aUL, 0x2fdfe253UL, 0x3ea57cd3UL, + 0x5766336fUL, 0x3f617caaUL, 0x600944c3UL, 0x3e954ed6UL, 0xa4e0aaf8UL, + 0x3f62c646UL, 0x6b8fb29cUL, 0x3e74e3a3UL, 0xdc4c0409UL, 0x3f33f952UL, + 0x9bffe365UL, 0x3e6301ecUL, 0xb8869e44UL, 0x3f2fc566UL, 0xe1e04000UL, + 0x3fb0cc62UL, 0x016b907fUL, 0x3d119cbcUL, 0x00000000UL, 0x00000000UL, + 0xe6b9d8faUL, 0x3fd57fb3UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, + 0xfffffff8UL, 0x1a154b97UL, 0x3f116b01UL, 0x00000000UL, 0x00000000UL, + 0x2d427630UL, 0x3f0147bfUL, 0x00000000UL, 0x00000000UL, 0xb93820c8UL, + 0x3ee264d4UL, 0xbb6cbb18UL, 0x3f94ab8cUL, 0x888d4d92UL, 0x3ed0568bUL, + 0x60730f7cUL, 0x3f98b19bUL, 0xe4b1fb11UL, 0x3eb2f950UL, 0x22cf9f74UL, + 0x3f6b21cdUL, 0x4a3ff0a6UL, 0x3e9f499eUL, 0xfd2b83ceUL, 0x3f64aad7UL, + 0x637b73afUL, 0x3e83487cUL, 0xe522591aUL, 0x3f3fc092UL, 0xa158e8bcUL, + 0x3e6e3aaeUL, 0xe5e82ffaUL, 0x3f329d2fUL, 0xd636a000UL, 0x3fb9477fUL, + 0xc2c2d2bcUL, 0x3d135ef9UL, 0x00000000UL, 0x00000000UL, 0xf2fdb123UL, + 0x3fd5b566UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, + 0x7d98a556UL, 0x3f1a3958UL, 0x00000000UL, 0x00000000UL, 0x9d88dc01UL, + 0x3f0704c2UL, 0x00000000UL, 0x00000000UL, 0x73742a2bUL, 0x3eed054aUL, + 0x58844587UL, 0x3f9c2a13UL, 0x55688a79UL, 0x3ed7a326UL, 0xee33f1d6UL, + 0x3f9a48f4UL, 0xa8dc9888UL, 0x3ebf8939UL, 0xaad4b5b8UL, 0x3f72f746UL, + 0x9102efa1UL, 0x3ea88f82UL, 0xdabc29cfUL, 0x3f678228UL, 0x9289afb8UL, + 0x3e90f456UL, 0x741fb4edUL, 0x3f46f3a3UL, 0xa97f6663UL, 0x3e79b4bfUL, + 0xca89ff3fUL, 0x3f36db70UL, 0xa8a2a000UL, 0x3fc0ee13UL, 0x3da24be1UL, + 0x3d338b9fUL, 0x00000000UL, 0x00000000UL, 0x11cd6c69UL, 0x3fd601fdUL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0xb9ff07ceUL, + 0x3f231c78UL, 0x00000000UL, 0x00000000UL, 0xa5517182UL, 0x3f0ff0e0UL, + 0x00000000UL, 0x00000000UL, 0x790b4cbcUL, 0x3ef66191UL, 0x848a46c6UL, + 0x3fa21ac0UL, 0xb16435faUL, 0x3ee1d3ecUL, 0x2a1aa832UL, 0x3f9c71eaUL, + 0xfdd299efUL, 0x3ec9dd1aUL, 0x3f8dbaafUL, 0x3f793363UL, 0x309fc6eaUL, + 0x3eb415d6UL, 0xbee60471UL, 0x3f6b83baUL, 0x94a0a697UL, 0x3e9dae11UL, + 0x3e5c67b3UL, 0x3f4fd07bUL, 0x9a8f3e3eUL, 0x3e86bd75UL, 0xa4beb7a4UL, + 0x3f3d1eb1UL, 0x29cfc000UL, 0x3fc549ceUL, 0xbf159358UL, 0x3d397b33UL, + 0x00000000UL, 0x00000000UL, 0x871fee6cUL, 0x3fd666f0UL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x535ad890UL, 0x3f2b9320UL, + 0x00000000UL, 0x00000000UL, 0x018fdf1fUL, 0x3f16d61dUL, 0x00000000UL, + 0x00000000UL, 0x0359f1beUL, 0x3f0139e4UL, 0xa4317c6dUL, 0x3fa67e17UL, + 0x82672d0fUL, 0x3eebb405UL, 0x2f1b621eUL, 0x3f9f455bUL, 0x51ccf238UL, + 0x3ed55317UL, 0xf437b9acUL, 0x3f804beeUL, 0xc791a2b5UL, 0x3ec0e993UL, + 0x919a1db2UL, 0x3f7080c2UL, 0x336a5b0eUL, 0x3eaa48a2UL, 0x0a268358UL, + 0x3f55a443UL, 0xdfd978e4UL, 0x3e94b61fUL, 0xd7767a58UL, 0x3f431806UL, + 0x2aea0000UL, 0x3fc9bbe8UL, 0x7723ea61UL, 0x3d3a2369UL, 0x00000000UL, + 0x00000000UL, 0xdf7796ffUL, 0x3fd6e642UL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0xfffffff8UL, 0x4f48b8d3UL, 0x3f33eaf9UL, 0x00000000UL, + 0x00000000UL, 0x0cf7586fUL, 0x3f20b8eaUL, 0x00000000UL, 0x00000000UL, + 0xd0258911UL, 0x3f0abaf3UL, 0x23e49fe9UL, 0x3fab5a8cUL, 0x2d53222eUL, + 0x3ef60d15UL, 0x21169451UL, 0x3fa172b2UL, 0xbb254dbcUL, 0x3ee1d3b5UL, + 0xdbf93b8eUL, 0x3f84c7dbUL, 0x05b4630bUL, 0x3ecd3364UL, 0xee9aada7UL, + 0x3f743924UL, 0x794a8297UL, 0x3eb7b7b9UL, 0xe015f797UL, 0x3f5d41f5UL, + 0xe41a4a56UL, 0x3ea35dfbUL, 0xe4c2a251UL, 0x3f49a2abUL, 0x5af9e000UL, + 0x3fce49ceUL, 0x8c743719UL, 0xbd1eb860UL, 0x00000000UL, 0x00000000UL, + 0x1b4863cfUL, 0x3fd78294UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, + 0xfffffff8UL, 0x65965966UL, 0xc0219659UL, 0x00000000UL, 0x00000000UL, + 0x882c10faUL, 0x402664f4UL, 0x00000000UL, 0x00000000UL, 0x83cd3723UL, + 0xc02c8342UL, 0x00000000UL, 0xc0000000UL, 0x55e6c23dUL, 0x403226e3UL, + 0x55555555UL, 0x40055555UL, 0x34451939UL, 0xc0371c96UL, 0xaaaaaaabUL, + 0xc00aaaaaUL, 0x0e157de0UL, 0x403d6d3dUL, 0x11111111UL, 0x40111111UL, + 0xa738201fUL, 0xc042bbceUL, 0x05b05b06UL, 0xc015b05bUL, 0x452b75e3UL, + 0x4047da36UL, 0x1ba1ba1cUL, 0x401ba1baUL, 0x00000000UL, 0xbff00000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x40000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0xc7ab4d5aUL, 0xc0085e24UL, 0x00000000UL, 0x00000000UL, 0xe93ea75dUL, + 0x400b963dUL, 0x00000000UL, 0x00000000UL, 0x94a7f25aUL, 0xc00f37e2UL, + 0x4b6261cbUL, 0xbff5f984UL, 0x5a9dd812UL, 0x4011aab0UL, 0x74c30018UL, + 0x3ffaf5a5UL, 0x7f2ce8e3UL, 0xc013fe8bUL, 0xfe8e54faUL, 0xbffd7334UL, + 0x670d618dUL, 0x4016a10cUL, 0x4db97058UL, 0x4000e012UL, 0x24df44ddUL, + 0xc0199c5fUL, 0x697d6eceUL, 0xc003006eUL, 0x83298b82UL, 0x401cfc4dUL, + 0x19d490d6UL, 0x40058c19UL, 0x2ae42850UL, 0xbfea4300UL, 0x118e20e6UL, + 0x3c7a6db8UL, 0x00000000UL, 0x40000000UL, 0xe33345b8UL, 0xbfd4e526UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x2b2c49d0UL, + 0xbff2de9cUL, 0x00000000UL, 0x00000000UL, 0x2655bc98UL, 0x3ff33e58UL, + 0x00000000UL, 0x00000000UL, 0xff691fa2UL, 0xbff3972eUL, 0xe93463bdUL, + 0xbfeeed87UL, 0x070e10a0UL, 0x3ff3f5b2UL, 0xf4d790a4UL, 0x3ff20c10UL, + 0xa04e8ea3UL, 0xbff4541aUL, 0x386accd3UL, 0xbff1369eUL, 0x222a66ddUL, + 0x3ff4b521UL, 0x22a9777eUL, 0x3ff20817UL, 0x52a04a6eUL, 0xbff5178fUL, + 0xddaa0031UL, 0xbff22137UL, 0x4447d47cUL, 0x3ff57c01UL, 0x1e9c7f1dUL, + 0x3ff29311UL, 0x2ab7f990UL, 0xbfe561b8UL, 0x209c7df1UL, 0xbc87a8c5UL, + 0x00000000UL, 0x3ff00000UL, 0x4170bcc6UL, 0x3fdc92d8UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xcc03e501UL, 0xbfdff10fUL, + 0x00000000UL, 0x00000000UL, 0x44a4e845UL, 0x3fddb63bUL, 0x00000000UL, + 0x00000000UL, 0x3768ad9fUL, 0xbfdb72a4UL, 0x3dd01ccaUL, 0xbfe5fdb9UL, + 0xa61d2811UL, 0x3fd972b2UL, 0x5645ad0bUL, 0x3fe977f9UL, 0xd013b3abUL, + 0xbfd78ca3UL, 0xbf0bf914UL, 0xbfe4f192UL, 0x4d53e730UL, 0x3fd5d060UL, + 0x3f8b9000UL, 0x3fe49933UL, 0xe2b82f08UL, 0xbfd4322aUL, 0x5936a835UL, + 0xbfe27ae1UL, 0xb1c61c9bUL, 0x3fd2b3fbUL, 0xef478605UL, 0x3fe1659eUL, + 0x190834ecUL, 0xbfe11ab7UL, 0xcdb625eaUL, 0x3c8e564bUL, 0x00000000UL, + 0x3ff00000UL, 0xb07217e3UL, 0x3fd248f1UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x56f37042UL, 0xbfccfc56UL, 0x00000000UL, + 0x00000000UL, 0xaa563951UL, 0x3fc90125UL, 0x00000000UL, 0x00000000UL, + 0x3d0e7c5dUL, 0xbfc50533UL, 0x9bed9b2eUL, 0xbfdf0ed9UL, 0x5fe7c47cUL, + 0x3fc1f250UL, 0x96c125e5UL, 0x3fe2edd9UL, 0x5a02bbd8UL, 0xbfbe5c71UL, + 0x86362c20UL, 0xbfda08b7UL, 0x4b4435edUL, 0x3fb9d342UL, 0x4b494091UL, + 0x3fd911bdUL, 0xb56658beUL, 0xbfb5e4c7UL, 0x93a2fd76UL, 0xbfd3c092UL, + 0xda271794UL, 0x3fb29910UL, 0x3303df2bUL, 0x3fd189beUL, 0x99fcef32UL, + 0xbfda8279UL, 0xb68c1467UL, 0xbc708b2fUL, 0x00000000UL, 0x3ff00000UL, + 0x980c4337UL, 0x3fc5f619UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x9314533eUL, 0xbfbb8ec5UL, 0x00000000UL, 0x00000000UL, + 0x09aa36d0UL, 0x3fb6d3f4UL, 0x00000000UL, 0x00000000UL, 0xdcb427fdUL, + 0xbfb13950UL, 0xd87ab0bbUL, 0xbfd5335eUL, 0xce0ae8a5UL, 0x3fabb382UL, + 0x79143126UL, 0x3fddba41UL, 0x5f2b28d4UL, 0xbfa552f1UL, 0x59f21a6dUL, + 0xbfd015abUL, 0x22c27d95UL, 0x3fa0e984UL, 0xe19fc6aaUL, 0x3fd0576cUL, + 0x8f2c2950UL, 0xbf9a4898UL, 0xc0b3f22cUL, 0xbfc59462UL, 0x1883a4b8UL, + 0x3f94b61cUL, 0x3f838640UL, 0x3fc30eb8UL, 0x355c63dcUL, 0xbfd36a08UL, + 0x1dce993dUL, 0x3c6d704dUL, 0x00000000UL, 0x3ff00000UL, 0x2b82ab63UL, + 0x3fb78e92UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x5a279ea3UL, 0xbfaa3407UL, 0x00000000UL, 0x00000000UL, 0x432d65faUL, + 0x3fa70153UL, 0x00000000UL, 0x00000000UL, 0x891a4602UL, 0xbf9d03efUL, + 0xd62ca5f8UL, 0xbfca77d9UL, 0xb35f4628UL, 0x3f97a265UL, 0x433258faUL, + 0x3fd8cf51UL, 0xb58fd909UL, 0xbf8f88e3UL, 0x01771ceaUL, 0xbfc2b154UL, + 0xf3562f8eUL, 0x3f888f57UL, 0xc028a723UL, 0x3fc7370fUL, 0x20b7f9f0UL, + 0xbf80f44cUL, 0x214368e9UL, 0xbfb6dfaaUL, 0x28891863UL, 0x3f79b4b6UL, + 0x172dbbf0UL, 0x3fb6cb8eUL, 0xe0553158UL, 0xbfc975f5UL, 0x593fe814UL, + 0xbc2ef5d3UL, 0x00000000UL, 0x3ff00000UL, 0x03dec550UL, 0x3fa44203UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x4e435f9bUL, + 0xbf953f83UL, 0x00000000UL, 0x00000000UL, 0x3c6e8e46UL, 0x3f9b74eaUL, + 0x00000000UL, 0x00000000UL, 0xda5b7511UL, 0xbf85ad63UL, 0xdc230b9bUL, + 0xbfb97558UL, 0x26cb3788UL, 0x3f881308UL, 0x76fc4985UL, 0x3fd62ac9UL, + 0x77bb08baUL, 0xbf757c85UL, 0xb6247521UL, 0xbfb1381eUL, 0x5922170cUL, + 0x3f754e95UL, 0x8746482dUL, 0x3fc27f83UL, 0x11055b30UL, 0xbf64e391UL, + 0x3e666320UL, 0xbfa3e609UL, 0x0de9dae3UL, 0x3f6301dfUL, 0x1f1dca06UL, + 0x3fafa8aeUL, 0x8c5b2da2UL, 0xbfb936bbUL, 0x4e88f7a5UL, 0xbc587d05UL, + 0x00000000UL, 0x3ff00000UL, 0xa8935dd9UL, 0x3f83dde2UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL +}; + +ALIGNED_(16) juint _MASK_35_tan[] = +{ + 0xfffc0000UL, 0xffffffffUL, 0x00000000UL, 0x00000000UL +}; + +ALIGNED_(16) juint _Q_11_tan[] = +{ + 0xb8fe4d77UL, 0x3f82609aUL +}; + +ALIGNED_(16) juint _Q_9_tan[] = +{ + 0xbf847a43UL, 0x3f9664a0UL +}; + +ALIGNED_(16) juint _Q_7_tan[] = +{ + 0x52c4c8abUL, 0x3faba1baUL +}; + +ALIGNED_(16) juint _Q_5_tan[] = +{ + 0x11092746UL, 0x3fc11111UL +}; + +ALIGNED_(16) juint _Q_3_tan[] = +{ + 0x55555612UL, 0x3fd55555UL +}; + +ALIGNED_(16) juint _PI_INV_TABLE_tan[] = +{ + 0x00000000UL, 0x00000000UL, 0xa2f9836eUL, 0x4e441529UL, 0xfc2757d1UL, + 0xf534ddc0UL, 0xdb629599UL, 0x3c439041UL, 0xfe5163abUL, 0xdebbc561UL, + 0xb7246e3aUL, 0x424dd2e0UL, 0x06492eeaUL, 0x09d1921cUL, 0xfe1deb1cUL, + 0xb129a73eUL, 0xe88235f5UL, 0x2ebb4484UL, 0xe99c7026UL, 0xb45f7e41UL, + 0x3991d639UL, 0x835339f4UL, 0x9c845f8bUL, 0xbdf9283bUL, 0x1ff897ffUL, + 0xde05980fUL, 0xef2f118bUL, 0x5a0a6d1fUL, 0x6d367ecfUL, 0x27cb09b7UL, + 0x4f463f66UL, 0x9e5fea2dUL, 0x7527bac7UL, 0xebe5f17bUL, 0x3d0739f7UL, + 0x8a5292eaUL, 0x6bfb5fb1UL, 0x1f8d5d08UL, 0x56033046UL, 0xfc7b6babUL, + 0xf0cfbc21UL +}; + +ALIGNED_(8) juint _PI_4_tan[] = +{ + 0x00000000UL, 0x3fe921fbUL, 0x4611a626UL, 0x3e85110bUL +}; + +ALIGNED_(8) juint _QQ_2_tan[] = +{ + 0x676733afUL, 0x3d32e7b9UL +}; + +ALIGNED_(8) juint _ONE_tan[] = +{ + 0x00000000UL, 0x3ff00000UL +}; + +ALIGNED_(8) juint _TWO_POW_55_tan[] = +{ + 0x00000000UL, 0x43600000UL +}; + +ALIGNED_(4) juint _TWO_POW_M55_tan[] = +{ + 0x00000000UL, 0x3c800000UL +}; + +ALIGNED_(4) juint _NEG_ZERO_tan[] = +{ + 0x00000000UL, 0x80000000UL +}; + +void MacroAssembler::fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register r8, Register r9, Register r10, Register r11) { + + Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1; + Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1; + Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1; + Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1, B1_2, B1_3, B1_4, B1_5, start; + + address ONEHALF = (address)_ONEHALF_tan; + address MUL16 = (address)_MUL16; + address sign_mask = (address)_sign_mask_tan; + address PI32INV = (address)_PI32INV_tan; + address P_1 = (address)_P_1_tan; + address P_2 = (address)_P_2_tan; + address P_3 = (address)_P_3_tan; + address Ctable = (address)_Ctable_tan; + address MASK_35 = (address)_MASK_35_tan; + address Q_11 = (address)_Q_11_tan; + address Q_9 = (address)_Q_9_tan; + address Q_7 = (address)_Q_7_tan; + address Q_5 = (address)_Q_5_tan; + address Q_3 = (address)_Q_3_tan; + address PI_INV_TABLE = (address)_PI_INV_TABLE_tan; + address PI_4 = (address)_PI_4_tan; + address QQ_2 = (address)_QQ_2_tan; + address ONE = (address)_ONE_tan; + address TWO_POW_55 = (address)_TWO_POW_55_tan; + address TWO_POW_M55 = (address)_TWO_POW_M55_tan; + address NEG_ZERO = (address)_NEG_ZERO_tan; + + bind(start); + push(rbx); + subq(rsp, 16); + movsd(Address(rsp, 8), xmm0); + + bind(B1_2); + pextrw(eax, xmm0, 3); + andl(eax, 32767); + subl(eax, 16314); + cmpl(eax, 270); + jcc(Assembler::above, L_2TAG_PACKET_0_0_1); + movdqu(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL + movdqu(xmm6, ExternalAddress(MUL16)); //0x00000000UL, 0x40300000UL, 0x00000000UL, 0x3ff00000UL + unpcklpd(xmm0, xmm0); + movdqu(xmm4, ExternalAddress(sign_mask)); //0x00000000UL, 0x80000000UL, 0x00000000UL, 0x80000000UL + andpd(xmm4, xmm0); + movdqu(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x3fe45f30UL, 0x6dc9c883UL, 0x40245f30UL + mulpd(xmm1, xmm0); + por(xmm5, xmm4); + addpd(xmm1, xmm5); + movdqu(xmm7, xmm1); + unpckhpd(xmm7, xmm7); + cvttsd2sil(edx, xmm7); + cvttpd2dq(xmm1, xmm1); + cvtdq2pd(xmm1, xmm1); + mulpd(xmm1, xmm6); + movdqu(xmm3, ExternalAddress(P_1)); //0x54444000UL, 0x3fb921fbUL, 0x54440000UL, 0x3fb921fbUL + movq(xmm5, ExternalAddress(QQ_2)); //0x676733afUL, 0x3d32e7b9UL + addq(rdx, 469248); + movdqu(xmm4, ExternalAddress(P_2)); //0x67674000UL, 0xbd32e7b9UL, 0x4c4c0000UL, 0x3d468c23UL + mulpd(xmm3, xmm1); + andq(rdx, 31); + mulsd(xmm5, xmm1); + movq(rcx, rdx); + mulpd(xmm4, xmm1); + shlq(rcx, 1); + subpd(xmm0, xmm3); + mulpd(xmm1, ExternalAddress(P_3)); //0x3707344aUL, 0x3aa8a2e0UL, 0x03707345UL, 0x3ae98a2eUL + addq(rdx, rcx); + shlq(rcx, 2); + addq(rdx, rcx); + addsd(xmm5, xmm0); + movdqu(xmm2, xmm0); + subpd(xmm0, xmm4); + movq(xmm6, ExternalAddress(ONE)); //0x00000000UL, 0x3ff00000UL + shlq(rdx, 4); + lea(rax, ExternalAddress(Ctable)); + andpd(xmm5, ExternalAddress(MASK_35)); //0xfffc0000UL, 0xffffffffUL, 0x00000000UL, 0x00000000UL + movdqu(xmm3, xmm0); + addq(rax, rdx); + subpd(xmm2, xmm0); + unpckhpd(xmm0, xmm0); + divsd(xmm6, xmm5); + subpd(xmm2, xmm4); + movdqu(xmm7, Address(rax, 16)); + subsd(xmm3, xmm5); + mulpd(xmm7, xmm0); + subpd(xmm2, xmm1); + movdqu(xmm1, Address(rax, 48)); + mulpd(xmm1, xmm0); + movdqu(xmm4, Address(rax, 96)); + mulpd(xmm4, xmm0); + addsd(xmm2, xmm3); + movdqu(xmm3, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm7, Address(rax, 0)); + addpd(xmm1, Address(rax, 32)); + mulpd(xmm1, xmm0); + addpd(xmm4, Address(rax, 80)); + addpd(xmm7, xmm1); + movdqu(xmm1, Address(rax, 112)); + mulpd(xmm1, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm4, xmm1); + movdqu(xmm1, Address(rax, 64)); + mulpd(xmm1, xmm0); + addpd(xmm7, xmm1); + movdqu(xmm1, xmm3); + mulpd(xmm3, xmm0); + mulsd(xmm0, xmm0); + mulpd(xmm1, Address(rax, 144)); + mulpd(xmm4, xmm3); + movdqu(xmm3, xmm1); + addpd(xmm7, xmm4); + movdqu(xmm4, xmm1); + mulsd(xmm0, xmm7); + unpckhpd(xmm7, xmm7); + addsd(xmm0, xmm7); + unpckhpd(xmm1, xmm1); + addsd(xmm3, xmm1); + subsd(xmm4, xmm3); + addsd(xmm1, xmm4); + movdqu(xmm4, xmm2); + movq(xmm7, Address(rax, 144)); + unpckhpd(xmm2, xmm2); + addsd(xmm7, Address(rax, 152)); + mulsd(xmm7, xmm2); + addsd(xmm7, Address(rax, 136)); + addsd(xmm7, xmm1); + addsd(xmm0, xmm7); + movq(xmm7, ExternalAddress(ONE)); //0x00000000UL, 0x3ff00000UL + mulsd(xmm4, xmm6); + movq(xmm2, Address(rax, 168)); + andpd(xmm2, xmm6); + mulsd(xmm5, xmm2); + mulsd(xmm6, Address(rax, 160)); + subsd(xmm7, xmm5); + subsd(xmm2, Address(rax, 128)); + subsd(xmm7, xmm4); + mulsd(xmm7, xmm6); + movdqu(xmm4, xmm3); + subsd(xmm3, xmm2); + addsd(xmm2, xmm3); + subsd(xmm4, xmm2); + addsd(xmm0, xmm4); + subsd(xmm0, xmm7); + addsd(xmm0, xmm3); + jmp(B1_4); + + bind(L_2TAG_PACKET_0_0_1); + jcc(Assembler::greater, L_2TAG_PACKET_1_0_1); + pextrw(eax, xmm0, 3); + movl(edx, eax); + andl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_2_0_1); + andl(edx, 32767); + cmpl(edx, 15904); + jcc(Assembler::below, L_2TAG_PACKET_3_0_1); + movdqu(xmm2, xmm0); + movdqu(xmm3, xmm0); + movq(xmm1, ExternalAddress(Q_11)); //0xb8fe4d77UL, 0x3f82609aUL + mulsd(xmm2, xmm0); + mulsd(xmm3, xmm2); + mulsd(xmm1, xmm2); + addsd(xmm1, ExternalAddress(Q_9)); //0xbf847a43UL, 0x3f9664a0UL + mulsd(xmm1, xmm2); + addsd(xmm1, ExternalAddress(Q_7)); //0x52c4c8abUL, 0x3faba1baUL + mulsd(xmm1, xmm2); + addsd(xmm1, ExternalAddress(Q_5)); //0x11092746UL, 0x3fc11111UL + mulsd(xmm1, xmm2); + addsd(xmm1, ExternalAddress(Q_3)); //0x55555612UL, 0x3fd55555UL + mulsd(xmm1, xmm3); + addsd(xmm0, xmm1); + jmp(B1_4); + + bind(L_2TAG_PACKET_3_0_1); + movq(xmm3, ExternalAddress(TWO_POW_55)); //0x00000000UL, 0x43600000UL + mulsd(xmm3, xmm0); + addsd(xmm0, xmm3); + mulsd(xmm0, ExternalAddress(TWO_POW_M55)); //0x00000000UL, 0x3c800000UL + jmp(B1_4); + + bind(L_2TAG_PACKET_2_0_1); + movdqu(xmm1, xmm0); + mulsd(xmm1, xmm1); + jmp(B1_4); + + bind(L_2TAG_PACKET_1_0_1); + pextrw(eax, xmm0, 3); + andl(eax, 32752); + cmpl(eax, 32752); + jcc(Assembler::equal, L_2TAG_PACKET_4_0_1); + pextrw(ecx, xmm0, 3); + andl(ecx, 32752); + subl(ecx, 16224); + shrl(ecx, 7); + andl(ecx, 65532); + lea(r11, ExternalAddress(PI_INV_TABLE)); + addq(rcx, r11); + movdq(rax, xmm0); + movl(r10, Address(rcx, 20)); + movl(r8, Address(rcx, 24)); + movl(edx, eax); + shrq(rax, 21); + orl(eax, INT_MIN); + shrl(eax, 11); + movl(r9, r10); + imulq(r10, rdx); + imulq(r9, rax); + imulq(r8, rax); + movl(rsi, Address(rcx, 16)); + movl(rdi, Address(rcx, 12)); + movl(r11, r10); + shrq(r10, 32); + addq(r9, r10); + addq(r11, r8); + movl(r8, r11); + shrq(r11, 32); + addq(r9, r11); + movl(r10, rsi); + imulq(rsi, rdx); + imulq(r10, rax); + movl(r11, rdi); + imulq(rdi, rdx); + movl(rbx, rsi); + shrq(rsi, 32); + addq(r9, rbx); + movl(rbx, r9); + shrq(r9, 32); + addq(r10, rsi); + addq(r10, r9); + shlq(rbx, 32); + orq(r8, rbx); + imulq(r11, rax); + movl(r9, Address(rcx, 8)); + movl(rsi, Address(rcx, 4)); + movl(rbx, rdi); + shrq(rdi, 32); + addq(r10, rbx); + movl(rbx, r10); + shrq(r10, 32); + addq(r11, rdi); + addq(r11, r10); + movq(rdi, r9); + imulq(r9, rdx); + imulq(rdi, rax); + movl(r10, r9); + shrq(r9, 32); + addq(r11, r10); + movl(r10, r11); + shrq(r11, 32); + addq(rdi, r9); + addq(rdi, r11); + movq(r9, rsi); + imulq(rsi, rdx); + imulq(r9, rax); + shlq(r10, 32); + orq(r10, rbx); + movl(eax, Address(rcx, 0)); + movl(r11, rsi); + shrq(rsi, 32); + addq(rdi, r11); + movl(r11, rdi); + shrq(rdi, 32); + addq(r9, rsi); + addq(r9, rdi); + imulq(rdx, rax); + pextrw(rbx, xmm0, 3); + lea(rdi, ExternalAddress(PI_INV_TABLE)); + subq(rcx, rdi); + addl(ecx, ecx); + addl(ecx, ecx); + addl(ecx, ecx); + addl(ecx, 19); + movl(rsi, 32768); + andl(rsi, rbx); + shrl(rbx, 4); + andl(rbx, 2047); + subl(rbx, 1023); + subl(ecx, rbx); + addq(r9, rdx); + movl(edx, ecx); + addl(edx, 32); + cmpl(ecx, 0); + jcc(Assembler::less, L_2TAG_PACKET_5_0_1); + negl(ecx); + addl(ecx, 29); + shll(r9); + movl(rdi, r9); + andl(r9, 1073741823); + testl(r9, 536870912); + jcc(Assembler::notEqual, L_2TAG_PACKET_6_0_1); + shrl(r9); + movl(rbx, 0); + shlq(r9, 32); + orq(r9, r11); + + bind(L_2TAG_PACKET_7_0_1); + + bind(L_2TAG_PACKET_8_0_1); + cmpq(r9, 0); + jcc(Assembler::equal, L_2TAG_PACKET_9_0_1); + + bind(L_2TAG_PACKET_10_0_1); + bsrq(r11, r9); + movl(ecx, 29); + subl(ecx, r11); + jcc(Assembler::lessEqual, L_2TAG_PACKET_11_0_1); + shlq(r9); + movq(rax, r10); + shlq(r10); + addl(edx, ecx); + negl(ecx); + addl(ecx, 64); + shrq(rax); + shrq(r8); + orq(r9, rax); + orq(r10, r8); + + bind(L_2TAG_PACKET_12_0_1); + cvtsi2sdq(xmm0, r9); + shrq(r10, 1); + cvtsi2sdq(xmm3, r10); + xorpd(xmm4, xmm4); + shll(edx, 4); + negl(edx); + addl(edx, 16368); + orl(edx, rsi); + xorl(edx, rbx); + pinsrw(xmm4, edx, 3); + movq(xmm2, ExternalAddress(PI_4)); //0x00000000UL, 0x3fe921fbUL, 0x4611a626UL, 0x3e85110bUL + movq(xmm7, ExternalAddress(8 + PI_4)); //0x3fe921fbUL, 0x4611a626UL, 0x3e85110bUL + xorpd(xmm5, xmm5); + subl(edx, 1008); + pinsrw(xmm5, edx, 3); + mulsd(xmm0, xmm4); + shll(rsi, 16); + sarl(rsi, 31); + mulsd(xmm3, xmm5); + movdqu(xmm1, xmm0); + mulsd(xmm0, xmm2); + shrl(rdi, 30); + addsd(xmm1, xmm3); + mulsd(xmm3, xmm2); + addl(rdi, rsi); + xorl(rdi, rsi); + mulsd(xmm7, xmm1); + movl(eax, rdi); + addsd(xmm7, xmm3); + movdqu(xmm2, xmm0); + addsd(xmm0, xmm7); + subsd(xmm2, xmm0); + addsd(xmm7, xmm2); + movdqu(xmm1, ExternalAddress(PI32INV)); //0x6dc9c883UL, 0x3fe45f30UL, 0x6dc9c883UL, 0x40245f30UL + if (VM_Version::supports_sse3()) { + movddup(xmm0, xmm0); + } + else { + movlhps(xmm0, xmm0); + } + movdqu(xmm4, ExternalAddress(sign_mask)); //0x00000000UL, 0x80000000UL, 0x00000000UL, 0x80000000UL + andpd(xmm4, xmm0); + mulpd(xmm1, xmm0); + if (VM_Version::supports_sse3()) { + movddup(xmm7, xmm7); + } + else { + movlhps(xmm7, xmm7); + } + movdqu(xmm5, ExternalAddress(ONEHALF)); //0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL + movdqu(xmm6, ExternalAddress(MUL16)); //0x00000000UL, 0x40300000UL, 0x00000000UL, 0x3ff00000UL + por(xmm5, xmm4); + addpd(xmm1, xmm5); + movdqu(xmm5, xmm1); + unpckhpd(xmm5, xmm5); + cvttsd2sil(edx, xmm5); + cvttpd2dq(xmm1, xmm1); + cvtdq2pd(xmm1, xmm1); + mulpd(xmm1, xmm6); + movdqu(xmm3, ExternalAddress(P_1)); //0x54444000UL, 0x3fb921fbUL, 0x54440000UL, 0x3fb921fbUL + movq(xmm5, ExternalAddress(QQ_2)); //0x676733afUL, 0x3d32e7b9UL + shll(eax, 4); + addl(edx, 469248); + movdqu(xmm4, ExternalAddress(P_2)); //0x67674000UL, 0xbd32e7b9UL, 0x4c4c0000UL, 0x3d468c23UL + mulpd(xmm3, xmm1); + addl(edx, eax); + andl(edx, 31); + mulsd(xmm5, xmm1); + movl(ecx, edx); + mulpd(xmm4, xmm1); + shll(ecx, 1); + subpd(xmm0, xmm3); + mulpd(xmm1, ExternalAddress(P_3)); //0x3707344aUL, 0x3aa8a2e0UL, 0x03707345UL, 0x3ae98a2eUL + addl(edx, ecx); + shll(ecx, 2); + addl(edx, ecx); + addsd(xmm5, xmm0); + movdqu(xmm2, xmm0); + subpd(xmm0, xmm4); + movq(xmm6, ExternalAddress(ONE)); //0x00000000UL, 0x3ff00000UL + shll(edx, 4); + lea(rax, ExternalAddress(Ctable)); + andpd(xmm5, ExternalAddress(MASK_35)); //0xfffc0000UL, 0xffffffffUL, 0x00000000UL, 0x00000000UL + movdqu(xmm3, xmm0); + addq(rax, rdx); + subpd(xmm2, xmm0); + unpckhpd(xmm0, xmm0); + divsd(xmm6, xmm5); + subpd(xmm2, xmm4); + subsd(xmm3, xmm5); + subpd(xmm2, xmm1); + movdqu(xmm1, Address(rax, 48)); + addpd(xmm2, xmm7); + movdqu(xmm7, Address(rax, 16)); + mulpd(xmm7, xmm0); + movdqu(xmm4, Address(rax, 96)); + mulpd(xmm1, xmm0); + mulpd(xmm4, xmm0); + addsd(xmm2, xmm3); + movdqu(xmm3, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm7, Address(rax, 0)); + addpd(xmm1, Address(rax, 32)); + mulpd(xmm1, xmm0); + addpd(xmm4, Address(rax, 80)); + addpd(xmm7, xmm1); + movdqu(xmm1, Address(rax, 112)); + mulpd(xmm1, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm4, xmm1); + movdqu(xmm1, Address(rax, 64)); + mulpd(xmm1, xmm0); + addpd(xmm7, xmm1); + movdqu(xmm1, xmm3); + mulpd(xmm3, xmm0); + mulsd(xmm0, xmm0); + mulpd(xmm1, Address(rax, 144)); + mulpd(xmm4, xmm3); + movdqu(xmm3, xmm1); + addpd(xmm7, xmm4); + movdqu(xmm4, xmm1); + mulsd(xmm0, xmm7); + unpckhpd(xmm7, xmm7); + addsd(xmm0, xmm7); + unpckhpd(xmm1, xmm1); + addsd(xmm3, xmm1); + subsd(xmm4, xmm3); + addsd(xmm1, xmm4); + movdqu(xmm4, xmm2); + movq(xmm7, Address(rax, 144)); + unpckhpd(xmm2, xmm2); + addsd(xmm7, Address(rax, 152)); + mulsd(xmm7, xmm2); + addsd(xmm7, Address(rax, 136)); + addsd(xmm7, xmm1); + addsd(xmm0, xmm7); + movq(xmm7, ExternalAddress(ONE)); //0x00000000UL, 0x3ff00000UL + mulsd(xmm4, xmm6); + movq(xmm2, Address(rax, 168)); + andpd(xmm2, xmm6); + mulsd(xmm5, xmm2); + mulsd(xmm6, Address(rax, 160)); + subsd(xmm7, xmm5); + subsd(xmm2, Address(rax, 128)); + subsd(xmm7, xmm4); + mulsd(xmm7, xmm6); + movdqu(xmm4, xmm3); + subsd(xmm3, xmm2); + addsd(xmm2, xmm3); + subsd(xmm4, xmm2); + addsd(xmm0, xmm4); + subsd(xmm0, xmm7); + addsd(xmm0, xmm3); + jmp(B1_4); + + bind(L_2TAG_PACKET_9_0_1); + addl(edx, 64); + movq(r9, r10); + movq(r10, r8); + movl(r8, 0); + cmpq(r9, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_10_0_1); + addl(edx, 64); + movq(r9, r10); + movq(r10, r8); + cmpq(r9, 0); + jcc(Assembler::notEqual, L_2TAG_PACKET_10_0_1); + jmp(L_2TAG_PACKET_12_0_1); + + bind(L_2TAG_PACKET_11_0_1); + jcc(Assembler::equal, L_2TAG_PACKET_12_0_1); + negl(ecx); + shrq(r10); + movq(rax, r9); + shrq(r9); + subl(edx, ecx); + negl(ecx); + addl(ecx, 64); + shlq(rax); + orq(r10, rax); + jmp(L_2TAG_PACKET_12_0_1); + + bind(L_2TAG_PACKET_5_0_1); + notl(ecx); + shlq(r9, 32); + orq(r9, r11); + shlq(r9); + movq(rdi, r9); + testl(r9, INT_MIN); + jcc(Assembler::notEqual, L_2TAG_PACKET_13_0_1); + shrl(r9); + movl(rbx, 0); + shrq(rdi, 2); + jmp(L_2TAG_PACKET_8_0_1); + + bind(L_2TAG_PACKET_6_0_1); + shrl(r9); + movl(rbx, 1073741824); + shrl(rbx); + shlq(r9, 32); + orq(r9, r11); + shlq(rbx, 32); + addl(rdi, 1073741824); + movl(rcx, 0); + movl(r11, 0); + subq(rcx, r8); + sbbq(r11, r10); + sbbq(rbx, r9); + movq(r8, rcx); + movq(r10, r11); + movq(r9, rbx); + movl(rbx, 32768); + jmp(L_2TAG_PACKET_7_0_1); + + bind(L_2TAG_PACKET_13_0_1); + shrl(r9); + mov64(rbx, 0x100000000); + shrq(rbx); + movl(rcx, 0); + movl(r11, 0); + subq(rcx, r8); + sbbq(r11, r10); + sbbq(rbx, r9); + movq(r8, rcx); + movq(r10, r11); + movq(r9, rbx); + movl(rbx, 32768); + shrq(rdi, 2); + addl(rdi, 1073741824); + jmp(L_2TAG_PACKET_8_0_1); + + bind(L_2TAG_PACKET_4_0_1); + movq(xmm0, Address(rsp, 8)); + mulsd(xmm0, ExternalAddress(NEG_ZERO)); //0x00000000UL, 0x80000000UL + movq(Address(rsp, 0), xmm0); + + bind(L_2TAG_PACKET_14_0_1); + + bind(B1_4); + addq(rsp, 16); + +} +#else +// The 32 bit code is at most SSE2 compliant +ALIGNED_(16) jushort _TP[] = +{ + 0x4cd6, 0xaf6c, 0xc710, 0xc662, 0xbffd, 0x0000, 0x4b06, 0xb0ac, 0xd3b2, 0xcc2c, + 0x3ff9, 0x0000, 0x00e3, 0xc850, 0xaa28, 0x9533, 0xbff3, 0x0000, 0x2ff0, 0x466d, + 0x1a3b, 0xb266, 0x3fe5, 0x0000 +}; + +ALIGNED_(16) jushort _TQ[] = +{ + 0x399c, 0x8391, 0x154c, 0x94ca, 0xbfff, 0x0000, 0xb6a3, 0xc36a, 0x44e2, 0x8a2c, + 0x3ffe, 0x0000, 0xb70f, 0xd068, 0xa6ce, 0xe9dd, 0xbff9, 0x0000, 0x820f, 0x51ce, + 0x7d76, 0x9bff, 0x3ff3, 0x0000 +}; + +ALIGNED_(16) jushort _GP[] = +{ + 0xaaab, 0xaaaa, 0xaaaa, 0xaaaa, 0xbffd, 0x0000, 0xb62f, 0x0b60, 0x60b6, 0xb60b, + 0xbff9, 0x0000, 0xdfa7, 0x08aa, 0x55e0, 0x8ab3, 0xbff6, 0x0000, 0x85a0, 0xa819, + 0xbc99, 0xddeb, 0xbff2, 0x0000, 0x7065, 0x6a37, 0x795f, 0xb354, 0xbfef, 0x0000, + 0xa8f9, 0x83f1, 0x2ec8, 0x9140, 0xbfec, 0x0000, 0xf3ca, 0x8c96, 0x8e0b, 0xeb6d, + 0xbfe8, 0x0000, 0x355b, 0xd910, 0x67c9, 0xbed3, 0xbfe5, 0x0000, 0x286b, 0xb49e, + 0xb854, 0x9a98, 0xbfe2, 0x0000, 0x0871, 0x1a2f, 0x6477, 0xfcc4, 0xbfde, 0x0000, + 0xa559, 0x1da9, 0xaed2, 0xba76, 0xbfdb, 0x0000, 0x00a3, 0x7fea, 0x9bc3, 0xf205, + 0xbfd8, 0x0000 +}; + +void MacroAssembler::libm_tancot_huge(XMMRegister xmm0, XMMRegister xmm1, Register eax, Register ecx, Register edx, Register ebx, Register esi, Register edi, Register ebp, Register esp) { + Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12; + Label B1_13, B1_14, B1_15, B1_16, B1_17, B1_18, B1_19, B1_20, B1_21, B1_22, B1_23; + Label B1_24, B1_25, B1_26, B1_27, B1_28, B1_29, B1_30, B1_31, B1_32, B1_33, B1_34; + Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_44, B1_45, B1_46; + + assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp); + + address L_2il0floatpacket_0 = StubRoutines::x86::_L_2il0floatpacket_0_addr(); + address Pi4Inv = StubRoutines::x86::_Pi4Inv_addr(); + address Pi4x3 = StubRoutines::x86::_Pi4x3_addr(); + address Pi4x4 = StubRoutines::x86::_Pi4x4_addr(); + address ones = StubRoutines::x86::_ones_addr(); + address TP = (address)_TP; + address TQ = (address)_TQ; + address GP = (address)_GP; + + bind(B1_1); + push(ebp); + movl(ebp, esp); + andl(esp, -64); + push(esi); + push(edi); + push(ebx); + subl(esp, 52); + movl(eax, Address(ebp, 16)); + movl(ebx, Address(ebp, 20)); + movl(Address(esp, 40), eax); + + bind(B1_2); + fnstcw(Address(esp, 38)); + + bind(B1_3); + movl(edx, Address(ebp, 12)); + movl(eax, edx); + andl(eax, 2147483647); + shrl(edx, 31); + movl(Address(esp, 44), edx); + cmpl(eax, 1104150528); + jcc(Assembler::aboveEqual, B1_11); + + bind(B1_4); + movsd(xmm1, Address(ebp, 8)); + movzwl(ecx, Address(esp, 38)); + movl(edx, ecx); + andl(edx, 768); + andps(xmm1, ExternalAddress(L_2il0floatpacket_0)); //0xffffffffUL, 0x7fffffffUL, 0x00000000UL, 0x00000000UL + cmpl(edx, 768); + movsd(xmm0, ExternalAddress(Pi4Inv)); ////0x6dc9c883UL, 0x3ff45f30UL + mulsd(xmm0, xmm1); + movsd(Address(ebp, 8), xmm1); + movsd(Address(esp, 0), xmm0); + jcc(Assembler::equal, B1_39); + + bind(B1_5); + orl(ecx, -64768); + movw(Address(esp, 36), ecx); + + bind(B1_6); + fldcw(Address(esp, 36)); + + bind(B1_7); + movsd(xmm1, Address(ebp, 8)); + movl(edi, 1); + + bind(B1_8); + movl(Address(esp, 12), esi); + movl(esi, Address(esp, 4)); + movl(edx, esi); + movl(Address(esp, 24), edi); + movl(edi, esi); + shrl(edi, 20); + andl(edx, 1048575); + movl(ecx, edi); + orl(edx, 1048576); + negl(ecx); + addl(edi, 13); + movl(Address(esp, 8), ebx); + addl(ecx, 19); + movl(ebx, edx); + movl(Address(esp, 28), ecx); + shrl(ebx); + movl(ecx, edi); + shll(edx); + movl(ecx, Address(esp, 28)); + movl(edi, Address(esp, 0)); + shrl(edi); + orl(edx, edi); + cmpl(esi, 1094713344); + movsd(Address(esp, 16), xmm1); + fld_d(Address(esp, 16)); + cmov32(Assembler::below, edx, ebx); + movl(edi, Address(esp, 24)); + movl(esi, Address(esp, 12)); + lea(ebx, Address(edx, 1)); + andl(ebx, -2); + movl(Address(esp, 16), ebx); + cmpl(eax, 1094713344); + fild_s(Address(esp, 16)); + movl(ebx, Address(esp, 8)); + jcc(Assembler::aboveEqual, B1_10); + + bind(B1_9); + fld_d(ExternalAddress(Pi4x3)); //0x54443000UL, 0xbfe921fbUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(8 + Pi4x3)); //0x3b39a000UL, 0x3d373dcbUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(16 + Pi4x3)); //0xe0e68948UL, 0xba845c06UL + fmulp(1); + faddp(1); + jmp(B1_17); + + bind(B1_10); + fld_d(ExternalAddress(Pi4x4)); //0x54400000UL, 0xbfe921fbUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(8 + Pi4x4)); //0x1a600000UL, 0xbdc0b461UL + fmul(1); + faddp(2); + fld_d(ExternalAddress(16 + Pi4x4)); //0x2e000000UL, 0xbb93198aUL + fmul(1); + faddp(2); + fld_d(ExternalAddress(24 + Pi4x4)); //0x252049c1UL, 0xb96b839aUL + fmulp(1); + faddp(1); + jmp(B1_17); + + bind(B1_11); + movzwl(edx, Address(esp, 38)); + movl(eax, edx); + andl(eax, 768); + cmpl(eax, 768); + jcc(Assembler::equal, B1_40); + + bind(B1_12); + orl(edx, -64768); + movw(Address(esp, 36), edx); + + bind(B1_13); + fldcw(Address(esp, 36)); + + bind(B1_14); + movl(edi, 1); + + bind(B1_15); + movsd(xmm0, Address(ebp, 8)); + addl(esp, -32); + andps(xmm0, ExternalAddress(L_2il0floatpacket_0)); //0xffffffffUL, 0x7fffffffUL, 0x00000000UL, 0x00000000UL + lea(eax, Address(esp, 32)); + movsd(Address(eax, 16), xmm0); + fld_d(Address(eax, 16)); + fstp_x(Address(esp, 0)); + movl(Address(esp, 12), 0); + movl(Address(esp, 16), eax); + call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_reduce_pi04l()))); + + bind(B1_43); + movl(edx, eax); + addl(esp, 32); + + bind(B1_16); + fld_d(Address(esp, 0)); + fld_d(Address(esp, 8)); + faddp(1); + + bind(B1_17); + movl(eax, ebx); + andl(eax, 3); + cmpl(eax, 3); + jcc(Assembler::notEqual, B1_24); + + bind(B1_18); + fld_d(ExternalAddress(ones)); + incl(edx); + fdiv(1); + testb(edx, 2); + fstp_x(Address(esp, 24)); + fld_s(0); + fmul(1); + fld_s(0); + fmul(1); + fld_x(ExternalAddress(36 + TP)); //0x2ff0, 0x466d, 0x1a + fmul(2); + fld_x(ExternalAddress(24 + TP)); //0x00e3, 0xc850, 0xaa + faddp(1); + fmul(2); + fld_x(ExternalAddress(12 + TP)); //0x4b06, 0xb0ac, 0xd3 + faddp(1); + fmul(2); + fld_x(ExternalAddress(36 + TQ)); //0x820f, 0x51ce, 0x7d + fmul(3); + fld_x(ExternalAddress(24 + TQ)); //0xb70f, 0xd068, 0xa6 + faddp(1); + fmul(3); + fld_x(ExternalAddress(12 + TQ)); //0xb6a3, 0xc36a, 0x44 + faddp(1); + fmul(3); + fld_x(ExternalAddress(TQ)); //0x399c, 0x8391, 0x15 + faddp(1); + fld_x(ExternalAddress(TP)); //0x4cd6, 0xaf6c, 0xc7 + faddp(2); + fld_x(ExternalAddress(132 + GP)); //0x00a3, 0x7fea, 0x9b + fmul(3); + fld_x(ExternalAddress(120 + GP)); //0xa559, 0x1da9, 0xae + fmul(4); + fld_x(ExternalAddress(108 + GP)); //0x0871, 0x1a2f, 0x64 + faddp(2); + fxch(1); + fmul(4); + fld_x(ExternalAddress(96 + GP)); //0x286b, 0xb49e, 0xb8 + faddp(2); + fxch(1); + fmul(4); + fld_x(ExternalAddress(84 + GP)); //0x355b, 0xd910, 0x67 + faddp(2); + fxch(1); + fmul(4); + fld_x(ExternalAddress(72 + GP)); //0x8c96, 0x8e0b, 0xeb + faddp(2); + fxch(1); + fmul(4); + fld_x(ExternalAddress(60 + GP)); //0xa8f9, 0x83f1, 0x2e + faddp(2); + fxch(1); + fmul(4); + fld_x(ExternalAddress(48 + GP)); //0x7065, 0x6a37, 0x79 + faddp(2); + fxch(1); + fmul(4); + fld_x(ExternalAddress(36 + GP)); //0x85a0, 0xa819, 0xbc + faddp(2); + fxch(1); + fmul(4); + fld_x(ExternalAddress(24 + GP)); //0xdfa7, 0x08aa, 0x55 + faddp(2); + fxch(1); + fmulp(4); + fld_x(ExternalAddress(12 + GP)); //0xb62f, 0x0b60, 0x60 + faddp(1); + fmul(4); + fmul(5); + fld_x(ExternalAddress(GP)); //0xaaab, 0xaaaa, 0xaa + faddp(4); + fxch(3); + fmul(5); + faddp(3); + jcc(Assembler::equal, B1_20); + + bind(B1_19); + fld_x(Address(esp, 24)); + fxch(1); + fdivrp(2); + fxch(1); + fmulp(3); + movl(eax, Address(esp, 44)); + xorl(eax, 1); + fxch(2); + fmul(3); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmula(2); + fmula(3); + fxch(3); + faddp(2); + fxch(1); + fstp_d(Address(esp, 16)); + fmul(1); + fxch(1); + fmulp(2); + movsd(xmm0, Address(esp, 16)); + faddp(1); + fstp_d(Address(esp, 16)); + movsd(xmm1, Address(esp, 16)); + jmp(B1_21); + + bind(B1_20); + fdivrp(1); + fmulp(2); + fxch(1); + fmul(2); + movl(eax, Address(esp, 44)); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmula(1); + fmula(3); + fxch(3); + faddp(1); + fstp_d(Address(esp, 16)); + fmul(1); + fld_x(Address(esp, 24)); + fmulp(2); + movsd(xmm0, Address(esp, 16)); + faddp(1); + fstp_d(Address(esp, 16)); + movsd(xmm1, Address(esp, 16)); + + bind(B1_21); + testl(edi, edi); + jcc(Assembler::equal, B1_23); + + bind(B1_22); + fldcw(Address(esp, 38)); + + bind(B1_23); + movl(eax, Address(esp, 40)); + movsd(Address(eax, 0), xmm0); + movsd(Address(eax, 8), xmm1); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_24); + testb(ebx, 2); + jcc(Assembler::equal, B1_31); + + bind(B1_25); + incl(edx); + fld_s(0); + fmul(1); + testb(edx, 2); + jcc(Assembler::equal, B1_27); + + bind(B1_26); + fld_d(ExternalAddress(ones)); + fdiv(2); + fld_s(1); + fmul(2); + fld_x(ExternalAddress(132 + GP)); //0x00a3, 0x7fea, 0x9b + fmul(1); + fld_x(ExternalAddress(120 + GP)); //0xa559, 0x1da9, 0xae + fmul(2); + fld_x(ExternalAddress(108 + GP)); //0x67c9, 0xbed3, 0xbf + movl(eax, Address(esp, 44)); + faddp(2); + fxch(1); + fmul(2); + xorl(eax, 1); + fld_x(ExternalAddress(96 + GP)); //0x286b, 0xb49e, 0xb8 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(84 + GP)); //0x355b, 0xd910, 0x67 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(72 + GP)); //0xf3ca, 0x8c96, 0x8e + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(60 + GP)); //0xa8f9, 0x83f1, 0x2e + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(48 + GP)); //0x7065, 0x6a37, 0x79 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(36 + GP)); //0x85a0, 0xa819, 0xbc + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(24 + GP)); //0xdfa7, 0x08aa, 0x55 + faddp(2); + fxch(1); + fmulp(2); + fld_x(ExternalAddress(12 + GP)); //0xb62f, 0x0b60, 0x60 + faddp(1); + fmulp(3); + fld_x(ExternalAddress(GP)); //0xaaab, 0xaaaa, 0xaa + faddp(1); + fmul(3); + fxch(2); + fmulp(3); + fxch(1); + faddp(2); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmula(2); + fmulp(1); + faddp(1); + fstp_d(Address(esp, 16)); + movsd(xmm0, Address(esp, 16)); + jmp(B1_28); + + bind(B1_27); + fld_x(ExternalAddress(36 + TP)); //0x2ff0, 0x466d, 0x1a + fmul(1); + fld_x(ExternalAddress(24 + TP)); //0x00e3, 0xc850, 0xaa + movl(eax, Address(esp, 44)); + faddp(1); + fmul(1); + fld_x(ExternalAddress(36 + TQ)); //0x820f, 0x51ce, 0x7d + fmul(2); + fld_x(ExternalAddress(24 + TQ)); //0xb70f, 0xd068, 0xa6 + faddp(1); + fmul(2); + fld_x(ExternalAddress(12 + TQ)); //0xb6a3, 0xc36a, 0x44 + faddp(1); + fmul(2); + fld_x(ExternalAddress(TQ)); //0x399c, 0x8391, 0x15 + faddp(1); + fld_x(ExternalAddress(12 + TP)); //0x4b06, 0xb0ac, 0xd3 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(TP)); //0x4cd6, 0xaf6c, 0xc7 + faddp(1); + fdivrp(1); + fmulp(1); + fmul(1); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmula(1); + fmulp(2); + faddp(1); + fstp_d(Address(esp, 16)); + movsd(xmm0, Address(esp, 16)); + + bind(B1_28); + testl(edi, edi); + jcc(Assembler::equal, B1_30); + + bind(B1_29); + fldcw(Address(esp, 38)); + + bind(B1_30); + movl(eax, Address(esp, 40)); + movsd(Address(eax, 0), xmm0); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + movl(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_31); + testb(ebx, 1); + jcc(Assembler::equal, B1_38); + + bind(B1_32); + incl(edx); + fld_s(0); + fmul(1); + testb(edx, 2); + jcc(Assembler::equal, B1_34); + + bind(B1_33); + fld_x(ExternalAddress(36 + TP)); //0x2ff0, 0x466d, 0x1a + fmul(1); + fld_x(ExternalAddress(24 + TP)); //0x00e3, 0xc850, 0xaa + movl(eax, Address(esp, 44)); + faddp(1); + fmul(1); + xorl(eax, 1); + fld_x(ExternalAddress(36 + TQ)); //0x820f, 0x51ce, 0x7d + fmul(2); + fld_x(ExternalAddress(24 + TQ)); //0xb70f, 0xd068, 0xa6 + faddp(1); + fmul(2); + fld_x(ExternalAddress(12 + TQ)); //0xb6a3, 0xc36a, 0x44 + faddp(1); + fmul(2); + fld_x(ExternalAddress(TQ)); //0x399c, 0x8391, 0x15 + faddp(1); + fld_x(ExternalAddress(12 + TP)); //0x4b06, 0xb0ac, 0xd3 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(TP)); //0x4cd6, 0xaf6c, 0xc7 + faddp(1); + fdivrp(1); + fmulp(1); + fmul(1); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmula(1); + fmulp(2); + faddp(1); + fstp_d(Address(esp, 16)); + movsd(xmm0, Address(esp, 16)); + jmp(B1_35); + + bind(B1_34); + fld_d(ExternalAddress(ones)); + fdiv(2); + fld_s(1); + fmul(2); + fld_x(ExternalAddress(132 + GP)); //0x00a3, 0x7fea, 0x9b + fmul(1); + fld_x(ExternalAddress(120 + GP)); //0xa559, 0x1da9, 0xae + fmul(2); + fld_x(ExternalAddress(108 + GP)); //0x67c9, 0xbed3, 0xbf + movl(eax, Address(esp, 44)); + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(96 + GP)); //0x286b, 0xb49e, 0xb8 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(84 + GP)); //0x355b, 0xd910, 0x67 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(72 + GP)); //0xf3ca, 0x8c96, 0x8e + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(60 + GP)); //0xa8f9, 0x83f1, 0x2e + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(48 + GP)); //0x7065, 0x6a37, 0x79 + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(36 + GP)); //0x85a0, 0xa819, 0xbc + faddp(2); + fxch(1); + fmul(2); + fld_x(ExternalAddress(24 + GP)); //0xdfa7, 0x08aa, 0x55 + faddp(2); + fxch(1); + fmulp(2); + fld_x(ExternalAddress(12 + GP)); //0xb62f, 0x0b60, 0x60 + faddp(1); + fmulp(3); + fld_x(ExternalAddress(GP)); //0xaaab, 0xaaaa, 0xaa + faddp(1); + fmul(3); + fxch(2); + fmulp(3); + fxch(1); + faddp(2); + fld_d(Address(ones, RelocationHolder::none).plus_disp(eax, Address::times_8)); + fmula(2); + fmulp(1); + faddp(1); + fstp_d(Address(esp, 16)); + movsd(xmm0, Address(esp, 16)); + + bind(B1_35); + testl(edi, edi); + jcc(Assembler::equal, B1_37); + + bind(B1_36); + fldcw(Address(esp, 38)); + + bind(B1_37); + movl(eax, Address(esp, 40)); + movsd(Address(eax, 8), xmm0); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + mov(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_38); + fstp_d(0); + addl(esp, 52); + pop(ebx); + pop(edi); + pop(esi); + mov(esp, ebp); + pop(ebp); + ret(0); + + bind(B1_39); + xorl(edi, edi); + jmp(B1_8); + + bind(B1_40); + xorl(edi, edi); + jmp(B1_15); +} + +ALIGNED_(16) juint _static_const_table_tan[] = +{ + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x882c10faUL, + 0x3f9664f4UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x55e6c23dUL, 0x3f8226e3UL, 0x55555555UL, + 0x3fd55555UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x0e157de0UL, 0x3f6d6d3dUL, 0x11111111UL, 0x3fc11111UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x452b75e3UL, 0x3f57da36UL, + 0x1ba1ba1cUL, 0x3faba1baUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x4e435f9bUL, + 0x3f953f83UL, 0x00000000UL, 0x00000000UL, 0x3c6e8e46UL, 0x3f9b74eaUL, + 0x00000000UL, 0x00000000UL, 0xda5b7511UL, 0x3f85ad63UL, 0xdc230b9bUL, + 0x3fb97558UL, 0x26cb3788UL, 0x3f881308UL, 0x76fc4985UL, 0x3fd62ac9UL, + 0x77bb08baUL, 0x3f757c85UL, 0xb6247521UL, 0x3fb1381eUL, 0x5922170cUL, + 0x3f754e95UL, 0x8746482dUL, 0x3fc27f83UL, 0x11055b30UL, 0x3f64e391UL, + 0x3e666320UL, 0x3fa3e609UL, 0x0de9dae3UL, 0x3f6301dfUL, 0x1f1dca06UL, + 0x3fafa8aeUL, 0x8c5b2da2UL, 0x3fb936bbUL, 0x4e88f7a5UL, 0x3c587d05UL, + 0x00000000UL, 0x3ff00000UL, 0xa8935dd9UL, 0x3f83dde2UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x5a279ea3UL, 0x3faa3407UL, + 0x00000000UL, 0x00000000UL, 0x432d65faUL, 0x3fa70153UL, 0x00000000UL, + 0x00000000UL, 0x891a4602UL, 0x3f9d03efUL, 0xd62ca5f8UL, 0x3fca77d9UL, + 0xb35f4628UL, 0x3f97a265UL, 0x433258faUL, 0x3fd8cf51UL, 0xb58fd909UL, + 0x3f8f88e3UL, 0x01771ceaUL, 0x3fc2b154UL, 0xf3562f8eUL, 0x3f888f57UL, + 0xc028a723UL, 0x3fc7370fUL, 0x20b7f9f0UL, 0x3f80f44cUL, 0x214368e9UL, + 0x3fb6dfaaUL, 0x28891863UL, 0x3f79b4b6UL, 0x172dbbf0UL, 0x3fb6cb8eUL, + 0xe0553158UL, 0x3fc975f5UL, 0x593fe814UL, 0x3c2ef5d3UL, 0x00000000UL, + 0x3ff00000UL, 0x03dec550UL, 0x3fa44203UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x9314533eUL, 0x3fbb8ec5UL, 0x00000000UL, + 0x00000000UL, 0x09aa36d0UL, 0x3fb6d3f4UL, 0x00000000UL, 0x00000000UL, + 0xdcb427fdUL, 0x3fb13950UL, 0xd87ab0bbUL, 0x3fd5335eUL, 0xce0ae8a5UL, + 0x3fabb382UL, 0x79143126UL, 0x3fddba41UL, 0x5f2b28d4UL, 0x3fa552f1UL, + 0x59f21a6dUL, 0x3fd015abUL, 0x22c27d95UL, 0x3fa0e984UL, 0xe19fc6aaUL, + 0x3fd0576cUL, 0x8f2c2950UL, 0x3f9a4898UL, 0xc0b3f22cUL, 0x3fc59462UL, + 0x1883a4b8UL, 0x3f94b61cUL, 0x3f838640UL, 0x3fc30eb8UL, 0x355c63dcUL, + 0x3fd36a08UL, 0x1dce993dUL, 0xbc6d704dUL, 0x00000000UL, 0x3ff00000UL, + 0x2b82ab63UL, 0x3fb78e92UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x56f37042UL, 0x3fccfc56UL, 0x00000000UL, 0x00000000UL, + 0xaa563951UL, 0x3fc90125UL, 0x00000000UL, 0x00000000UL, 0x3d0e7c5dUL, + 0x3fc50533UL, 0x9bed9b2eUL, 0x3fdf0ed9UL, 0x5fe7c47cUL, 0x3fc1f250UL, + 0x96c125e5UL, 0x3fe2edd9UL, 0x5a02bbd8UL, 0x3fbe5c71UL, 0x86362c20UL, + 0x3fda08b7UL, 0x4b4435edUL, 0x3fb9d342UL, 0x4b494091UL, 0x3fd911bdUL, + 0xb56658beUL, 0x3fb5e4c7UL, 0x93a2fd76UL, 0x3fd3c092UL, 0xda271794UL, + 0x3fb29910UL, 0x3303df2bUL, 0x3fd189beUL, 0x99fcef32UL, 0x3fda8279UL, + 0xb68c1467UL, 0x3c708b2fUL, 0x00000000UL, 0x3ff00000UL, 0x980c4337UL, + 0x3fc5f619UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0xcc03e501UL, 0x3fdff10fUL, 0x00000000UL, 0x00000000UL, 0x44a4e845UL, + 0x3fddb63bUL, 0x00000000UL, 0x00000000UL, 0x3768ad9fUL, 0x3fdb72a4UL, + 0x3dd01ccaUL, 0x3fe5fdb9UL, 0xa61d2811UL, 0x3fd972b2UL, 0x5645ad0bUL, + 0x3fe977f9UL, 0xd013b3abUL, 0x3fd78ca3UL, 0xbf0bf914UL, 0x3fe4f192UL, + 0x4d53e730UL, 0x3fd5d060UL, 0x3f8b9000UL, 0x3fe49933UL, 0xe2b82f08UL, + 0x3fd4322aUL, 0x5936a835UL, 0x3fe27ae1UL, 0xb1c61c9bUL, 0x3fd2b3fbUL, + 0xef478605UL, 0x3fe1659eUL, 0x190834ecUL, 0x3fe11ab7UL, 0xcdb625eaUL, + 0xbc8e564bUL, 0x00000000UL, 0x3ff00000UL, 0xb07217e3UL, 0x3fd248f1UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x2b2c49d0UL, + 0x3ff2de9cUL, 0x00000000UL, 0x00000000UL, 0x2655bc98UL, 0x3ff33e58UL, + 0x00000000UL, 0x00000000UL, 0xff691fa2UL, 0x3ff3972eUL, 0xe93463bdUL, + 0x3feeed87UL, 0x070e10a0UL, 0x3ff3f5b2UL, 0xf4d790a4UL, 0x3ff20c10UL, + 0xa04e8ea3UL, 0x3ff4541aUL, 0x386accd3UL, 0x3ff1369eUL, 0x222a66ddUL, + 0x3ff4b521UL, 0x22a9777eUL, 0x3ff20817UL, 0x52a04a6eUL, 0x3ff5178fUL, + 0xddaa0031UL, 0x3ff22137UL, 0x4447d47cUL, 0x3ff57c01UL, 0x1e9c7f1dUL, + 0x3ff29311UL, 0x2ab7f990UL, 0x3fe561b8UL, 0x209c7df1UL, 0x3c87a8c5UL, + 0x00000000UL, 0x3ff00000UL, 0x4170bcc6UL, 0x3fdc92d8UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xc7ab4d5aUL, 0x40085e24UL, + 0x00000000UL, 0x00000000UL, 0xe93ea75dUL, 0x400b963dUL, 0x00000000UL, + 0x00000000UL, 0x94a7f25aUL, 0x400f37e2UL, 0x4b6261cbUL, 0x3ff5f984UL, + 0x5a9dd812UL, 0x4011aab0UL, 0x74c30018UL, 0x3ffaf5a5UL, 0x7f2ce8e3UL, + 0x4013fe8bUL, 0xfe8e54faUL, 0x3ffd7334UL, 0x670d618dUL, 0x4016a10cUL, + 0x4db97058UL, 0x4000e012UL, 0x24df44ddUL, 0x40199c5fUL, 0x697d6eceUL, + 0x4003006eUL, 0x83298b82UL, 0x401cfc4dUL, 0x19d490d6UL, 0x40058c19UL, + 0x2ae42850UL, 0x3fea4300UL, 0x118e20e6UL, 0xbc7a6db8UL, 0x00000000UL, + 0x40000000UL, 0xe33345b8UL, 0xbfd4e526UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x65965966UL, 0x40219659UL, 0x00000000UL, + 0x00000000UL, 0x882c10faUL, 0x402664f4UL, 0x00000000UL, 0x00000000UL, + 0x83cd3723UL, 0x402c8342UL, 0x00000000UL, 0x40000000UL, 0x55e6c23dUL, + 0x403226e3UL, 0x55555555UL, 0x40055555UL, 0x34451939UL, 0x40371c96UL, + 0xaaaaaaabUL, 0x400aaaaaUL, 0x0e157de0UL, 0x403d6d3dUL, 0x11111111UL, + 0x40111111UL, 0xa738201fUL, 0x4042bbceUL, 0x05b05b06UL, 0x4015b05bUL, + 0x452b75e3UL, 0x4047da36UL, 0x1ba1ba1cUL, 0x401ba1baUL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x40000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x4f48b8d3UL, 0xbf33eaf9UL, 0x00000000UL, 0x00000000UL, + 0x0cf7586fUL, 0x3f20b8eaUL, 0x00000000UL, 0x00000000UL, 0xd0258911UL, + 0xbf0abaf3UL, 0x23e49fe9UL, 0xbfab5a8cUL, 0x2d53222eUL, 0x3ef60d15UL, + 0x21169451UL, 0x3fa172b2UL, 0xbb254dbcUL, 0xbee1d3b5UL, 0xdbf93b8eUL, + 0xbf84c7dbUL, 0x05b4630bUL, 0x3ecd3364UL, 0xee9aada7UL, 0x3f743924UL, + 0x794a8297UL, 0xbeb7b7b9UL, 0xe015f797UL, 0xbf5d41f5UL, 0xe41a4a56UL, + 0x3ea35dfbUL, 0xe4c2a251UL, 0x3f49a2abUL, 0x5af9e000UL, 0xbfce49ceUL, + 0x8c743719UL, 0x3d1eb860UL, 0x00000000UL, 0x00000000UL, 0x1b4863cfUL, + 0x3fd78294UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, + 0x535ad890UL, 0xbf2b9320UL, 0x00000000UL, 0x00000000UL, 0x018fdf1fUL, + 0x3f16d61dUL, 0x00000000UL, 0x00000000UL, 0x0359f1beUL, 0xbf0139e4UL, + 0xa4317c6dUL, 0xbfa67e17UL, 0x82672d0fUL, 0x3eebb405UL, 0x2f1b621eUL, + 0x3f9f455bUL, 0x51ccf238UL, 0xbed55317UL, 0xf437b9acUL, 0xbf804beeUL, + 0xc791a2b5UL, 0x3ec0e993UL, 0x919a1db2UL, 0x3f7080c2UL, 0x336a5b0eUL, + 0xbeaa48a2UL, 0x0a268358UL, 0xbf55a443UL, 0xdfd978e4UL, 0x3e94b61fUL, + 0xd7767a58UL, 0x3f431806UL, 0x2aea0000UL, 0xbfc9bbe8UL, 0x7723ea61UL, + 0xbd3a2369UL, 0x00000000UL, 0x00000000UL, 0xdf7796ffUL, 0x3fd6e642UL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0xb9ff07ceUL, + 0xbf231c78UL, 0x00000000UL, 0x00000000UL, 0xa5517182UL, 0x3f0ff0e0UL, + 0x00000000UL, 0x00000000UL, 0x790b4cbcUL, 0xbef66191UL, 0x848a46c6UL, + 0xbfa21ac0UL, 0xb16435faUL, 0x3ee1d3ecUL, 0x2a1aa832UL, 0x3f9c71eaUL, + 0xfdd299efUL, 0xbec9dd1aUL, 0x3f8dbaafUL, 0xbf793363UL, 0x309fc6eaUL, + 0x3eb415d6UL, 0xbee60471UL, 0x3f6b83baUL, 0x94a0a697UL, 0xbe9dae11UL, + 0x3e5c67b3UL, 0xbf4fd07bUL, 0x9a8f3e3eUL, 0x3e86bd75UL, 0xa4beb7a4UL, + 0x3f3d1eb1UL, 0x29cfc000UL, 0xbfc549ceUL, 0xbf159358UL, 0xbd397b33UL, + 0x00000000UL, 0x00000000UL, 0x871fee6cUL, 0x3fd666f0UL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x7d98a556UL, 0xbf1a3958UL, + 0x00000000UL, 0x00000000UL, 0x9d88dc01UL, 0x3f0704c2UL, 0x00000000UL, + 0x00000000UL, 0x73742a2bUL, 0xbeed054aUL, 0x58844587UL, 0xbf9c2a13UL, + 0x55688a79UL, 0x3ed7a326UL, 0xee33f1d6UL, 0x3f9a48f4UL, 0xa8dc9888UL, + 0xbebf8939UL, 0xaad4b5b8UL, 0xbf72f746UL, 0x9102efa1UL, 0x3ea88f82UL, + 0xdabc29cfUL, 0x3f678228UL, 0x9289afb8UL, 0xbe90f456UL, 0x741fb4edUL, + 0xbf46f3a3UL, 0xa97f6663UL, 0x3e79b4bfUL, 0xca89ff3fUL, 0x3f36db70UL, + 0xa8a2a000UL, 0xbfc0ee13UL, 0x3da24be1UL, 0xbd338b9fUL, 0x00000000UL, + 0x00000000UL, 0x11cd6c69UL, 0x3fd601fdUL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0xfffffff8UL, 0x1a154b97UL, 0xbf116b01UL, 0x00000000UL, + 0x00000000UL, 0x2d427630UL, 0x3f0147bfUL, 0x00000000UL, 0x00000000UL, + 0xb93820c8UL, 0xbee264d4UL, 0xbb6cbb18UL, 0xbf94ab8cUL, 0x888d4d92UL, + 0x3ed0568bUL, 0x60730f7cUL, 0x3f98b19bUL, 0xe4b1fb11UL, 0xbeb2f950UL, + 0x22cf9f74UL, 0xbf6b21cdUL, 0x4a3ff0a6UL, 0x3e9f499eUL, 0xfd2b83ceUL, + 0x3f64aad7UL, 0x637b73afUL, 0xbe83487cUL, 0xe522591aUL, 0xbf3fc092UL, + 0xa158e8bcUL, 0x3e6e3aaeUL, 0xe5e82ffaUL, 0x3f329d2fUL, 0xd636a000UL, + 0xbfb9477fUL, 0xc2c2d2bcUL, 0xbd135ef9UL, 0x00000000UL, 0x00000000UL, + 0xf2fdb123UL, 0x3fd5b566UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, + 0xfffffff8UL, 0xc41acb64UL, 0xbf05448dUL, 0x00000000UL, 0x00000000UL, + 0xdbb03d6fUL, 0x3efb7ad2UL, 0x00000000UL, 0x00000000UL, 0x9e42962dUL, + 0xbed5aea5UL, 0x2579f8efUL, 0xbf8b2398UL, 0x288a1ed9UL, 0x3ec81441UL, + 0xb0198dc5UL, 0x3f979a3aUL, 0x2fdfe253UL, 0xbea57cd3UL, 0x5766336fUL, + 0xbf617caaUL, 0x600944c3UL, 0x3e954ed6UL, 0xa4e0aaf8UL, 0x3f62c646UL, + 0x6b8fb29cUL, 0xbe74e3a3UL, 0xdc4c0409UL, 0xbf33f952UL, 0x9bffe365UL, + 0x3e6301ecUL, 0xb8869e44UL, 0x3f2fc566UL, 0xe1e04000UL, 0xbfb0cc62UL, + 0x016b907fUL, 0xbd119cbcUL, 0x00000000UL, 0x00000000UL, 0xe6b9d8faUL, + 0x3fd57fb3UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, + 0x5daf22a6UL, 0xbef429d7UL, 0x00000000UL, 0x00000000UL, 0x06bca545UL, + 0x3ef7a27dUL, 0x00000000UL, 0x00000000UL, 0x7211c19aUL, 0xbec41c3eUL, + 0x956ed53eUL, 0xbf7ae3f4UL, 0xee750e72UL, 0x3ec3901bUL, 0x91d443f5UL, + 0x3f96f713UL, 0x36661e6cUL, 0xbe936e09UL, 0x506f9381UL, 0xbf5122e8UL, + 0xcb6dd43fUL, 0x3e9041b9UL, 0x6698b2ffUL, 0x3f61b0c7UL, 0x576bf12bUL, + 0xbe625a8aUL, 0xe5a0e9dcUL, 0xbf23499dUL, 0x110384ddUL, 0x3e5b1c2cUL, + 0x68d43db6UL, 0x3f2cb899UL, 0x6ecac000UL, 0xbfa0c414UL, 0xcd7dd58cUL, + 0x3d13500fUL, 0x00000000UL, 0x00000000UL, 0x85a2c8fbUL, 0x3fd55fe0UL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x2bf70ebeUL, 0x3ef66a8fUL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0xd644267fUL, 0x3ec22805UL, 0x16c16c17UL, 0x3f96c16cUL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xc4e09162UL, + 0x3e8d6db2UL, 0xbc011567UL, 0x3f61566aUL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x1f79955cUL, 0x3e57da4eUL, 0x9334ef0bUL, + 0x3f2bbd77UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x55555555UL, 0x3fd55555UL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x5daf22a6UL, 0x3ef429d7UL, + 0x00000000UL, 0x00000000UL, 0x06bca545UL, 0x3ef7a27dUL, 0x00000000UL, + 0x00000000UL, 0x7211c19aUL, 0x3ec41c3eUL, 0x956ed53eUL, 0x3f7ae3f4UL, + 0xee750e72UL, 0x3ec3901bUL, 0x91d443f5UL, 0x3f96f713UL, 0x36661e6cUL, + 0x3e936e09UL, 0x506f9381UL, 0x3f5122e8UL, 0xcb6dd43fUL, 0x3e9041b9UL, + 0x6698b2ffUL, 0x3f61b0c7UL, 0x576bf12bUL, 0x3e625a8aUL, 0xe5a0e9dcUL, + 0x3f23499dUL, 0x110384ddUL, 0x3e5b1c2cUL, 0x68d43db6UL, 0x3f2cb899UL, + 0x6ecac000UL, 0x3fa0c414UL, 0xcd7dd58cUL, 0xbd13500fUL, 0x00000000UL, + 0x00000000UL, 0x85a2c8fbUL, 0x3fd55fe0UL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0xfffffff8UL, 0xc41acb64UL, 0x3f05448dUL, 0x00000000UL, + 0x00000000UL, 0xdbb03d6fUL, 0x3efb7ad2UL, 0x00000000UL, 0x00000000UL, + 0x9e42962dUL, 0x3ed5aea5UL, 0x2579f8efUL, 0x3f8b2398UL, 0x288a1ed9UL, + 0x3ec81441UL, 0xb0198dc5UL, 0x3f979a3aUL, 0x2fdfe253UL, 0x3ea57cd3UL, + 0x5766336fUL, 0x3f617caaUL, 0x600944c3UL, 0x3e954ed6UL, 0xa4e0aaf8UL, + 0x3f62c646UL, 0x6b8fb29cUL, 0x3e74e3a3UL, 0xdc4c0409UL, 0x3f33f952UL, + 0x9bffe365UL, 0x3e6301ecUL, 0xb8869e44UL, 0x3f2fc566UL, 0xe1e04000UL, + 0x3fb0cc62UL, 0x016b907fUL, 0x3d119cbcUL, 0x00000000UL, 0x00000000UL, + 0xe6b9d8faUL, 0x3fd57fb3UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, + 0xfffffff8UL, 0x1a154b97UL, 0x3f116b01UL, 0x00000000UL, 0x00000000UL, + 0x2d427630UL, 0x3f0147bfUL, 0x00000000UL, 0x00000000UL, 0xb93820c8UL, + 0x3ee264d4UL, 0xbb6cbb18UL, 0x3f94ab8cUL, 0x888d4d92UL, 0x3ed0568bUL, + 0x60730f7cUL, 0x3f98b19bUL, 0xe4b1fb11UL, 0x3eb2f950UL, 0x22cf9f74UL, + 0x3f6b21cdUL, 0x4a3ff0a6UL, 0x3e9f499eUL, 0xfd2b83ceUL, 0x3f64aad7UL, + 0x637b73afUL, 0x3e83487cUL, 0xe522591aUL, 0x3f3fc092UL, 0xa158e8bcUL, + 0x3e6e3aaeUL, 0xe5e82ffaUL, 0x3f329d2fUL, 0xd636a000UL, 0x3fb9477fUL, + 0xc2c2d2bcUL, 0x3d135ef9UL, 0x00000000UL, 0x00000000UL, 0xf2fdb123UL, + 0x3fd5b566UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, + 0x7d98a556UL, 0x3f1a3958UL, 0x00000000UL, 0x00000000UL, 0x9d88dc01UL, + 0x3f0704c2UL, 0x00000000UL, 0x00000000UL, 0x73742a2bUL, 0x3eed054aUL, + 0x58844587UL, 0x3f9c2a13UL, 0x55688a79UL, 0x3ed7a326UL, 0xee33f1d6UL, + 0x3f9a48f4UL, 0xa8dc9888UL, 0x3ebf8939UL, 0xaad4b5b8UL, 0x3f72f746UL, + 0x9102efa1UL, 0x3ea88f82UL, 0xdabc29cfUL, 0x3f678228UL, 0x9289afb8UL, + 0x3e90f456UL, 0x741fb4edUL, 0x3f46f3a3UL, 0xa97f6663UL, 0x3e79b4bfUL, + 0xca89ff3fUL, 0x3f36db70UL, 0xa8a2a000UL, 0x3fc0ee13UL, 0x3da24be1UL, + 0x3d338b9fUL, 0x00000000UL, 0x00000000UL, 0x11cd6c69UL, 0x3fd601fdUL, + 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0xb9ff07ceUL, + 0x3f231c78UL, 0x00000000UL, 0x00000000UL, 0xa5517182UL, 0x3f0ff0e0UL, + 0x00000000UL, 0x00000000UL, 0x790b4cbcUL, 0x3ef66191UL, 0x848a46c6UL, + 0x3fa21ac0UL, 0xb16435faUL, 0x3ee1d3ecUL, 0x2a1aa832UL, 0x3f9c71eaUL, + 0xfdd299efUL, 0x3ec9dd1aUL, 0x3f8dbaafUL, 0x3f793363UL, 0x309fc6eaUL, + 0x3eb415d6UL, 0xbee60471UL, 0x3f6b83baUL, 0x94a0a697UL, 0x3e9dae11UL, + 0x3e5c67b3UL, 0x3f4fd07bUL, 0x9a8f3e3eUL, 0x3e86bd75UL, 0xa4beb7a4UL, + 0x3f3d1eb1UL, 0x29cfc000UL, 0x3fc549ceUL, 0xbf159358UL, 0x3d397b33UL, + 0x00000000UL, 0x00000000UL, 0x871fee6cUL, 0x3fd666f0UL, 0x00000000UL, + 0x3ff00000UL, 0x00000000UL, 0xfffffff8UL, 0x535ad890UL, 0x3f2b9320UL, + 0x00000000UL, 0x00000000UL, 0x018fdf1fUL, 0x3f16d61dUL, 0x00000000UL, + 0x00000000UL, 0x0359f1beUL, 0x3f0139e4UL, 0xa4317c6dUL, 0x3fa67e17UL, + 0x82672d0fUL, 0x3eebb405UL, 0x2f1b621eUL, 0x3f9f455bUL, 0x51ccf238UL, + 0x3ed55317UL, 0xf437b9acUL, 0x3f804beeUL, 0xc791a2b5UL, 0x3ec0e993UL, + 0x919a1db2UL, 0x3f7080c2UL, 0x336a5b0eUL, 0x3eaa48a2UL, 0x0a268358UL, + 0x3f55a443UL, 0xdfd978e4UL, 0x3e94b61fUL, 0xd7767a58UL, 0x3f431806UL, + 0x2aea0000UL, 0x3fc9bbe8UL, 0x7723ea61UL, 0x3d3a2369UL, 0x00000000UL, + 0x00000000UL, 0xdf7796ffUL, 0x3fd6e642UL, 0x00000000UL, 0x3ff00000UL, + 0x00000000UL, 0xfffffff8UL, 0x4f48b8d3UL, 0x3f33eaf9UL, 0x00000000UL, + 0x00000000UL, 0x0cf7586fUL, 0x3f20b8eaUL, 0x00000000UL, 0x00000000UL, + 0xd0258911UL, 0x3f0abaf3UL, 0x23e49fe9UL, 0x3fab5a8cUL, 0x2d53222eUL, + 0x3ef60d15UL, 0x21169451UL, 0x3fa172b2UL, 0xbb254dbcUL, 0x3ee1d3b5UL, + 0xdbf93b8eUL, 0x3f84c7dbUL, 0x05b4630bUL, 0x3ecd3364UL, 0xee9aada7UL, + 0x3f743924UL, 0x794a8297UL, 0x3eb7b7b9UL, 0xe015f797UL, 0x3f5d41f5UL, + 0xe41a4a56UL, 0x3ea35dfbUL, 0xe4c2a251UL, 0x3f49a2abUL, 0x5af9e000UL, + 0x3fce49ceUL, 0x8c743719UL, 0xbd1eb860UL, 0x00000000UL, 0x00000000UL, + 0x1b4863cfUL, 0x3fd78294UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, + 0xfffffff8UL, 0x65965966UL, 0xc0219659UL, 0x00000000UL, 0x00000000UL, + 0x882c10faUL, 0x402664f4UL, 0x00000000UL, 0x00000000UL, 0x83cd3723UL, + 0xc02c8342UL, 0x00000000UL, 0xc0000000UL, 0x55e6c23dUL, 0x403226e3UL, + 0x55555555UL, 0x40055555UL, 0x34451939UL, 0xc0371c96UL, 0xaaaaaaabUL, + 0xc00aaaaaUL, 0x0e157de0UL, 0x403d6d3dUL, 0x11111111UL, 0x40111111UL, + 0xa738201fUL, 0xc042bbceUL, 0x05b05b06UL, 0xc015b05bUL, 0x452b75e3UL, + 0x4047da36UL, 0x1ba1ba1cUL, 0x401ba1baUL, 0x00000000UL, 0xbff00000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x40000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0xc7ab4d5aUL, 0xc0085e24UL, 0x00000000UL, 0x00000000UL, 0xe93ea75dUL, + 0x400b963dUL, 0x00000000UL, 0x00000000UL, 0x94a7f25aUL, 0xc00f37e2UL, + 0x4b6261cbUL, 0xbff5f984UL, 0x5a9dd812UL, 0x4011aab0UL, 0x74c30018UL, + 0x3ffaf5a5UL, 0x7f2ce8e3UL, 0xc013fe8bUL, 0xfe8e54faUL, 0xbffd7334UL, + 0x670d618dUL, 0x4016a10cUL, 0x4db97058UL, 0x4000e012UL, 0x24df44ddUL, + 0xc0199c5fUL, 0x697d6eceUL, 0xc003006eUL, 0x83298b82UL, 0x401cfc4dUL, + 0x19d490d6UL, 0x40058c19UL, 0x2ae42850UL, 0xbfea4300UL, 0x118e20e6UL, + 0x3c7a6db8UL, 0x00000000UL, 0x40000000UL, 0xe33345b8UL, 0xbfd4e526UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x2b2c49d0UL, + 0xbff2de9cUL, 0x00000000UL, 0x00000000UL, 0x2655bc98UL, 0x3ff33e58UL, + 0x00000000UL, 0x00000000UL, 0xff691fa2UL, 0xbff3972eUL, 0xe93463bdUL, + 0xbfeeed87UL, 0x070e10a0UL, 0x3ff3f5b2UL, 0xf4d790a4UL, 0x3ff20c10UL, + 0xa04e8ea3UL, 0xbff4541aUL, 0x386accd3UL, 0xbff1369eUL, 0x222a66ddUL, + 0x3ff4b521UL, 0x22a9777eUL, 0x3ff20817UL, 0x52a04a6eUL, 0xbff5178fUL, + 0xddaa0031UL, 0xbff22137UL, 0x4447d47cUL, 0x3ff57c01UL, 0x1e9c7f1dUL, + 0x3ff29311UL, 0x2ab7f990UL, 0xbfe561b8UL, 0x209c7df1UL, 0xbc87a8c5UL, + 0x00000000UL, 0x3ff00000UL, 0x4170bcc6UL, 0x3fdc92d8UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0xcc03e501UL, 0xbfdff10fUL, + 0x00000000UL, 0x00000000UL, 0x44a4e845UL, 0x3fddb63bUL, 0x00000000UL, + 0x00000000UL, 0x3768ad9fUL, 0xbfdb72a4UL, 0x3dd01ccaUL, 0xbfe5fdb9UL, + 0xa61d2811UL, 0x3fd972b2UL, 0x5645ad0bUL, 0x3fe977f9UL, 0xd013b3abUL, + 0xbfd78ca3UL, 0xbf0bf914UL, 0xbfe4f192UL, 0x4d53e730UL, 0x3fd5d060UL, + 0x3f8b9000UL, 0x3fe49933UL, 0xe2b82f08UL, 0xbfd4322aUL, 0x5936a835UL, + 0xbfe27ae1UL, 0xb1c61c9bUL, 0x3fd2b3fbUL, 0xef478605UL, 0x3fe1659eUL, + 0x190834ecUL, 0xbfe11ab7UL, 0xcdb625eaUL, 0x3c8e564bUL, 0x00000000UL, + 0x3ff00000UL, 0xb07217e3UL, 0x3fd248f1UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x56f37042UL, 0xbfccfc56UL, 0x00000000UL, + 0x00000000UL, 0xaa563951UL, 0x3fc90125UL, 0x00000000UL, 0x00000000UL, + 0x3d0e7c5dUL, 0xbfc50533UL, 0x9bed9b2eUL, 0xbfdf0ed9UL, 0x5fe7c47cUL, + 0x3fc1f250UL, 0x96c125e5UL, 0x3fe2edd9UL, 0x5a02bbd8UL, 0xbfbe5c71UL, + 0x86362c20UL, 0xbfda08b7UL, 0x4b4435edUL, 0x3fb9d342UL, 0x4b494091UL, + 0x3fd911bdUL, 0xb56658beUL, 0xbfb5e4c7UL, 0x93a2fd76UL, 0xbfd3c092UL, + 0xda271794UL, 0x3fb29910UL, 0x3303df2bUL, 0x3fd189beUL, 0x99fcef32UL, + 0xbfda8279UL, 0xb68c1467UL, 0xbc708b2fUL, 0x00000000UL, 0x3ff00000UL, + 0x980c4337UL, 0x3fc5f619UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x9314533eUL, 0xbfbb8ec5UL, 0x00000000UL, 0x00000000UL, + 0x09aa36d0UL, 0x3fb6d3f4UL, 0x00000000UL, 0x00000000UL, 0xdcb427fdUL, + 0xbfb13950UL, 0xd87ab0bbUL, 0xbfd5335eUL, 0xce0ae8a5UL, 0x3fabb382UL, + 0x79143126UL, 0x3fddba41UL, 0x5f2b28d4UL, 0xbfa552f1UL, 0x59f21a6dUL, + 0xbfd015abUL, 0x22c27d95UL, 0x3fa0e984UL, 0xe19fc6aaUL, 0x3fd0576cUL, + 0x8f2c2950UL, 0xbf9a4898UL, 0xc0b3f22cUL, 0xbfc59462UL, 0x1883a4b8UL, + 0x3f94b61cUL, 0x3f838640UL, 0x3fc30eb8UL, 0x355c63dcUL, 0xbfd36a08UL, + 0x1dce993dUL, 0x3c6d704dUL, 0x00000000UL, 0x3ff00000UL, 0x2b82ab63UL, + 0x3fb78e92UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, + 0x5a279ea3UL, 0xbfaa3407UL, 0x00000000UL, 0x00000000UL, 0x432d65faUL, + 0x3fa70153UL, 0x00000000UL, 0x00000000UL, 0x891a4602UL, 0xbf9d03efUL, + 0xd62ca5f8UL, 0xbfca77d9UL, 0xb35f4628UL, 0x3f97a265UL, 0x433258faUL, + 0x3fd8cf51UL, 0xb58fd909UL, 0xbf8f88e3UL, 0x01771ceaUL, 0xbfc2b154UL, + 0xf3562f8eUL, 0x3f888f57UL, 0xc028a723UL, 0x3fc7370fUL, 0x20b7f9f0UL, + 0xbf80f44cUL, 0x214368e9UL, 0xbfb6dfaaUL, 0x28891863UL, 0x3f79b4b6UL, + 0x172dbbf0UL, 0x3fb6cb8eUL, 0xe0553158UL, 0xbfc975f5UL, 0x593fe814UL, + 0xbc2ef5d3UL, 0x00000000UL, 0x3ff00000UL, 0x03dec550UL, 0x3fa44203UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x4e435f9bUL, + 0xbf953f83UL, 0x00000000UL, 0x00000000UL, 0x3c6e8e46UL, 0x3f9b74eaUL, + 0x00000000UL, 0x00000000UL, 0xda5b7511UL, 0xbf85ad63UL, 0xdc230b9bUL, + 0xbfb97558UL, 0x26cb3788UL, 0x3f881308UL, 0x76fc4985UL, 0x3fd62ac9UL, + 0x77bb08baUL, 0xbf757c85UL, 0xb6247521UL, 0xbfb1381eUL, 0x5922170cUL, + 0x3f754e95UL, 0x8746482dUL, 0x3fc27f83UL, 0x11055b30UL, 0xbf64e391UL, + 0x3e666320UL, 0xbfa3e609UL, 0x0de9dae3UL, 0x3f6301dfUL, 0x1f1dca06UL, + 0x3fafa8aeUL, 0x8c5b2da2UL, 0xbfb936bbUL, 0x4e88f7a5UL, 0xbc587d05UL, + 0x00000000UL, 0x3ff00000UL, 0xa8935dd9UL, 0x3f83dde2UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x6dc9c883UL, 0x3fe45f30UL, + 0x6dc9c883UL, 0x40245f30UL, 0x00000000UL, 0x43780000UL, 0x00000000UL, + 0x43380000UL, 0x54444000UL, 0x3fb921fbUL, 0x54440000UL, 0x3fb921fbUL, + 0x67674000UL, 0xbd32e7b9UL, 0x4c4c0000UL, 0x3d468c23UL, 0x3707344aUL, + 0x3aa8a2e0UL, 0x03707345UL, 0x3ae98a2eUL, 0x00000000UL, 0x80000000UL, + 0x00000000UL, 0x80000000UL, 0x676733afUL, 0x3d32e7b9UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x3ff00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x7ff00000UL, 0x00000000UL, 0x00000000UL, 0xfffc0000UL, + 0xffffffffUL, 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x43600000UL, + 0x00000000UL, 0x00000000UL, 0x00000000UL, 0x3c800000UL, 0x00000000UL, + 0x00000000UL, 0x00000000UL, 0x3ca00000UL, 0x00000000UL, 0x00000000UL, + 0x00000000UL, 0x3fe00000UL, 0x00000000UL, 0x3fe00000UL, 0x00000000UL, + 0x40300000UL, 0x00000000UL, 0x3ff00000UL +}; + +void MacroAssembler::fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) { + + Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2; + Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2; + Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2; + Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start; + + assert_different_registers(tmp, eax, ecx, edx); + + address static_const_table_tan = (address)_static_const_table_tan; + + bind(start); + subl(rsp, 120); + movl(Address(rsp, 56), tmp); + lea(tmp, ExternalAddress(static_const_table_tan)); + movsd(xmm0, Address(rsp, 128)); + pextrw(eax, xmm0, 3); + andl(eax, 32767); + subl(eax, 14368); + cmpl(eax, 2216); + jcc(Assembler::above, L_2TAG_PACKET_0_0_2); + movdqu(xmm5, Address(tmp, 5840)); + movdqu(xmm6, Address(tmp, 5856)); + unpcklpd(xmm0, xmm0); + movdqu(xmm4, Address(tmp, 5712)); + andpd(xmm4, xmm0); + movdqu(xmm1, Address(tmp, 5632)); + mulpd(xmm1, xmm0); + por(xmm5, xmm4); + addpd(xmm1, xmm5); + movdqu(xmm7, xmm1); + unpckhpd(xmm7, xmm7); + cvttsd2sil(edx, xmm7); + cvttpd2dq(xmm1, xmm1); + cvtdq2pd(xmm1, xmm1); + mulpd(xmm1, xmm6); + movdqu(xmm3, Address(tmp, 5664)); + movsd(xmm5, Address(tmp, 5728)); + addl(edx, 469248); + movdqu(xmm4, Address(tmp, 5680)); + mulpd(xmm3, xmm1); + andl(edx, 31); + mulsd(xmm5, xmm1); + movl(ecx, edx); + mulpd(xmm4, xmm1); + shll(ecx, 1); + subpd(xmm0, xmm3); + mulpd(xmm1, Address(tmp, 5696)); + addl(edx, ecx); + shll(ecx, 2); + addl(edx, ecx); + addsd(xmm5, xmm0); + movdqu(xmm2, xmm0); + subpd(xmm0, xmm4); + movsd(xmm6, Address(tmp, 5744)); + shll(edx, 4); + lea(eax, Address(tmp, 0)); + andpd(xmm5, Address(tmp, 5776)); + movdqu(xmm3, xmm0); + addl(eax, edx); + subpd(xmm2, xmm0); + unpckhpd(xmm0, xmm0); + divsd(xmm6, xmm5); + subpd(xmm2, xmm4); + movdqu(xmm7, Address(eax, 16)); + subsd(xmm3, xmm5); + mulpd(xmm7, xmm0); + subpd(xmm2, xmm1); + movdqu(xmm1, Address(eax, 48)); + mulpd(xmm1, xmm0); + movdqu(xmm4, Address(eax, 96)); + mulpd(xmm4, xmm0); + addsd(xmm2, xmm3); + movdqu(xmm3, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm7, Address(eax, 0)); + addpd(xmm1, Address(eax, 32)); + mulpd(xmm1, xmm0); + addpd(xmm4, Address(eax, 80)); + addpd(xmm7, xmm1); + movdqu(xmm1, Address(eax, 112)); + mulpd(xmm1, xmm0); + mulpd(xmm0, xmm0); + addpd(xmm4, xmm1); + movdqu(xmm1, Address(eax, 64)); + mulpd(xmm1, xmm0); + addpd(xmm7, xmm1); + movdqu(xmm1, xmm3); + mulpd(xmm3, xmm0); + mulsd(xmm0, xmm0); + mulpd(xmm1, Address(eax, 144)); + mulpd(xmm4, xmm3); + movdqu(xmm3, xmm1); + addpd(xmm7, xmm4); + movdqu(xmm4, xmm1); + mulsd(xmm0, xmm7); + unpckhpd(xmm7, xmm7); + addsd(xmm0, xmm7); + unpckhpd(xmm1, xmm1); + addsd(xmm3, xmm1); + subsd(xmm4, xmm3); + addsd(xmm1, xmm4); + movdqu(xmm4, xmm2); + movsd(xmm7, Address(eax, 144)); + unpckhpd(xmm2, xmm2); + addsd(xmm7, Address(eax, 152)); + mulsd(xmm7, xmm2); + addsd(xmm7, Address(eax, 136)); + addsd(xmm7, xmm1); + addsd(xmm0, xmm7); + movsd(xmm7, Address(tmp, 5744)); + mulsd(xmm4, xmm6); + movsd(xmm2, Address(eax, 168)); + andpd(xmm2, xmm6); + mulsd(xmm5, xmm2); + mulsd(xmm6, Address(eax, 160)); + subsd(xmm7, xmm5); + subsd(xmm2, Address(eax, 128)); + subsd(xmm7, xmm4); + mulsd(xmm7, xmm6); + movdqu(xmm4, xmm3); + subsd(xmm3, xmm2); + addsd(xmm2, xmm3); + subsd(xmm4, xmm2); + addsd(xmm0, xmm4); + subsd(xmm0, xmm7); + addsd(xmm0, xmm3); + movsd(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_0_0_2); + jcc(Assembler::greater, L_2TAG_PACKET_2_0_2); + shrl(eax, 4); + cmpl(eax, 268434558); + jcc(Assembler::notEqual, L_2TAG_PACKET_3_0_2); + movdqu(xmm3, xmm0); + mulsd(xmm3, Address(tmp, 5808)); + + bind(L_2TAG_PACKET_3_0_2); + movsd(xmm3, Address(tmp, 5792)); + mulsd(xmm3, xmm0); + addsd(xmm3, xmm0); + mulsd(xmm3, Address(tmp, 5808)); + movsd(Address(rsp, 0), xmm3); + fld_d(Address(rsp, 0)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_2_0_2); + movq(xmm7, Address(tmp, 5712)); + andpd(xmm7, xmm0); + xorpd(xmm7, xmm0); + ucomisd(xmm7, Address(tmp, 5760)); + jcc(Assembler::equal, L_2TAG_PACKET_4_0_2); + subl(rsp, 32); + movsd(Address(rsp, 0), xmm0); + lea(eax, Address(rsp, 40)); + movl(Address(rsp, 8), eax); + movl(eax, 2); + movl(Address(rsp, 12), eax); + call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlibm_tan_cot_huge()))); + addl(rsp, 32); + fld_d(Address(rsp, 8)); + jmp(L_2TAG_PACKET_1_0_2); + + bind(L_2TAG_PACKET_4_0_2); + movq(Address(rsp, 0), xmm0); + fld_d(Address(rsp, 0)); + fsub_d(Address(rsp, 0)); + + bind(L_2TAG_PACKET_1_0_2); + movl(tmp, Address(rsp, 56)); +} +#endif diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp index 3763b058b8b..a24397f4c8f 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp @@ -29,9 +29,9 @@ #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_x86.inline.hpp" @@ -1953,7 +1953,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { __ mov_metadata(rax, method()); __ call_VM_leaf( CAST_FROM_FN_PTR(address, SharedRuntime::rc_trace_method_entry), diff --git a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp index 8fca552dd34..81ed472f462 100644 --- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp @@ -32,9 +32,9 @@ #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_x86.inline.hpp" @@ -2322,7 +2322,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, } // RedefineClasses() tracing support for obsolete method entry - if (RC_TRACE_IN_RANGE(0x00001000, 0x00002000)) { + if (log_is_enabled(Trace, redefine, class, obsolete)) { // protect the args we've loaded save_args(masm, total_c_args, c_arg, out_regs); __ mov_metadata(c_rarg1, method()); diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp index 0f11b9c0371..adcfe63b39f 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp @@ -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 @@ -63,21 +63,6 @@ const int FPU_CNTRL_WRD_MASK = 0xFFFF; // ------------------------------------------------------------------------------------------------------------------------- // Stub Code definitions -static address handle_unsafe_access() { - JavaThread* thread = JavaThread::current(); - address pc = thread->saved_exception_pc(); - // pc is the instruction which we must emulate - // doing a no-op is fine: return garbage from the load - // therefore, compute npc - address npc = Assembler::locate_next_instruction(pc); - - // request an async exception - thread->set_pending_unsafe_access_error(); - - // return address of next instruction to execute - return npc; -} - class StubGenerator: public StubCodeGenerator { private: @@ -623,27 +608,6 @@ class StubGenerator: public StubCodeGenerator { } - //--------------------------------------------------------------------------- - // The following routine generates a subroutine to throw an asynchronous - // UnknownError when an unsafe access gets a fault that could not be - // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.) - address generate_handler_for_unsafe_access() { - StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access"); - address start = __ pc(); - - __ push(0); // hole for return address-to-be - __ pusha(); // push registers - Address next_pc(rsp, RegisterImpl::number_of_registers * BytesPerWord); - BLOCK_COMMENT("call handle_unsafe_access"); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, handle_unsafe_access))); - __ movptr(next_pc, rax); // stuff next address - __ popa(); - __ ret(0); // jump to next address - - return start; - } - - //---------------------------------------------------------------------------------------------------- // Non-destructive plausibility checks for oops @@ -2092,25 +2056,6 @@ class StubGenerator: public StubCodeGenerator { entry_checkcast_arraycopy); } - void generate_math_stubs() { - { - StubCodeMark mark(this, "StubRoutines", "log10"); - StubRoutines::_intrinsic_log10 = (double (*)(double)) __ pc(); - - __ fld_d(Address(rsp, 4)); - __ flog10(); - __ ret(0); - } - { - StubCodeMark mark(this, "StubRoutines", "tan"); - StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc(); - - __ fld_d(Address(rsp, 4)); - __ trigfunc('t'); - __ ret(0); - } - } - // AES intrinsic stubs enum {AESBlockSize = 16}; @@ -3533,6 +3478,31 @@ class StubGenerator: public StubCodeGenerator { } + address generate_libmLog10() { + address start = __ pc(); + + const XMMRegister x0 = xmm0; + const XMMRegister x1 = xmm1; + const XMMRegister x2 = xmm2; + const XMMRegister x3 = xmm3; + + const XMMRegister x4 = xmm4; + const XMMRegister x5 = xmm5; + const XMMRegister x6 = xmm6; + const XMMRegister x7 = xmm7; + + const Register tmp = rbx; + + BLOCK_COMMENT("Entry:"); + __ enter(); // required for proper stackwalking of RuntimeStub frame + __ fast_log10(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp); + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(0); + + return start; + + } + address generate_libmPow() { address start = __ pc(); @@ -3627,6 +3597,44 @@ class StubGenerator: public StubCodeGenerator { return start; + } + + address generate_libm_tan_cot_huge() { + address start = __ pc(); + + const XMMRegister x0 = xmm0; + const XMMRegister x1 = xmm1; + + BLOCK_COMMENT("Entry:"); + __ libm_tancot_huge(x0, x1, rax, rcx, rdx, rbx, rsi, rdi, rbp, rsp); + + return start; + + } + + address generate_libmTan() { + address start = __ pc(); + + const XMMRegister x0 = xmm0; + const XMMRegister x1 = xmm1; + const XMMRegister x2 = xmm2; + const XMMRegister x3 = xmm3; + + const XMMRegister x4 = xmm4; + const XMMRegister x5 = xmm5; + const XMMRegister x6 = xmm6; + const XMMRegister x7 = xmm7; + + const Register tmp = rbx; + + BLOCK_COMMENT("Entry:"); + __ enter(); // required for proper stackwalking of RuntimeStub frame + __ fast_tan(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp); + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(0); + + return start; + } // Safefetch stubs. @@ -3821,9 +3829,6 @@ class StubGenerator: public StubCodeGenerator { // These are currently used by Solaris/Intel StubRoutines::_atomic_xchg_entry = generate_atomic_xchg(); - StubRoutines::_handler_for_unsafe_access_entry = - generate_handler_for_unsafe_access(); - // platform dependent create_control_words(); @@ -3852,24 +3857,25 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_crc32c_table_addr = (address)StubRoutines::x86::_crc32c_table; StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(supports_clmul); } - if (VM_Version::supports_sse2()) { + if (VM_Version::supports_sse2() && UseLibmIntrinsic) { + StubRoutines::x86::_L_2il0floatpacket_0_adr = (address)StubRoutines::x86::_L_2il0floatpacket_0; + StubRoutines::x86::_Pi4Inv_adr = (address)StubRoutines::x86::_Pi4Inv; + StubRoutines::x86::_Pi4x3_adr = (address)StubRoutines::x86::_Pi4x3; + StubRoutines::x86::_Pi4x4_adr = (address)StubRoutines::x86::_Pi4x4; + StubRoutines::x86::_ones_adr = (address)StubRoutines::x86::_ones; StubRoutines::_dexp = generate_libmExp(); StubRoutines::_dlog = generate_libmLog(); + StubRoutines::_dlog10 = generate_libmLog10(); StubRoutines::_dpow = generate_libmPow(); - if (UseLibmSinIntrinsic || UseLibmCosIntrinsic) { - StubRoutines::_dlibm_reduce_pi04l = generate_libm_reduce_pi04l(); - StubRoutines::_dlibm_sin_cos_huge = generate_libm_sin_cos_huge(); - } - if (UseLibmSinIntrinsic) { - StubRoutines::_dsin = generate_libmSin(); - } - if (UseLibmCosIntrinsic) { - StubRoutines::_dcos = generate_libmCos(); - } + StubRoutines::_dlibm_reduce_pi04l = generate_libm_reduce_pi04l(); + StubRoutines::_dlibm_sin_cos_huge = generate_libm_sin_cos_huge(); + StubRoutines::_dsin = generate_libmSin(); + StubRoutines::_dcos = generate_libmCos(); + StubRoutines::_dlibm_tan_cot_huge = generate_libm_tan_cot_huge(); + StubRoutines::_dtan = generate_libmTan(); } } - void generate_all() { // Generates all stubs and initializes the entry points @@ -3888,8 +3894,6 @@ class StubGenerator: public StubCodeGenerator { // arraycopy stubs used by compilers generate_arraycopy_stubs(); - generate_math_stubs(); - // don't bother generating these AES intrinsic stubs unless global flag is set if (UseAESIntrinsics) { StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask(); // might be needed by the others diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index d51f3a696a0..768cff7c635 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -61,21 +61,6 @@ const int MXCSR_MASK = 0xFFC0; // Mask out any pending exceptions // Stub Code definitions -static address handle_unsafe_access() { - JavaThread* thread = JavaThread::current(); - address pc = thread->saved_exception_pc(); - // pc is the instruction which we must emulate - // doing a no-op is fine: return garbage from the load - // therefore, compute npc - address npc = Assembler::locate_next_instruction(pc); - - // request an async exception - thread->set_pending_unsafe_access_error(); - - // return address of next instruction to execute - return npc; -} - class StubGenerator: public StubCodeGenerator { private: @@ -989,32 +974,6 @@ class StubGenerator: public StubCodeGenerator { return start; } - // The following routine generates a subroutine to throw an - // asynchronous UnknownError when an unsafe access gets a fault that - // could not be reasonably prevented by the programmer. (Example: - // SIGBUS/OBJERR.) - address generate_handler_for_unsafe_access() { - StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access"); - address start = __ pc(); - - __ push(0); // hole for return address-to-be - __ pusha(); // push registers - Address next_pc(rsp, RegisterImpl::number_of_registers * BytesPerWord); - - // FIXME: this probably needs alignment logic - - __ subptr(rsp, frame::arg_reg_save_area_bytes); - BLOCK_COMMENT("call handle_unsafe_access"); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, handle_unsafe_access))); - __ addptr(rsp, frame::arg_reg_save_area_bytes); - - __ movptr(next_pc, rax); // stuff next address - __ popa(); - __ ret(0); // jump to next address - - return start; - } - // Non-destructive plausibility checks for oops // // Arguments: @@ -2971,35 +2930,6 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_arrayof_oop_arraycopy_uninit = StubRoutines::_oop_arraycopy_uninit; } - void generate_math_stubs() { - { - StubCodeMark mark(this, "StubRoutines", "log10"); - StubRoutines::_intrinsic_log10 = (double (*)(double)) __ pc(); - - __ subq(rsp, 8); - __ movdbl(Address(rsp, 0), xmm0); - __ fld_d(Address(rsp, 0)); - __ flog10(); - __ fstp_d(Address(rsp, 0)); - __ movdbl(xmm0, Address(rsp, 0)); - __ addq(rsp, 8); - __ ret(0); - } - { - StubCodeMark mark(this, "StubRoutines", "tan"); - StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc(); - - __ subq(rsp, 8); - __ movdbl(Address(rsp, 0), xmm0); - __ fld_d(Address(rsp, 0)); - __ trigfunc('t'); - __ fstp_d(Address(rsp, 0)); - __ movdbl(xmm0, Address(rsp, 0)); - __ addq(rsp, 8); - __ ret(0); - } - } - // AES intrinsic stubs enum {AESBlockSize = 16}; @@ -3800,12 +3730,29 @@ class StubGenerator: public StubCodeGenerator { address start = __ pc(); __ emit_data64(0x0405060700010203, relocInfo::none); __ emit_data64(0x0c0d0e0f08090a0b, relocInfo::none); + + if (VM_Version::supports_avx2()) { + __ emit_data64(0x0405060700010203, relocInfo::none); // second copy + __ emit_data64(0x0c0d0e0f08090a0b, relocInfo::none); + // _SHUF_00BA + __ emit_data64(0x0b0a090803020100, relocInfo::none); + __ emit_data64(0xFFFFFFFFFFFFFFFF, relocInfo::none); + __ emit_data64(0x0b0a090803020100, relocInfo::none); + __ emit_data64(0xFFFFFFFFFFFFFFFF, relocInfo::none); + // _SHUF_DC00 + __ emit_data64(0xFFFFFFFFFFFFFFFF, relocInfo::none); + __ emit_data64(0x0b0a090803020100, relocInfo::none); + __ emit_data64(0xFFFFFFFFFFFFFFFF, relocInfo::none); + __ emit_data64(0x0b0a090803020100, relocInfo::none); + } + return start; } // ofs and limit are use for multi-block byte array. // int com.sun.security.provider.DigestBase.implCompressMultiBlock(byte[] b, int ofs, int limit) address generate_sha256_implCompress(bool multi_block, const char *name) { + assert(VM_Version::supports_sha() || VM_Version::supports_avx2(), ""); __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", name); address start = __ pc(); @@ -3834,16 +3781,37 @@ class StubGenerator: public StubCodeGenerator { __ movdqu(Address(rsp, 0), xmm6); __ movdqu(Address(rsp, 2 * wordSize), xmm7); __ movdqu(Address(rsp, 4 * wordSize), xmm8); + + if (!VM_Version::supports_sha() && VM_Version::supports_avx2()) { + __ subptr(rsp, 10 * wordSize); + __ movdqu(Address(rsp, 0), xmm9); + __ movdqu(Address(rsp, 2 * wordSize), xmm10); + __ movdqu(Address(rsp, 4 * wordSize), xmm11); + __ movdqu(Address(rsp, 6 * wordSize), xmm12); + __ movdqu(Address(rsp, 8 * wordSize), xmm13); + } #endif __ subptr(rsp, 4 * wordSize); - __ fast_sha256(msg, state0, state1, msgtmp0, msgtmp1, msgtmp2, msgtmp3, msgtmp4, - buf, state, ofs, limit, rsp, multi_block, shuf_mask); - + if (VM_Version::supports_sha()) { + __ fast_sha256(msg, state0, state1, msgtmp0, msgtmp1, msgtmp2, msgtmp3, msgtmp4, + buf, state, ofs, limit, rsp, multi_block, shuf_mask); + } else if (VM_Version::supports_avx2()) { + __ sha256_AVX2(msg, state0, state1, msgtmp0, msgtmp1, msgtmp2, msgtmp3, msgtmp4, + buf, state, ofs, limit, rsp, multi_block, shuf_mask); + } __ addptr(rsp, 4 * wordSize); #ifdef _WIN64 // restore xmm regs belonging to calling function + if (!VM_Version::supports_sha() && VM_Version::supports_avx2()) { + __ movdqu(xmm9, Address(rsp, 0)); + __ movdqu(xmm10, Address(rsp, 2 * wordSize)); + __ movdqu(xmm11, Address(rsp, 4 * wordSize)); + __ movdqu(xmm12, Address(rsp, 6 * wordSize)); + __ movdqu(xmm13, Address(rsp, 8 * wordSize)); + __ addptr(rsp, 10 * wordSize); + } __ movdqu(xmm6, Address(rsp, 0)); __ movdqu(xmm7, Address(rsp, 2 * wordSize)); __ movdqu(xmm8, Address(rsp, 4 * wordSize)); @@ -4400,7 +4368,7 @@ class StubGenerator: public StubCodeGenerator { * c_rarg0 - int crc * c_rarg1 - byte* buf * c_rarg2 - long length - * c_rarg3 - table_start - optional (present only when doing a library_calll, + * c_rarg3 - table_start - optional (present only when doing a library_call, * not used by x86 algorithm) * * Ouput: @@ -4523,6 +4491,9 @@ class StubGenerator: public StubCodeGenerator { * c_rarg1 - objb address * c_rarg3 - length length * c_rarg4 - scale log2_array_indxscale + * + * Output: + * rax - int >= mismatched index, < 0 bitwise complement of tail */ address generate_vectorizedMismatch() { __ align(CodeEntryAlignment); @@ -4730,6 +4701,46 @@ class StubGenerator: public StubCodeGenerator { #endif __ fast_log(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2); +#ifdef _WIN64 + // restore xmm regs belonging to calling function + __ movdqu(xmm6, Address(rsp, 0)); + __ movdqu(xmm7, Address(rsp, 2 * wordSize)); + __ addptr(rsp, 4 * wordSize); +#endif + + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(0); + + return start; + + } + + address generate_libmLog10() { + address start = __ pc(); + + const XMMRegister x0 = xmm0; + const XMMRegister x1 = xmm1; + const XMMRegister x2 = xmm2; + const XMMRegister x3 = xmm3; + + const XMMRegister x4 = xmm4; + const XMMRegister x5 = xmm5; + const XMMRegister x6 = xmm6; + const XMMRegister x7 = xmm7; + + const Register tmp = r11; + + BLOCK_COMMENT("Entry:"); + __ enter(); // required for proper stackwalking of RuntimeStub frame + +#ifdef _WIN64 + // save the xmm registers which must be preserved 6-7 + __ subptr(rsp, 4 * wordSize); + __ movdqu(Address(rsp, 0), xmm6); + __ movdqu(Address(rsp, 2 * wordSize), xmm7); +#endif + __ fast_log10(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp); + #ifdef _WIN64 // restore xmm regs belonging to calling function __ movdqu(xmm6, Address(rsp, 0)); @@ -4809,6 +4820,8 @@ class StubGenerator: public StubCodeGenerator { __ enter(); // required for proper stackwalking of RuntimeStub frame #ifdef _WIN64 + __ push(rsi); + __ push(rdi); // save the xmm registers which must be preserved 6-7 __ subptr(rsp, 4 * wordSize); __ movdqu(Address(rsp, 0), xmm6); @@ -4821,6 +4834,8 @@ class StubGenerator: public StubCodeGenerator { __ movdqu(xmm6, Address(rsp, 0)); __ movdqu(xmm7, Address(rsp, 2 * wordSize)); __ addptr(rsp, 4 * wordSize); + __ pop(rdi); + __ pop(rsi); #endif __ leave(); // required for proper stackwalking of RuntimeStub frame @@ -4852,6 +4867,8 @@ class StubGenerator: public StubCodeGenerator { __ enter(); // required for proper stackwalking of RuntimeStub frame #ifdef _WIN64 + __ push(rsi); + __ push(rdi); // save the xmm registers which must be preserved 6-7 __ subptr(rsp, 4 * wordSize); __ movdqu(Address(rsp, 0), xmm6); @@ -4864,6 +4881,55 @@ class StubGenerator: public StubCodeGenerator { __ movdqu(xmm6, Address(rsp, 0)); __ movdqu(xmm7, Address(rsp, 2 * wordSize)); __ addptr(rsp, 4 * wordSize); + __ pop(rdi); + __ pop(rsi); +#endif + + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(0); + + return start; + + } + + address generate_libmTan() { + address start = __ pc(); + + const XMMRegister x0 = xmm0; + const XMMRegister x1 = xmm1; + const XMMRegister x2 = xmm2; + const XMMRegister x3 = xmm3; + + const XMMRegister x4 = xmm4; + const XMMRegister x5 = xmm5; + const XMMRegister x6 = xmm6; + const XMMRegister x7 = xmm7; + + const Register tmp1 = r8; + const Register tmp2 = r9; + const Register tmp3 = r10; + const Register tmp4 = r11; + + BLOCK_COMMENT("Entry:"); + __ enter(); // required for proper stackwalking of RuntimeStub frame + +#ifdef _WIN64 + __ push(rsi); + __ push(rdi); + // save the xmm registers which must be preserved 6-7 + __ subptr(rsp, 4 * wordSize); + __ movdqu(Address(rsp, 0), xmm6); + __ movdqu(Address(rsp, 2 * wordSize), xmm7); +#endif + __ fast_tan(x0, x1, x2, x3, x4, x5, x6, x7, rax, rcx, rdx, tmp1, tmp2, tmp3, tmp4); + +#ifdef _WIN64 + // restore xmm regs belonging to calling function + __ movdqu(xmm6, Address(rsp, 0)); + __ movdqu(xmm7, Address(rsp, 2 * wordSize)); + __ addptr(rsp, 4 * wordSize); + __ pop(rdi); + __ pop(rsi); #endif __ leave(); // required for proper stackwalking of RuntimeStub frame @@ -5032,9 +5098,6 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_atomic_add_ptr_entry = generate_atomic_add_ptr(); StubRoutines::_fence_entry = generate_orderaccess_fence(); - StubRoutines::_handler_for_unsafe_access_entry = - generate_handler_for_unsafe_access(); - // platform dependent StubRoutines::x86::_get_previous_fp_entry = generate_get_previous_fp(); StubRoutines::x86::_get_previous_sp_entry = generate_get_previous_sp(); @@ -5064,16 +5127,28 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_crc32c_table_addr = (address)StubRoutines::x86::_crc32c_table; StubRoutines::_updateBytesCRC32C = generate_updateBytesCRC32C(supports_clmul); } - if (VM_Version::supports_sse2()) { + if (VM_Version::supports_sse2() && UseLibmIntrinsic) { + StubRoutines::x86::_ONEHALF_adr = (address)StubRoutines::x86::_ONEHALF; + StubRoutines::x86::_P_2_adr = (address)StubRoutines::x86::_P_2; + StubRoutines::x86::_SC_4_adr = (address)StubRoutines::x86::_SC_4; + StubRoutines::x86::_Ctable_adr = (address)StubRoutines::x86::_Ctable; + StubRoutines::x86::_SC_2_adr = (address)StubRoutines::x86::_SC_2; + StubRoutines::x86::_SC_3_adr = (address)StubRoutines::x86::_SC_3; + StubRoutines::x86::_SC_1_adr = (address)StubRoutines::x86::_SC_1; + StubRoutines::x86::_PI_INV_TABLE_adr = (address)StubRoutines::x86::_PI_INV_TABLE; + StubRoutines::x86::_PI_4_adr = (address)StubRoutines::x86::_PI_4; + StubRoutines::x86::_PI32INV_adr = (address)StubRoutines::x86::_PI32INV; + StubRoutines::x86::_SIGN_MASK_adr = (address)StubRoutines::x86::_SIGN_MASK; + StubRoutines::x86::_P_1_adr = (address)StubRoutines::x86::_P_1; + StubRoutines::x86::_P_3_adr = (address)StubRoutines::x86::_P_3; + StubRoutines::x86::_NEG_ZERO_adr = (address)StubRoutines::x86::_NEG_ZERO; StubRoutines::_dexp = generate_libmExp(); StubRoutines::_dlog = generate_libmLog(); + StubRoutines::_dlog10 = generate_libmLog10(); StubRoutines::_dpow = generate_libmPow(); - if (UseLibmSinIntrinsic) { - StubRoutines::_dsin = generate_libmSin(); - } - if (UseLibmCosIntrinsic) { - StubRoutines::_dcos = generate_libmCos(); - } + StubRoutines::_dtan = generate_libmTan(); + StubRoutines::_dsin = generate_libmSin(); + StubRoutines::_dcos = generate_libmCos(); } } @@ -5118,8 +5193,6 @@ class StubGenerator: public StubCodeGenerator { // arraycopy stubs used by compilers generate_arraycopy_stubs(); - generate_math_stubs(); - // don't bother generating these AES intrinsic stubs unless global flag is set if (UseAESIntrinsics) { StubRoutines::x86::_key_shuffle_mask_addr = generate_key_shuffle_mask(); // needed by the others @@ -5141,6 +5214,13 @@ class StubGenerator: public StubCodeGenerator { } if (UseSHA256Intrinsics) { StubRoutines::x86::_k256_adr = (address)StubRoutines::x86::_k256; + char* dst = (char*)StubRoutines::x86::_k256_W; + char* src = (char*)StubRoutines::x86::_k256; + for (int ii = 0; ii < 16; ++ii) { + memcpy(dst + 32 * ii, src + 16 * ii, 16); + memcpy(dst + 32 * ii + 16, src + 16 * ii, 16); + } + StubRoutines::x86::_k256_W_adr = (address)StubRoutines::x86::_k256_W; StubRoutines::x86::_pshuffle_byte_flip_mask_addr = generate_pshuffle_byte_flip_mask(); StubRoutines::_sha256_implCompress = generate_sha256_implCompress(false, "sha256_implCompress"); StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB"); @@ -5170,9 +5250,6 @@ class StubGenerator: public StubCodeGenerator { if (UseMulAddIntrinsic) { StubRoutines::_mulAdd = generate_mulAdd(); } - if (UseVectorizedMismatchIntrinsic) { - StubRoutines::_vectorizedMismatch = generate_vectorizedMismatch(); - } #ifndef _WINDOWS if (UseMontgomeryMultiplyIntrinsic) { StubRoutines::_montgomeryMultiply @@ -5184,6 +5261,10 @@ class StubGenerator: public StubCodeGenerator { } #endif // WINDOWS #endif // COMPILER2 + + if (UseVectorizedMismatchIntrinsic) { + StubRoutines::_vectorizedMismatch = generate_vectorizedMismatch(); + } } public: diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp index 141fbf048eb..ea7952e9660 100644 --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp @@ -46,8 +46,34 @@ address StubRoutines::x86::_ghash_byte_swap_mask_addr = NULL; address StubRoutines::x86::_upper_word_mask_addr = NULL; address StubRoutines::x86::_shuffle_byte_flip_mask_addr = NULL; address StubRoutines::x86::_k256_adr = NULL; +#ifdef _LP64 +address StubRoutines::x86::_k256_W_adr = NULL; +#endif address StubRoutines::x86::_pshuffle_byte_flip_mask_addr = NULL; +//tables common for sin and cos +address StubRoutines::x86::_ONEHALF_adr = NULL; +address StubRoutines::x86::_P_2_adr = NULL; +address StubRoutines::x86::_SC_4_adr = NULL; +address StubRoutines::x86::_Ctable_adr = NULL; +address StubRoutines::x86::_SC_2_adr = NULL; +address StubRoutines::x86::_SC_3_adr = NULL; +address StubRoutines::x86::_SC_1_adr = NULL; +address StubRoutines::x86::_PI_INV_TABLE_adr = NULL; +address StubRoutines::x86::_PI_4_adr = NULL; +address StubRoutines::x86::_PI32INV_adr = NULL; +address StubRoutines::x86::_SIGN_MASK_adr = NULL; +address StubRoutines::x86::_P_1_adr = NULL; +address StubRoutines::x86::_P_3_adr = NULL; +address StubRoutines::x86::_NEG_ZERO_adr = NULL; + +//tables common for sincos and tancot +address StubRoutines::x86::_L_2il0floatpacket_0_adr = NULL; +address StubRoutines::x86::_Pi4Inv_adr = NULL; +address StubRoutines::x86::_Pi4x3_adr = NULL; +address StubRoutines::x86::_Pi4x4_adr = NULL; +address StubRoutines::x86::_ones_adr = NULL; + uint64_t StubRoutines::x86::_crc_by128_masks[] = { /* The fields in this structure are arranged so that they can be @@ -266,3 +292,9 @@ ALIGNED_(64) juint StubRoutines::x86::_k256[] = 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL }; + +#ifdef _LP64 +// used in MacroAssembler::sha256_AVX2 +// dynamically built from _k256 +ALIGNED_(64) juint StubRoutines::x86::_k256_W[2*sizeof(StubRoutines::x86::_k256)]; +#endif diff --git a/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp index 4c9ce0153fd..eeceb0169ee 100644 --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp @@ -54,9 +54,55 @@ //k256 table for sha256 static juint _k256[]; static address _k256_adr; +#ifdef _LP64 + static juint _k256_W[]; + static address _k256_W_adr; +#endif // byte flip mask for sha256 static address _pshuffle_byte_flip_mask_addr; + //tables common for LIBM sin and cos + static juint _ONEHALF[]; + static address _ONEHALF_adr; + static juint _P_2[]; + static address _P_2_adr; + static juint _SC_4[]; + static address _SC_4_adr; + static juint _Ctable[]; + static address _Ctable_adr; + static juint _SC_2[]; + static address _SC_2_adr; + static juint _SC_3[]; + static address _SC_3_adr; + static juint _SC_1[]; + static address _SC_1_adr; + static juint _PI_INV_TABLE[]; + static address _PI_INV_TABLE_adr; + static juint _PI_4[]; + static address _PI_4_adr; + static juint _PI32INV[]; + static address _PI32INV_adr; + static juint _SIGN_MASK[]; + static address _SIGN_MASK_adr; + static juint _P_1[]; + static address _P_1_adr; + static juint _P_3[]; + static address _P_3_adr; + static juint _NEG_ZERO[]; + static address _NEG_ZERO_adr; + + //tables common for LIBM sincos and tancot + static juint _L_2il0floatpacket_0[]; + static address _L_2il0floatpacket_0_adr; + static juint _Pi4Inv[]; + static address _Pi4Inv_adr; + static juint _Pi4x3[]; + static address _Pi4x3_adr; + static juint _Pi4x4[]; + static address _Pi4x4_adr; + static juint _ones[]; + static address _ones_adr; + public: static address verify_mxcsr_entry() { return _verify_mxcsr_entry; } static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; } @@ -67,6 +113,29 @@ static address upper_word_mask_addr() { return _upper_word_mask_addr; } static address shuffle_byte_flip_mask_addr() { return _shuffle_byte_flip_mask_addr; } static address k256_addr() { return _k256_adr; } +#ifdef _LP64 + static address k256_W_addr() { return _k256_W_adr; } +#endif static address pshuffle_byte_flip_mask_addr() { return _pshuffle_byte_flip_mask_addr; } static void generate_CRC32C_table(bool is_pclmulqdq_supported); + static address _ONEHALF_addr() { return _ONEHALF_adr; } + static address _P_2_addr() { return _P_2_adr; } + static address _SC_4_addr() { return _SC_4_adr; } + static address _Ctable_addr() { return _Ctable_adr; } + static address _SC_2_addr() { return _SC_2_adr; } + static address _SC_3_addr() { return _SC_3_adr; } + static address _SC_1_addr() { return _SC_1_adr; } + static address _PI_INV_TABLE_addr() { return _PI_INV_TABLE_adr; } + static address _PI_4_addr() { return _PI_4_adr; } + static address _PI32INV_addr() { return _PI32INV_adr; } + static address _SIGN_MASK_addr() { return _SIGN_MASK_adr; } + static address _P_1_addr() { return _P_1_adr; } + static address _P_3_addr() { return _P_3_adr; } + static address _NEG_ZERO_addr() { return _NEG_ZERO_adr; } + static address _L_2il0floatpacket_0_addr() { return _L_2il0floatpacket_0_adr; } + static address _Pi4Inv_addr() { return _Pi4Inv_adr; } + static address _Pi4x3_addr() { return _Pi4x3_adr; } + static address _Pi4x4_addr() { return _Pi4x4_adr; } + static address _ones_addr() { return _ones_adr; } + #endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP diff --git a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp index 84d07960f24..6d07051c901 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp @@ -608,18 +608,13 @@ void TemplateInterpreterGenerator::lock_method() { // get synchronization object { - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); Label done; __ movl(rax, access_flags); __ testl(rax, JVM_ACC_STATIC); // get receiver (assume this is frequent case) __ movptr(rax, Address(rlocals, Interpreter::local_offset_in_bytes(0))); __ jcc(Assembler::zero, done); - __ movptr(rax, Address(rbx, Method::const_offset())); - __ movptr(rax, Address(rax, ConstMethod::constants_offset())); - __ movptr(rax, Address(rax, - ConstantPool::pool_holder_offset_in_bytes())); - __ movptr(rax, Address(rax, mirror_offset)); + __ load_mirror(rax, rbx); #ifdef ASSERT { @@ -662,6 +657,9 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) { __ movptr(rbcp, Address(rbx, Method::const_offset())); // get ConstMethod* __ lea(rbcp, Address(rbcp, ConstMethod::codes_offset())); // get codebase __ push(rbx); // save Method* + // Get mirror and store it in the frame as GC root for this Method* + __ load_mirror(rdx, rbx); + __ push(rdx); if (ProfileInterpreter) { Label method_data_continue; __ movptr(rdx, Address(rbx, in_bytes(Method::method_data_offset()))); @@ -999,15 +997,11 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) { // pass mirror handle if static call { Label L; - const int mirror_offset = in_bytes(Klass::java_mirror_offset()); __ movl(t, Address(method, Method::access_flags_offset())); __ testl(t, JVM_ACC_STATIC); __ jcc(Assembler::zero, L); // get mirror - __ movptr(t, Address(method, Method::const_offset())); - __ movptr(t, Address(t, ConstMethod::constants_offset())); - __ movptr(t, Address(t, ConstantPool::pool_holder_offset_in_bytes())); - __ movptr(t, Address(t, mirror_offset)); + __ load_mirror(t, method); // copy mirror into activation frame __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset * wordSize), t); diff --git a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp index f5c286ec784..1339b1e065e 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp @@ -345,13 +345,34 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M __ fld_d(Address(rsp, 1*wordSize)); switch (kind) { case Interpreter::java_lang_math_sin : - __ trigfunc('s'); + __ subptr(rsp, 2 * wordSize); + __ fstp_d(Address(rsp, 0)); + if (VM_Version::supports_sse2() && StubRoutines::dsin() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dsin))); + } + __ addptr(rsp, 2 * wordSize); break; case Interpreter::java_lang_math_cos : - __ trigfunc('c'); + __ subptr(rsp, 2 * wordSize); + __ fstp_d(Address(rsp, 0)); + if (VM_Version::supports_sse2() && StubRoutines::dcos() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dcos))); + } + __ addptr(rsp, 2 * wordSize); break; case Interpreter::java_lang_math_tan : - __ trigfunc('t'); + __ subptr(rsp, 2 * wordSize); + __ fstp_d(Address(rsp, 0)); + if (StubRoutines::dtan() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtan()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtan))); + } + __ addptr(rsp, 2 * wordSize); break; case Interpreter::java_lang_math_sqrt: __ fsqrt(); @@ -362,26 +383,29 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M case Interpreter::java_lang_math_log: __ subptr(rsp, 2 * wordSize); __ fstp_d(Address(rsp, 0)); - if (VM_Version::supports_sse2()) { + if (StubRoutines::dlog() != NULL) { __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog()))); - } - else { + } else { __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog))); } __ addptr(rsp, 2 * wordSize); break; case Interpreter::java_lang_math_log10: - __ flog10(); - // Store to stack to convert 80bit precision back to 64bits - __ push_fTOS(); - __ pop_fTOS(); + __ subptr(rsp, 2 * wordSize); + __ fstp_d(Address(rsp, 0)); + if (StubRoutines::dlog10() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog10()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10))); + } + __ addptr(rsp, 2 * wordSize); break; case Interpreter::java_lang_math_pow: __ fld_d(Address(rsp, 3*wordSize)); // second argument __ subptr(rsp, 4 * wordSize); __ fstp_d(Address(rsp, 0)); __ fstp_d(Address(rsp, 2 * wordSize)); - if (VM_Version::supports_sse2()) { + if (StubRoutines::dpow() != NULL) { __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow()))); } else { __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dpow))); @@ -391,7 +415,7 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M case Interpreter::java_lang_math_exp: __ subptr(rsp, 2*wordSize); __ fstp_d(Address(rsp, 0)); - if (VM_Version::supports_sse2()) { + if (StubRoutines::dexp() != NULL) { __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp()))); } else { __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dexp))); diff --git a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp index 3345cfee795..a9cb7962fb1 100644 --- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp @@ -29,6 +29,7 @@ #include "interpreter/interpreterRuntime.hpp" #include "interpreter/templateInterpreterGenerator.hpp" #include "runtime/arguments.hpp" +#include "runtime/sharedRuntime.hpp" #define __ _masm-> @@ -288,9 +289,9 @@ address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractI } /** -* Method entry for static native methods: +* Method entry for static (non-native) methods: * int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end) -* int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end) +* int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long address, int off, int end) */ address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { if (UseCRC32CIntrinsics) { @@ -305,7 +306,7 @@ address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(Abstract // Arguments are reversed on java expression stack // Calculate address of start element if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) { - __ movptr(buf, Address(rsp, 3 * wordSize)); // long buf + __ movptr(buf, Address(rsp, 3 * wordSize)); // long address __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset __ addq(buf, off); // + offset __ movl(crc, Address(rsp, 5 * wordSize)); // Initial CRC @@ -373,32 +374,60 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M __ sqrtsd(xmm0, Address(rsp, wordSize)); } else if (kind == Interpreter::java_lang_math_exp) { __ movdbl(xmm0, Address(rsp, wordSize)); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp()))); + if (StubRoutines::dexp() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dexp))); + } } else if (kind == Interpreter::java_lang_math_log) { __ movdbl(xmm0, Address(rsp, wordSize)); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog()))); + if (StubRoutines::dlog() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog))); + } + } else if (kind == Interpreter::java_lang_math_log10) { + __ movdbl(xmm0, Address(rsp, wordSize)); + if (StubRoutines::dlog10() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog10()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10))); + } + } else if (kind == Interpreter::java_lang_math_sin) { + __ movdbl(xmm0, Address(rsp, wordSize)); + if (StubRoutines::dsin() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dsin))); + } + } else if (kind == Interpreter::java_lang_math_cos) { + __ movdbl(xmm0, Address(rsp, wordSize)); + if (StubRoutines::dcos() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dcos))); + } } else if (kind == Interpreter::java_lang_math_pow) { __ movdbl(xmm1, Address(rsp, wordSize)); __ movdbl(xmm0, Address(rsp, 3 * wordSize)); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow()))); + if (StubRoutines::dpow() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dpow))); + } + } else if (kind == Interpreter::java_lang_math_tan) { + __ movdbl(xmm0, Address(rsp, wordSize)); + if (StubRoutines::dtan() != NULL) { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtan()))); + } else { + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtan))); + } } else { __ fld_d(Address(rsp, wordSize)); switch (kind) { - case Interpreter::java_lang_math_sin : - __ trigfunc('s'); - break; - case Interpreter::java_lang_math_cos : - __ trigfunc('c'); - break; - case Interpreter::java_lang_math_tan : - __ trigfunc('t'); - break; case Interpreter::java_lang_math_abs: __ fabs(); break; - case Interpreter::java_lang_math_log10: - __ flog10(); - break; default : ShouldNotReachHere(); } diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp index 6d871ce92de..65acaffe4cf 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp @@ -732,7 +732,7 @@ void VM_Version::get_processor_features() { FLAG_SET_DEFAULT(UseGHASHIntrinsics, false); } - if (supports_sha()) { + if (supports_sha() LP64_ONLY(|| supports_avx2() && supports_bmi2())) { if (FLAG_IS_DEFAULT(UseSHA)) { UseSHA = true; } @@ -741,7 +741,7 @@ void VM_Version::get_processor_features() { FLAG_SET_DEFAULT(UseSHA, false); } - if (UseSHA) { + if (supports_sha() && UseSHA) { if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) { FLAG_SET_DEFAULT(UseSHA1Intrinsics, true); } diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp index 8dca27b546b..a4c02654cad 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp @@ -844,6 +844,11 @@ public: static uint32_t get_xsave_header_upper_segment() { return _cpuid_info.xem_xcr0_edx; } + + // SSE2 and later processors implement a 'pause' instruction + // that can be used for efficient implementation of + // the intrinsic for java.lang.Thread.onSpinWait() + static bool supports_on_spin_wait() { return supports_sse2(); } }; #endif // CPU_X86_VM_VM_VERSION_X86_HPP diff --git a/hotspot/src/cpu/x86/vm/x86.ad b/hotspot/src/cpu/x86/vm/x86.ad index 603e00beef4..ce14f4c742e 100644 --- a/hotspot/src/cpu/x86/vm/x86.ad +++ b/hotspot/src/cpu/x86/vm/x86.ad @@ -1586,6 +1586,8 @@ class HandlerImpl { source %{ +#include "opto/addnode.hpp" + // Emit exception handler code. // Stuff framesize into a register and call a VM stub routine. int HandlerImpl::emit_exception_handler(CodeBuffer& cbuf) { @@ -1719,6 +1721,10 @@ const bool Matcher::match_rule_supported(int opcode) { if (!(UseSSE > 4)) ret_value = false; break; + case Op_OnSpinWait: + if (VM_Version::supports_on_spin_wait() == false) + ret_value = false; + break; } return ret_value; // Per default match rules are supported. @@ -1754,6 +1760,15 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen) { return ret_value; // Per default match rules are supported. } +const bool Matcher::has_predicated_vectors(void) { + bool ret_value = false; + if (UseAVX > 2) { + ret_value = VM_Version::supports_avx512vl(); + } + + return ret_value; +} + const int Matcher::float_pressure(int default_pressure_threshold) { int float_pressure_threshold = default_pressure_threshold; #ifdef _LP64 @@ -1848,6 +1863,79 @@ const bool Matcher::pass_original_key_for_aes() { return false; } + +const bool Matcher::convi2l_type_required = true; + +// Check for shift by small constant as well +static bool clone_shift(Node* shift, Matcher* matcher, Matcher::MStack& mstack, VectorSet& address_visited) { + if (shift->Opcode() == Op_LShiftX && shift->in(2)->is_Con() && + shift->in(2)->get_int() <= 3 && + // Are there other uses besides address expressions? + !matcher->is_visited(shift)) { + address_visited.set(shift->_idx); // Flag as address_visited + mstack.push(shift->in(2), Matcher::Visit); + Node *conv = shift->in(1); +#ifdef _LP64 + // Allow Matcher to match the rule which bypass + // ConvI2L operation for an array index on LP64 + // if the index value is positive. + if (conv->Opcode() == Op_ConvI2L && + conv->as_Type()->type()->is_long()->_lo >= 0 && + // Are there other uses besides address expressions? + !matcher->is_visited(conv)) { + address_visited.set(conv->_idx); // Flag as address_visited + mstack.push(conv->in(1), Matcher::Pre_Visit); + } else +#endif + mstack.push(conv, Matcher::Pre_Visit); + return true; + } + return false; +} + +// Should the Matcher clone shifts on addressing modes, expecting them +// to be subsumed into complex addressing expressions or compute them +// into registers? +bool Matcher::clone_address_expressions(AddPNode* m, Matcher::MStack& mstack, VectorSet& address_visited) { + Node *off = m->in(AddPNode::Offset); + if (off->is_Con()) { + address_visited.test_set(m->_idx); // Flag as address_visited + Node *adr = m->in(AddPNode::Address); + + // Intel can handle 2 adds in addressing mode + // AtomicAdd is not an addressing expression. + // Cheap to find it by looking for screwy base. + if (adr->is_AddP() && + !adr->in(AddPNode::Base)->is_top() && + // Are there other uses besides address expressions? + !is_visited(adr)) { + address_visited.set(adr->_idx); // Flag as address_visited + Node *shift = adr->in(AddPNode::Offset); + if (!clone_shift(shift, this, mstack, address_visited)) { + mstack.push(shift, Pre_Visit); + } + mstack.push(adr->in(AddPNode::Address), Pre_Visit); + mstack.push(adr->in(AddPNode::Base), Pre_Visit); + } else { + mstack.push(adr, Pre_Visit); + } + + // Clone X+offset as it also folds into most addressing expressions + mstack.push(off, Visit); + mstack.push(m->in(AddPNode::Base), Pre_Visit); + return true; + } else if (clone_shift(off, this, mstack, address_visited)) { + address_visited.test_set(m->_idx); // Flag as address_visited + mstack.push(m->in(AddPNode::Address), Pre_Visit); + mstack.push(m->in(AddPNode::Base), Pre_Visit); + return true; + } + return false; +} + +void Compile::reshape_address(AddPNode* addp) { +} + // Helper methods for MachSpillCopyNode::implementation(). static int vec_mov_helper(CodeBuffer *cbuf, bool do_size, int src_lo, int dst_lo, int src_hi, int dst_hi, uint ireg, outputStream* st) { @@ -1871,7 +1959,7 @@ static int vec_mov_helper(CodeBuffer *cbuf, bool do_size, int src_lo, int dst_lo __ vmovdqu(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo])); break; case Op_VecZ: - __ evmovdqul(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]), 2); + __ evmovdquq(as_XMMRegister(Matcher::_regEncode[dst_lo]), as_XMMRegister(Matcher::_regEncode[src_lo]), 2); break; default: ShouldNotReachHere(); @@ -1926,7 +2014,7 @@ static int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load, __ vmovdqu(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset)); break; case Op_VecZ: - __ evmovdqul(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset), 2); + __ evmovdquq(as_XMMRegister(Matcher::_regEncode[reg]), Address(rsp, stack_offset), 2); break; default: ShouldNotReachHere(); @@ -1946,7 +2034,7 @@ static int vec_spill_helper(CodeBuffer *cbuf, bool do_size, bool is_load, __ vmovdqu(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg])); break; case Op_VecZ: - __ evmovdqul(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]), 2); + __ evmovdquq(Address(rsp, stack_offset), as_XMMRegister(Matcher::_regEncode[reg]), 2); break; default: ShouldNotReachHere(); @@ -2172,6 +2260,19 @@ instruct ShouldNotReachHere() %{ ins_pipe(pipe_slow); %} +// =================================EVEX special=============================== + +instruct setMask(rRegI dst, rRegI src) %{ + predicate(Matcher::has_predicated_vectors()); + match(Set dst (SetVectMaskI src)); + effect(TEMP dst); + format %{ "setvectmask $dst, $src" %} + ins_encode %{ + __ setvectmask($dst$$Register, $src$$Register); + %} + ins_pipe(pipe_slow); +%} + // ============================================================================ instruct addF_reg(regF dst, regF src) %{ @@ -2996,6 +3097,24 @@ instruct sqrtD_imm(regD dst, immD con) %{ ins_pipe(pipe_slow); %} +instruct onspinwait() %{ + match(OnSpinWait); + ins_cost(200); + + format %{ + $$template + if (os::is_MP()) { + $$emit$$"pause\t! membar_onspinwait" + } else { + $$emit$$"MEMBAR-onspinwait ! (empty encoding)" + } + %} + ins_encode %{ + __ pause(); + %} + ins_pipe(pipe_slow); +%} + // ====================VECTOR INSTRUCTIONS===================================== // Load vectors (4 bytes long) @@ -3047,11 +3166,11 @@ instruct loadV32(vecY dst, memory mem) %{ %} // Load vectors (64 bytes long) -instruct loadV64(vecZ dst, memory mem) %{ - predicate(n->as_LoadVector()->memory_size() == 64); +instruct loadV64_dword(vecZ dst, memory mem) %{ + predicate(n->as_LoadVector()->memory_size() == 64 && n->as_LoadVector()->element_size() <= 4); match(Set dst (LoadVector mem)); ins_cost(125); - format %{ "vmovdqu $dst k0,$mem\t! load vector (64 bytes)" %} + format %{ "vmovdqul $dst k0,$mem\t! load vector (64 bytes)" %} ins_encode %{ int vector_len = 2; __ evmovdqul($dst$$XMMRegister, $mem$$Address, vector_len); @@ -3059,6 +3178,19 @@ instruct loadV64(vecZ dst, memory mem) %{ ins_pipe( pipe_slow ); %} +// Load vectors (64 bytes long) +instruct loadV64_qword(vecZ dst, memory mem) %{ + predicate(n->as_LoadVector()->memory_size() == 64 && n->as_LoadVector()->element_size() > 4); + match(Set dst (LoadVector mem)); + ins_cost(125); + format %{ "vmovdquq $dst k0,$mem\t! load vector (64 bytes)" %} + ins_encode %{ + int vector_len = 2; + __ evmovdquq($dst$$XMMRegister, $mem$$Address, vector_len); + %} + ins_pipe( pipe_slow ); +%} + // Store vectors instruct storeV4(memory mem, vecS src) %{ predicate(n->as_StoreVector()->memory_size() == 4); @@ -3104,11 +3236,11 @@ instruct storeV32(memory mem, vecY src) %{ ins_pipe( pipe_slow ); %} -instruct storeV64(memory mem, vecZ src) %{ - predicate(n->as_StoreVector()->memory_size() == 64); +instruct storeV64_dword(memory mem, vecZ src) %{ + predicate(n->as_StoreVector()->memory_size() == 64 && n->as_StoreVector()->element_size() <= 4); match(Set mem (StoreVector mem src)); ins_cost(145); - format %{ "vmovdqu $mem k0,$src\t! store vector (64 bytes)" %} + format %{ "vmovdqul $mem k0,$src\t! store vector (64 bytes)" %} ins_encode %{ int vector_len = 2; __ evmovdqul($mem$$Address, $src$$XMMRegister, vector_len); @@ -3116,6 +3248,18 @@ instruct storeV64(memory mem, vecZ src) %{ ins_pipe( pipe_slow ); %} +instruct storeV64_qword(memory mem, vecZ src) %{ + predicate(n->as_StoreVector()->memory_size() == 64 && n->as_StoreVector()->element_size() > 4); + match(Set mem (StoreVector mem src)); + ins_cost(145); + format %{ "vmovdquq $mem k0,$src\t! store vector (64 bytes)" %} + ins_encode %{ + int vector_len = 2; + __ evmovdquq($mem$$Address, $src$$XMMRegister, vector_len); + %} + ins_pipe( pipe_slow ); +%} + // ====================LEGACY REPLICATE======================================= instruct Repl4B_mem(vecS dst, memory mem) %{ diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index a7ee85d03ae..a45cb554e3c 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -1021,10 +1021,10 @@ static int vec_stack_to_stack_helper(CodeBuffer *cbuf, bool do_size, int src_off __ vmovdqu(xmm0, Address(rsp, -32)); break; case Op_VecZ: - __ evmovdqul(Address(rsp, -64), xmm0, 2); - __ evmovdqul(xmm0, Address(rsp, src_offset), 2); - __ evmovdqul(Address(rsp, dst_offset), xmm0, 2); - __ evmovdqul(xmm0, Address(rsp, -64), 2); + __ evmovdquq(Address(rsp, -64), xmm0, 2); + __ evmovdquq(xmm0, Address(rsp, src_offset), 2); + __ evmovdquq(Address(rsp, dst_offset), xmm0, 2); + __ evmovdquq(xmm0, Address(rsp, -64), 2); break; default: ShouldNotReachHere(); @@ -1438,11 +1438,6 @@ const int Matcher::float_cmove_cost() { return (UseSSE>=1) ? ConditionalMoveLimi // Does the CPU require late expand (see block.cpp for description of late expand)? const bool Matcher::require_postalloc_expand = false; -// Should the Matcher clone shifts on addressing modes, expecting them to -// be subsumed into complex addressing expressions or compute them into -// registers? True for Intel but false for most RISCs -const bool Matcher::clone_shift_expressions = true; - // Do we need to mask the count passed to shift instructions or does // the cpu only look at the lower 5/6 bits anyway? const bool Matcher::need_masked_shift_count = false; @@ -9828,27 +9823,6 @@ instruct modD_reg(regD dst, regD src0, regD src1, eAXRegI rax, eFlagsReg cr) %{ ins_pipe( pipe_slow ); %} -instruct tanDPR_reg(regDPR1 dst, regDPR1 src) %{ - predicate (UseSSE<=1); - match(Set dst(TanD src)); - format %{ "DTAN $dst" %} - ins_encode( Opcode(0xD9), Opcode(0xF2), // fptan - Opcode(0xDD), Opcode(0xD8)); // fstp st - ins_pipe( pipe_slow ); -%} - -instruct tanD_reg(regD dst, eFlagsReg cr) %{ - predicate (UseSSE>=2); - match(Set dst(TanD dst)); - effect(KILL cr); // Push_{Src|Result}D() uses "{SUB|ADD} ESP,8" - format %{ "DTAN $dst" %} - ins_encode( Push_SrcD(dst), - Opcode(0xD9), Opcode(0xF2), // fptan - Opcode(0xDD), Opcode(0xD8), // fstp st - Push_ResultD(dst) ); - ins_pipe( pipe_slow ); -%} - instruct atanDPR_reg(regDPR dst, regDPR src) %{ predicate (UseSSE<=1); match(Set dst(AtanD dst src)); @@ -9880,41 +9854,6 @@ instruct sqrtDPR_reg(regDPR dst, regDPR src) %{ ins_pipe( pipe_slow ); %} -instruct log10DPR_reg(regDPR1 dst, regDPR1 src) %{ - predicate (UseSSE<=1); - // The source Double operand on FPU stack - match(Set dst (Log10D src)); - // fldlg2 ; push log_10(2) on the FPU stack; full 80-bit number - // fxch ; swap ST(0) with ST(1) - // fyl2x ; compute log_10(2) * log_2(x) - format %{ "FLDLG2 \t\t\t#Log10\n\t" - "FXCH \n\t" - "FYL2X \t\t\t# Q=Log10*Log_2(x)" - %} - ins_encode( Opcode(0xD9), Opcode(0xEC), // fldlg2 - Opcode(0xD9), Opcode(0xC9), // fxch - Opcode(0xD9), Opcode(0xF1)); // fyl2x - - ins_pipe( pipe_slow ); -%} - -instruct log10D_reg(regD dst, regD src, eFlagsReg cr) %{ - predicate (UseSSE>=2); - effect(KILL cr); - match(Set dst (Log10D src)); - // fldlg2 ; push log_10(2) on the FPU stack; full 80-bit number - // fyl2x ; compute log_10(2) * log_2(x) - format %{ "FLDLG2 \t\t\t#Log10\n\t" - "FYL2X \t\t\t# Q=Log10*Log_2(x)" - %} - ins_encode( Opcode(0xD9), Opcode(0xEC), // fldlg2 - Push_SrcD(src), - Opcode(0xD9), Opcode(0xF1), // fyl2x - Push_ResultD(dst)); - - ins_pipe( pipe_slow ); -%} - //-------------Float Instructions------------------------------- // Float Math @@ -12103,6 +12042,7 @@ instruct jmpCon(cmpOp cop, eFlagsReg cr, label labl) %{ // Jump Direct Conditional - Label defines a relative address from Jcc+1 instruct jmpLoopEnd(cmpOp cop, eFlagsReg cr, label labl) %{ + predicate(!n->has_vector_mask_set()); match(CountedLoopEnd cop cr); effect(USE labl); @@ -12118,6 +12058,7 @@ instruct jmpLoopEnd(cmpOp cop, eFlagsReg cr, label labl) %{ // Jump Direct Conditional - Label defines a relative address from Jcc+1 instruct jmpLoopEndU(cmpOpU cop, eFlagsRegU cmp, label labl) %{ + predicate(!n->has_vector_mask_set()); match(CountedLoopEnd cop cmp); effect(USE labl); @@ -12132,6 +12073,7 @@ instruct jmpLoopEndU(cmpOpU cop, eFlagsRegU cmp, label labl) %{ %} instruct jmpLoopEndUCF(cmpOpUCF cop, eFlagsRegUCF cmp, label labl) %{ + predicate(!n->has_vector_mask_set()); match(CountedLoopEnd cop cmp); effect(USE labl); @@ -12145,6 +12087,60 @@ instruct jmpLoopEndUCF(cmpOpUCF cop, eFlagsRegUCF cmp, label labl) %{ ins_pipe( pipe_jcc ); %} +// mask version +// Jump Direct Conditional - Label defines a relative address from Jcc+1 +instruct jmpLoopEnd_and_restoreMask(cmpOp cop, eFlagsReg cr, label labl) %{ + predicate(n->has_vector_mask_set()); + match(CountedLoopEnd cop cr); + effect(USE labl); + + ins_cost(400); + format %{ "J$cop $labl\t# Loop end\n\t" + "restorevectmask \t# vector mask restore for loops" %} + size(10); + ins_encode %{ + Label* L = $labl$$label; + __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump + __ restorevectmask(); + %} + ins_pipe( pipe_jcc ); +%} + +// Jump Direct Conditional - Label defines a relative address from Jcc+1 +instruct jmpLoopEndU_and_restoreMask(cmpOpU cop, eFlagsRegU cmp, label labl) %{ + predicate(n->has_vector_mask_set()); + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(400); + format %{ "J$cop,u $labl\t# Loop end\n\t" + "restorevectmask \t# vector mask restore for loops" %} + size(10); + ins_encode %{ + Label* L = $labl$$label; + __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump + __ restorevectmask(); + %} + ins_pipe( pipe_jcc ); +%} + +instruct jmpLoopEndUCF_and_restoreMask(cmpOpUCF cop, eFlagsRegUCF cmp, label labl) %{ + predicate(n->has_vector_mask_set()); + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(300); + format %{ "J$cop,u $labl\t# Loop end\n\t" + "restorevectmask \t# vector mask restore for loops" %} + size(10); + ins_encode %{ + Label* L = $labl$$label; + __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump + __ restorevectmask(); + %} + ins_pipe( pipe_jcc ); +%} + // Jump Direct Conditional - using unsigned comparison instruct jmpConU(cmpOpU cop, eFlagsRegU cmp, label labl) %{ match(If cop cmp); diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 9579436fb20..a680d60e994 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -1081,10 +1081,10 @@ static void vec_stack_to_stack_helper(CodeBuffer *cbuf, int src_offset, __ vmovdqu(xmm0, Address(rsp, -32)); break; case Op_VecZ: - __ evmovdqul(Address(rsp, -64), xmm0, 2); - __ evmovdqul(xmm0, Address(rsp, src_offset), 2); - __ evmovdqul(Address(rsp, dst_offset), xmm0, 2); - __ evmovdqul(xmm0, Address(rsp, -64), 2); + __ evmovdquq(Address(rsp, -64), xmm0, 2); + __ evmovdquq(xmm0, Address(rsp, src_offset), 2); + __ evmovdquq(Address(rsp, dst_offset), xmm0, 2); + __ evmovdquq(xmm0, Address(rsp, -64), 2); break; default: ShouldNotReachHere(); @@ -1646,11 +1646,6 @@ const int Matcher::float_cmove_cost() { return ConditionalMoveLimit; } // Does the CPU require late expand (see block.cpp for description of late expand)? const bool Matcher::require_postalloc_expand = false; -// Should the Matcher clone shifts on addressing modes, expecting them -// to be subsumed into complex addressing expressions or compute them -// into registers? True for Intel but false for most RISCs -const bool Matcher::clone_shift_expressions = true; - // Do we need to mask the count passed to shift instructions or does // the cpu only look at the lower 5/6 bits anyway? const bool Matcher::need_masked_shift_count = false; @@ -9897,34 +9892,6 @@ instruct cmpD_imm(rRegI dst, regD src, immD con, rFlagsReg cr) %{ ins_pipe(pipe_slow); %} -// -----------Trig and Trancendental Instructions------------------------------ -instruct tanD_reg(regD dst) %{ - match(Set dst (TanD dst)); - - format %{ "dtan $dst\n\t" %} - ins_encode( Push_SrcXD(dst), - Opcode(0xD9), Opcode(0xF2), //fptan - Opcode(0xDD), Opcode(0xD8), //fstp st - Push_ResultXD(dst) ); - ins_pipe( pipe_slow ); -%} - -instruct log10D_reg(regD dst) %{ - // The source and result Double operands in XMM registers - match(Set dst (Log10D dst)); - // fldlg2 ; push log_10(2) on the FPU stack; full 80-bit number - // fyl2x ; compute log_10(2) * log_2(x) - format %{ "fldlg2\t\t\t#Log10\n\t" - "fyl2x\t\t\t# Q=Log10*Log_2(x)\n\t" - %} - ins_encode(Opcode(0xD9), Opcode(0xEC), // fldlg2 - Push_SrcXD(dst), - Opcode(0xD9), Opcode(0xF1), // fyl2x - Push_ResultXD(dst)); - - ins_pipe( pipe_slow ); -%} - //----------Arithmetic Conversion Instructions--------------------------------- instruct roundFloat_nop(regF dst) @@ -11471,6 +11438,7 @@ instruct jmpCon(cmpOp cop, rFlagsReg cr, label labl) // Jump Direct Conditional - Label defines a relative address from Jcc+1 instruct jmpLoopEnd(cmpOp cop, rFlagsReg cr, label labl) %{ + predicate(!n->has_vector_mask_set()); match(CountedLoopEnd cop cr); effect(USE labl); @@ -11486,6 +11454,7 @@ instruct jmpLoopEnd(cmpOp cop, rFlagsReg cr, label labl) // Jump Direct Conditional - Label defines a relative address from Jcc+1 instruct jmpLoopEndU(cmpOpU cop, rFlagsRegU cmp, label labl) %{ + predicate(!n->has_vector_mask_set()); match(CountedLoopEnd cop cmp); effect(USE labl); @@ -11500,6 +11469,7 @@ instruct jmpLoopEndU(cmpOpU cop, rFlagsRegU cmp, label labl) %{ %} instruct jmpLoopEndUCF(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{ + predicate(!n->has_vector_mask_set()); match(CountedLoopEnd cop cmp); effect(USE labl); @@ -11513,6 +11483,61 @@ instruct jmpLoopEndUCF(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{ ins_pipe(pipe_jcc); %} +// mask version +// Jump Direct Conditional - Label defines a relative address from Jcc+1 +instruct jmpLoopEnd_and_restoreMask(cmpOp cop, rFlagsReg cr, label labl) +%{ + predicate(n->has_vector_mask_set()); + match(CountedLoopEnd cop cr); + effect(USE labl); + + ins_cost(400); + format %{ "j$cop $labl\t# loop end\n\t" + "restorevectmask \t# vector mask restore for loops" %} + size(10); + ins_encode %{ + Label* L = $labl$$label; + __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump + __ restorevectmask(); + %} + ins_pipe(pipe_jcc); +%} + +// Jump Direct Conditional - Label defines a relative address from Jcc+1 +instruct jmpLoopEndU_and_restoreMask(cmpOpU cop, rFlagsRegU cmp, label labl) %{ + predicate(n->has_vector_mask_set()); + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(400); + format %{ "j$cop,u $labl\t# loop end\n\t" + "restorevectmask \t# vector mask restore for loops" %} + size(10); + ins_encode %{ + Label* L = $labl$$label; + __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump + __ restorevectmask(); + %} + ins_pipe(pipe_jcc); +%} + +instruct jmpLoopEndUCF_and_restoreMask(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{ + predicate(n->has_vector_mask_set()); + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(300); + format %{ "j$cop,u $labl\t# loop end\n\t" + "restorevectmask \t# vector mask restore for loops" %} + size(10); + ins_encode %{ + Label* L = $labl$$label; + __ jcc((Assembler::Condition)($cop$$cmpcode), *L, false); // Always long jump + __ restorevectmask(); + %} + ins_pipe(pipe_jcc); +%} + // Jump Direct Conditional - using unsigned comparison instruct jmpConU(cmpOpU cop, rFlagsRegU cmp, label labl) %{ match(If cop cmp); diff --git a/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.cpp index 2290f59d1b1..1dbe94d5469 100644 --- a/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.cpp +++ b/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.cpp @@ -49,6 +49,7 @@ const char *BytecodeInterpreter::name_of_field_at_address(address addr) { DO(_locals); DO(_constants); DO(_method); + DO(_mirror); DO(_mdx); DO(_stack); DO(_msg); @@ -77,6 +78,7 @@ void BytecodeInterpreter::layout_interpreterState(interpreterState istate, bool is_top_frame) { istate->set_locals(locals); istate->set_method(method); + istate->set_mirror(method->method_holder()->java_mirror()); istate->set_self_link(istate); istate->set_prev_link(NULL); // thread will be set by a hacky repurposing of frame::patch_pc() diff --git a/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp b/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp index f7bcb91e547..e7ef4c1a26e 100644 --- a/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp +++ b/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -44,6 +44,9 @@ inline void set_method(Method* new_method) { _method = new_method; } + inline void set_mirror(oop new_mirror) { + _mirror = new_mirror; + } inline interpreterState self_link() { return _self_link; } diff --git a/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp b/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp index bc3e3624e3d..8f912db7bf9 100644 --- a/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp +++ b/hotspot/src/cpu/zero/vm/compiledIC_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -42,22 +42,6 @@ #include "utilities/events.hpp" -// Release the CompiledICHolder* associated with this call site is there is one. -void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - if (is_icholder_entry(call->destination())) { - NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); - InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); - } -} - -bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { - // This call site might have become stale so inspect it carefully. - NativeCall* call = nativeCall_at(call_site->addr()); - return is_icholder_entry(call->destination()); -} - // ---------------------------------------------------------------------------- address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf, address mark) { diff --git a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp index e05e6d65bc0..9e91f22f266 100644 --- a/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp +++ b/hotspot/src/cpu/zero/vm/cppInterpreter_zero.cpp @@ -221,9 +221,16 @@ void CppInterpreter::main_loop(int recurse, TRAPS) { // Push our result for (int i = 0; i < result_slots; i++) { // Adjust result to smaller - intptr_t res = result[-i]; + union { + intptr_t res; + jint res_jint; + }; + res = result[-i]; if (result_slots == 1) { - res = narrow(method->result_type(), res); + BasicType t = method->result_type(); + if (is_subword_type(t)) { + res_jint = (jint)narrow(t, res_jint); + } } stack->push(res); } @@ -748,6 +755,7 @@ InterpreterFrame *InterpreterFrame::build(Method* const method, TRAPS) { istate->set_locals(locals); istate->set_method(method); + istate->set_mirror(method->method_holder()->java_mirror()); istate->set_self_link(istate); istate->set_prev_link(NULL); istate->set_thread(thread); diff --git a/hotspot/src/cpu/zero/vm/frame_zero.cpp b/hotspot/src/cpu/zero/vm/frame_zero.cpp index fe1ee4f4f95..19acf03681e 100644 --- a/hotspot/src/cpu/zero/vm/frame_zero.cpp +++ b/hotspot/src/cpu/zero/vm/frame_zero.cpp @@ -360,7 +360,7 @@ void SharkFrame::identify_word(int frame_index, case pc_off: strncpy(fieldbuf, "pc", buflen); if (method()->is_method()) { - nmethod *code = method()->code(); + CompiledMethod *code = method()->code(); if (code && code->pc_desc_at(pc())) { SimpleScopeDesc ssd(code, pc()); snprintf(valuebuf, buflen, PTR_FORMAT " (bci %d)", diff --git a/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp b/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp index f8011a25161..1ecd9db38a8 100644 --- a/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp +++ b/hotspot/src/cpu/zero/vm/frame_zero.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -59,7 +59,7 @@ inline frame::frame(ZeroFrame* zf, intptr_t* sp) { case ZeroFrame::SHARK_FRAME: { _pc = zero_sharkframe()->pc(); _cb = CodeCache::find_blob_unsafe(pc()); - address original_pc = nmethod::get_deopt_original_pc(this); + address original_pc = CompiledMethod::get_deopt_original_pc(this); if (original_pc != NULL) { _pc = original_pc; _deopt_state = is_deoptimized; @@ -115,6 +115,10 @@ inline Method** frame::interpreter_frame_method_addr() const { return &(get_interpreterState()->_method); } +inline oop* frame::interpreter_frame_mirror_addr() const { + return &(get_interpreterState()->_mirror); +} + inline intptr_t* frame::interpreter_frame_mdp_addr() const { return (intptr_t*) &(get_interpreterState()->_mdx); } diff --git a/hotspot/src/cpu/zero/vm/globals_zero.hpp b/hotspot/src/cpu/zero/vm/globals_zero.hpp index 52a3cacbd70..7ce33a94447 100644 --- a/hotspot/src/cpu/zero/vm/globals_zero.hpp +++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp @@ -43,7 +43,12 @@ define_pd_global(intx, CodeEntryAlignment, 32); define_pd_global(intx, OptoLoopAlignment, 16); define_pd_global(intx, InlineFrequencyCount, 100); define_pd_global(intx, InlineSmallCode, 1000); -define_pd_global(intx, InitArrayShortSize, -1); // not used + +// not used, but must satisfy following constraints: +// 1.) must be in the allowed range for intx *and* +// 2.) % BytesPerLong == 0 so as to not +// violate the constraint verifier on JVM start-up. +define_pd_global(intx, InitArrayShortSize, 0); #define DEFAULT_STACK_YELLOW_PAGES (2) #define DEFAULT_STACK_RED_PAGES (1) @@ -75,7 +80,14 @@ define_pd_global(bool, PreserveFramePointer, false); // No performance work done here yet. define_pd_global(bool, CompactStrings, false); -#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct, range, constraint) \ +#define ARCH_FLAGS(develop, \ + product, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(bool, UseFastEmptyMethods, true, \ "Use fast method entry code for empty methods") \ diff --git a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp index 0fb36b01b75..27b96b57bec 100644 --- a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp +++ b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp @@ -31,7 +31,6 @@ #include "code/vtableStubs.hpp" #include "interpreter/interpreter.hpp" #include "oops/compiledICHolder.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/vframeArray.hpp" #include "vmreg_zero.inline.hpp" diff --git a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp index bdaec67cd73..9d64fb99e94 100644 --- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp +++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2010, 2015 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -261,10 +261,6 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_atomic_add_entry = ShouldNotCallThisStub(); StubRoutines::_atomic_add_ptr_entry = ShouldNotCallThisStub(); StubRoutines::_fence_entry = ShouldNotCallThisStub(); - - // amd64 does this here, sparc does it in generate_all() - StubRoutines::_handler_for_unsafe_access_entry = - ShouldNotCallThisStub(); } void generate_all() { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java index 85b163bcd02..65b804d0857 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/module-info.java @@ -28,7 +28,6 @@ module jdk.hotspot.agent { requires java.desktop; requires java.rmi; requires java.scripting; - requires jdk.jcmd; requires jdk.jdi; // RMI needs to serialize types in this package @@ -37,13 +36,4 @@ module jdk.hotspot.agent { provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SADebugServerAttachingConnector; provides com.sun.jdi.connect.Connector with sun.jvm.hotspot.jdi.SAPIDAttachingConnector; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.JStack; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.JInfo; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.ClassLoaderStats; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.FinalizerInfo; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.HeapDumper; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.HeapSummary; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.ObjectHistogram; - provides jdk.internal.vm.agent.spi.ToolProvider with sun.jvm.hotspot.tools.PMap; } - diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java index dfbbb6ff440..83c86051ba9 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/SALauncher.java @@ -73,6 +73,7 @@ public class SALauncher { System.out.println(" \tto print same info as Solaris pmap"); System.out.println(" --heap\tto print java heap summary"); System.out.println(" --binaryheap\tto dump java heap in hprof binary format"); + System.out.println(" --dumpfile\tname of the dump file"); System.out.println(" --histo\tto print histogram of java object heap"); System.out.println(" --clstats\tto print class loader statistics"); System.out.println(" --finalizerinfo\tto print information on objects awaiting finalization"); @@ -241,13 +242,15 @@ public class SALauncher { private static void runJMAP(String[] oldArgs) { SAGetopt sg = new SAGetopt(oldArgs); String[] longOpts = {"exe=", "core=", "pid=", - "heap", "binaryheap", "histo", "clstats", "finalizerinfo"}; + "heap", "binaryheap", "dumpfile=", "histo", "clstats", "finalizerinfo"}; ArrayList newArgs = new ArrayList(); String pid = null; String exe = null; String core = null; String s = null; + String dumpfile = null; + boolean requestHeapdump = false; while((s = sg.next(null, longOpts)) != null) { if (s.equals("exe")) { @@ -267,7 +270,11 @@ public class SALauncher { continue; } if (s.equals("binaryheap")) { - newArgs.add("-heap:format=b"); + requestHeapdump = true; + continue; + } + if (s.equals("dumpfile")) { + dumpfile = sg.getOptarg(); continue; } if (s.equals("histo")) { @@ -284,6 +291,17 @@ public class SALauncher { } } + if (!requestHeapdump && (dumpfile != null)) { + throw new IllegalArgumentException("Unexpected argument dumpfile"); + } + if (requestHeapdump) { + if (dumpfile == null) { + newArgs.add("-heap:format=b"); + } else { + newArgs.add("-heap:format=b,file=" + dumpfile); + } + } + buildAttachArgs(newArgs, pid, exe, core, false); JMap.main(newArgs.toArray(new String[newArgs.size()])); } diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/AdapterBlob.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/AdapterBlob.java index 654a733bb2b..378e11858c4 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/AdapterBlob.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/AdapterBlob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; -public class AdapterBlob extends CodeBlob { +public class AdapterBlob extends RuntimeBlob { static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/BufferBlob.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/BufferBlob.java index 5fa98b63fe3..d80eb9cd49e 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/BufferBlob.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/BufferBlob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -29,7 +29,7 @@ import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; -public class BufferBlob extends CodeBlob { +public class BufferBlob extends RuntimeBlob { static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java index a018ab83014..89bc1fcfce2 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CodeBlob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -19,84 +19,142 @@ * 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.code; -import java.io.*; -import java.util.*; +import sun.jvm.hotspot.compiler.ImmutableOopMap; +import sun.jvm.hotspot.compiler.ImmutableOopMapSet; +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.runtime.VMObject; +import sun.jvm.hotspot.types.AddressField; +import sun.jvm.hotspot.types.CIntegerField; +import sun.jvm.hotspot.types.Type; +import sun.jvm.hotspot.types.TypeDataBase; +import sun.jvm.hotspot.utilities.Assert; -import sun.jvm.hotspot.compiler.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; +import java.io.PrintStream; +import java.util.Observable; +import java.util.Observer; public class CodeBlob extends VMObject { - private static AddressField nameField; + private static AddressField nameField; private static CIntegerField sizeField; private static CIntegerField headerSizeField; - private static CIntegerField relocationSizeField; - private static CIntegerField contentOffsetField; - private static CIntegerField codeOffsetField; + private static AddressField contentBeginField; + private static AddressField codeBeginField; + private static AddressField codeEndField; + private static AddressField dataEndField; private static CIntegerField frameCompleteOffsetField; private static CIntegerField dataOffsetField; private static CIntegerField frameSizeField; private static AddressField oopMapsField; - // Only used by server compiler on x86; computed over in SA rather - // than relying on computation in target VM - private static final int NOT_YET_COMPUTED = -2; - private static final int UNDEFINED = -1; - private int linkOffset = NOT_YET_COMPUTED; - private static int matcherInterpreterFramePointerReg; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); + public CodeBlob(Address addr) { + super(addr); } + protected static int matcherInterpreterFramePointerReg; + private static void initialize(TypeDataBase db) { Type type = db.lookupType("CodeBlob"); nameField = type.getAddressField("_name"); sizeField = type.getCIntegerField("_size"); headerSizeField = type.getCIntegerField("_header_size"); - relocationSizeField = type.getCIntegerField("_relocation_size"); frameCompleteOffsetField = type.getCIntegerField("_frame_complete_offset"); - contentOffsetField = type.getCIntegerField("_content_offset"); - codeOffsetField = type.getCIntegerField("_code_offset"); + contentBeginField = type.getAddressField("_content_begin"); + codeBeginField = type.getAddressField("_code_begin"); + codeEndField = type.getAddressField("_code_end"); + dataEndField = type.getAddressField("_data_end"); dataOffsetField = type.getCIntegerField("_data_offset"); frameSizeField = type.getCIntegerField("_frame_size"); oopMapsField = type.getAddressField("_oop_maps"); if (VM.getVM().isServerCompiler()) { matcherInterpreterFramePointerReg = - db.lookupIntConstant("Matcher::interpreter_frame_pointer_reg").intValue(); + db.lookupIntConstant("Matcher::interpreter_frame_pointer_reg").intValue(); } } - public CodeBlob(Address addr) { - super(addr); + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); } + public Address headerBegin() { return getAddress(); } + + public Address headerEnd() { return getAddress().addOffsetTo(getHeaderSize()); } + + public Address contentBegin() { return contentBeginField.getValue(addr); } + + public Address contentEnd() { return headerBegin().addOffsetTo(getDataOffset()); } + + public Address codeBegin() { return codeBeginField.getValue(addr); } + + public Address codeEnd() { return codeEndField.getValue(addr); } + + public Address dataBegin() { return headerBegin().addOffsetTo(getDataOffset()); } + + public Address dataEnd() { return dataEndField.getValue(addr); } + + public long getFrameCompleteOffset() { return frameCompleteOffsetField.getValue(addr); } + + public int getDataOffset() { return (int) dataOffsetField.getValue(addr); } + + // Sizes + public int getSize() { return (int) sizeField.getValue(addr); } + + public int getHeaderSize() { return (int) headerSizeField.getValue(addr); } + + public long getFrameSizeWords() { + return (int) frameSizeField.getValue(addr); + } + + public String getName() { + return getName(); + } + + /** OopMap for frame; can return null if none available */ + + public ImmutableOopMapSet getOopMaps() { + Address value = oopMapsField.getValue(addr); + if (value == null) { + return null; + } + return new ImmutableOopMapSet(value); + } + + // Typing public boolean isBufferBlob() { return false; } + + public boolean isAOT() { return false; } + + public boolean isCompiled() { return false; } + public boolean isNMethod() { return false; } + public boolean isRuntimeStub() { return false; } + public boolean isDeoptimizationStub() { return false; } + public boolean isUncommonTrapStub() { return false; } + public boolean isExceptionStub() { return false; } + public boolean isSafepointStub() { return false; } + public boolean isAdapterBlob() { return false; } // Fine grain nmethod support: isNmethod() == isJavaMethod() || isNativeMethod() || isOSRMethod() public boolean isJavaMethod() { return false; } + public boolean isNativeMethod() { return false; } + /** On-Stack Replacement method */ public boolean isOSRMethod() { return false; } @@ -105,81 +163,32 @@ public class CodeBlob extends VMObject { return null; } - // Boundaries - public Address headerBegin() { - return addr; - } - - public Address headerEnd() { - return addr.addOffsetTo(headerSizeField.getValue(addr)); - } - - // FIXME: add RelocInfo - // public RelocInfo relocationBegin(); - // public RelocInfo relocationEnd(); - - public Address contentBegin() { - return headerBegin().addOffsetTo(contentOffsetField.getValue(addr)); - } - - public Address contentEnd() { - return headerBegin().addOffsetTo(dataOffsetField.getValue(addr)); - } - - public Address codeBegin() { - return headerBegin().addOffsetTo(contentOffsetField.getValue(addr)); - } - - public Address codeEnd() { - return headerBegin().addOffsetTo(dataOffsetField.getValue(addr)); - } - - public Address dataBegin() { - return headerBegin().addOffsetTo(dataOffsetField.getValue(addr)); - } - - public Address dataEnd() { - return headerBegin().addOffsetTo(sizeField.getValue(addr)); - } - - // Offsets - public int getRelocationOffset() { return (int) headerSizeField .getValue(addr); } - public int getContentOffset() { return (int) contentOffsetField.getValue(addr); } - public int getCodeOffset() { return (int) codeOffsetField .getValue(addr); } - public int getDataOffset() { return (int) dataOffsetField .getValue(addr); } - - // Sizes - public int getSize() { return (int) sizeField .getValue(addr); } - public int getHeaderSize() { return (int) headerSizeField.getValue(addr); } // FIXME: add getRelocationSize() public int getContentSize() { return (int) contentEnd().minus(contentBegin()); } + public int getCodeSize() { return (int) codeEnd() .minus(codeBegin()); } + public int getDataSize() { return (int) dataEnd() .minus(dataBegin()); } // Containment public boolean blobContains(Address addr) { return headerBegin() .lessThanOrEqual(addr) && dataEnd() .greaterThan(addr); } + // FIXME: add relocationContains public boolean contentContains(Address addr) { return contentBegin().lessThanOrEqual(addr) && contentEnd().greaterThan(addr); } + public boolean codeContains(Address addr) { return codeBegin() .lessThanOrEqual(addr) && codeEnd() .greaterThan(addr); } + public boolean dataContains(Address addr) { return dataBegin() .lessThanOrEqual(addr) && dataEnd() .greaterThan(addr); } + public boolean contains(Address addr) { return contentContains(addr); } - public boolean isFrameCompleteAt(Address a) { return codeContains(a) && a.minus(codeBegin()) >= frameCompleteOffsetField.getValue(addr); } + + public boolean isFrameCompleteAt(Address a) { return codeContains(a) && a.minus(codeBegin()) >= getFrameCompleteOffset(); } // Reclamation support (really only used by the nmethods, but in order to get asserts to work // in the CodeCache they are defined virtual here) public boolean isZombie() { return false; } - public boolean isLockedByVM() { return false; } - /** OopMap for frame; can return null if none available */ - public ImmutableOopMapSet getOopMaps() { - Address oopMapsAddr = oopMapsField.getValue(addr); - if (oopMapsAddr == null) { - return null; - } - return new ImmutableOopMapSet(oopMapsAddr); - } - // FIXME: not yet implementable - // void set_oop_maps(ImmutableOopMapSet* p); + public boolean isLockedByVM() { return false; } public ImmutableOopMap getOopMapForReturnAddress(Address returnAddress, boolean debugging) { Address pc = returnAddress; @@ -189,25 +198,14 @@ public class CodeBlob extends VMObject { return getOopMaps().findMapAtOffset(pc.minus(codeBegin()), debugging); } - // virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, void f(oop*)) { ShouldNotReachHere(); } - // FIXME; - /** NOTE: this returns a size in BYTES in this system! */ public long getFrameSize() { - return VM.getVM().getAddressSize() * frameSizeField.getValue(addr); + return VM.getVM().getAddressSize() * getFrameSizeWords(); } // Returns true, if the next frame is responsible for GC'ing oops passed as arguments public boolean callerMustGCArguments() { return false; } - public String getName() { - return CStringUtilities.getString(nameField.getValue(addr)); - } - - // FIXME: NOT FINISHED - - // FIXME: add more accessors - public void print() { printOn(System.out); } diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CompiledMethod.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CompiledMethod.java new file mode 100644 index 00000000000..9f883360be9 --- /dev/null +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/CompiledMethod.java @@ -0,0 +1,74 @@ +/* + * 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 sun.jvm.hotspot.code; + +import java.util.*; + +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.oops.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +public abstract class CompiledMethod extends CodeBlob { + private static AddressField methodField; + private static AddressField deoptHandlerBeginField; + private static AddressField deoptMhHandlerBeginField; + private static AddressField scopesDataBeginField; + + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static void initialize(TypeDataBase db) { + Type type = db.lookupType("CompiledMethod"); + + methodField = type.getAddressField("_method"); + deoptHandlerBeginField = type.getAddressField("_deopt_handler_begin"); + deoptMhHandlerBeginField = type.getAddressField("_deopt_mh_handler_begin"); + scopesDataBeginField = type.getAddressField("_scopes_data_begin"); + } + + public CompiledMethod(Address addr) { + super(addr); + } + + public Method getMethod() { + return (Method)Metadata.instantiateWrapperFor(methodField.getValue(addr)); + } + + public Address deoptHandlerBegin() { return deoptHandlerBeginField.getValue(addr); } + public Address deoptMhHandlerBegin() { return deoptMhHandlerBeginField.getValue(addr); } + public Address scopesDataBegin() { return scopesDataBeginField.getValue(addr); } + + public static int getMethodOffset() { return (int) methodField.getOffset(); } + + @Override + public boolean isCompiled() { + return true; + } +} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java index df8202dbd41..f2ae000b8df 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/NMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -27,15 +27,13 @@ package sun.jvm.hotspot.code; import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; import sun.jvm.hotspot.utilities.*; -public class NMethod extends CodeBlob { +public class NMethod extends CompiledMethod { private static long pcDescSize; - private static AddressField methodField; /** != InvocationEntryBci if this nmethod is an on-stack replacement method */ private static CIntegerField entryBCIField; /** To support simple linked-list chaining of nmethods */ @@ -45,13 +43,10 @@ public class NMethod extends CodeBlob { /** Offsets for different nmethod parts */ private static CIntegerField exceptionOffsetField; - private static CIntegerField deoptOffsetField; - private static CIntegerField deoptMhOffsetField; private static CIntegerField origPCOffsetField; private static CIntegerField stubOffsetField; private static CIntegerField oopsOffsetField; private static CIntegerField metadataOffsetField; - private static CIntegerField scopesDataOffsetField; private static CIntegerField scopesPCsOffsetField; private static CIntegerField dependenciesOffsetField; private static CIntegerField handlerTableOffsetField; @@ -91,20 +86,16 @@ public class NMethod extends CodeBlob { private static void initialize(TypeDataBase db) { Type type = db.lookupType("nmethod"); - methodField = type.getAddressField("_method"); entryBCIField = type.getCIntegerField("_entry_bci"); osrLinkField = type.getAddressField("_osr_link"); scavengeRootLinkField = type.getAddressField("_scavenge_root_link"); scavengeRootStateField = type.getJByteField("_scavenge_root_state"); exceptionOffsetField = type.getCIntegerField("_exception_offset"); - deoptOffsetField = type.getCIntegerField("_deoptimize_offset"); - deoptMhOffsetField = type.getCIntegerField("_deoptimize_mh_offset"); origPCOffsetField = type.getCIntegerField("_orig_pc_offset"); stubOffsetField = type.getCIntegerField("_stub_offset"); oopsOffsetField = type.getCIntegerField("_oops_offset"); metadataOffsetField = type.getCIntegerField("_metadata_offset"); - scopesDataOffsetField = type.getCIntegerField("_scopes_data_offset"); scopesPCsOffsetField = type.getCIntegerField("_scopes_pcs_offset"); dependenciesOffsetField = type.getCIntegerField("_dependencies_offset"); handlerTableOffsetField = type.getCIntegerField("_handler_table_offset"); @@ -123,16 +114,11 @@ public class NMethod extends CodeBlob { super(addr); } - // Accessors public Address getAddress() { return addr; } - public Method getMethod() { - return (Method)Metadata.instantiateWrapperFor(methodField.getValue(addr)); - } - // Type info public boolean isNMethod() { return true; } public boolean isJavaMethod() { return !getMethod().isNative(); } @@ -145,15 +131,12 @@ public class NMethod extends CodeBlob { public Address instsBegin() { return codeBegin(); } public Address instsEnd() { return headerBegin().addOffsetTo(getStubOffset()); } public Address exceptionBegin() { return headerBegin().addOffsetTo(getExceptionOffset()); } - public Address deoptHandlerBegin() { return headerBegin().addOffsetTo(getDeoptOffset()); } - public Address deoptMhHandlerBegin() { return headerBegin().addOffsetTo(getDeoptMhOffset()); } public Address stubBegin() { return headerBegin().addOffsetTo(getStubOffset()); } public Address stubEnd() { return headerBegin().addOffsetTo(getOopsOffset()); } public Address oopsBegin() { return headerBegin().addOffsetTo(getOopsOffset()); } public Address oopsEnd() { return headerBegin().addOffsetTo(getMetadataOffset()); } public Address metadataBegin() { return headerBegin().addOffsetTo(getMetadataOffset()); } - public Address metadataEnd() { return headerBegin().addOffsetTo(getScopesDataOffset()); } - public Address scopesDataBegin() { return headerBegin().addOffsetTo(getScopesDataOffset()); } + public Address metadataEnd() { return scopesDataBegin(); } public Address scopesDataEnd() { return headerBegin().addOffsetTo(getScopesPCsOffset()); } public Address scopesPCsBegin() { return headerBegin().addOffsetTo(getScopesPCsOffset()); } public Address scopesPCsEnd() { return headerBegin().addOffsetTo(getDependenciesOffset()); } @@ -462,8 +445,6 @@ public class NMethod extends CodeBlob { public static int getVerifiedEntryPointOffset() { return (int) verifiedEntryPointField.getOffset(); } public static int getOSREntryPointOffset() { return (int) osrEntryPointField.getOffset(); } public static int getEntryBCIOffset() { return (int) entryBCIField.getOffset(); } - /** NOTE: renamed from "method_offset_in_bytes" */ - public static int getMethodOffset() { return (int) methodField.getOffset(); } public void print() { printOn(System.out); @@ -541,12 +522,9 @@ public class NMethod extends CodeBlob { private int getEntryBCI() { return (int) entryBCIField .getValue(addr); } private int getExceptionOffset() { return (int) exceptionOffsetField .getValue(addr); } - private int getDeoptOffset() { return (int) deoptOffsetField .getValue(addr); } - private int getDeoptMhOffset() { return (int) deoptMhOffsetField .getValue(addr); } private int getStubOffset() { return (int) stubOffsetField .getValue(addr); } private int getOopsOffset() { return (int) oopsOffsetField .getValue(addr); } private int getMetadataOffset() { return (int) metadataOffsetField .getValue(addr); } - private int getScopesDataOffset() { return (int) scopesDataOffsetField .getValue(addr); } private int getScopesPCsOffset() { return (int) scopesPCsOffsetField .getValue(addr); } private int getDependenciesOffset() { return (int) dependenciesOffsetField.getValue(addr); } private int getHandlerTableOffset() { return (int) handlerTableOffsetField.getValue(addr); } diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeBlob.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeBlob.java new file mode 100644 index 00000000000..c4077f995b0 --- /dev/null +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeBlob.java @@ -0,0 +1,58 @@ +/* + * 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 sun.jvm.hotspot.code; + +import java.util.*; + +import sun.jvm.hotspot.compiler.*; +import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; +import sun.jvm.hotspot.utilities.*; + +public class RuntimeBlob extends CodeBlob { + + // Only used by server compiler on x86; computed over in SA rather + // than relying on computation in target VM + private static final int NOT_YET_COMPUTED = -2; + private static final int UNDEFINED = -1; + private int linkOffset = NOT_YET_COMPUTED; + + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static void initialize(TypeDataBase db) { + Type type = db.lookupType("RuntimeBlob"); + } + + public RuntimeBlob(Address addr) { + super(addr); + } +} diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeStub.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeStub.java index fd0d72aaace..98e3dc0cf81 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeStub.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/RuntimeStub.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -29,7 +29,7 @@ import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; -public class RuntimeStub extends CodeBlob { +public class RuntimeStub extends RuntimeBlob { private static CIntegerField callerMustGCArgumentsField; static { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/SingletonBlob.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/SingletonBlob.java index 32614929813..6d56f485a34 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/SingletonBlob.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/SingletonBlob.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -29,7 +29,7 @@ import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.types.*; -public class SingletonBlob extends CodeBlob { +public class SingletonBlob extends RuntimeBlob { static { VM.registerVMInitializedObserver(new Observer() { public void update(Observable o, Object data) { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java index cefdcf2aa30..46d087332ac 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/SymbolTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -85,6 +85,12 @@ public class SymbolTable extends sun.jvm.hotspot.utilities.Hashtable { tables. */ public Symbol probe(byte[] name) { long hashValue = hashSymbol(name); + + Symbol s = sharedTable.probe(name, hashValue); + if (s != null) { + return s; + } + for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) { if (e.hash() == hashValue) { Symbol sym = Symbol.create(e.literalValue()); @@ -94,7 +100,7 @@ public class SymbolTable extends sun.jvm.hotspot.utilities.Hashtable { } } - return sharedTable.probe(name, hashValue); + return null; } public interface SymbolVisitor { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/BreakpointInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/BreakpointInfo.java index af62d291e46..207810dd99b 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/BreakpointInfo.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/BreakpointInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,6 +46,11 @@ public class BreakpointInfo extends VMObject { } private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { + if (!VM.getVM().isJvmtiSupported()) { + // no BreakpointInfo support without JVMTI + return; + } + Type type = db.lookupType("BreakpointInfo"); origBytecodeField = type.getCIntegerField("_orig_bytecode"); diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index d2f15f0c606..de1221628ad 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -85,7 +85,9 @@ public class InstanceKlass extends Klass { isMarkedDependent = new CIntField(type.getCIntegerField("_is_marked_dependent"), 0); initState = new CIntField(type.getCIntegerField("_init_state"), 0); itableLen = new CIntField(type.getCIntegerField("_itable_len"), 0); - breakpoints = type.getAddressField("_breakpoints"); + if (VM.getVM().isJvmtiSupported()) { + breakpoints = type.getAddressField("_breakpoints"); + } genericSignatureIndex = new CIntField(type.getCIntegerField("_generic_signature_index"), 0); majorVersion = new CIntField(type.getCIntegerField("_major_version"), 0); minorVersion = new CIntField(type.getCIntegerField("_minor_version"), 0); @@ -837,6 +839,9 @@ public class InstanceKlass extends Klass { /** Breakpoint support (see methods on Method* for details) */ public BreakpointInfo getBreakpoints() { + if (!VM.getVM().isJvmtiSupported()) { + return null; + } Address addr = getAddress().getAddressAt(breakpoints.getOffset()); return (BreakpointInfo) VMObjectFactory.newObject(BreakpointInfo.class, addr); } diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java index 09bb426cfb3..a69b3ceb0b8 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -87,6 +87,8 @@ public class VM { private StubRoutines stubRoutines; private Bytes bytes; + /** Flag indicating if JVMTI support is included in the build */ + private boolean isJvmtiSupported; /** Flags indicating whether we are attached to a core, C1, or C2 build */ private boolean usingClientCompiler; private boolean usingServerCompiler; @@ -324,8 +326,9 @@ public class VM { Address vmInternalInfoAddr = vmVersion.getAddressField("_s_internal_vm_info_string").getValue(); vmInternalInfo = CStringUtilities.getString(vmInternalInfoAddr); + Type threadLocalAllocBuffer = db.lookupType("ThreadLocalAllocBuffer"); CIntegerType intType = (CIntegerType) db.lookupType("int"); - CIntegerField reserveForAllocationPrefetchField = vmVersion.getCIntegerField("_reserve_for_allocation_prefetch"); + CIntegerField reserveForAllocationPrefetchField = threadLocalAllocBuffer.getCIntegerField("_reserve_for_allocation_prefetch"); reserveForAllocationPrefetch = (int)reserveForAllocationPrefetchField.getCInteger(intType); } catch (Exception exp) { throw new RuntimeException("can't determine target's VM version : " + exp.getMessage()); @@ -336,6 +339,16 @@ public class VM { stackBias = db.lookupIntConstant("STACK_BIAS").intValue(); invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue(); + // We infer the presence of JVMTI from the presence of the InstanceKlass::_breakpoints field. + { + Type type = db.lookupType("InstanceKlass"); + if (type.getField("_breakpoints", false, false) == null) { + isJvmtiSupported = false; + } else { + isJvmtiSupported = true; + } + } + // We infer the presence of C1 or C2 from a couple of fields we // already have present in the type database { @@ -701,6 +714,11 @@ public class VM { return isBigEndian; } + /** Returns true if JVMTI is supported, false otherwise */ + public boolean isJvmtiSupported() { + return isJvmtiSupported; + } + /** Returns true if this is a "core" build, false if either C1 or C2 is present */ public boolean isCore() { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java index 558117e30ca..80b6c79e608 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/aarch64/AARCH64Frame.java @@ -49,11 +49,12 @@ public class AARCH64Frame extends Frame { private static final int SENDER_SP_OFFSET = 2; // Interpreter frames - private static final int INTERPRETER_FRAME_MIRROR_OFFSET = 2; // for native calls only private static final int INTERPRETER_FRAME_SENDER_SP_OFFSET = -1; private static final int INTERPRETER_FRAME_LAST_SP_OFFSET = INTERPRETER_FRAME_SENDER_SP_OFFSET - 1; private static final int INTERPRETER_FRAME_METHOD_OFFSET = INTERPRETER_FRAME_LAST_SP_OFFSET - 1; private static int INTERPRETER_FRAME_MDX_OFFSET; // Non-core builds only + private static int INTERPRETER_FRAME_PADDING_OFFSET; + private static int INTERPRETER_FRAME_MIRROR_OFFSET; private static int INTERPRETER_FRAME_CACHE_OFFSET; private static int INTERPRETER_FRAME_LOCALS_OFFSET; private static int INTERPRETER_FRAME_BCX_OFFSET; @@ -79,7 +80,9 @@ public class AARCH64Frame extends Frame { private static synchronized void initialize(TypeDataBase db) { INTERPRETER_FRAME_MDX_OFFSET = INTERPRETER_FRAME_METHOD_OFFSET - 1; - INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1; + INTERPRETER_FRAME_PADDING_OFFSET = INTERPRETER_FRAME_MDX_OFFSET - 1; + INTERPRETER_FRAME_MIRROR_OFFSET = INTERPRETER_FRAME_PADDING_OFFSET - 1; + INTERPRETER_FRAME_CACHE_OFFSET = INTERPRETER_FRAME_MIRROR_OFFSET - 1; INTERPRETER_FRAME_LOCALS_OFFSET = INTERPRETER_FRAME_CACHE_OFFSET - 1; INTERPRETER_FRAME_BCX_OFFSET = INTERPRETER_FRAME_LOCALS_OFFSET - 1; INTERPRETER_FRAME_INITIAL_SP_OFFSET = INTERPRETER_FRAME_BCX_OFFSET - 1; diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java index 34f5bfbefef..8dac3a84656 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java @@ -32,13 +32,12 @@ import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; import sun.jvm.hotspot.utilities.*; -import jdk.internal.vm.agent.spi.ToolProvider; /** A command line tool to print class loader statistics. */ -public class ClassLoaderStats extends Tool implements ToolProvider { +public class ClassLoaderStats extends Tool { boolean verbose = true; public ClassLoaderStats() { @@ -54,11 +53,6 @@ public class ClassLoaderStats extends Tool implements ToolProvider { return "classLoaderStats"; } - @Override - public void run(String... arguments) { - execute(arguments); - } - public static void main(String[] args) { ClassLoaderStats cls = new ClassLoaderStats(); cls.execute(args); diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java index 9da8e523afb..3f5c55a46d6 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java @@ -28,7 +28,6 @@ import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.utilities.SystemDictionaryHelper; -import jdk.internal.vm.agent.spi.ToolProvider; import java.util.ArrayList; import java.util.Collections; @@ -39,7 +38,7 @@ import java.util.HashMap; * Iterates over the queue of object pending finalization and prints a * summary of these objects in the form of a histogram. */ -public class FinalizerInfo extends Tool implements ToolProvider { +public class FinalizerInfo extends Tool { public FinalizerInfo() { super(); @@ -54,11 +53,6 @@ public class FinalizerInfo extends Tool implements ToolProvider { return "finalizerInfo"; } - @Override - public void run(String... arguments) { - execute(arguments); - } - public static void main(String[] args) { FinalizerInfo finfo = new FinalizerInfo(); finfo.execute(args); diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapDumper.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapDumper.java index d0a11abd095..b2cf190bf3b 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapDumper.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapDumper.java @@ -26,7 +26,6 @@ package sun.jvm.hotspot.tools; import sun.jvm.hotspot.utilities.HeapHprofBinWriter; import sun.jvm.hotspot.debugger.JVMDebugger; -import jdk.internal.vm.agent.spi.ToolProvider; import java.io.IOException; @@ -35,7 +34,7 @@ import java.io.IOException; * process/core as a HPROF binary file. It can also be used as a standalone * tool if required. */ -public class HeapDumper extends Tool implements ToolProvider { +public class HeapDumper extends Tool { private static String DEFAULT_DUMP_FILE = "heap.bin"; @@ -81,11 +80,10 @@ public class HeapDumper extends Tool implements ToolProvider { // HeapDumper -f public static void main(String args[]) { HeapDumper dumper = new HeapDumper(); - dumper.run(args); + dumper.runWithArgs(args); } - @Override - public void run(String... args) { + public void runWithArgs(String... args) { if (args.length > 2) { if (args[0].equals("-f")) { this.dumpFile = args[1]; diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java index 5c1012bf644..643109bc1e9 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java @@ -33,9 +33,8 @@ import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; -import jdk.internal.vm.agent.spi.ToolProvider; -public class HeapSummary extends Tool implements ToolProvider { +public class HeapSummary extends Tool { public HeapSummary() { super(); @@ -55,11 +54,6 @@ public class HeapSummary extends Tool implements ToolProvider { return "heapSummary"; } - @Override - public void run(String... arguments) { - execute(arguments); - } - public void run() { CollectedHeap heap = VM.getVM().getUniverse().heap(); VM.Flag[] flags = VM.getVM().getCommandLineFlags(); diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JInfo.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JInfo.java index 50f9c30975b..3e724b979a0 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JInfo.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JInfo.java @@ -27,9 +27,8 @@ package sun.jvm.hotspot.tools; import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.runtime.Arguments; import sun.jvm.hotspot.runtime.VM; -import jdk.internal.vm.agent.spi.ToolProvider; -public class JInfo extends Tool implements ToolProvider { +public class JInfo extends Tool { public JInfo() { super(); } @@ -46,6 +45,7 @@ public class JInfo extends Tool implements ToolProvider { return false; } + @Override public String getName() { return "jinfo"; } @@ -95,8 +95,7 @@ public class JInfo extends Tool implements ToolProvider { tool.run(); } - @Override - public void run(String... args) { + public void runWithArgs(String... args) { int mode = -1; switch (args.length) { case 1: @@ -142,7 +141,7 @@ public class JInfo extends Tool implements ToolProvider { public static void main(String[] args) { JInfo jinfo = new JInfo(); - jinfo.run(args); + jinfo.runWithArgs(args); } private void printVMFlags() { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java index 847eac19468..21842a88a8f 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JMap.java @@ -71,6 +71,8 @@ public class JMap extends Tool { public static final int MODE_HEAP_GRAPH_GXL = 5; public static final int MODE_FINALIZERINFO = 6; + private static String dumpfile = "heap.bin"; + public void run() { Tool tool = null; switch (mode) { @@ -92,11 +94,11 @@ public class JMap extends Tool { break; case MODE_HEAP_GRAPH_HPROF_BIN: - writeHeapHprofBin(); + writeHeapHprofBin(dumpfile); return; case MODE_HEAP_GRAPH_GXL: - writeHeapGXL(); + writeHeapGXL(dumpfile); return; case MODE_FINALIZERINFO: @@ -127,18 +129,34 @@ public class JMap extends Tool { } else if (modeFlag.equals("-finalizerinfo")) { mode = MODE_FINALIZERINFO; } else { - int index = modeFlag.indexOf("-heap:format="); + int index = modeFlag.indexOf("-heap:"); if (index != -1) { - String format = modeFlag.substring(1 + modeFlag.indexOf('=')); - if (format.equals("b")) { - mode = MODE_HEAP_GRAPH_HPROF_BIN; - } else if (format.equals("x")) { - mode = MODE_HEAP_GRAPH_GXL; - } else { - System.err.println("unknown heap format:" + format); + String[] options = modeFlag.substring(6).split(","); + for (String option : options) { + String[] keyValue = option.split("="); + if (keyValue[0].equals("format")) { + if (keyValue[1].equals("b")) { + mode = MODE_HEAP_GRAPH_HPROF_BIN; + } else if (keyValue[1].equals("x")) { + mode = MODE_HEAP_GRAPH_GXL; + } else { + System.err.println("unknown heap format:" + keyValue[0]); - // Exit with error status - System.exit(1); + // Exit with error status + System.exit(1); + } + } else if (keyValue[0].equals("file")) { + if ((keyValue[1] == null) || keyValue[1].equals("")) { + System.err.println("File name must be set."); + System.exit(1); + } + dumpfile = keyValue[1]; + } else { + System.err.println("unknown option:" + keyValue[0]); + + // Exit with error status + System.exit(1); + } } } else { copyArgs = false; diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JStack.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JStack.java index 821ed388853..65757702645 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JStack.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/JStack.java @@ -25,9 +25,8 @@ package sun.jvm.hotspot.tools; import sun.jvm.hotspot.debugger.JVMDebugger; -import jdk.internal.vm.agent.spi.ToolProvider; -public class JStack extends Tool implements ToolProvider { +public class JStack extends Tool { public JStack(boolean mixedMode, boolean concurrentLocks) { this.mixedMode = mixedMode; this.concurrentLocks = concurrentLocks; @@ -45,6 +44,7 @@ public class JStack extends Tool implements ToolProvider { return false; } + @Override public String getName() { return "jstack"; } @@ -67,8 +67,7 @@ public class JStack extends Tool implements ToolProvider { tool.run(); } - @Override - public void run(String... args) { + public void runWithArgs(String... args) { int used = 0; for (int i = 0; i < args.length; i++) { if (args[i].equals("-m")) { @@ -93,7 +92,7 @@ public class JStack extends Tool implements ToolProvider { public static void main(String[] args) { JStack jstack = new JStack(); - jstack.run(args); + jstack.runWithArgs(args); } private boolean mixedMode; diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java index 0dc100eebe5..414f857df35 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java @@ -27,52 +27,46 @@ package sun.jvm.hotspot.tools; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; -import jdk.internal.vm.agent.spi.ToolProvider; import java.io.PrintStream; /** A sample tool which uses the Serviceability Agent's APIs to obtain an object histogram from a remote or crashed VM. */ -public class ObjectHistogram extends Tool implements ToolProvider { +public class ObjectHistogram extends Tool { public ObjectHistogram() { - super(); + super(); } public ObjectHistogram(JVMDebugger d) { - super(d); + super(d); } @Override public String getName() { - return "objectHistogram"; + return "objectHistogram"; } - @Override - public void run(String... arguments) { - execute(arguments); + public void run() { + run(System.out, System.err); } - public void run() { - run(System.out, System.err); - } - - public void run(PrintStream out, PrintStream err) { - // Ready to go with the database... - ObjectHeap heap = VM.getVM().getObjectHeap(); - sun.jvm.hotspot.oops.ObjectHistogram histogram = + public void run(PrintStream out, PrintStream err) { + // Ready to go with the database... + ObjectHeap heap = VM.getVM().getObjectHeap(); + sun.jvm.hotspot.oops.ObjectHistogram histogram = new sun.jvm.hotspot.oops.ObjectHistogram(); - err.println("Iterating over heap. This may take a while..."); - long startTime = System.currentTimeMillis(); - heap.iterate(histogram); - long endTime = System.currentTimeMillis(); - histogram.printOn(out); - float secs = (float) (endTime - startTime) / 1000.0f; - err.println("Heap traversal took " + secs + " seconds."); - } + err.println("Iterating over heap. This may take a while..."); + long startTime = System.currentTimeMillis(); + heap.iterate(histogram); + long endTime = System.currentTimeMillis(); + histogram.printOn(out); + float secs = (float) (endTime - startTime) / 1000.0f; + err.println("Heap traversal took " + secs + " seconds."); + } - public static void main(String[] args) { - ObjectHistogram oh = new ObjectHistogram(); - oh.execute(args); - } + public static void main(String[] args) { + ObjectHistogram oh = new ObjectHistogram(); + oh.execute(args); + } } diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PMap.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PMap.java index 0c0ccbf6c8c..484994c666e 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PMap.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PMap.java @@ -28,9 +28,8 @@ import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.cdbg.*; -import jdk.internal.vm.agent.spi.ToolProvider; -public class PMap extends Tool implements ToolProvider { +public class PMap extends Tool { public PMap() { super(); @@ -45,11 +44,6 @@ public class PMap extends Tool implements ToolProvider { return "pmap"; } - @Override - public void run(String... arguments) { - execute(arguments); - } - public void run() { run(System.out); } diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/JavaThreadsPanel.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/JavaThreadsPanel.java index 6316d3538ce..a9397001b84 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/JavaThreadsPanel.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/ui/JavaThreadsPanel.java @@ -39,6 +39,7 @@ import javax.swing.table.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.types.*; import sun.jvm.hotspot.ui.action.*; @@ -55,9 +56,19 @@ public class JavaThreadsPanel extends SAPanel implements ActionListener { private JavaThreadsTableModel dataModel; private StatusBar statusBar; private JTable threadTable; - private java.util.List cachedThreads = new ArrayList(); + private java.util.List cachedThreads = new ArrayList(); + private static AddressField crashThread; + static { + VM.registerVMInitializedObserver( + (o, a) -> initialize(VM.getVM().getTypeDataBase())); + } + + private static void initialize(TypeDataBase db) { + crashThread = db.lookupType("VMError").getAddressField("_thread"); + } + /** Constructor assumes the threads panel is created while the VM is suspended. Subsequent resume and suspend operations of the VM will cause the threads panel to clear and fill itself back in, @@ -437,21 +448,14 @@ public class JavaThreadsPanel extends SAPanel implements ActionListener { * @return a flag which indicates if crashes were encountered. */ private boolean fireShowThreadCrashes() { - boolean crash = false; - for (Iterator iter = cachedThreads.iterator(); iter.hasNext(); ) { - JavaThread t = (JavaThread) ((CachedThread) iter.next()).getThread(); - sun.jvm.hotspot.runtime.Frame tmpFrame = t.getCurrentFrameGuess(); - RegisterMap tmpMap = t.newRegisterMap(false); - while ((tmpFrame != null) && (!tmpFrame.isFirstFrame())) { - if (tmpFrame.isSignalHandlerFrameDbg()) { - showThreadStackMemory(t); - crash = true; - break; - } - tmpFrame = tmpFrame.sender(tmpMap); - } - } - return crash; + Optional crashed = + cachedThreads.stream() + .map(t -> t.getThread()) + .filter(t -> t.getAddress().equals( + crashThread.getValue())) + .findAny(); + crashed.ifPresent(this::showThreadStackMemory); + return crashed.isPresent(); } private void cache() { diff --git a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java index e5eefb0daa6..e03a85531fe 100644 --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -44,21 +44,23 @@ public class CompactHashTable extends VMObject { Type type = db.lookupType("SymbolCompactHashTable"); baseAddressField = type.getAddressField("_base_address"); bucketCountField = type.getCIntegerField("_bucket_count"); - tableEndOffsetField = type.getCIntegerField("_table_end_offset"); + entryCountField = type.getCIntegerField("_entry_count"); bucketsField = type.getAddressField("_buckets"); - uintSize = db.lookupType("juint").getSize(); + entriesField = type.getAddressField("_entries"); + uintSize = db.lookupType("u4").getSize(); } // Fields private static CIntegerField bucketCountField; - private static CIntegerField tableEndOffsetField; + private static CIntegerField entryCountField; private static AddressField baseAddressField; private static AddressField bucketsField; + private static AddressField entriesField; private static long uintSize; private static int BUCKET_OFFSET_MASK = 0x3FFFFFFF; private static int BUCKET_TYPE_SHIFT = 30; - private static int COMPACT_BUCKET_TYPE = 1; + private static int VALUE_ONLY_BUCKET_TYPE = 1; public CompactHashTable(Address addr) { super(addr); @@ -68,12 +70,8 @@ public class CompactHashTable extends VMObject { return (int)bucketCountField.getValue(addr); } - private int tableEndOffset() { - return (int)tableEndOffsetField.getValue(addr); - } - - private boolean isCompactBucket(int bucket_info) { - return (bucket_info >> BUCKET_TYPE_SHIFT) == COMPACT_BUCKET_TYPE; + private boolean isValueOnlyBucket(int bucket_info) { + return (bucket_info >> BUCKET_TYPE_SHIFT) == VALUE_ONLY_BUCKET_TYPE; } private int bucketOffset(int bucket_info) { @@ -81,9 +79,8 @@ public class CompactHashTable extends VMObject { } public Symbol probe(byte[] name, long hash) { - - if (bucketCount() == 0) { - // The table is invalid, so don't try to lookup + if (bucketCount() <= 0) { + // This CompactHashTable is not in use return null; } @@ -91,34 +88,33 @@ public class CompactHashTable extends VMObject { Symbol sym; Address baseAddress = baseAddressField.getValue(addr); Address bucket = bucketsField.getValue(addr); - Address bucketEnd = bucket; long index = hash % bucketCount(); int bucketInfo = (int)bucket.getCIntegerAt(index * uintSize, uintSize, true); int bucketOffset = bucketOffset(bucketInfo); int nextBucketInfo = (int)bucket.getCIntegerAt((index+1) * uintSize, uintSize, true); int nextBucketOffset = bucketOffset(nextBucketInfo); - bucket = bucket.addOffsetTo(bucketOffset * uintSize); + Address entry = entriesField.getValue(addr).addOffsetTo(bucketOffset * uintSize); - if (isCompactBucket(bucketInfo)) { - symOffset = bucket.getCIntegerAt(0, uintSize, true); + if (isValueOnlyBucket(bucketInfo)) { + symOffset = entry.getCIntegerAt(0, uintSize, true); sym = Symbol.create(baseAddress.addOffsetTo(symOffset)); if (sym.equals(name)) { return sym; } } else { - bucketEnd = bucket.addOffsetTo(nextBucketOffset * uintSize); - while (bucket.lessThan(bucketEnd)) { - long symHash = bucket.getCIntegerAt(0, uintSize, true); + Address entryMax = entriesField.getValue(addr).addOffsetTo(nextBucketOffset * uintSize); + while (entry.lessThan(entryMax)) { + long symHash = entry.getCIntegerAt(0, uintSize, true); if (symHash == hash) { - symOffset = bucket.getCIntegerAt(uintSize, uintSize, true); + symOffset = entry.getCIntegerAt(uintSize, uintSize, true); Address symAddr = baseAddress.addOffsetTo(symOffset); sym = Symbol.create(symAddr); if (sym.equals(name)) { return sym; } } - bucket = bucket.addOffsetTo(2 * uintSize); + entry = entry.addOffsetTo(2 * uintSize); } } return null; diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/UnsafeUtil.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/UnsafeUtil.java index 7668759da84..9b8f75511c4 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/UnsafeUtil.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.common/src/jdk/vm/ci/common/UnsafeUtil.java @@ -22,7 +22,7 @@ */ package jdk.vm.ci.common; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Utilities for operating on raw memory with {@link Unsafe}. diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java index 09901998ffb..6f2d8c5e6aa 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java @@ -39,7 +39,7 @@ import jdk.vm.ci.inittimer.InitTimer; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Calls from Java into HotSpot. The behavior of all the methods in this class that take a native diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java index a01a304d2a8..dac0fb3a553 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCodeCacheProvider.java @@ -120,7 +120,9 @@ public class HotSpotCodeCacheProvider implements CodeCacheProvider { resultInstalledCode = installedCode; } - int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, (HotSpotSpeculationLog) log); + HotSpotSpeculationLog speculationLog = (log != null && log.hasSpeculations()) ? (HotSpotSpeculationLog) log : null; + + int result = runtime.getCompilerToVM().installCode(target, (HotSpotCompiledCode) compiledCode, resultInstalledCode, speculationLog); if (result != config.codeInstallResultOk) { String resultDesc = config.getCodeInstallResultDescription(result); if (compiledCode instanceof HotSpotCompiledNmethod) { diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotInstalledCode.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotInstalledCode.java index aa8368d9777..98fa1816065 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotInstalledCode.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotInstalledCode.java @@ -25,7 +25,7 @@ package jdk.vm.ci.hotspot; import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.inittimer.SuppressFBWarnings; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Implementation of {@link InstalledCode} for HotSpot. diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java index 12cc5255ead..7d6b4b287ae 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntimeProvider.java @@ -30,7 +30,7 @@ import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.runtime.JVMCIRuntime; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; //JaCoCo Exclude diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java index b824f0cd8d3..6914926d661 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java @@ -146,6 +146,9 @@ class HotSpotMemoryAccessProviderImpl implements HotSpotMemoryAccessProvider, Ho @Override public JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) { + if (kind == null) { + throw new IllegalArgumentException("null JavaKind"); + } if (kind == JavaKind.Object) { Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops); return HotSpotObjectConstantImpl.forObject(o); diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java index f42f9aff6ab..dfdc3ebf3f6 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java @@ -39,7 +39,7 @@ import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.TriState; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Access to a HotSpot MethodData structure (defined in methodData.hpp). diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java index 87cf467f6d7..1293a1083d7 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodHandleAccessProvider.java @@ -130,7 +130,7 @@ public class HotSpotMethodHandleAccessProvider implements MethodHandleAccessProv /* Load non-public field: LambdaForm MethodHandle.form */ JavaConstant lambdaForm = constantReflection.readFieldValue(LazyInitialization.methodHandleFormField, methodHandle); - if (lambdaForm.isNull()) { + if (lambdaForm == null || lambdaForm.isNull()) { return null; } diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java index 6d192ef8a86..75a76e82240 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java @@ -392,18 +392,13 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem return JavaKind.Object; } - @Override - public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { - ResolvedJavaMethod resolvedMethod = resolveMethod(method, callerType); - if (resolvedMethod == null || resolvedMethod.isAbstract()) { - return null; - } - return resolvedMethod; - } - @Override public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { assert !callerType.isArray(); + if (isInterface()) { + // Methods can only be resolved against concrete types + return null; + } if (method.isConcrete() && method.getDeclaringClass().equals(this) && method.isPublic()) { return method; } @@ -887,4 +882,9 @@ final class HotSpotResolvedObjectTypeImpl extends HotSpotResolvedJavaType implem public boolean isTrustedInterfaceType() { return TrustedInterface.class.isAssignableFrom(mirror()); } + + @Override + public boolean isCloneableWithAllocation() { + return (getAccessFlags() & config().jvmAccIsCloneableFast) != 0; + } } diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java index 06e03ae69f2..64f9027fe66 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java @@ -168,11 +168,6 @@ public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType return false; } - @Override - public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { - return null; - } - @Override public ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { return null; @@ -272,4 +267,9 @@ public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType public boolean isTrustedInterfaceType() { return false; } + + @Override + public boolean isCloneableWithAllocation() { + return false; + } } diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java index e619fb45ee7..0cd643fa3ca 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotSpeculationLog.java @@ -38,7 +38,7 @@ public class HotSpotSpeculationLog implements SpeculationLog { /** All speculations that have been a deoptimization reason. */ private Set failedSpeculations; - /** Strong references to all reasons embededded in the current nmethod. */ + /** Strong references to all reasons embedded in the current nmethod. */ private volatile Collection speculations; @Override @@ -81,4 +81,9 @@ public class HotSpotSpeculationLog implements SpeculationLog { return HotSpotObjectConstantImpl.forObject(reason); } + + @Override + public synchronized boolean hasSpeculations() { + return speculations != null && !speculations.isEmpty(); + } } diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java index 72c2552adf3..1f7ffc18a71 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java @@ -38,7 +38,7 @@ import jdk.vm.ci.hotspotvmconfig.HotSpotVMData; import jdk.vm.ci.hotspotvmconfig.HotSpotVMField; import jdk.vm.ci.hotspotvmconfig.HotSpotVMFlag; import jdk.vm.ci.hotspotvmconfig.HotSpotVMType; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; //JaCoCo Exclude @@ -1077,6 +1077,7 @@ public class HotSpotVMConfig { @HotSpotVMConstant(name = "JVM_ACC_FIELD_STABLE") @Stable public int jvmAccFieldStable; @HotSpotVMConstant(name = "JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE") @Stable public int jvmAccFieldHasGenericSignature; @HotSpotVMConstant(name = "JVM_ACC_WRITTEN_FLAGS") @Stable public int jvmAccWrittenFlags; + @HotSpotVMConstant(name = "JVM_ACC_IS_CLONEABLE_FAST") @Stable public int jvmAccIsCloneableFast; // Modifier.SYNTHETIC is not public so we get it via vmStructs. @HotSpotVMConstant(name = "JVM_ACC_SYNTHETIC") @Stable public int jvmAccSynthetic; @@ -1230,7 +1231,7 @@ public class HotSpotVMConfig { @HotSpotVMField(name = "Method::_method_counters", type = "MethodCounters*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCountersOffset; @HotSpotVMField(name = "Method::_method_data", type = "MethodData*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodDataOffset; @HotSpotVMField(name = "Method::_from_compiled_entry", type = "address", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCompiledEntryOffset; - @HotSpotVMField(name = "Method::_code", type = "nmethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset; + @HotSpotVMField(name = "Method::_code", type = "CompiledMethod*", get = HotSpotVMField.Type.OFFSET) @Stable public int methodCodeOffset; @HotSpotVMConstant(name = "Method::_jfr_towrite") @Stable public int methodFlagsJfrTowrite; @HotSpotVMConstant(name = "Method::_caller_sensitive") @Stable public int methodFlagsCallerSensitive; @@ -1558,13 +1559,13 @@ public class HotSpotVMConfig { @HotSpotVMAddress(name = "os::javaTimeMillis") @Stable public long javaTimeMillisAddress; @HotSpotVMAddress(name = "os::javaTimeNanos") @Stable public long javaTimeNanosAddress; - @HotSpotVMAddress(name = "SharedRuntime::dsin") @Stable public long arithmeticSinAddress; - @HotSpotVMAddress(name = "SharedRuntime::dcos") @Stable public long arithmeticCosAddress; - @HotSpotVMAddress(name = "SharedRuntime::dtan") @Stable public long arithmeticTanAddress; - @HotSpotVMAddress(name = "SharedRuntime::dexp") @Stable public long arithmeticExpAddress; - @HotSpotVMAddress(name = "SharedRuntime::dlog") @Stable public long arithmeticLogAddress; - @HotSpotVMAddress(name = "SharedRuntime::dlog10") @Stable public long arithmeticLog10Address; - @HotSpotVMAddress(name = "SharedRuntime::dpow") @Stable public long arithmeticPowAddress; + @HotSpotVMField(name = "CompilerToVM::Data::dsin", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticSinAddress; + @HotSpotVMField(name = "CompilerToVM::Data::dcos", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticCosAddress; + @HotSpotVMField(name = "CompilerToVM::Data::dtan", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticTanAddress; + @HotSpotVMField(name = "CompilerToVM::Data::dexp", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticExpAddress; + @HotSpotVMField(name = "CompilerToVM::Data::dlog", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticLogAddress; + @HotSpotVMField(name = "CompilerToVM::Data::dlog10", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticLog10Address; + @HotSpotVMField(name = "CompilerToVM::Data::dpow", type = "address", get = HotSpotVMField.Type.VALUE) @Stable public long arithmeticPowAddress; @HotSpotVMFlag(name = "JVMCICounterSize") @Stable public int jvmciCountersSize; diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigVerifier.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigVerifier.java index 5f82244d055..8995bd60797 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigVerifier.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigVerifier.java @@ -40,7 +40,7 @@ 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 sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * A {@link ClassVisitor} that verifies {@link HotSpotVMConfig} does not access {@link Unsafe} from diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVmSymbols.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVmSymbols.java index 0e1398eeaea..bcc2b8f99eb 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVmSymbols.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVmSymbols.java @@ -24,7 +24,7 @@ package jdk.vm.ci.hotspot; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Class to access the C++ {@code vmSymbols} table. diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/UnsafeAccess.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/UnsafeAccess.java index cff2ced4100..c75c449f9dd 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/UnsafeAccess.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/UnsafeAccess.java @@ -24,7 +24,7 @@ package jdk.vm.ci.hotspot; import java.lang.reflect.Field; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Package private access to the {@link Unsafe} capability. diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java index 2f10d1073c6..f98461d45e8 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java @@ -35,8 +35,8 @@ public interface MemoryAccessProvider { * @param displacement the displacement within the object in bytes * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the * value cannot be read. - * @throws IllegalArgumentException if {@code kind} is {@link JavaKind#Void} or not - * {@linkplain JavaKind#isPrimitive() primitive} kind + * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void} or + * not {@linkplain JavaKind#isPrimitive() primitive} kind */ JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant base, long displacement) throws IllegalArgumentException; diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java index 3be863e751e..9a882975984 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java @@ -217,27 +217,34 @@ public interface ResolvedJavaType extends JavaType, ModifiersProvider { /** * Resolves the method implementation for virtual dispatches on objects of this dynamic type. - * This resolution process only searches "up" the class hierarchy of this type. + * This resolution process only searches "up" the class hierarchy of this type. A broader search + * that also walks "down" the hierarchy is implemented by + * {@link #findUniqueConcreteMethod(ResolvedJavaMethod)}. For interface types it returns null + * since no concrete object can be an interface. * * @param method the method to select the implementation of * @param callerType the caller or context type used to perform access checks - * @return the link-time resolved method (might be abstract) or {@code null} if it can not be - * linked + * @return the method that would be selected at runtime (might be abstract) or {@code null} if + * it can not be resolved */ ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType); /** - * Resolves the method implementation for virtual dispatches on objects of this dynamic type. - * This resolution process only searches "up" the class hierarchy of this type. A broader search - * that also walks "down" the hierarchy is implemented by - * {@link #findUniqueConcreteMethod(ResolvedJavaMethod)}. + * A convenience wrapper for {@link #resolveMethod(ResolvedJavaMethod, ResolvedJavaType)} that + * only returns non-abstract methods. * * @param method the method to select the implementation of * @param callerType the caller or context type used to perform access checks * @return the concrete method that would be selected at runtime, or {@code null} if there is no * concrete implementation of {@code method} in this type or any of its superclasses */ - ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType); + default ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { + ResolvedJavaMethod resolvedMethod = resolveMethod(method, callerType); + if (resolvedMethod == null || resolvedMethod.isAbstract()) { + return null; + } + return resolvedMethod; + } /** * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is @@ -352,4 +359,12 @@ public interface ResolvedJavaType extends JavaType, ModifiersProvider { } return null; } + + /** + * Returns true if this type is {@link Cloneable} and can be safely cloned by creating a normal + * Java allocation and populating it from the fields returned by + * {@link #getInstanceFields(boolean)}. Some types may require special handling by the platform + * so they would to go through the normal {@link Object#clone} path. + */ + boolean isCloneableWithAllocation(); } diff --git a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SpeculationLog.java b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SpeculationLog.java index 4330e65715e..b81f5f25a53 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SpeculationLog.java +++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/SpeculationLog.java @@ -56,4 +56,11 @@ public interface SpeculationLog { * argument to the deoptimization function. */ JavaConstant speculate(SpeculationReason reason); + + /** + * Returns if this log has speculations. + * + * @return true if there are speculations, false otherwise + */ + boolean hasSpeculations(); } diff --git a/hotspot/src/jdk.vm.ci/share/classes/module-info.java b/hotspot/src/jdk.vm.ci/share/classes/module-info.java index e105f01e10a..a59a37d56e2 100644 --- a/hotspot/src/jdk.vm.ci/share/classes/module-info.java +++ b/hotspot/src/jdk.vm.ci/share/classes/module-info.java @@ -24,9 +24,6 @@ */ module jdk.vm.ci { - // 8153756 - requires jdk.unsupported; - uses jdk.vm.ci.hotspot.HotSpotVMEventListener; uses jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory; uses jdk.vm.ci.runtime.JVMCICompilerFactory; diff --git a/hotspot/src/os/aix/vm/globals_aix.hpp b/hotspot/src/os/aix/vm/globals_aix.hpp index bfd244eb6fc..21f250bd161 100644 --- a/hotspot/src/os/aix/vm/globals_aix.hpp +++ b/hotspot/src/os/aix/vm/globals_aix.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2015 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,7 +30,15 @@ // Defines Aix specific flags. They are not available on other platforms. // // (Please keep the switches sorted alphabetically.) -#define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, range, constraint) \ +#define RUNTIME_OS_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ /* Whether to allow the VM to run if EXTSHM=ON. EXTSHM is an environment */ \ /* variable used on AIX to activate certain hacks which allow more shm segments */\ diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp index 22e016b65f2..20e3770af33 100644 --- a/hotspot/src/os/aix/vm/os_aix.cpp +++ b/hotspot/src/os/aix/vm/os_aix.cpp @@ -777,7 +777,7 @@ bool os::Aix::get_meminfo(meminfo_t* pmi) { // create new thread // Thread start routine for all newly created threads -static void *java_start(Thread *thread) { +static void *thread_native_entry(Thread *thread) { // find out my own stack dimensions { @@ -838,6 +838,15 @@ static void *java_start(Thread *thread) { log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").", os::current_thread_id(), (uintx) kernel_thread_id); + // If a thread has not deleted itself ("delete this") as part of its + // termination sequence, we have to ensure thread-local-storage is + // cleared before we actually terminate. No threads should ever be + // deleted asynchronously with respect to their termination. + if (Thread::current_or_null_safe() != NULL) { + assert(Thread::current_or_null_safe() == thread, "current thread is wrong"); + thread->clear_thread_current(); + } + return 0; } @@ -902,7 +911,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { pthread_attr_setstacksize(&attr, stack_size); pthread_t tid; - int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); + int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread); char buf[64]; @@ -993,11 +1002,14 @@ void os::pd_start_thread(Thread* thread) { void os::free_thread(OSThread* osthread) { assert(osthread != NULL, "osthread not set"); - if (Thread::current()->osthread() == osthread) { - // Restore caller's signal mask - sigset_t sigmask = osthread->caller_sigmask(); - pthread_sigmask(SIG_SETMASK, &sigmask, NULL); - } + // We are told to free resources of the argument thread, + // but we can only really operate on the current thread. + assert(Thread::current()->osthread() == osthread, + "os::free_thread but not current thread"); + + // Restore caller's signal mask + sigset_t sigmask = osthread->caller_sigmask(); + pthread_sigmask(SIG_SETMASK, &sigmask, NULL); delete osthread; } @@ -4875,3 +4887,16 @@ bool os::start_debugging(char *buf, int buflen) { } return yes; } + +static inline time_t get_mtime(const char* filename) { + struct stat st; + int ret = os::stat(filename, &st); + assert(ret == 0, "failed to stat() file '%s': %s", filename, strerror(errno)); + return st.st_mtime; +} + +int os::compare_file_modified_times(const char* file1, const char* file2) { + time_t t1 = get_mtime(file1); + time_t t2 = get_mtime(file2); + return t1 - t2; +} diff --git a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp index 6e012a9bee1..111f64491ab 100644 --- a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp +++ b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -256,8 +256,9 @@ int generateJvmOffsets(GEN_variant gen_variant) { GEN_OFFS(CodeBlob, _name); GEN_OFFS(CodeBlob, _header_size); - GEN_OFFS(CodeBlob, _content_offset); - GEN_OFFS(CodeBlob, _code_offset); + GEN_OFFS(CodeBlob, _content_begin); + GEN_OFFS(CodeBlob, _code_begin); + GEN_OFFS(CodeBlob, _code_end); GEN_OFFS(CodeBlob, _data_offset); GEN_OFFS(CodeBlob, _frame_size); printf("\n"); @@ -265,10 +266,10 @@ int generateJvmOffsets(GEN_variant gen_variant) { GEN_OFFS(nmethod, _method); GEN_OFFS(nmethod, _dependencies_offset); GEN_OFFS(nmethod, _metadata_offset); - GEN_OFFS(nmethod, _scopes_data_offset); + GEN_OFFS(nmethod, _scopes_data_begin); GEN_OFFS(nmethod, _scopes_pcs_offset); GEN_OFFS(nmethod, _handler_table_offset); - GEN_OFFS(nmethod, _deoptimize_offset); + GEN_OFFS(nmethod, _deopt_handler_begin); GEN_OFFS(nmethod, _orig_pc_offset); GEN_OFFS(PcDesc, _pc_offset); diff --git a/hotspot/src/os/bsd/dtrace/libjvm_db.c b/hotspot/src/os/bsd/dtrace/libjvm_db.c index 7a7105c1b25..d68436c3f3c 100644 --- a/hotspot/src/os/bsd/dtrace/libjvm_db.c +++ b/hotspot/src/os/bsd/dtrace/libjvm_db.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -124,10 +124,10 @@ typedef struct Nmethod_t { uint64_t pc_desc; int32_t orig_pc_offset; /* _orig_pc_offset */ - int32_t instrs_beg; /* _code_offset */ - int32_t instrs_end; - int32_t deopt_beg; /* _deoptimize_offset */ - int32_t scopes_data_beg; /* _scopes_data_offset */ + uint64_t instrs_beg; /* _code_offset */ + uint64_t instrs_end; + uint64_t deopt_beg; /* _deoptimize_offset */ + uint64_t scopes_data_beg; /* _scopes_data_offset */ int32_t scopes_data_end; int32_t metadata_beg; /* _metadata_offset */ int32_t metadata_end; @@ -617,11 +617,12 @@ static int nmethod_info(Nmethod_t *N) fprintf(stderr, "\t nmethod_info: BEGIN \n"); /* Instructions */ - err = ps_pread(J->P, nm + OFFSET_CodeBlob_code_offset, &N->instrs_beg, SZ32); + err = read_pointer(J, base + OFFSET_VMStructEntryaddress, &vmp->address); + err = read_pointer(J, nm + OFFSET_CodeBlob_code_begin, &N->instrs_beg); CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_CodeBlob_data_offset, &N->instrs_end, SZ32); + err = read_pointer(J, nm + OFFSET_CodeBlob_code_end, &N->instrs_end); CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_deoptimize_offset, &N->deopt_beg, SZ32); + err = read_pointer(J, nm + OFFSET_nmethod_deopt_handler_begin, &N->deopt_beg); CHECK_FAIL(err); err = ps_pread(J->P, nm + OFFSET_nmethod_orig_pc_offset, &N->orig_pc_offset, SZ32); CHECK_FAIL(err); @@ -639,7 +640,7 @@ static int nmethod_info(Nmethod_t *N) CHECK_FAIL(err); /* scopes_data */ - err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_offset, &N->scopes_data_beg, SZ32); + err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_begin, &N->scopes_data_beg, POINTER_SIZE); CHECK_FAIL(err); if (debug > 2 ) { @@ -868,7 +869,7 @@ get_real_pc(Nmethod_t *N, uint64_t pc_desc, uint64_t *real_pc) err = ps_pread(N->J->P, pc_desc + OFFSET_PcDesc_pc_offset, &pc_offset, SZ32); CHECK_FAIL(err); - *real_pc = N->nm + N->instrs_beg + pc_offset; + *real_pc = N->instrs_beg + pc_offset; if (debug > 2) { fprintf(stderr, "\t\t get_real_pc: pc_offset: %lx, real_pc: %llx\n", pc_offset, *real_pc); @@ -942,7 +943,7 @@ scope_desc_at(Nmethod_t *N, int32_t decode_offset, Vframe_t *vf) fprintf(stderr, "\t\t scope_desc_at: BEGIN \n"); } - buffer = N->nm + N->scopes_data_beg + decode_offset; + buffer = N->scopes_data_beg + decode_offset; err = raw_read_int(N->J, &buffer, &vf->sender_decode_offset); CHECK_FAIL(err); @@ -1052,11 +1053,11 @@ name_for_nmethod(jvm_agent_t* J, CHECK_FAIL(err); if (debug) { fprintf(stderr, "name_for_nmethod: pc: %#llx, deopt_pc: %#llx\n", - pc, N->nm + N->deopt_beg); + pc, N->deopt_beg); } /* check for a deoptimized frame */ - if ( pc == N->nm + N->deopt_beg) { + if ( pc == N->deopt_beg) { uint64_t base; if (debug) { fprintf(stderr, "name_for_nmethod: found deoptimized frame\n"); diff --git a/hotspot/src/os/bsd/vm/globals_bsd.hpp b/hotspot/src/os/bsd/vm/globals_bsd.hpp index a085cbe5114..f3b076e825e 100644 --- a/hotspot/src/os/bsd/vm/globals_bsd.hpp +++ b/hotspot/src/os/bsd/vm/globals_bsd.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,15 @@ // // Defines Bsd specific flags. They are not available on other platforms. // -#define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, range, constraint) \ +#define RUNTIME_OS_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(bool, UseOprofile, false, \ "enable support for Oprofile profiler") \ diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp index 78def166e58..6de75924e8d 100644 --- a/hotspot/src/os/bsd/vm/os_bsd.cpp +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp @@ -665,7 +665,7 @@ static uint64_t locate_unique_thread_id(mach_port_t mach_thread_port) { #endif // Thread start routine for all newly created threads -static void *java_start(Thread *thread) { +static void *thread_native_entry(Thread *thread) { // Try to randomize the cache line index of hot stack frames. // This helps when threads of the same stack traces evict each other's // cache lines. The threads can be either from the same JVM instance, or @@ -723,6 +723,15 @@ static void *java_start(Thread *thread) { log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", os::current_thread_id(), (uintx) pthread_self()); + // If a thread has not deleted itself ("delete this") as part of its + // termination sequence, we have to ensure thread-local-storage is + // cleared before we actually terminate. No threads should ever be + // deleted asynchronously with respect to their termination. + if (Thread::current_or_null_safe() != NULL) { + assert(Thread::current_or_null_safe() == thread, "current thread is wrong"); + thread->clear_thread_current(); + } + return 0; } @@ -781,7 +790,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, size_t stack_size) { { pthread_t tid; - int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); + int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread); char buf[64]; if (ret == 0) { @@ -889,11 +898,14 @@ void os::pd_start_thread(Thread* thread) { void os::free_thread(OSThread* osthread) { assert(osthread != NULL, "osthread not set"); - if (Thread::current()->osthread() == osthread) { - // Restore caller's signal mask - sigset_t sigmask = osthread->caller_sigmask(); - pthread_sigmask(SIG_SETMASK, &sigmask, NULL); - } + // We are told to free resources of the argument thread, + // but we can only really operate on the current thread. + assert(Thread::current()->osthread() == osthread, + "os::free_thread but not current thread"); + + // Restore caller's signal mask + sigset_t sigmask = osthread->caller_sigmask(); + pthread_sigmask(SIG_SETMASK, &sigmask, NULL); delete osthread; } diff --git a/hotspot/src/os/linux/vm/globals_linux.hpp b/hotspot/src/os/linux/vm/globals_linux.hpp index 05f4c181336..39bedf3ff59 100644 --- a/hotspot/src/os/linux/vm/globals_linux.hpp +++ b/hotspot/src/os/linux/vm/globals_linux.hpp @@ -28,7 +28,15 @@ // // Defines Linux specific flags. They are not available on other platforms. // -#define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, range, constraint) \ +#define RUNTIME_OS_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(bool, UseOprofile, false, \ "enable support for Oprofile profiler") \ diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 4889870e8f4..3becb38278b 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -638,7 +638,7 @@ bool os::Linux::manually_expand_stack(JavaThread * t, address addr) { // create new thread // Thread start routine for all newly created threads -static void *java_start(Thread *thread) { +static void *thread_native_entry(Thread *thread) { // Try to randomize the cache line index of hot stack frames. // This helps when threads of the same stack traces evict each other's // cache lines. The threads can be either from the same JVM instance, or @@ -690,6 +690,15 @@ static void *java_start(Thread *thread) { log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ", pthread id: " UINTX_FORMAT ").", os::current_thread_id(), (uintx) pthread_self()); + // If a thread has not deleted itself ("delete this") as part of its + // termination sequence, we have to ensure thread-local-storage is + // cleared before we actually terminate. No threads should ever be + // deleted asynchronously with respect to their termination. + if (Thread::current_or_null_safe() != NULL) { + assert(Thread::current_or_null_safe() == thread, "current thread is wrong"); + thread->clear_thread_current(); + } + return 0; } @@ -753,7 +762,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, { pthread_t tid; - int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread); + int ret = pthread_create(&tid, &attr, (void* (*)(void*)) thread_native_entry, thread); char buf[64]; if (ret == 0) { @@ -881,18 +890,21 @@ void os::pd_start_thread(Thread* thread) { void os::free_thread(OSThread* osthread) { assert(osthread != NULL, "osthread not set"); - if (Thread::current()->osthread() == osthread) { + // We are told to free resources of the argument thread, + // but we can only really operate on the current thread. + assert(Thread::current()->osthread() == osthread, + "os::free_thread but not current thread"); + #ifdef ASSERT - sigset_t current; - sigemptyset(¤t); - pthread_sigmask(SIG_SETMASK, NULL, ¤t); - assert(!sigismember(¤t, SR_signum), "SR signal should not be blocked!"); + sigset_t current; + sigemptyset(¤t); + pthread_sigmask(SIG_SETMASK, NULL, ¤t); + assert(!sigismember(¤t, SR_signum), "SR signal should not be blocked!"); #endif - // Restore caller's signal mask - sigset_t sigmask = osthread->caller_sigmask(); - pthread_sigmask(SIG_SETMASK, &sigmask, NULL); - } + // Restore caller's signal mask + sigset_t sigmask = osthread->caller_sigmask(); + pthread_sigmask(SIG_SETMASK, &sigmask, NULL); delete osthread; } @@ -2013,8 +2025,8 @@ void os::print_os_info(outputStream* st) { // their own specific XXX-release file as well as a redhat-release file. // Because of this the XXX-release file needs to be searched for before the // redhat-release file. -// Since Red Hat has a lsb-release file that is not very descriptive the -// search for redhat-release needs to be before lsb-release. +// Since Red Hat and SuSE have an lsb-release file that is not very descriptive the +// search for redhat-release / SuSE-release needs to be before lsb-release. // Since the lsb-release file is the new standard it needs to be searched // before the older style release files. // Searching system-release (Red Hat) and os-release (other Linuxes) are a @@ -2031,8 +2043,8 @@ const char* distro_files[] = { "/etc/mandrake-release", "/etc/sun-release", "/etc/redhat-release", - "/etc/lsb-release", "/etc/SuSE-release", + "/etc/lsb-release", "/etc/turbolinux-release", "/etc/gentoo-release", "/etc/ltib-release", @@ -2062,14 +2074,11 @@ void os::Linux::print_distro_info(outputStream* st) { st->cr(); } -static void parse_os_info(char* distro, size_t length, const char* file) { - FILE* fp = fopen(file, "r"); - if (fp != NULL) { - char buf[256]; - // get last line of the file. - while (fgets(buf, sizeof(buf), fp)) { } - // Edit out extra stuff in expected ubuntu format - if (strstr(buf, "DISTRIB_DESCRIPTION=") != NULL) { +static void parse_os_info_helper(FILE* fp, char* distro, size_t length, bool get_first_line) { + char buf[256]; + while (fgets(buf, sizeof(buf), fp)) { + // Edit out extra stuff in expected format + if (strstr(buf, "DISTRIB_DESCRIPTION=") != NULL || strstr(buf, "PRETTY_NAME=") != NULL) { char* ptr = strstr(buf, "\""); // the name is in quotes if (ptr != NULL) { ptr++; // go beyond first quote @@ -2083,13 +2092,26 @@ static void parse_os_info(char* distro, size_t length, const char* file) { if (nl != NULL) *nl = '\0'; strncpy(distro, ptr, length); } - } else { - // if not in expected Ubuntu format, print out whole line minus \n + return; + } else if (get_first_line) { char* nl = strchr(buf, '\n'); if (nl != NULL) *nl = '\0'; strncpy(distro, buf, length); + return; } - // close distro file + } + // print last line and close + char* nl = strchr(buf, '\n'); + if (nl != NULL) *nl = '\0'; + strncpy(distro, buf, length); +} + +static void parse_os_info(char* distro, size_t length, const char* file) { + FILE* fp = fopen(file, "r"); + if (fp != NULL) { + // if suse format, print out first line + bool get_first_line = (strcmp(file, "/etc/SuSE-release") == 0); + parse_os_info_helper(fp, distro, length, get_first_line); fclose(fp); } } @@ -3041,6 +3063,48 @@ static char* anon_mmap(char* requested_addr, size_t bytes, bool fixed) { return addr == MAP_FAILED ? NULL : addr; } +// Allocate (using mmap, NO_RESERVE, with small pages) at either a given request address +// (req_addr != NULL) or with a given alignment. +// - bytes shall be a multiple of alignment. +// - req_addr can be NULL. If not NULL, it must be a multiple of alignment. +// - alignment sets the alignment at which memory shall be allocated. +// It must be a multiple of allocation granularity. +// Returns address of memory or NULL. If req_addr was not NULL, will only return +// req_addr or NULL. +static char* anon_mmap_aligned(size_t bytes, size_t alignment, char* req_addr) { + + size_t extra_size = bytes; + if (req_addr == NULL && alignment > 0) { + extra_size += alignment; + } + + char* start = (char*) ::mmap(req_addr, extra_size, PROT_NONE, + MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, + -1, 0); + if (start == MAP_FAILED) { + start = NULL; + } else { + if (req_addr != NULL) { + if (start != req_addr) { + ::munmap(start, extra_size); + start = NULL; + } + } else { + char* const start_aligned = (char*) align_ptr_up(start, alignment); + char* const end_aligned = start_aligned + bytes; + char* const end = start + extra_size; + if (start_aligned > start) { + ::munmap(start, start_aligned - start); + } + if (end_aligned < end) { + ::munmap(end_aligned, end - end_aligned); + } + start = start_aligned; + } + } + return start; +} + static int anon_munmap(char * addr, size_t size) { return ::munmap(addr, size) == 0; } @@ -3317,29 +3381,113 @@ void os::large_page_init() { #define SHM_HUGETLB 04000 #endif +#define shm_warning_format(format, ...) \ + do { \ + if (UseLargePages && \ + (!FLAG_IS_DEFAULT(UseLargePages) || \ + !FLAG_IS_DEFAULT(UseSHM) || \ + !FLAG_IS_DEFAULT(LargePageSizeInBytes))) { \ + warning(format, __VA_ARGS__); \ + } \ + } while (0) + +#define shm_warning(str) shm_warning_format("%s", str) + +#define shm_warning_with_errno(str) \ + do { \ + int err = errno; \ + shm_warning_format(str " (error = %d)", err); \ + } while (0) + +static char* shmat_with_alignment(int shmid, size_t bytes, size_t alignment) { + assert(is_size_aligned(bytes, alignment), "Must be divisible by the alignment"); + + if (!is_size_aligned(alignment, SHMLBA)) { + assert(false, "Code below assumes that alignment is at least SHMLBA aligned"); + return NULL; + } + + // To ensure that we get 'alignment' aligned memory from shmat, + // we pre-reserve aligned virtual memory and then attach to that. + + char* pre_reserved_addr = anon_mmap_aligned(bytes, alignment, NULL); + if (pre_reserved_addr == NULL) { + // Couldn't pre-reserve aligned memory. + shm_warning("Failed to pre-reserve aligned memory for shmat."); + return NULL; + } + + // SHM_REMAP is needed to allow shmat to map over an existing mapping. + char* addr = (char*)shmat(shmid, pre_reserved_addr, SHM_REMAP); + + if ((intptr_t)addr == -1) { + int err = errno; + shm_warning_with_errno("Failed to attach shared memory."); + + assert(err != EACCES, "Unexpected error"); + assert(err != EIDRM, "Unexpected error"); + assert(err != EINVAL, "Unexpected error"); + + // Since we don't know if the kernel unmapped the pre-reserved memory area + // we can't unmap it, since that would potentially unmap memory that was + // mapped from other threads. + return NULL; + } + + return addr; +} + +static char* shmat_at_address(int shmid, char* req_addr) { + if (!is_ptr_aligned(req_addr, SHMLBA)) { + assert(false, "Requested address needs to be SHMLBA aligned"); + return NULL; + } + + char* addr = (char*)shmat(shmid, req_addr, 0); + + if ((intptr_t)addr == -1) { + shm_warning_with_errno("Failed to attach shared memory."); + return NULL; + } + + return addr; +} + +static char* shmat_large_pages(int shmid, size_t bytes, size_t alignment, char* req_addr) { + // If a req_addr has been provided, we assume that the caller has already aligned the address. + if (req_addr != NULL) { + assert(is_ptr_aligned(req_addr, os::large_page_size()), "Must be divisible by the large page size"); + assert(is_ptr_aligned(req_addr, alignment), "Must be divisible by given alignment"); + return shmat_at_address(shmid, req_addr); + } + + // Since shmid has been setup with SHM_HUGETLB, shmat will automatically + // return large page size aligned memory addresses when req_addr == NULL. + // However, if the alignment is larger than the large page size, we have + // to manually ensure that the memory returned is 'alignment' aligned. + if (alignment > os::large_page_size()) { + assert(is_size_aligned(alignment, os::large_page_size()), "Must be divisible by the large page size"); + return shmat_with_alignment(shmid, bytes, alignment); + } else { + return shmat_at_address(shmid, NULL); + } +} + char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, char* req_addr, bool exec) { // "exec" is passed in but not used. Creating the shared image for // the code cache doesn't have an SHM_X executable permission to check. assert(UseLargePages && UseSHM, "only for SHM large pages"); assert(is_ptr_aligned(req_addr, os::large_page_size()), "Unaligned address"); + assert(is_ptr_aligned(req_addr, alignment), "Unaligned address"); - if (!is_size_aligned(bytes, os::large_page_size()) || alignment > os::large_page_size()) { + if (!is_size_aligned(bytes, os::large_page_size())) { return NULL; // Fallback to small pages. } - key_t key = IPC_PRIVATE; - char *addr; - - bool warn_on_failure = UseLargePages && - (!FLAG_IS_DEFAULT(UseLargePages) || - !FLAG_IS_DEFAULT(UseSHM) || - !FLAG_IS_DEFAULT(LargePageSizeInBytes)); - char msg[128]; - // Create a large shared memory region to attach to based on size. - // Currently, size is the total size of the heap - int shmid = shmget(key, bytes, SHM_HUGETLB|IPC_CREAT|SHM_R|SHM_W); + // Currently, size is the total size of the heap. + int shmid = shmget(IPC_PRIVATE, bytes, SHM_HUGETLB|IPC_CREAT|SHM_R|SHM_W); if (shmid == -1) { // Possible reasons for shmget failure: // 1. shmmax is too small for Java heap. @@ -3355,16 +3503,12 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, // they are so fragmented after a long run that they can't // coalesce into large pages. Try to reserve large pages when // the system is still "fresh". - if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); - warning("%s", msg); - } + shm_warning_with_errno("Failed to reserve shared memory."); return NULL; } - // attach to the region - addr = (char*)shmat(shmid, req_addr, 0); - int err = errno; + // Attach to the region. + char* addr = shmat_large_pages(shmid, bytes, alignment, req_addr); // Remove shmid. If shmat() is successful, the actual shared memory segment // will be deleted when it's detached by shmdt() or when the process @@ -3372,14 +3516,6 @@ char* os::Linux::reserve_memory_special_shm(size_t bytes, size_t alignment, // segment immediately. shmctl(shmid, IPC_RMID, NULL); - if ((intptr_t)addr == -1) { - if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); - warning("%s", msg); - } - return NULL; - } - return addr; } @@ -3422,50 +3558,6 @@ char* os::Linux::reserve_memory_special_huge_tlbfs_only(size_t bytes, return addr; } -// Helper for os::Linux::reserve_memory_special_huge_tlbfs_mixed(). -// Allocate (using mmap, NO_RESERVE, with small pages) at either a given request address -// (req_addr != NULL) or with a given alignment. -// - bytes shall be a multiple of alignment. -// - req_addr can be NULL. If not NULL, it must be a multiple of alignment. -// - alignment sets the alignment at which memory shall be allocated. -// It must be a multiple of allocation granularity. -// Returns address of memory or NULL. If req_addr was not NULL, will only return -// req_addr or NULL. -static char* anon_mmap_aligned(size_t bytes, size_t alignment, char* req_addr) { - - size_t extra_size = bytes; - if (req_addr == NULL && alignment > 0) { - extra_size += alignment; - } - - char* start = (char*) ::mmap(req_addr, extra_size, PROT_NONE, - MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, - -1, 0); - if (start == MAP_FAILED) { - start = NULL; - } else { - if (req_addr != NULL) { - if (start != req_addr) { - ::munmap(start, extra_size); - start = NULL; - } - } else { - char* const start_aligned = (char*) align_ptr_up(start, alignment); - char* const end_aligned = start_aligned + bytes; - char* const end = start + extra_size; - if (start_aligned > start) { - ::munmap(start, start_aligned - start); - } - if (end_aligned < end) { - ::munmap(end_aligned, end - end_aligned); - } - start = start_aligned; - } - } - return start; - -} - // Reserve memory using mmap(MAP_HUGETLB). // - bytes shall be a multiple of alignment. // - req_addr can be NULL. If not NULL, it must be a multiple of alignment. diff --git a/hotspot/src/os/posix/vm/os_posix.cpp b/hotspot/src/os/posix/vm/os_posix.cpp index 1c6efe5b513..ad10c82a5b2 100644 --- a/hotspot/src/os/posix/vm/os_posix.cpp +++ b/hotspot/src/os/posix/vm/os_posix.cpp @@ -47,6 +47,12 @@ // Check core dump limit and report possible place where core can be found void os::check_dump_limit(char* buffer, size_t bufferSize) { + if (!FLAG_IS_DEFAULT(CreateCoredumpOnCrash) && !CreateCoredumpOnCrash) { + jio_snprintf(buffer, bufferSize, "CreateCoredumpOnCrash is disabled from command line"); + VMError::record_coredump_status(buffer, false); + return; + } + int n; struct rlimit rlim; bool success; @@ -181,8 +187,8 @@ int os::log_vsnprintf(char* buf, size_t len, const char* fmt, va_list args) { return vsnprintf(buf, len, fmt, args); } -int os::fileno(FILE* fp) { - return ::fileno(fp); +int os::get_fileno(FILE* fp) { + return NOT_AIX(::)fileno(fp); } void os::Posix::print_load_average(outputStream* st) { @@ -321,6 +327,14 @@ FILE* os::open(int fd, const char* mode) { return ::fdopen(fd, mode); } +void os::flockfile(FILE* fp) { + ::flockfile(fp); +} + +void os::funlockfile(FILE* fp) { + ::funlockfile(fp); +} + // Builds a platform dependent Agent_OnLoad_ function name // which is used to find statically linked in agents. // Parameters: diff --git a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp index ddd74b16d9e..7d23282b412 100644 --- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp +++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -251,8 +251,9 @@ int generateJvmOffsets(GEN_variant gen_variant) { GEN_OFFS(CodeBlob, _name); GEN_OFFS(CodeBlob, _header_size); - GEN_OFFS(CodeBlob, _content_offset); - GEN_OFFS(CodeBlob, _code_offset); + GEN_OFFS(CodeBlob, _content_begin); + GEN_OFFS(CodeBlob, _code_begin); + GEN_OFFS(CodeBlob, _code_end); GEN_OFFS(CodeBlob, _data_offset); GEN_OFFS(CodeBlob, _frame_size); printf("\n"); @@ -260,10 +261,10 @@ int generateJvmOffsets(GEN_variant gen_variant) { GEN_OFFS(nmethod, _method); GEN_OFFS(nmethod, _dependencies_offset); GEN_OFFS(nmethod, _metadata_offset); - GEN_OFFS(nmethod, _scopes_data_offset); + GEN_OFFS(nmethod, _scopes_data_begin); GEN_OFFS(nmethod, _scopes_pcs_offset); GEN_OFFS(nmethod, _handler_table_offset); - GEN_OFFS(nmethod, _deoptimize_offset); + GEN_OFFS(nmethod, _deopt_handler_begin); GEN_OFFS(nmethod, _orig_pc_offset); GEN_OFFS(PcDesc, _pc_offset); diff --git a/hotspot/src/os/solaris/dtrace/libjvm_db.c b/hotspot/src/os/solaris/dtrace/libjvm_db.c index e00284532a6..73b26bcb9d5 100644 --- a/hotspot/src/os/solaris/dtrace/libjvm_db.c +++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -124,10 +124,10 @@ typedef struct Nmethod_t { uint64_t pc_desc; int32_t orig_pc_offset; /* _orig_pc_offset */ - int32_t instrs_beg; /* _code_offset */ - int32_t instrs_end; - int32_t deopt_beg; /* _deoptimize_offset */ - int32_t scopes_data_beg; /* _scopes_data_offset */ + uint64_t instrs_beg; /* _code_offset */ + uint64_t instrs_end; + uint64_t deopt_beg; /* _deoptimize_offset */ + uint64_t scopes_data_beg; /* _scopes_data_begin */ int32_t scopes_data_end; int32_t metadata_beg; /* _metadata_offset */ int32_t metadata_end; @@ -617,11 +617,11 @@ static int nmethod_info(Nmethod_t *N) fprintf(stderr, "\t nmethod_info: BEGIN \n"); /* Instructions */ - err = ps_pread(J->P, nm + OFFSET_CodeBlob_code_offset, &N->instrs_beg, SZ32); + err = read_pointer(J, nm + OFFSET_CodeBlob_code_begin, &N->instrs_beg); CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_CodeBlob_data_offset, &N->instrs_end, SZ32); + err = read_pointer(J, nm + OFFSET_CodeBlob_code_end, &N->instrs_end); CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_deoptimize_offset, &N->deopt_beg, SZ32); + err = read_pointer(J, nm + OFFSET_nmethod_deopt_handler_begin, &N->deopt_beg); CHECK_FAIL(err); err = ps_pread(J->P, nm + OFFSET_nmethod_orig_pc_offset, &N->orig_pc_offset, SZ32); CHECK_FAIL(err); @@ -629,7 +629,7 @@ static int nmethod_info(Nmethod_t *N) /* Metadata */ err = ps_pread(J->P, nm + OFFSET_nmethod_metadata_offset, &N->metadata_beg, SZ32); CHECK_FAIL(err); - err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_offset, &N->metadata_end, SZ32); + err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_begin, &N->metadata_end, SZ32); CHECK_FAIL(err); /* scopes_pcs */ @@ -639,7 +639,7 @@ static int nmethod_info(Nmethod_t *N) CHECK_FAIL(err); /* scopes_data */ - err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_offset, &N->scopes_data_beg, SZ32); + err = ps_pread(J->P, nm + OFFSET_nmethod_scopes_data_begin, &N->scopes_data_beg, POINTER_SIZE); CHECK_FAIL(err); if (debug > 2 ) { @@ -868,7 +868,7 @@ get_real_pc(Nmethod_t *N, uint64_t pc_desc, uint64_t *real_pc) err = ps_pread(N->J->P, pc_desc + OFFSET_PcDesc_pc_offset, &pc_offset, SZ32); CHECK_FAIL(err); - *real_pc = N->nm + N->instrs_beg + pc_offset; + *real_pc = N->instrs_beg + pc_offset; if (debug > 2) { fprintf(stderr, "\t\t get_real_pc: pc_offset: %lx, real_pc: %llx\n", pc_offset, *real_pc); @@ -942,7 +942,7 @@ scope_desc_at(Nmethod_t *N, int32_t decode_offset, Vframe_t *vf) fprintf(stderr, "\t\t scope_desc_at: BEGIN \n"); } - buffer = N->nm + N->scopes_data_beg + decode_offset; + buffer = N->scopes_data_beg + decode_offset; err = raw_read_int(N->J, &buffer, &vf->sender_decode_offset); CHECK_FAIL(err); @@ -1052,11 +1052,11 @@ name_for_nmethod(jvm_agent_t* J, CHECK_FAIL(err); if (debug) { fprintf(stderr, "name_for_nmethod: pc: %#llx, deopt_pc: %#llx\n", - pc, N->nm + N->deopt_beg); + pc, N->deopt_beg); } /* check for a deoptimized frame */ - if ( pc == N->nm + N->deopt_beg) { + if ( pc == N->deopt_beg) { uint64_t base; if (debug) { fprintf(stderr, "name_for_nmethod: found deoptimized frame\n"); diff --git a/hotspot/src/os/solaris/vm/globals_solaris.hpp b/hotspot/src/os/solaris/vm/globals_solaris.hpp index 4e6d8182533..b3e2e34a314 100644 --- a/hotspot/src/os/solaris/vm/globals_solaris.hpp +++ b/hotspot/src/os/solaris/vm/globals_solaris.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,15 @@ // // Defines Solaris specific flags. They are not available on other platforms. // -#define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, range, constraint) \ +#define RUNTIME_OS_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(bool, UseExtendedFileIO, true, \ "Enable workaround for limitations of stdio FILE structure") diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 1d68dcc7721..1b02694822e 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -725,8 +725,8 @@ extern "C" void breakpoint() { static thread_t main_thread; -// Thread start routine for all new Java threads -extern "C" void* java_start(void* thread_addr) { +// Thread start routine for all newly created threads +extern "C" void* thread_native_entry(void* thread_addr) { // Try to randomize the cache line index of hot stack frames. // This helps when threads of the same stack traces evict each other's // cache lines. The threads can be either from the same JVM instance, or @@ -796,6 +796,15 @@ extern "C" void* java_start(void* thread_addr) { log_info(os, thread)("Thread finished (tid: " UINTX_FORMAT ").", os::current_thread_id()); + // If a thread has not deleted itself ("delete this") as part of its + // termination sequence, we have to ensure thread-local-storage is + // cleared before we actually terminate. No threads should ever be + // deleted asynchronously with respect to their termination. + if (Thread::current_or_null_safe() != NULL) { + assert(Thread::current_or_null_safe() == thread, "current thread is wrong"); + thread->clear_thread_current(); + } + if (UseDetachedThreads) { thr_exit(NULL); ShouldNotReachHere(); @@ -1009,7 +1018,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, osthread->set_lwp_id(-1); osthread->set_thread_id(-1); - status = thr_create(NULL, stack_size, java_start, thread, flags, &tid); + status = thr_create(NULL, stack_size, thread_native_entry, thread, flags, &tid); char buf[64]; if (status == 0) { @@ -1221,18 +1230,15 @@ void os::initialize_thread(Thread* thr) { void os::free_thread(OSThread* osthread) { assert(osthread != NULL, "os::free_thread but osthread not set"); - // We are told to free resources of the argument thread, // but we can only really operate on the current thread. - // The main thread must take the VMThread down synchronously - // before the main thread exits and frees up CodeHeap - guarantee((Thread::current()->osthread() == osthread - || (osthread == VMThread::vm_thread()->osthread())), "os::free_thread but not current thread"); - if (Thread::current()->osthread() == osthread) { - // Restore caller's signal mask - sigset_t sigmask = osthread->caller_sigmask(); - pthread_sigmask(SIG_SETMASK, &sigmask, NULL); - } + assert(Thread::current()->osthread() == osthread, + "os::free_thread but not current thread"); + + // Restore caller's signal mask + sigset_t sigmask = osthread->caller_sigmask(); + pthread_sigmask(SIG_SETMASK, &sigmask, NULL); + delete osthread; } @@ -1351,24 +1357,29 @@ double os::elapsedVTime() { return (double)gethrvtime() / (double)hrtime_hz; } -// Used internally for comparisons only -// getTimeMillis guaranteed to not move backwards on Solaris -jlong getTimeMillis() { - jlong nanotime = getTimeNanos(); - return (jlong)(nanotime / NANOSECS_PER_MILLISEC); -} +// in-memory timestamp support - has update accuracy of 1ms +typedef void (*_get_nsec_fromepoch_func_t)(hrtime_t*); +static _get_nsec_fromepoch_func_t _get_nsec_fromepoch = NULL; // Must return millis since Jan 1 1970 for JVM_CurrentTimeMillis jlong os::javaTimeMillis() { - timeval t; - if (gettimeofday(&t, NULL) == -1) { - fatal("os::javaTimeMillis: gettimeofday (%s)", os::strerror(errno)); + if (_get_nsec_fromepoch != NULL) { + hrtime_t now; + _get_nsec_fromepoch(&now); + return now / NANOSECS_PER_MILLISEC; + } + else { + timeval t; + if (gettimeofday(&t, NULL) == -1) { + fatal("os::javaTimeMillis: gettimeofday (%s)", os::strerror(errno)); + } + return jlong(t.tv_sec) * 1000 + jlong(t.tv_usec) / 1000; } - return jlong(t.tv_sec) * 1000 + jlong(t.tv_usec) / 1000; } void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) { timeval t; + // can't use get_nsec_fromepoch here as we need better accuracy than 1ms if (gettimeofday(&t, NULL) == -1) { fatal("os::javaTimeSystemUTC: gettimeofday (%s)", os::strerror(errno)); } @@ -4432,11 +4443,15 @@ void os::init(void) { // enough to allow the thread to get to user bytecode execution. Solaris::min_stack_allowed = MAX2(thr_min_stack(), Solaris::min_stack_allowed); - // retrieve entry point for pthread_setname_np + // dynamic lookup of functions that may not be available in our lowest + // supported Solaris release void * handle = dlopen("libc.so.1", RTLD_LAZY); if (handle != NULL) { - Solaris::_pthread_setname_np = + Solaris::_pthread_setname_np = // from 11.3 (Solaris::pthread_setname_np_func_t)dlsym(handle, "pthread_setname_np"); + + _get_nsec_fromepoch = // from 11.3.6 + (_get_nsec_fromepoch_func_t) dlsym(handle, "get_nsec_fromepoch"); } } diff --git a/hotspot/src/os/windows/vm/globals_windows.hpp b/hotspot/src/os/windows/vm/globals_windows.hpp index 1a2eb4fdd4a..3d831ec1257 100644 --- a/hotspot/src/os/windows/vm/globals_windows.hpp +++ b/hotspot/src/os/windows/vm/globals_windows.hpp @@ -28,7 +28,15 @@ // // Defines Windows specific flags. They are not available on other platforms. // -#define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, range, constraint) \ +#define RUNTIME_OS_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ product(bool, UseUTCFileTimestamp, true, \ "Adjust the timestamp returned from stat() to be UTC") diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index fa401527ed7..7c3b6da4ed4 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -409,8 +409,8 @@ struct tm* os::localtime_pd(const time_t* clock, struct tm* res) { LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo); -// Thread start routine for all new Java threads -static unsigned __stdcall java_start(Thread* thread) { +// Thread start routine for all newly created threads +static unsigned __stdcall thread_native_entry(Thread* thread) { // Try to randomize the cache line index of hot stack frames. // This helps when threads of the same stack traces evict each other's // cache lines. The threads can be either from the same JVM instance, or @@ -459,6 +459,15 @@ static unsigned __stdcall java_start(Thread* thread) { Atomic::dec_ptr((intptr_t*)&os::win32::_os_thread_count); } + // If a thread has not deleted itself ("delete this") as part of its + // termination sequence, we have to ensure thread-local-storage is + // cleared before we actually terminate. No threads should ever be + // deleted asynchronously with respect to their termination. + if (Thread::current_or_null_safe() != NULL) { + assert(Thread::current_or_null_safe() == thread, "current thread is wrong"); + thread->clear_thread_current(); + } + // Thread must not return from exit_process_or_thread(), but if it does, // let it proceed to exit normally return (unsigned)os::win32::exit_process_or_thread(os::win32::EPT_THREAD, res); @@ -631,7 +640,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, HANDLE thread_handle = (HANDLE)_beginthreadex(NULL, (unsigned)stack_size, - (unsigned (__stdcall *)(void*)) java_start, + (unsigned (__stdcall *)(void*)) thread_native_entry, thread, initflag, &thread_id); @@ -670,6 +679,12 @@ bool os::create_thread(Thread* thread, ThreadType thr_type, // Free Win32 resources related to the OSThread void os::free_thread(OSThread* osthread) { assert(osthread != NULL, "osthread not set"); + + // We are told to free resources of the argument thread, + // but we can only really operate on the current thread. + assert(Thread::current()->osthread() == osthread, + "os::free_thread but not current thread"); + CloseHandle(osthread->thread_handle()); CloseHandle(osthread->interrupt_event()); delete osthread; @@ -4602,7 +4617,7 @@ int os::ftruncate(int fd, jlong length) { return 0; } -int os::fileno(FILE* fp) { +int os::get_fileno(FILE* fp) { return _fileno(fp); } @@ -4661,6 +4676,14 @@ int os::available(int fd, jlong *bytes) { } } +void os::flockfile(FILE* fp) { + _lock_file(fp); +} + +void os::funlockfile(FILE* fp) { + _unlock_file(fp); +} + // This code is a copy of JDK's nonSeekAvailable // from src/windows/hpi/src/sys_api_md.c diff --git a/hotspot/src/os/windows/vm/os_windows.hpp b/hotspot/src/os/windows/vm/os_windows.hpp index 5bef412f904..9170dfe1665 100644 --- a/hotspot/src/os/windows/vm/os_windows.hpp +++ b/hotspot/src/os/windows/vm/os_windows.hpp @@ -36,7 +36,7 @@ static const char* path_separator() { return ";"; } class win32 { friend class os; - friend unsigned __stdcall java_start(class Thread*); + friend unsigned __stdcall thread_native_entry(class Thread*); protected: static int _vm_page_size; diff --git a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp index 537595f95ad..211a2dc3323 100644 --- a/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp +++ b/hotspot/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp @@ -390,13 +390,11 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec // BugId 4454115: A read from a MappedByteBuffer can fault here if the // underlying file has been truncated. Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; + CompiledMethod* nm = cb->as_compiled_method_or_null(); if (nm != NULL && nm->has_unsafe_access()) { - // We don't really need a stub here! Just set the pending exeption and - // continue at the next instruction after the faulting read. Returning - // garbage from this read is ok. - thread->set_pending_unsafe_access_error(); - os::Aix::ucontext_set_pc(uc, pc + 4); + address next_pc = pc + 4; + next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); + os::Aix::ucontext_set_pc(uc, next_pc); return 1; } } @@ -415,11 +413,9 @@ JVM_handle_aix_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrec } else if (thread->thread_state() == _thread_in_vm && sig == SIGBUS && thread->doing_unsafe_access()) { - // We don't really need a stub here! Just set the pending exeption and - // continue at the next instruction after the faulting read. Returning - // garbage from this read is ok. - thread->set_pending_unsafe_access_error(); - os::Aix::ucontext_set_pc(uc, pc + 4); + address next_pc = pc + 4; + next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); + os::Aix::ucontext_set_pc(uc, next_pc); return 1; } } diff --git a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp index 73acdebfb47..9fe34fc1770 100644 --- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp +++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp @@ -582,9 +582,10 @@ JVM_handle_bsd_signal(int sig, // here if the underlying file has been truncated. // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL; + CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; if (nm != NULL && nm->has_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + address next_pc = Assembler::locate_next_instruction(pc); + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } } else @@ -655,7 +656,8 @@ JVM_handle_bsd_signal(int sig, } else if (thread->thread_state() == _thread_in_vm && sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + address next_pc = Assembler::locate_next_instruction(pc); + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } // jni_fast_GetField can trap at certain pc's if a GC kicks in diff --git a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp index 2a354fbb72c..04179925e67 100644 --- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp +++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp @@ -226,23 +226,6 @@ extern "C" void FetchNPFI () ; extern "C" void FetchNResume () ; #endif -// An operation in Unsafe has faulted. We're going to return to the -// instruction after the faulting load or store. We also set -// pending_unsafe_access_error so that at some point in the future our -// user will get a helpful message. -static address handle_unsafe_access(JavaThread* thread, address pc) { - // pc is the instruction which we must emulate - // doing a no-op is fine: return garbage from the load - // therefore, compute npc - address npc = pc + NativeCall::instruction_size; - - // request an async exception - thread->set_pending_unsafe_access_error(); - - // return address of next instruction to execute - return npc; -} - extern "C" JNIEXPORT int JVM_handle_linux_signal(int sig, siginfo_t* info, @@ -385,9 +368,10 @@ JVM_handle_linux_signal(int sig, // here if the underlying file has been truncated. // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL; + CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; if (nm != NULL && nm->has_unsafe_access()) { - stub = handle_unsafe_access(thread, pc); + address next_pc = pc + NativeCall::instruction_size; + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } } else @@ -408,7 +392,8 @@ JVM_handle_linux_signal(int sig, } else if (thread->thread_state() == _thread_in_vm && sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { - stub = handle_unsafe_access(thread, pc); + address next_pc = pc + NativeCall::instruction_size; + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } // jni_fast_GetField can trap at certain pc's if a GC kicks in diff --git a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp index 117bf1067f3..8cd04dce290 100644 --- a/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp +++ b/hotspot/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp @@ -315,7 +315,7 @@ JVM_handle_linux_signal(int sig, ((NativeInstruction*)pc)->is_safepoint_poll() && CodeCache::contains((void*) pc) && ((cb = CodeCache::find_blob(pc)) != NULL) && - cb->is_nmethod()) { + cb->is_compiled()) { if (TraceTraps) { tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (SIGSEGV)", p2i(pc)); } @@ -364,13 +364,11 @@ JVM_handle_linux_signal(int sig, // BugId 4454115: A read from a MappedByteBuffer can fault here if the // underlying file has been truncated. Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL; + CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; if (nm != NULL && nm->has_unsafe_access()) { - // We don't really need a stub here! Just set the pending exeption and - // continue at the next instruction after the faulting read. Returning - // garbage from this read is ok. - thread->set_pending_unsafe_access_error(); - os::Linux::ucontext_set_pc(uc, pc + 4); + address next_pc = pc + 4; + next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); + os::Linux::ucontext_set_pc(uc, next_pc); return true; } } @@ -385,10 +383,8 @@ JVM_handle_linux_signal(int sig, } else if (thread->thread_state() == _thread_in_vm && sig == SIGBUS && thread->doing_unsafe_access()) { - // We don't really need a stub here! Just set the pending exeption and - // continue at the next instruction after the faulting read. Returning - // garbage from this read is ok. - thread->set_pending_unsafe_access_error(); + address next_pc = pc + 4; + next_pc = SharedRuntime::handle_unsafe_access(thread, next_pc); os::Linux::ucontext_set_pc(uc, pc + 4); return true; } diff --git a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp index 44a5a7df1f9..4a0da12c498 100644 --- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp +++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp @@ -433,14 +433,14 @@ inline static bool checkPollingPage(address pc, address fault, address* stub) { return false; } -inline static bool checkByteBuffer(address pc, address* stub) { +inline static bool checkByteBuffer(address pc, address npc, address* stub) { // BugId 4454115: A read from a MappedByteBuffer can fault // here if the underlying file has been truncated. // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; + CompiledMethod* nm = cb->as_compiled_method_or_null(); if (nm != NULL && nm->has_unsafe_access()) { - *stub = StubRoutines::handler_for_unsafe_access(); + *stub = SharedRuntime::handle_unsafe_access(thread, npc); return true; } return false; @@ -613,7 +613,7 @@ JVM_handle_linux_signal(int sig, if (sig == SIGBUS && thread->thread_state() == _thread_in_vm && thread->doing_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + stub = SharedRuntime::handle_unsafe_access(thread, npc); } if (thread->thread_state() == _thread_in_Java) { @@ -625,7 +625,7 @@ JVM_handle_linux_signal(int sig, break; } - if ((sig == SIGBUS) && checkByteBuffer(pc, &stub)) { + if ((sig == SIGBUS) && checkByteBuffer(pc, npc, &stub)) { break; } diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index 0eb7a9e511f..b73658ed036 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -418,9 +418,10 @@ JVM_handle_linux_signal(int sig, // here if the underlying file has been truncated. // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - nmethod* nm = (cb != NULL && cb->is_nmethod()) ? (nmethod*)cb : NULL; + CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; if (nm != NULL && nm->has_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + address next_pc = Assembler::locate_next_instruction(pc); + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } } else @@ -469,7 +470,8 @@ JVM_handle_linux_signal(int sig, } else if (thread->thread_state() == _thread_in_vm && sig == SIGBUS && /* info->si_code == BUS_OBJERR && */ thread->doing_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + address next_pc = Assembler::locate_next_instruction(pc); + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } // jni_fast_GetField can trap at certain pc's if a GC kicks in diff --git a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp index 389f2b3a59d..39663ed0e74 100644 --- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp +++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp @@ -441,7 +441,7 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, if (thread->thread_state() == _thread_in_vm) { if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + stub = SharedRuntime::handle_unsafe_access(thread, npc); } } @@ -478,9 +478,9 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, // here if the underlying file has been truncated. // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; + CompiledMethod* nm = cb->as_compiled_method_or_null(); if (nm != NULL && nm->has_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + stub = SharedRuntime::handle_unsafe_access(thread, npc); } } diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index 0784f3f25f7..695fc127835 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -503,7 +503,8 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, if (thread->thread_state() == _thread_in_vm) { if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + address next_pc = Assembler::locate_next_instruction(pc); + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } } @@ -518,9 +519,10 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, // Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob_unsafe(pc); if (cb != NULL) { - nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL; + CompiledMethod* nm = cb->as_compiled_method_or_null(); if (nm != NULL && nm->has_unsafe_access()) { - stub = StubRoutines::handler_for_unsafe_access(); + address next_pc = Assembler::locate_next_instruction(pc); + stub = SharedRuntime::handle_unsafe_access(thread, next_pc); } } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java index 713d7a1d80f..8b526cf6b64 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java @@ -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 @@ -25,11 +25,13 @@ package com.sun.hotspot.igv.coordinator; import com.sun.hotspot.igv.coordinator.actions.RemoveCookie; import com.sun.hotspot.igv.data.*; +import com.sun.hotspot.igv.util.PropertiesSheet; import java.awt.Image; import java.util.List; import org.openide.nodes.AbstractNode; import org.openide.nodes.Children; import org.openide.nodes.Node; +import org.openide.nodes.Sheet; import org.openide.util.ImageUtilities; import org.openide.util.lookup.AbstractLookup; import org.openide.util.lookup.InstanceContent; @@ -74,6 +76,16 @@ public class FolderNode extends AbstractNode { } } + @Override + protected Sheet createSheet() { + Sheet s = super.createSheet(); + if (children.folder instanceof Properties.Entity) { + Properties.Entity p = (Properties.Entity) children.folder; + PropertiesSheet.initializeSheet(p.getProperties(), s); + } + return s; + } + @Override public Image getIcon(int i) { return ImageUtilities.loadImage("com/sun/hotspot/igv/coordinator/images/folder.png"); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java index 292dcd4b6fb..ad43e6f8949 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/OutlineTopComponent.java @@ -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 @@ -124,6 +124,8 @@ public final class OutlineTopComponent extends TopComponent implements ExplorerM public void clear() { document.clear(); + root = new FolderNode(document); + manager.setRootContext(root); } @Override diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java index 5bd6c199bf5..ee643b23cc0 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/ImportAction.java @@ -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 @@ -31,31 +31,47 @@ import com.sun.hotspot.igv.data.serialization.GraphParser; import com.sun.hotspot.igv.data.serialization.ParseMonitor; import com.sun.hotspot.igv.data.serialization.Parser; import com.sun.hotspot.igv.settings.Settings; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; +import java.awt.event.ActionEvent; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.channels.FileChannel; import java.nio.file.StandardOpenOption; -import javax.swing.Action; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.JFileChooser; -import javax.swing.KeyStroke; import javax.swing.SwingUtilities; import javax.swing.filechooser.FileFilter; import org.netbeans.api.progress.ProgressHandle; import org.netbeans.api.progress.ProgressHandleFactory; import org.openide.util.Exceptions; +import org.openide.util.RequestProcessor; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; -import org.openide.util.RequestProcessor; -import org.openide.util.actions.CallableSystemAction; +import org.openide.util.actions.SystemAction; /** * * @author Thomas Wuerthinger */ -public final class ImportAction extends CallableSystemAction { + +@ActionID( + category = "File", + id = "com.sun.hotspot.igv.coordinator.actions.ImportAction" +) +@ActionRegistration( + iconBase = "com/sun/hotspot/igv/coordinator/images/import.png", + displayName = "#CTL_ImportAction" +) +@ActionReferences({ + @ActionReference(path = "Menu/File", position = 0), + @ActionReference(path = "Shortcuts", name = "C-O") +}) +public final class ImportAction extends SystemAction { private static final int WORKUNITS = 10000; public static FileFilter getFileFilter() { @@ -74,74 +90,77 @@ public final class ImportAction extends CallableSystemAction { } @Override - public void performAction() { - + public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ImportAction.getFileFilter()); fc.setCurrentDirectory(new File(Settings.get().get(Settings.DIRECTORY, Settings.DIRECTORY_DEFAULT))); + fc.setMultiSelectionEnabled(true); if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { - File file = fc.getSelectedFile(); - - File dir = file; - if (!dir.isDirectory()) { - dir = dir.getParentFile(); - } - - Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); - try { - final FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.READ); - final ProgressHandle handle = ProgressHandleFactory.createHandle("Opening file " + file.getName()); - handle.start(WORKUNITS); - final long start = channel.size(); - ParseMonitor monitor = new ParseMonitor() { - @Override - public void updateProgress() { - try { - int prog = (int) (WORKUNITS * (double) channel.position() / (double) start); - handle.progress(prog); - } catch (IOException ex) { - } - } - @Override - public void setState(String state) { - updateProgress(); - handle.progress(state); - } - }; - final GraphParser parser; - final OutlineTopComponent component = OutlineTopComponent.findInstance(); - if (file.getName().endsWith(".xml")) { - parser = new Parser(channel, monitor, null); - } else if (file.getName().endsWith(".bgv")) { - parser = new BinaryParser(channel, monitor, component.getDocument(), null); - } else { - parser = null; + for (final File file : fc.getSelectedFiles()) { + File dir = file; + if (!dir.isDirectory()) { + dir = dir.getParentFile(); } - RequestProcessor.getDefault().post(new Runnable() { - @Override - public void run() { - try { - final GraphDocument document = parser.parse(); - if (document != null) { - SwingUtilities.invokeLater(new Runnable(){ - @Override - public void run() { - component.requestActive(); - component.getDocument().addGraphDocument(document); - } - }); + + Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath()); + try { + final FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.READ); + final ProgressHandle handle = ProgressHandleFactory.createHandle("Opening file " + file.getName()); + handle.start(WORKUNITS); + final long startTime = System.currentTimeMillis(); + final long start = channel.size(); + ParseMonitor monitor = new ParseMonitor() { + @Override + public void updateProgress() { + try { + int prog = (int) (WORKUNITS * (double) channel.position() / (double) start); + handle.progress(prog); + } catch (IOException ex) { + } } - } catch (IOException ex) { - Exceptions.printStackTrace(ex); - } - handle.finish(); + @Override + public void setState(String state) { + updateProgress(); + handle.progress(state); + } + }; + final GraphParser parser; + final OutlineTopComponent component = OutlineTopComponent.findInstance(); + if (file.getName().endsWith(".xml")) { + parser = new Parser(channel, monitor, null); + } else if (file.getName().endsWith(".bgv")) { + parser = new BinaryParser(channel, monitor, component.getDocument(), null); + } else { + parser = null; } - }); - } catch (FileNotFoundException ex) { - Exceptions.printStackTrace(ex); - } catch (IOException ex) { - Exceptions.printStackTrace(ex); + RequestProcessor.getDefault().post(new Runnable() { + @Override + public void run() { + try { + final GraphDocument document = parser.parse(); + if (document != null) { + SwingUtilities.invokeLater(new Runnable(){ + @Override + public void run() { + component.requestActive(); + component.getDocument().addGraphDocument(document); + } + }); + } + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } + handle.finish(); + long stop = System.currentTimeMillis(); + Logger.getLogger(getClass().getName()).log(Level.INFO, "Loaded in " + file + " in " + ((stop - startTime) / 1000.0) + " seconds"); + } + }); + } catch (FileNotFoundException ex) { + Exceptions.printStackTrace(ex); + } catch (IOException ex) { + Exceptions.printStackTrace(ex); + } } } } @@ -151,11 +170,6 @@ public final class ImportAction extends CallableSystemAction { return NbBundle.getMessage(ImportAction.class, "CTL_ImportAction"); } - public ImportAction() { - putValue(Action.SHORT_DESCRIPTION, "Open XML graph document..."); - putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK)); - } - @Override protected String iconResource() { return "com/sun/hotspot/igv/coordinator/images/import.png"; @@ -165,9 +179,4 @@ public final class ImportAction extends CallableSystemAction { public HelpCtx getHelpCtx() { return HelpCtx.DEFAULT_HELP; } - - @Override - protected boolean asynchronous() { - return false; - } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java index eb75dd9753a..df1ed46a003 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/SaveAllAction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,14 +29,30 @@ import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import javax.swing.Action; import javax.swing.KeyStroke; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; import org.openide.util.HelpCtx; import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Messages; import org.openide.util.actions.CallableSystemAction; /** * * @author Thomas Wuerthinger */ +@ActionID( + category = "File", + id = "com.sun.hotspot.igv.coordinator.actions.SaveAllAction" +) +@ActionRegistration( + displayName = "#CTL_SaveAllAction" +) +@ActionReferences({ + @ActionReference(path = "Menu/File", position = 0), + @ActionReference(path = "Shortcuts", name = "C-S") +}) public final class SaveAllAction extends CallableSystemAction { @Override diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml index 49fbe2fd330..ef808eed53c 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/layer.xml @@ -18,6 +18,8 @@ + + @@ -43,11 +45,11 @@ - + - + diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java index 8c62573b2d4..85a0494658c 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java @@ -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 @@ -51,11 +51,13 @@ public class GraphDocument extends Properties.Entity implements ChangedEventProv } public void addGraphDocument(GraphDocument document) { - for (FolderElement e : document.elements) { - e.setParent(this); - this.addElement(e); + if (document != this) { + for (FolderElement e : document.elements) { + e.setParent(this); + this.addElement(e); + } + document.clear(); } - document.clear(); getChangedEvent().fire(); } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java index 2626e51e734..242623d7ada 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputBlock.java @@ -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 @@ -90,7 +90,9 @@ public class InputBlock { public void addNode(int id) { InputNode node = graph.getNode(id); assert node != null; - assert !nodes.contains(node) : "duplicate : " + node; + // nodes.contains(node) is too expensive for large graphs so + // just make sure the Graph doesn't know it yet. + assert graph.getBlock(id) == null : "duplicate : " + node; graph.setBlock(node, this); nodes.add(node); } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java index 2646231bfab..d0499c23524 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java @@ -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 @@ -24,7 +24,9 @@ package com.sun.hotspot.igv.data; import java.io.Serializable; +import java.lang.ref.WeakReference; import java.util.*; +import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; @@ -36,7 +38,7 @@ import java.util.regex.PatternSyntaxException; public class Properties implements Serializable, Iterable { public static final long serialVersionUID = 1L; - private String[] map = new String[4]; + protected String[] map = new String[4]; public Properties() { } @@ -102,6 +104,59 @@ public class Properties implements Serializable, Iterable { System.arraycopy(p.map, 0, map, 0, p.map.length); } + protected Properties(String[] map) { + this.map = map; + } + + static class SharedProperties extends Properties { + int hashCode; + + SharedProperties(String[] map) { + super(map); + this.hashCode = Arrays.hashCode(map); + } + + @Override + protected void setPropertyInternal(String name, String value) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean equals(Object other) { + if (this == other) { + return true; + } + if (!(other instanceof SharedProperties)) { + return super.equals(other); + } + SharedProperties props2 = (SharedProperties) other; + return Arrays.equals(map, props2.map); + } + + @Override + public int hashCode() { + return hashCode; + } + } + + private static class PropertyCache { + static WeakHashMap> immutableCache = new WeakHashMap<>(); + + static synchronized SharedProperties intern(Properties properties) { + String[] map = properties.map; + SharedProperties key = new SharedProperties(map); + WeakReference entry = immutableCache.get(key); + if (entry != null) { + SharedProperties props = entry.get(); + if (props != null) { + return props; + } + } + immutableCache.put(key, new WeakReference<>(key)); + return key; + } + } + public static class Entity implements Provider { private Properties properties; @@ -118,6 +173,10 @@ public class Properties implements Serializable, Iterable { public Properties getProperties() { return properties; } + + public void internProperties() { + properties = PropertyCache.intern(properties); + } } public interface PropertyMatcher { @@ -322,8 +381,8 @@ public class Properties implements Serializable, Iterable { public void setProperty(String name, String value) { setPropertyInternal(name.intern(), value != null ? value.intern() : null); } - private void setPropertyInternal(String name, String value) { + protected void setPropertyInternal(String name, String value) { for (int i = 0; i < map.length; i += 2) { if (map[i] != null && map[i].equals(name)) { String p = map[i + 1]; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/BinaryParser.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/BinaryParser.java index 5529701b979..52d5a7174f1 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/BinaryParser.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/BinaryParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -31,6 +31,7 @@ import java.io.EOFException; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.ReadableByteChannel; +import java.nio.charset.Charset; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -68,6 +69,8 @@ public class BinaryParser implements GraphParser { private static final String NO_BLOCK = "noBlock"; + private static final Charset utf8 = Charset.forName("UTF-8"); + private final GroupCallback callback; private final List constantPool; private final ByteBuffer buffer; @@ -275,28 +278,36 @@ public class BinaryParser implements GraphParser { hashStack = new LinkedList<>(); this.monitor = monitor; try { - this.digest = MessageDigest.getInstance("SHA-256"); + this.digest = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { } } private void fill() throws IOException { + // All the data between lastPosition and position has been + // used so add it to the digest. + int position = buffer.position(); + buffer.position(lastPosition); + byte[] remaining = new byte[position - buffer.position()]; + buffer.get(remaining); + digest.update(remaining); + assert position == buffer.position(); + buffer.compact(); if (channel.read(buffer) < 0) { throw new EOFException(); } buffer.flip(); + lastPosition = buffer.position(); } private void ensureAvailable(int i) throws IOException { + if (i > buffer.capacity()) { + throw new IllegalArgumentException(String.format("Can not request %d bytes: buffer capacity is %d", i, buffer.capacity())); + } while (buffer.remaining() < i) { fill(); } - buffer.mark(); - byte[] result = new byte[i]; - buffer.get(result); - digest.update(result); - buffer.reset(); } private int readByte() throws IOException { @@ -330,12 +341,7 @@ public class BinaryParser implements GraphParser { } private String readString() throws IOException { - int len = readInt(); - ensureAvailable(len * 2); - char[] chars = new char[len]; - buffer.asCharBuffer().get(chars); - buffer.position(buffer.position() + len * 2); - return new String(chars).intern(); + return new String(readBytes(), utf8).intern(); } private byte[] readBytes() throws IOException { @@ -343,10 +349,15 @@ public class BinaryParser implements GraphParser { if (len < 0) { return null; } - ensureAvailable(len); - byte[] data = new byte[len]; - buffer.get(data); - return data; + byte[] b = new byte[len]; + int bytesRead = 0; + while (bytesRead < b.length) { + int toRead = Math.min(b.length - bytesRead, buffer.capacity()); + ensureAvailable(toRead); + buffer.get(b, bytesRead, toRead); + bytesRead += toRead; + } + return b; } private String readIntsToString() throws IOException { @@ -643,6 +654,7 @@ public class BinaryParser implements GraphParser { int bci = readInt(); Group group = new Group(parent); group.getProperties().setProperty("name", name); + parseProperties(group.getProperties()); if (method != null) { InputMethod inMethod = new InputMethod(group, method.name, shortName, bci); inMethod.setBytecodes("TODO"); @@ -651,13 +663,25 @@ public class BinaryParser implements GraphParser { return group; } + int lastPosition = 0; + private InputGraph parseGraph() throws IOException { if (monitor != null) { monitor.updateProgress(); } String title = readPoolObject(String.class); digest.reset(); + lastPosition = buffer.position(); InputGraph graph = parseGraph(title); + + int position = buffer.position(); + buffer.position(lastPosition); + byte[] remaining = new byte[position - buffer.position()]; + buffer.get(remaining); + digest.update(remaining); + assert position == buffer.position(); + lastPosition = buffer.position(); + byte[] d = digest.digest(); byte[] hash = hashStack.peek(); if (hash != null && Arrays.equals(hash, d)) { @@ -669,11 +693,24 @@ public class BinaryParser implements GraphParser { return graph; } + private void parseProperties(Properties properties) throws IOException { + int propCount = readShort(); + for (int j = 0; j < propCount; j++) { + String key = readPoolObject(String.class); + Object value = readPropertyObject(); + properties.setProperty(key, value != null ? value.toString() : "null"); + } + } + private InputGraph parseGraph(String title) throws IOException { InputGraph graph = new InputGraph(title); + parseProperties(graph.getProperties()); parseNodes(graph); parseBlocks(graph); graph.ensureNodesInBlocks(); + for (InputNode node : graph.getNodes()) { + node.internProperties(); + } return graph; } @@ -822,9 +859,10 @@ public class BinaryParser implements GraphParser { } } + static final Pattern templatePattern = Pattern.compile("\\{(p|i)#([a-zA-Z0-9$_]+)(/(l|m|s))?\\}"); + private String createName(List edges, Map properties, String template) { - Pattern p = Pattern.compile("\\{(p|i)#([a-zA-Z0-9$_]+)(/(l|m|s))?\\}"); - Matcher m = p.matcher(template); + Matcher m = templatePattern.matcher(template); StringBuffer sb = new StringBuffer(); while (m.find()) { String name = m.group(2); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/InputGraphProvider.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/InputGraphProvider.java index 638a065c40b..b3ef1fcb876 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/InputGraphProvider.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/InputGraphProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,4 +37,14 @@ public interface InputGraphProvider { InputGraph getGraph(); void setSelectedNodes(Set nodes); + + /** + * @return an iterator walking forward through the {@link InputGraph}s following the {@link #getGraph()} + */ + Iterable searchForward(); + + /** + * @return an iterator walking backward through the {@link InputGraph}s preceeding the {@link #getGraph()} + */ + Iterable searchBackward(); } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/nbproject/project.xml b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/nbproject/project.xml index 7e3f062052b..a4aadaa4751 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/nbproject/project.xml +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/nbproject/project.xml @@ -22,6 +22,14 @@ 1.0 + + com.sun.hotspot.igv.util + + + + 1.0 + + com.sun.hotspot.igv.graph diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java index da101bf7341..79d129984f1 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Slot.java @@ -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 @@ -28,6 +28,7 @@ import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.data.Source; import com.sun.hotspot.igv.layout.Port; import com.sun.hotspot.igv.layout.Vertex; +import com.sun.hotspot.igv.util.StringUtils; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; @@ -141,7 +142,7 @@ public abstract class Slot implements Port, Source.Provider, Properties.Provider sb.append(text); for (InputNode n : getSource().getSourceNodes()) { - sb.append("Node (ID=" + n.getId() + "): " + n.getProperties().get("name")); + sb.append(StringUtils.escapeHTML("Node (ID=" + n.getId() + "): " + n.getProperties().get("name"))); sb.append("
"); } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java index a1ccc650230..cccca711113 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -445,5 +445,48 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene void close() { filterChain.getChangedEvent().removeListener(filterChainChangedListener); sequenceFilterChain.getChangedEvent().removeListener(filterChainChangedListener); -} + } + + Iterable getGraphsForward() { + return new Iterable() { + + @Override + public Iterator iterator() { + return new Iterator() { + int index = getFirstPosition(); + + @Override + public boolean hasNext() { + return index + 1 < graphs.size(); + } + + @Override + public InputGraph next() { + return graphs.get(++index); + } + }; + } + }; + } + + Iterable getGraphsBackward() { + return new Iterable() { + @Override + public Iterator iterator() { + return new Iterator() { + int index = getFirstPosition(); + + @Override + public boolean hasNext() { + return index - 1 > 0; + } + + @Override + public InputGraph next() { + return graphs.get(--index); + } + }; + } + }; + } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorInputGraphProvider.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorInputGraphProvider.java index cb4c9f6be96..fd7a19ae718 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorInputGraphProvider.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorInputGraphProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,4 +50,14 @@ public class EditorInputGraphProvider implements InputGraphProvider { public void setSelectedNodes(Set nodes) { editor.setSelectedNodes(nodes); } + + @Override + public Iterable searchBackward() { + return editor.getDiagramModel().getGraphsBackward(); + } + + @Override + public Iterable searchForward() { + return editor.getDiagramModel().getGraphsForward(); + } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java index 6da842ceb9d..9a858385f27 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/EditorTopComponent.java @@ -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 @@ -289,7 +289,10 @@ public final class EditorTopComponent extends TopComponent implements PropertyCh quicksearch = (Component) quicksearch.getClass().getConstructor(KeyStroke.class).newInstance(new Object[]{null}); } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) { } - quicksearch.setMinimumSize(quicksearch.getPreferredSize()); // necessary for GTK LAF + Dimension preferredSize = quicksearch.getPreferredSize(); + preferredSize = new Dimension((int) preferredSize.getWidth() * 2, (int) preferredSize.getHeight()); + quicksearch.setMinimumSize(preferredSize); // necessary for GTK LAF + quicksearch.setPreferredSize(preferredSize); toolBar.add(quicksearch); centerPanel = new JPanel(); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java index 53773a26b89..23b23ed15d0 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/NodeQuickSearch.java @@ -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 @@ -23,6 +23,7 @@ */ package com.sun.hotspot.igv.view; +import com.sun.hotspot.igv.data.InputGraph; import com.sun.hotspot.igv.data.InputNode; import com.sun.hotspot.igv.data.Properties; import com.sun.hotspot.igv.data.Properties.RegexpPropertyMatcher; @@ -81,57 +82,67 @@ public class NodeQuickSearch implements SearchProvider { final InputGraphProvider p = LookupHistory.getLast(InputGraphProvider.class); if (p != null && p.getGraph() != null) { - List matches = null; - try { - RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE); - Properties.PropertySelector selector = new Properties.PropertySelector<>(p.getGraph().getNodes()); - - matches = selector.selectMultiple(matcher); - } catch (Exception e) { - final String msg = e.getMessage(); - response.addResult(new Runnable() { - @Override - public void run() { - Message desc = new NotifyDescriptor.Message("An exception occurred during the search, " - + "perhaps due to a malformed query string:\n" + msg, - NotifyDescriptor.WARNING_MESSAGE); - DialogDisplayer.getDefault().notify(desc); - } - }, - "(Error during search)" - ); + InputGraph matchGraph = p.getGraph(); + // Search the current graph + List matches = findMatches(name, value, p.getGraph(), response); + if (matches == null) { + // See if the it hits in a later graph + for (InputGraph graph : p.searchForward()) { + matches = findMatches(name, value, graph, response); + if (matches != null) { + matchGraph = graph; + break; + } + } + } + if (matches == null) { + // See if it hits in a earlier graph + for (InputGraph graph : p.searchBackward()) { + matches = findMatches(name, value, graph, response); + if (matches != null) { + matchGraph = graph; + break; + } + } } if (matches != null) { final Set set = new HashSet<>(matches); + final InputGraph theGraph = p.getGraph() != matchGraph ? matchGraph : null; response.addResult(new Runnable() { @Override - public void run() { - final EditorTopComponent comp = EditorTopComponent.getActive(); - if (comp != null) { - comp.setSelectedNodes(set); - comp.requestActive(); + public void run() { + final EditorTopComponent comp = EditorTopComponent.getActive(); + if (comp != null) { + if (theGraph != null) { + comp.getDiagramModel().selectGraph(theGraph); } + comp.setSelectedNodes(set); + comp.requestActive(); } - }, - "All " + matches.size() + " matching nodes (" + name + "=" + value + ")" + } + }, + "All " + matches.size() + " matching nodes (" + name + "=" + value + ")" + (theGraph != null ? " in " + theGraph.getName() : "") ); // Single matches for (final InputNode n : matches) { response.addResult(new Runnable() { @Override - public void run() { - final EditorTopComponent comp = EditorTopComponent.getActive(); - if (comp != null) { - final Set tmpSet = new HashSet<>(); - tmpSet.add(n); - comp.setSelectedNodes(tmpSet); - comp.requestActive(); + public void run() { + final EditorTopComponent comp = EditorTopComponent.getActive(); + if (comp != null) { + final Set tmpSet = new HashSet<>(); + tmpSet.add(n); + if (theGraph != null) { + comp.getDiagramModel().selectGraph(theGraph); } + comp.setSelectedNodes(tmpSet); + comp.requestActive(); } - }, - n.getProperties().get(name) + " (" + n.getId() + " " + n.getProperties().get("name") + ")" + } + }, + n.getProperties().get(name) + " (" + n.getId() + " " + n.getProperties().get("name") + ")" + (theGraph != null ? " in " + theGraph.getName() : "") ); } } @@ -139,4 +150,27 @@ public class NodeQuickSearch implements SearchProvider { System.out.println("no input graph provider!"); } } + + private List findMatches(String name, String value, InputGraph inputGraph, SearchResponse response) { + try { + RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE); + Properties.PropertySelector selector = new Properties.PropertySelector<>(inputGraph.getNodes()); + List matches = selector.selectMultiple(matcher); + return matches.size() == 0 ? null : matches; + } catch (Exception e) { + final String msg = e.getMessage(); + response.addResult(new Runnable() { + @Override + public void run() { + Message desc = new NotifyDescriptor.Message("An exception occurred during the search, " + + "perhaps due to a malformed query string:\n" + msg, + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(desc); + } + }, + "(Error during search)" + ); + } + return null; + } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/layer.xml b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/layer.xml index 66979b19e57..e37ac818667 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/layer.xml +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/layer.xml @@ -61,14 +61,26 @@ + + + + + + + + + + + + diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java index 2d9efb8fdcc..3cf39ca34ef 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/widgets/LineWidget.java @@ -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 @@ -27,6 +27,7 @@ import com.sun.hotspot.igv.graph.Connection; import com.sun.hotspot.igv.graph.Figure; import com.sun.hotspot.igv.graph.InputSlot; import com.sun.hotspot.igv.graph.OutputSlot; +import com.sun.hotspot.igv.util.StringUtils; import com.sun.hotspot.igv.view.DiagramScene; import java.awt.*; import java.awt.geom.Line2D; @@ -148,7 +149,7 @@ public class LineWidget extends Widget implements PopupMenuProvider { private String generateToolTipText(List conn) { StringBuilder sb = new StringBuilder(); for (Connection c : conn) { - sb.append(c.getToolTipText()); + sb.append(StringUtils.escapeHTML(c.getToolTipText())); sb.append("
"); } return sb.toString(); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties b/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties index 39801a7cf7a..f9a657cb6ee 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties +++ b/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties @@ -48,5 +48,5 @@ project.com.sun.hotspot.igv.util=Util # Disable assertions for RequestProcessor to prevent annoying messages in case # of multiple SceneAnimator update tasks in the default RequestProcessor. -run.args.extra = -J-server -J-da:org.openide.util.RequestProcessor -J-Xms2g -J-Xmx8g -J-Djava.lang.Integer.IntegerCache.high=20000 +run.args.extra = -J-server -J-da:org.openide.util.RequestProcessor -J-Xms2g -J-Xmx8g -J-Djava.lang.Integer.IntegerCache.high=200000 debug.args.extra = -J-server -J-da:org.openide.util.RequestProcessor diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp index 0586fbe228b..c3fba978d66 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.cpp +++ b/hotspot/src/share/vm/asm/codeBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -604,7 +604,7 @@ void CodeBuffer::finalize_oop_references(const methodHandle& mh) { -csize_t CodeBuffer::total_offset_of(CodeSection* cs) const { +csize_t CodeBuffer::total_offset_of(const CodeSection* cs) const { csize_t size_so_far = 0; for (int n = (int) SECT_FIRST; n < (int) SECT_LIMIT; n++) { const CodeSection* cur_cs = code_section(n); diff --git a/hotspot/src/share/vm/asm/codeBuffer.hpp b/hotspot/src/share/vm/asm/codeBuffer.hpp index 534a81f0631..aefcbab1174 100644 --- a/hotspot/src/share/vm/asm/codeBuffer.hpp +++ b/hotspot/src/share/vm/asm/codeBuffer.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -468,9 +468,11 @@ class CodeBuffer: public StackObj { // construction. void initialize(csize_t code_size, csize_t locs_size); - CodeSection* consts() { return &_consts; } - CodeSection* insts() { return &_insts; } - CodeSection* stubs() { return &_stubs; } + CodeSection* consts() { return &_consts; } + CodeSection* insts() { return &_insts; } + CodeSection* stubs() { return &_stubs; } + + const CodeSection* insts() const { return &_insts; } // present sections in order; return NULL at end; consts is #0, etc. CodeSection* code_section(int n) { @@ -547,7 +549,7 @@ class CodeBuffer: public StackObj { // Combined offset (relative to start of first section) of given // section, as eventually found in the final CodeBlob. - csize_t total_offset_of(CodeSection* cs) const; + csize_t total_offset_of(const CodeSection* cs) const; // allocated size of all relocation data, including index, rounded up csize_t total_relocation_size() const; diff --git a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp index 2b01e3ae04c..7e65f3c235f 100644 --- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp +++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp @@ -247,7 +247,7 @@ void Canonicalizer::do_ArrayLength (ArrayLength* x) { } else if ((lf = x->array()->as_LoadField()) != NULL) { ciField* field = lf->field(); - if (field->is_constant() && field->is_static()) { + if (field->is_static_constant()) { assert(PatchALot || ScavengeRootsInCode < 2, "Constant field loads are folded during parsing"); ciObject* c = field->constant_value().as_object(); if (!c->is_null_object()) { diff --git a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp index 05a8c70506f..457c9cc14eb 100644 --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp @@ -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 @@ -77,17 +77,13 @@ class CodeStub: public CompilationResourceObj { } }; - -define_array(CodeStubArray, CodeStub*) -define_stack(_CodeStubList, CodeStubArray) - -class CodeStubList: public _CodeStubList { +class CodeStubList: public GrowableArray { public: - CodeStubList(): _CodeStubList() {} + CodeStubList(): GrowableArray() {} void append(CodeStub* stub) { if (!contains(stub)) { - _CodeStubList::append(stub); + GrowableArray::append(stub); } } }; diff --git a/hotspot/src/share/vm/c1/c1_Compilation.hpp b/hotspot/src/share/vm/c1/c1_Compilation.hpp index 3bc07da9f7d..a60d1fd62a3 100644 --- a/hotspot/src/share/vm/c1/c1_Compilation.hpp +++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -53,12 +53,9 @@ class C1_MacroAssembler; class CFGPrinter; typedef LIR_OprDesc* LIR_Opr; - -define_array(BasicTypeArray, BasicType) -define_stack(BasicTypeList, BasicTypeArray) - -define_array(ExceptionInfoArray, ExceptionInfo*) -define_stack(ExceptionInfoList, ExceptionInfoArray) +typedef GrowableArray BasicTypeArray; +typedef GrowableArray BasicTypeList; +typedef GrowableArray ExceptionInfoList; class Compilation: public StackObj { friend class CompilationResourceObj; diff --git a/hotspot/src/share/vm/c1/c1_Compiler.cpp b/hotspot/src/share/vm/c1/c1_Compiler.cpp index 1829ff8f887..e292574e80c 100644 --- a/hotspot/src/share/vm/c1/c1_Compiler.cpp +++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp @@ -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 @@ -131,6 +131,9 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) { if (!VM_Version::supports_atomic_getset4()) return false; #endif break; + case vmIntrinsics::_onSpinWait: + if (!VM_Version::supports_on_spin_wait()) return false; + break; case vmIntrinsics::_arraycopy: case vmIntrinsics::_currentTimeMillis: case vmIntrinsics::_nanoTime: @@ -195,20 +198,6 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) { case vmIntrinsics::_putLongVolatile: case vmIntrinsics::_putFloatVolatile: case vmIntrinsics::_putDoubleVolatile: - case vmIntrinsics::_getByte_raw: - case vmIntrinsics::_getShort_raw: - case vmIntrinsics::_getChar_raw: - case vmIntrinsics::_getInt_raw: - case vmIntrinsics::_getLong_raw: - case vmIntrinsics::_getFloat_raw: - case vmIntrinsics::_getDouble_raw: - case vmIntrinsics::_putByte_raw: - case vmIntrinsics::_putShort_raw: - case vmIntrinsics::_putChar_raw: - case vmIntrinsics::_putInt_raw: - case vmIntrinsics::_putLong_raw: - case vmIntrinsics::_putFloat_raw: - case vmIntrinsics::_putDouble_raw: case vmIntrinsics::_getShortUnaligned: case vmIntrinsics::_getCharUnaligned: case vmIntrinsics::_getIntUnaligned: @@ -221,6 +210,11 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) { case vmIntrinsics::_updateCRC32: case vmIntrinsics::_updateBytesCRC32: case vmIntrinsics::_updateByteBufferCRC32: +#ifdef SPARC + case vmIntrinsics::_updateBytesCRC32C: + case vmIntrinsics::_updateDirectByteBufferCRC32C: +#endif + case vmIntrinsics::_vectorizedMismatch: case vmIntrinsics::_compareAndSwapInt: case vmIntrinsics::_compareAndSwapObject: case vmIntrinsics::_getCharStringU: diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.cpp b/hotspot/src/share/vm/c1/c1_FrameMap.cpp index a164d8ccb00..d9e5acbfe2c 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -164,7 +164,7 @@ FrameMap::FrameMap(ciMethod* method, int monitors, int reserved_argument_area_si _reserved_argument_area_size = MAX2(4, reserved_argument_area_size) * BytesPerWord; _argcount = method->arg_size(); - _argument_locations = new intArray(_argcount, -1); + _argument_locations = new intArray(_argcount, _argcount, -1); _incoming_arguments = java_calling_convention(signature_type_array_for(method), false); _oop_map_arg_count = _incoming_arguments->reserved_stack_slots(); diff --git a/hotspot/src/share/vm/c1/c1_FrameMap.hpp b/hotspot/src/share/vm/c1/c1_FrameMap.hpp index d5d12ed36c3..5e29ca33aec 100644 --- a/hotspot/src/share/vm/c1/c1_FrameMap.hpp +++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -36,8 +36,6 @@ class ciMethod; class CallingConvention; -class BasicTypeArray; -class BasicTypeList; //-------------------------------------------------------- // FrameMap diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index 7eacc2c952d..69d475ac939 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -50,11 +50,11 @@ class BlockListBuilder VALUE_OBJ_CLASS_SPEC { BlockList* _bci2block; // mapping from bci to blocks for GraphBuilder // fields used by mark_loops - BitMap _active; // for iteration of control flow graph - BitMap _visited; // for iteration of control flow graph - intArray _loop_map; // caches the information if a block is contained in a loop - int _next_loop_index; // next free loop number - int _next_block_number; // for reverse postorder numbering of blocks + ResourceBitMap _active; // for iteration of control flow graph + ResourceBitMap _visited; // for iteration of control flow graph + intArray _loop_map; // caches the information if a block is contained in a loop + int _next_loop_index; // next free loop number + int _next_block_number; // for reverse postorder numbering of blocks // accessors Compilation* compilation() const { return _compilation; } @@ -227,7 +227,7 @@ void BlockListBuilder::set_leaders() { // Without it, backward branches could jump to a bci where no block was created // during bytecode iteration. This would require the creation of a new block at the // branch target and a modification of the successor lists. - BitMap bci_block_start = method()->bci_block_start(); + const BitMap& bci_block_start = method()->bci_block_start(); ciBytecodeStream s(method()); while (s.next() != ciBytecodeStream::EOBC()) { @@ -355,15 +355,19 @@ void BlockListBuilder::set_leaders() { void BlockListBuilder::mark_loops() { ResourceMark rm; - _active = BitMap(BlockBegin::number_of_blocks()); _active.clear(); - _visited = BitMap(BlockBegin::number_of_blocks()); _visited.clear(); - _loop_map = intArray(BlockBegin::number_of_blocks(), 0); + _active.initialize(BlockBegin::number_of_blocks()); + _visited.initialize(BlockBegin::number_of_blocks()); + _loop_map = intArray(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), 0); _next_loop_index = 0; _next_block_number = _blocks.length(); // recursively iterate the control flow graph mark_loops(_bci2block->at(0), false); assert(_next_block_number >= 0, "invalid block numbers"); + + // Remove dangling Resource pointers before the ResourceMark goes out-of-scope. + _active.resize(0); + _visited.resize(0); } void BlockListBuilder::make_loop_header(BlockBegin* block) { @@ -1366,7 +1370,7 @@ void GraphBuilder::lookup_switch() { } else { // collect successors & keys BlockList* sux = new BlockList(l + 1, NULL); - intArray* keys = new intArray(l, 0); + intArray* keys = new intArray(l, l, 0); int i; bool has_bb = false; for (i = 0; i < l; i++) { @@ -1563,6 +1567,8 @@ void GraphBuilder::method_return(Value x) { } Value GraphBuilder::make_constant(ciConstant field_value, ciField* field) { + if (!field_value.is_valid()) return NULL; + BasicType field_type = field_value.basic_type(); ValueType* value = as_ValueType(field_value); @@ -1630,9 +1636,8 @@ void GraphBuilder::access_field(Bytecodes::Code code) { case Bytecodes::_getstatic: { // check for compile-time constants, i.e., initialized static final fields Value constant = NULL; - if (field->is_constant() && !PatchALot) { + if (field->is_static_constant() && !PatchALot) { ciConstant field_value = field->constant_value(); - // Stable static fields are checked for non-default values in ciField::initialize_from(). assert(!field->is_stable() || !field_value.is_null_or_zero(), "stable static w/ default value shouldn't be a constant"); constant = make_constant(field_value, field); @@ -1665,31 +1670,18 @@ void GraphBuilder::access_field(Bytecodes::Code code) { Value constant = NULL; obj = apop(); ObjectType* obj_type = obj->type()->as_ObjectType(); - if (obj_type->is_constant() && !PatchALot) { + if (field->is_constant() && obj_type->is_constant() && !PatchALot) { ciObject* const_oop = obj_type->constant_value(); if (!const_oop->is_null_object() && const_oop->is_loaded()) { - if (field->is_constant()) { - ciConstant field_value = field->constant_value_of(const_oop); - if (FoldStableValues && field->is_stable() && field_value.is_null_or_zero()) { - // Stable field with default value can't be constant. - constant = NULL; - } else { - constant = make_constant(field_value, field); - } - } else { - // For CallSite objects treat the target field as a compile time constant. - if (const_oop->is_call_site()) { + ciConstant field_value = field->constant_value_of(const_oop); + if (field_value.is_valid()) { + constant = make_constant(field_value, field); + // For CallSite objects add a dependency for invalidation of the optimization. + if (field->is_call_site_target()) { ciCallSite* call_site = const_oop->as_call_site(); - if (field->is_call_site_target()) { - ciMethodHandle* target = call_site->get_target(); - if (target != NULL) { // just in case - ciConstant field_val(T_OBJECT, target); - constant = new Constant(as_ValueType(field_val)); - // Add a dependence for invalidation of the optimization. - if (!call_site->is_constant_call_site()) { - dependency_recorder()->assert_call_site_target_value(call_site, target); - } - } + if (!call_site->is_constant_call_site()) { + ciMethodHandle* target = field_value.as_object()->as_method_handle(); + dependency_recorder()->assert_call_site_target_value(call_site, target); } } } @@ -1772,7 +1764,7 @@ void GraphBuilder::check_args_for_profiling(Values* obj_args, int expected) { bool ignored_will_link; ciSignature* declared_signature = NULL; ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature); - assert(expected == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); + assert(expected == obj_args->max_length() || real_target->is_method_handle_intrinsic(), "missed on arg?"); #endif } @@ -1783,7 +1775,7 @@ Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, if (obj_args == NULL) { return NULL; } - int s = obj_args->size(); + int s = obj_args->max_length(); // if called through method handle invoke, some arguments may have been popped for (int i = start, j = 0; j < s && i < args->length(); i++) { if (args->at(i)->type()->is_object_kind()) { @@ -1804,25 +1796,14 @@ void GraphBuilder::invoke(Bytecodes::Code code) { const Bytecodes::Code bc_raw = stream()->cur_bc_raw(); assert(declared_signature != NULL, "cannot be null"); - // we have to make sure the argument size (incl. the receiver) - // is correct for compilation (the call would fail later during - // linkage anyway) - was bug (gri 7/28/99) - { - // Use raw to get rewritten bytecode. - const bool is_invokestatic = bc_raw == Bytecodes::_invokestatic; - const bool allow_static = - is_invokestatic || - bc_raw == Bytecodes::_invokehandle || - bc_raw == Bytecodes::_invokedynamic; - if (target->is_loaded()) { - if (( target->is_static() && !allow_static) || - (!target->is_static() && is_invokestatic)) { - BAILOUT("will cause link error"); - } - } - } ciInstanceKlass* klass = target->holder(); + // Make sure there are no evident problems with linking the instruction. + bool is_resolved = true; + if (klass->is_loaded() && !target->is_loaded()) { + is_resolved = false; // method not found + } + // check if CHA possible: if so, change the code to invoke_special ciInstanceKlass* calling_klass = method()->holder(); ciInstanceKlass* callee_holder = ciEnv::get_instance_klass_for_declared_method_holder(holder); @@ -1866,10 +1847,6 @@ void GraphBuilder::invoke(Bytecodes::Code code) { apush(arg); } - // NEEDS_CLEANUP - // I've added the target->is_loaded() test below but I don't really understand - // how klass->is_loaded() can be true and yet target->is_loaded() is false. - // this happened while running the JCK invokevirtual tests under doit. TKR ciMethod* cha_monomorphic_target = NULL; ciMethod* exact_target = NULL; Value better_receiver = NULL; @@ -1993,12 +1970,11 @@ void GraphBuilder::invoke(Bytecodes::Code code) { } // check if we could do inlining - if (!PatchALot && Inline && klass->is_loaded() && + if (!PatchALot && Inline && is_resolved && + klass->is_loaded() && target->is_loaded() && (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized()) - && target->is_loaded() && !patch_for_appendix) { // callee is known => check if we have static binding - assert(target->is_loaded(), "callee must be known"); if (code == Bytecodes::_invokestatic || code == Bytecodes::_invokespecial || code == Bytecodes::_invokevirtual && target->is_final_method() || @@ -2055,7 +2031,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) { // Currently only supported on Sparc. // The UseInlineCaches only controls dispatch to invokevirtuals for // loaded classes which we weren't able to statically bind. - if (!UseInlineCaches && is_loaded && code == Bytecodes::_invokevirtual + if (!UseInlineCaches && is_resolved && is_loaded && code == Bytecodes::_invokevirtual && !target->can_be_statically_bound()) { // Find a vtable index if one is available // For arrays, callee_holder is Object. Resolving the call with @@ -2068,35 +2044,37 @@ void GraphBuilder::invoke(Bytecodes::Code code) { } #endif - if (recv != NULL && - (code == Bytecodes::_invokespecial || - !is_loaded || target->is_final())) { - // invokespecial always needs a NULL check. invokevirtual where - // the target is final or where it's not known that whether the - // target is final requires a NULL check. Otherwise normal - // invokevirtual will perform the null check during the lookup - // logic or the unverified entry point. Profiling of calls - // requires that the null check is performed in all cases. - null_check(recv); - } + if (is_resolved) { + // invokespecial always needs a NULL check. invokevirtual where the target is + // final or where it's not known whether the target is final requires a NULL check. + // Otherwise normal invokevirtual will perform the null check during the lookup + // logic or the unverified entry point. Profiling of calls requires that + // the null check is performed in all cases. + bool do_null_check = (recv != NULL) && + (code == Bytecodes::_invokespecial || !is_loaded || target->is_final() || (is_profiling() && profile_calls())); - if (is_profiling()) { - if (recv != NULL && profile_calls()) { + if (do_null_check) { null_check(recv); } - // Note that we'd collect profile data in this method if we wanted it. - compilation()->set_would_profile(true); - if (profile_calls()) { - assert(cha_monomorphic_target == NULL || exact_target == NULL, "both can not be set"); - ciKlass* target_klass = NULL; - if (cha_monomorphic_target != NULL) { - target_klass = cha_monomorphic_target->holder(); - } else if (exact_target != NULL) { - target_klass = exact_target->holder(); + if (is_profiling()) { + // Note that we'd collect profile data in this method if we wanted it. + compilation()->set_would_profile(true); + + if (profile_calls()) { + assert(cha_monomorphic_target == NULL || exact_target == NULL, "both can not be set"); + ciKlass* target_klass = NULL; + if (cha_monomorphic_target != NULL) { + target_klass = cha_monomorphic_target->holder(); + } else if (exact_target != NULL) { + target_klass = exact_target->holder(); + } + profile_call(target, recv, target_klass, collect_args_for_profiling(args, NULL, false), false); } - profile_call(target, recv, target_klass, collect_args_for_profiling(args, NULL, false), false); } + } else { + // No need in null check or profiling: linkage error will be thrown at runtime + // during resolution. } Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target, state_before); @@ -2220,7 +2198,7 @@ void GraphBuilder::new_multi_array(int dimensions) { ciKlass* klass = stream()->get_klass(will_link); ValueStack* state_before = !klass->is_loaded() || PatchALot ? copy_state_before() : copy_state_exhandling(); - Values* dims = new Values(dimensions, NULL); + Values* dims = new Values(dimensions, dimensions, NULL); // fill in all dimensions int i = dimensions; while (i-- > 0) dims->at_put(i, ipop()); @@ -3102,7 +3080,7 @@ void GraphBuilder::setup_osr_entry_block() { Value local; // find all the locals that the interpreter thinks contain live oops - const BitMap live_oops = method()->live_local_oops_at_bci(osr_bci); + const ResourceBitMap live_oops = method()->live_local_oops_at_bci(osr_bci); // compute the offset into the locals so that we can treat the buffer // as if the locals were still in the interpreter frame @@ -3487,20 +3465,6 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee) { case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return; case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return; case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return; - case vmIntrinsics::_getByte_raw : append_unsafe_get_raw(callee, T_BYTE ); return; - case vmIntrinsics::_getShort_raw : append_unsafe_get_raw(callee, T_SHORT ); return; - case vmIntrinsics::_getChar_raw : append_unsafe_get_raw(callee, T_CHAR ); return; - case vmIntrinsics::_getInt_raw : append_unsafe_get_raw(callee, T_INT ); return; - case vmIntrinsics::_getLong_raw : append_unsafe_get_raw(callee, T_LONG ); return; - case vmIntrinsics::_getFloat_raw : append_unsafe_get_raw(callee, T_FLOAT ); return; - case vmIntrinsics::_getDouble_raw : append_unsafe_get_raw(callee, T_DOUBLE); return; - case vmIntrinsics::_putByte_raw : append_unsafe_put_raw(callee, T_BYTE ); return; - case vmIntrinsics::_putShort_raw : append_unsafe_put_raw(callee, T_SHORT ); return; - case vmIntrinsics::_putChar_raw : append_unsafe_put_raw(callee, T_CHAR ); return; - case vmIntrinsics::_putInt_raw : append_unsafe_put_raw(callee, T_INT ); return; - case vmIntrinsics::_putLong_raw : append_unsafe_put_raw(callee, T_LONG ); return; - case vmIntrinsics::_putFloat_raw : append_unsafe_put_raw(callee, T_FLOAT ); return; - case vmIntrinsics::_putDouble_raw : append_unsafe_put_raw(callee, T_DOUBLE); return; case vmIntrinsics::_compareAndSwapLong: case vmIntrinsics::_compareAndSwapInt: case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return; @@ -3823,9 +3787,9 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, Bytecode int start = 0; Values* obj_args = args_list_for_profiling(callee, start, has_receiver); if (obj_args != NULL) { - int s = obj_args->size(); + int s = obj_args->max_length(); // if called through method handle invoke, some arguments may have been popped - for (int i = args_base+start, j = 0; j < obj_args->size() && i < state()->stack_size(); ) { + for (int i = args_base+start, j = 0; j < obj_args->max_length() && i < state()->stack_size(); ) { Value v = state()->stack_at_inc(i); if (v->type()->is_object_kind()) { obj_args->push(v); @@ -4142,7 +4106,7 @@ void GraphBuilder::push_scope_for_jsr(BlockBegin* jsr_continuation, int jsr_dest // properly clone all blocks in jsr region as well as exception // handlers containing rets BlockList* new_bci2block = new BlockList(bci2block()->length()); - new_bci2block->push_all(bci2block()); + new_bci2block->appendAll(bci2block()); data->set_bci2block(new_bci2block); data->set_scope(scope()); data->setup_jsr_xhandlers(); diff --git a/hotspot/src/share/vm/c1/c1_IR.cpp b/hotspot/src/share/vm/c1/c1_IR.cpp index 459b377e2ff..c1c72cf74f5 100644 --- a/hotspot/src/share/vm/c1/c1_IR.cpp +++ b/hotspot/src/share/vm/c1/c1_IR.cpp @@ -460,14 +460,14 @@ class ComputeLinearScanOrder : public StackObj { BlockList* _linear_scan_order; // the resulting list of blocks in correct order - BitMap _visited_blocks; // used for recursive processing of blocks - BitMap _active_blocks; // used for recursive processing of blocks - BitMap _dominator_blocks; // temproary BitMap used for computation of dominator - intArray _forward_branches; // number of incoming forward branches for each block - BlockList _loop_end_blocks; // list of all loop end blocks collected during count_edges - BitMap2D _loop_map; // two-dimensional bit set: a bit is set if a block is contained in a loop - BlockList _work_list; // temporary list (used in mark_loops and compute_order) - BlockList _loop_headers; + ResourceBitMap _visited_blocks; // used for recursive processing of blocks + ResourceBitMap _active_blocks; // used for recursive processing of blocks + ResourceBitMap _dominator_blocks; // temproary BitMap used for computation of dominator + intArray _forward_branches; // number of incoming forward branches for each block + BlockList _loop_end_blocks; // list of all loop end blocks collected during count_edges + BitMap2D _loop_map; // two-dimensional bit set: a bit is set if a block is contained in a loop + BlockList _work_list; // temporary list (used in mark_loops and compute_order) + BlockList _loop_headers; Compilation* _compilation; @@ -531,11 +531,11 @@ ComputeLinearScanOrder::ComputeLinearScanOrder(Compilation* c, BlockBegin* start _visited_blocks(_max_block_id), _active_blocks(_max_block_id), _dominator_blocks(_max_block_id), - _forward_branches(_max_block_id, 0), + _forward_branches(_max_block_id, _max_block_id, 0), _loop_end_blocks(8), _work_list(8), _linear_scan_order(NULL), // initialized later with correct size - _loop_map(0, 0), // initialized later with correct size + _loop_map(0), // initialized later with correct size _compilation(c) { TRACE_LINEAR_SCAN(2, tty->print_cr("***** computing linear-scan block order")); @@ -849,13 +849,13 @@ bool ComputeLinearScanOrder::ready_for_processing(BlockBegin* cur) { return false; } - assert(_linear_scan_order->index_of(cur) == -1, "block already processed (block can be ready only once)"); - assert(_work_list.index_of(cur) == -1, "block already in work-list (block can be ready only once)"); + assert(_linear_scan_order->find(cur) == -1, "block already processed (block can be ready only once)"); + assert(_work_list.find(cur) == -1, "block already in work-list (block can be ready only once)"); return true; } void ComputeLinearScanOrder::sort_into_work_list(BlockBegin* cur) { - assert(_work_list.index_of(cur) == -1, "block already in work list"); + assert(_work_list.find(cur) == -1, "block already in work list"); int cur_weight = compute_weight(cur); @@ -891,7 +891,7 @@ void ComputeLinearScanOrder::sort_into_work_list(BlockBegin* cur) { void ComputeLinearScanOrder::append_block(BlockBegin* cur) { TRACE_LINEAR_SCAN(3, tty->print_cr("appending block B%d (weight 0x%6x) to linear-scan order", cur->block_id(), cur->linear_scan_number())); - assert(_linear_scan_order->index_of(cur) == -1, "cannot add the same block twice"); + assert(_linear_scan_order->find(cur) == -1, "cannot add the same block twice"); // currently, the linear scan order and code emit order are equal. // therefore the linear_scan_number and the weight of a block must also @@ -1116,13 +1116,13 @@ void ComputeLinearScanOrder::verify() { BlockBegin* cur = _linear_scan_order->at(i); assert(cur->linear_scan_number() == i, "incorrect linear_scan_number"); - assert(cur->linear_scan_number() >= 0 && cur->linear_scan_number() == _linear_scan_order->index_of(cur), "incorrect linear_scan_number"); + assert(cur->linear_scan_number() >= 0 && cur->linear_scan_number() == _linear_scan_order->find(cur), "incorrect linear_scan_number"); int j; for (j = cur->number_of_sux() - 1; j >= 0; j--) { BlockBegin* sux = cur->sux_at(j); - assert(sux->linear_scan_number() >= 0 && sux->linear_scan_number() == _linear_scan_order->index_of(sux), "incorrect linear_scan_number"); + assert(sux->linear_scan_number() >= 0 && sux->linear_scan_number() == _linear_scan_order->find(sux), "incorrect linear_scan_number"); if (!sux->is_set(BlockBegin::backward_branch_target_flag)) { assert(cur->linear_scan_number() < sux->linear_scan_number(), "invalid order"); } @@ -1134,7 +1134,7 @@ void ComputeLinearScanOrder::verify() { for (j = cur->number_of_preds() - 1; j >= 0; j--) { BlockBegin* pred = cur->pred_at(j); - assert(pred->linear_scan_number() >= 0 && pred->linear_scan_number() == _linear_scan_order->index_of(pred), "incorrect linear_scan_number"); + assert(pred->linear_scan_number() >= 0 && pred->linear_scan_number() == _linear_scan_order->find(pred), "incorrect linear_scan_number"); if (!cur->is_set(BlockBegin::backward_branch_target_flag)) { assert(cur->linear_scan_number() > pred->linear_scan_number(), "invalid order"); } @@ -1256,8 +1256,7 @@ void IR::print(bool cfg_only, bool live_only) { } -define_array(BlockListArray, BlockList*) -define_stack(BlockListList, BlockListArray) +typedef GrowableArray BlockListList; class PredecessorValidator : public BlockClosure { private: @@ -1271,7 +1270,7 @@ class PredecessorValidator : public BlockClosure { public: PredecessorValidator(IR* hir) { ResourceMark rm; - _predecessors = new BlockListList(BlockBegin::number_of_blocks(), NULL); + _predecessors = new BlockListList(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), NULL); _blocks = new BlockList(); int i; diff --git a/hotspot/src/share/vm/c1/c1_IR.hpp b/hotspot/src/share/vm/c1/c1_IR.hpp index 31d3b01aff2..c40cf2605f0 100644 --- a/hotspot/src/share/vm/c1/c1_IR.hpp +++ b/hotspot/src/share/vm/c1/c1_IR.hpp @@ -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 @@ -104,9 +104,7 @@ class XHandler: public CompilationResourceObj { bool equals(XHandler* other) const; }; -define_array(_XHandlerArray, XHandler*) -define_stack(_XHandlerList, _XHandlerArray) - +typedef GrowableArray _XHandlerList; // XHandlers is the C1 internal list of exception handlers for a method class XHandlers: public CompilationResourceObj { @@ -132,8 +130,7 @@ class XHandlers: public CompilationResourceObj { class IRScope; -define_array(IRScopeArray, IRScope*) -define_stack(IRScopeList, IRScopeArray) +typedef GrowableArray IRScopeList; class Compilation; class IRScope: public CompilationResourceObj { @@ -154,7 +151,7 @@ class IRScope: public CompilationResourceObj { bool _wrote_volatile; // has written volatile field BlockBegin* _start; // the start block, successsors are method entries - BitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable + ResourceBitMap _requires_phi_function; // bit is set if phi functions at loop headers are necessary for a local variable // helper functions BlockBegin* build_graph(Compilation* compilation, int osr_bci); diff --git a/hotspot/src/share/vm/c1/c1_Instruction.cpp b/hotspot/src/share/vm/c1/c1_Instruction.cpp index a77b22ff14c..ffb439d1150 100644 --- a/hotspot/src/share/vm/c1/c1_Instruction.cpp +++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -564,7 +564,7 @@ void BlockBegin::disconnect_edge(BlockBegin* from, BlockBegin* to) { for (int s = 0; s < from->number_of_sux();) { BlockBegin* sux = from->sux_at(s); if (sux == to) { - int index = sux->_predecessors.index_of(from); + int index = sux->_predecessors.find(from); if (index >= 0) { sux->_predecessors.remove_at(index); } @@ -664,7 +664,7 @@ BlockBegin* BlockBegin::insert_block_between(BlockBegin* sux) { void BlockBegin::remove_successor(BlockBegin* pred) { int idx; - while ((idx = _successors.index_of(pred)) >= 0) { + while ((idx = _successors.find(pred)) >= 0) { _successors.remove_at(idx); } } @@ -677,7 +677,7 @@ void BlockBegin::add_predecessor(BlockBegin* pred) { void BlockBegin::remove_predecessor(BlockBegin* pred) { int idx; - while ((idx = _predecessors.index_of(pred)) >= 0) { + while ((idx = _predecessors.find(pred)) >= 0) { _predecessors.remove_at(idx); } } @@ -722,13 +722,15 @@ void BlockBegin::iterate_postorder(boolArray& mark, BlockClosure* closure) { void BlockBegin::iterate_preorder(BlockClosure* closure) { - boolArray mark(number_of_blocks(), false); + int mark_len = number_of_blocks(); + boolArray mark(mark_len, mark_len, false); iterate_preorder(mark, closure); } void BlockBegin::iterate_postorder(BlockClosure* closure) { - boolArray mark(number_of_blocks(), false); + int mark_len = number_of_blocks(); + boolArray mark(mark_len, mark_len, false); iterate_postorder(mark, closure); } @@ -785,7 +787,7 @@ bool BlockBegin::try_merge(ValueStack* new_state) { TRACE_PHI(tty->print_cr("creating phi-function %c%d for stack %d", new_state->stack_at(index)->type()->tchar(), new_state->stack_at(index)->id(), index)); } - BitMap requires_phi_function = new_state->scope()->requires_phi_function(); + BitMap& requires_phi_function = new_state->scope()->requires_phi_function(); for_each_local_value(new_state, index, new_value) { bool requires_phi = requires_phi_function.at(index) || (new_value->type()->is_double_word() && requires_phi_function.at(index + 1)); diff --git a/hotspot/src/share/vm/c1/c1_Instruction.hpp b/hotspot/src/share/vm/c1/c1_Instruction.hpp index 38fcc56ae75..426507d301a 100644 --- a/hotspot/src/share/vm/c1/c1_Instruction.hpp +++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp @@ -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 @@ -115,11 +115,8 @@ class Assert; // A Value is a reference to the instruction creating the value typedef Instruction* Value; -define_array(ValueArray, Value) -define_stack(Values, ValueArray) - -define_array(ValueStackArray, ValueStack*) -define_stack(ValueStackStack, ValueStackArray) +typedef GrowableArray Values; +typedef GrowableArray ValueStackStack; // BlockClosure is the base class for block traversal/iteration. @@ -137,14 +134,13 @@ class ValueVisitor: public StackObj { // Some array and list classes -define_array(BlockBeginArray, BlockBegin*) -define_stack(_BlockList, BlockBeginArray) +typedef GrowableArray BlockBeginArray; -class BlockList: public _BlockList { +class BlockList: public GrowableArray { public: - BlockList(): _BlockList() {} - BlockList(const int size): _BlockList(size) {} - BlockList(const int size, BlockBegin* init): _BlockList(size, init) {} + BlockList(): GrowableArray() {} + BlockList(const int size): GrowableArray(size) {} + BlockList(const int size, BlockBegin* init): GrowableArray(size, size, init) {} void iterate_forward(BlockClosure* closure); void iterate_backward(BlockClosure* closure); @@ -1600,8 +1596,8 @@ LEAF(BlockBegin, StateSplit) int _flags; // the flags associated with this block // fields used by BlockListBuilder - int _total_preds; // number of predecessors found by BlockListBuilder - BitMap _stores_to_locals; // bit is set when a local variable is stored in the block + int _total_preds; // number of predecessors found by BlockListBuilder + ResourceBitMap _stores_to_locals; // bit is set when a local variable is stored in the block // SSA specific fields: (factor out later) BlockList _successors; // the successors of this block @@ -1618,15 +1614,15 @@ LEAF(BlockBegin, StateSplit) Label _label; // the label associated with this block LIR_List* _lir; // the low level intermediate representation for this block - BitMap _live_in; // set of live LIR_Opr registers at entry to this block - BitMap _live_out; // set of live LIR_Opr registers at exit from this block - BitMap _live_gen; // set of registers used before any redefinition in this block - BitMap _live_kill; // set of registers defined in this block + ResourceBitMap _live_in; // set of live LIR_Opr registers at entry to this block + ResourceBitMap _live_out; // set of live LIR_Opr registers at exit from this block + ResourceBitMap _live_gen; // set of registers used before any redefinition in this block + ResourceBitMap _live_kill; // set of registers defined in this block - BitMap _fpu_register_usage; - intArray* _fpu_stack_state; // For x86 FPU code generation with UseLinearScan - int _first_lir_instruction_id; // ID of first LIR instruction in this block - int _last_lir_instruction_id; // ID of last LIR instruction in this block + ResourceBitMap _fpu_register_usage; + intArray* _fpu_stack_state; // For x86 FPU code generation with UseLinearScan + int _first_lir_instruction_id; // ID of first LIR instruction in this block + int _last_lir_instruction_id; // ID of last LIR instruction in this block void iterate_preorder (boolArray& mark, BlockClosure* closure); void iterate_postorder(boolArray& mark, BlockClosure* closure); @@ -1697,11 +1693,11 @@ LEAF(BlockBegin, StateSplit) Label* label() { return &_label; } LIR_List* lir() const { return _lir; } int exception_handler_pco() const { return _exception_handler_pco; } - BitMap& live_in() { return _live_in; } - BitMap& live_out() { return _live_out; } - BitMap& live_gen() { return _live_gen; } - BitMap& live_kill() { return _live_kill; } - BitMap& fpu_register_usage() { return _fpu_register_usage; } + ResourceBitMap& live_in() { return _live_in; } + ResourceBitMap& live_out() { return _live_out; } + ResourceBitMap& live_gen() { return _live_gen; } + ResourceBitMap& live_kill() { return _live_kill; } + ResourceBitMap& fpu_register_usage() { return _fpu_register_usage; } intArray* fpu_stack_state() const { return _fpu_stack_state; } int first_lir_instruction_id() const { return _first_lir_instruction_id; } int last_lir_instruction_id() const { return _last_lir_instruction_id; } @@ -1722,16 +1718,16 @@ LEAF(BlockBegin, StateSplit) void substitute_sux(BlockBegin* old_sux, BlockBegin* new_sux); void set_lir(LIR_List* lir) { _lir = lir; } void set_exception_handler_pco(int pco) { _exception_handler_pco = pco; } - void set_live_in (BitMap map) { _live_in = map; } - void set_live_out (BitMap map) { _live_out = map; } - void set_live_gen (BitMap map) { _live_gen = map; } - void set_live_kill (BitMap map) { _live_kill = map; } - void set_fpu_register_usage(BitMap map) { _fpu_register_usage = map; } + void set_live_in (const ResourceBitMap& map) { _live_in = map; } + void set_live_out (const ResourceBitMap& map) { _live_out = map; } + void set_live_gen (const ResourceBitMap& map) { _live_gen = map; } + void set_live_kill(const ResourceBitMap& map) { _live_kill = map; } + void set_fpu_register_usage(const ResourceBitMap& map) { _fpu_register_usage = map; } void set_fpu_stack_state(intArray* state) { _fpu_stack_state = state; } void set_first_lir_instruction_id(int id) { _first_lir_instruction_id = id; } void set_last_lir_instruction_id(int id) { _last_lir_instruction_id = id; } void increment_total_preds(int n = 1) { _total_preds += n; } - void init_stores_to_locals(int locals_count) { _stores_to_locals = BitMap(locals_count); _stores_to_locals.clear(); } + void init_stores_to_locals(int locals_count) { _stores_to_locals.initialize(locals_count); } // generic virtual void state_values_do(ValueVisitor* f); @@ -1747,7 +1743,7 @@ LEAF(BlockBegin, StateSplit) void remove_predecessor(BlockBegin* pred); bool is_predecessor(BlockBegin* pred) const { return _predecessors.contains(pred); } int number_of_preds() const { return _predecessors.length(); } - BlockBegin* pred_at(int i) const { return _predecessors[i]; } + BlockBegin* pred_at(int i) const { return _predecessors.at(i); } // exception handlers potentially invoked by this block void add_exception_handler(BlockBegin* b); @@ -2612,10 +2608,7 @@ class BlockPair: public CompilationResourceObj { void set_from(BlockBegin* b) { _from = b; } }; - -define_array(BlockPairArray, BlockPair*) -define_stack(BlockPairList, BlockPairArray) - +typedef GrowableArray BlockPairList; inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); } inline BlockBegin* BlockBegin::sux_at(int i) const { assert(_end == NULL || _end->sux_at(i) == _successors.at(i), "mismatch"); return _successors.at(i); } diff --git a/hotspot/src/share/vm/c1/c1_LIR.cpp b/hotspot/src/share/vm/c1/c1_LIR.cpp index 6077c282472..c650ec0b9df 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.cpp +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp @@ -483,6 +483,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) { case lir_membar_storestore: // result and info always invalid case lir_membar_loadstore: // result and info always invalid case lir_membar_storeload: // result and info always invalid + case lir_on_spin_wait: { assert(op->as_Op0() != NULL, "must be"); assert(op->_info == NULL, "info not used by this instruction"); @@ -727,31 +728,6 @@ void LIR_OpVisitState::visit(LIR_Op* op) { break; } - - case lir_tan: - case lir_log10: { - assert(op->as_Op2() != NULL, "must be"); - LIR_Op2* op2 = (LIR_Op2*)op; - - // On x86 tan/sin/cos need two temporary fpu stack slots and - // log/log10 need one so handle opr2 and tmp as temp inputs. - // Register input operand as temp to guarantee that it doesn't - // overlap with the input. - assert(op2->_info == NULL, "not used"); - assert(op2->_tmp5->is_illegal(), "not used"); - assert(op2->_opr1->is_valid(), "used"); - do_input(op2->_opr1); do_temp(op2->_opr1); - - if (op2->_opr2->is_valid()) do_temp(op2->_opr2); - if (op2->_tmp1->is_valid()) do_temp(op2->_tmp1); - if (op2->_tmp2->is_valid()) do_temp(op2->_tmp2); - if (op2->_tmp3->is_valid()) do_temp(op2->_tmp3); - if (op2->_tmp4->is_valid()) do_temp(op2->_tmp4); - if (op2->_result->is_valid()) do_output(op2->_result); - - break; - } - // LIR_Op3 case lir_idiv: case lir_irem: { @@ -1691,6 +1667,7 @@ const char * LIR_Op::name() const { case lir_word_align: s = "word_align"; break; case lir_label: s = "label"; break; case lir_nop: s = "nop"; break; + case lir_on_spin_wait: s = "on_spin_wait"; break; case lir_backwardbranch_target: s = "backbranch"; break; case lir_std_entry: s = "std_entry"; break; case lir_osr_entry: s = "osr_entry"; break; @@ -1738,8 +1715,6 @@ const char * LIR_Op::name() const { case lir_rem: s = "rem"; break; case lir_abs: s = "abs"; break; case lir_sqrt: s = "sqrt"; break; - case lir_tan: s = "tan"; break; - case lir_log10: s = "log10"; break; case lir_logic_and: s = "logic_and"; break; case lir_logic_or: s = "logic_or"; break; case lir_logic_xor: s = "logic_xor"; break; diff --git a/hotspot/src/share/vm/c1/c1_LIR.hpp b/hotspot/src/share/vm/c1/c1_LIR.hpp index c5e52dec265..2943b380901 100644 --- a/hotspot/src/share/vm/c1/c1_LIR.hpp +++ b/hotspot/src/share/vm/c1/c1_LIR.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -59,17 +59,9 @@ class LIR_OprVisitor; typedef LIR_OprDesc* LIR_Opr; typedef int RegNr; -define_array(LIR_OprArray, LIR_Opr) -define_stack(LIR_OprList, LIR_OprArray) - -define_array(LIR_OprRefArray, LIR_Opr*) -define_stack(LIR_OprRefList, LIR_OprRefArray) - -define_array(CodeEmitInfoArray, CodeEmitInfo*) -define_stack(CodeEmitInfoList, CodeEmitInfoArray) - -define_array(LIR_OpArray, LIR_Op*) -define_stack(LIR_OpList, LIR_OpArray) +typedef GrowableArray LIR_OprList; +typedef GrowableArray LIR_OpArray; +typedef GrowableArray LIR_OpList; // define LIR_OprPtr early so LIR_OprDesc can refer to it class LIR_OprPtr: public CompilationResourceObj { @@ -920,6 +912,7 @@ enum LIR_Code { , lir_membar_loadstore , lir_membar_storeload , lir_get_thread + , lir_on_spin_wait , end_op0 , begin_op1 , lir_fxch @@ -2101,6 +2094,8 @@ class LIR_List: public CompilationResourceObj { void std_entry(LIR_Opr receiver) { append(new LIR_Op0(lir_std_entry, receiver)); } void osr_entry(LIR_Opr osrPointer) { append(new LIR_Op0(lir_osr_entry, osrPointer)); } + void on_spin_wait() { append(new LIR_Op0(lir_on_spin_wait)); } + void branch_destination(Label* lbl) { append(new LIR_OpLabel(lbl)); } void negate(LIR_Opr from, LIR_Opr to) { append(new LIR_Op1(lir_neg, from, to)); } diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp index 230a7bf0273..abd1fb4d3e7 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -127,7 +127,7 @@ void LIR_Assembler::append_code_stub(CodeStub* stub) { void LIR_Assembler::emit_stubs(CodeStubList* stub_list) { for (int m = 0; m < stub_list->length(); m++) { - CodeStub* s = (*stub_list)[m]; + CodeStub* s = stub_list->at(m); check_codespace(); CHECK_BAILOUT(); @@ -678,6 +678,10 @@ void LIR_Assembler::emit_op0(LIR_Op0* op) { get_thread(op->result_opr()); break; + case lir_on_spin_wait: + on_spin_wait(); + break; + default: ShouldNotReachHere(); break; diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp index 42e6f6642d3..c7d317051ca 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp @@ -250,6 +250,7 @@ class LIR_Assembler: public CompilationResourceObj { void membar_storestore(); void membar_loadstore(); void membar_storeload(); + void on_spin_wait(); void get_thread(LIR_Opr result); void verify_oop_map(CodeEmitInfo* info); diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index 956bb657ed6..ae49fc36878 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -150,7 +150,7 @@ PhiResolver::~PhiResolver() { int i; // resolve any cycles in moves from and to virtual registers for (i = virtual_operands().length() - 1; i >= 0; i --) { - ResolveNode* node = virtual_operands()[i]; + ResolveNode* node = virtual_operands().at(i); if (!node->visited()) { _loop = NULL; move(NULL, node); @@ -161,7 +161,7 @@ PhiResolver::~PhiResolver() { // generate move for move from non virtual register to abitrary destination for (i = other_operands().length() - 1; i >= 0; i --) { - ResolveNode* node = other_operands()[i]; + ResolveNode* node = other_operands().at(i); for (int j = node->no_of_destinations() - 1; j >= 0; j --) { emit_move(node->operand(), node->destination_at(j)->operand()); } @@ -177,7 +177,7 @@ ResolveNode* PhiResolver::create_node(LIR_Opr opr, bool source) { assert(node == NULL || node->operand() == opr, ""); if (node == NULL) { node = new ResolveNode(opr); - vreg_table()[vreg_num] = node; + vreg_table().at_put(vreg_num, node); } // Make sure that all virtual operands show up in the list when // they are used as the source of a move. @@ -3161,7 +3161,9 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) { case vmIntrinsics::_fullFence : if (os::is_MP()) __ membar(); break; - + case vmIntrinsics::_onSpinWait: + __ on_spin_wait(); + break; case vmIntrinsics::_Reference_get: do_Reference_get(x); break; @@ -3172,6 +3174,15 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) { do_update_CRC32(x); break; + case vmIntrinsics::_updateBytesCRC32C: + case vmIntrinsics::_updateDirectByteBufferCRC32C: + do_update_CRC32C(x); + break; + + case vmIntrinsics::_vectorizedMismatch: + do_vectorizedMismatch(x); + break; + default: ShouldNotReachHere(); break; } } diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp index 6885ff6186c..91536455821 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,8 +39,7 @@ class Invoke; class SwitchRange; class LIRItem; -define_array(LIRItemArray, LIRItem*) -define_stack(LIRItemList, LIRItemArray) +typedef GrowableArray LIRItemList; class SwitchRange: public CompilationResourceObj { private: @@ -56,15 +55,12 @@ class SwitchRange: public CompilationResourceObj { BlockBegin* sux() const { return _sux; } }; -define_array(SwitchRangeArray, SwitchRange*) -define_stack(SwitchRangeList, SwitchRangeArray) - +typedef GrowableArray SwitchRangeArray; +typedef GrowableArray SwitchRangeList; class ResolveNode; -define_array(NodeArray, ResolveNode*); -define_stack(NodeList, NodeArray); - +typedef GrowableArray NodeList; // Node objects form a directed graph of LIR_Opr // Edges between Nodes represent moves from one Node to its destinations @@ -86,7 +82,7 @@ class ResolveNode: public CompilationResourceObj { // accessors LIR_Opr operand() const { return _operand; } int no_of_destinations() const { return _destinations.length(); } - ResolveNode* destination_at(int i) { return _destinations[i]; } + ResolveNode* destination_at(int i) { return _destinations.at(i); } bool assigned() const { return _assigned; } bool visited() const { return _visited; } bool start_node() const { return _start_node; } @@ -257,6 +253,8 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { void do_FPIntrinsics(Intrinsic* x); void do_Reference_get(Intrinsic* x); void do_update_CRC32(Intrinsic* x); + void do_update_CRC32C(Intrinsic* x); + void do_vectorizedMismatch(Intrinsic* x); LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info); LIR_Opr call_runtime(BasicTypeArray* signature, LIR_OprList* args, address entry, ValueType* result_type, CodeEmitInfo* info); @@ -474,7 +472,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { : _compilation(compilation) , _method(method) , _virtual_register_number(LIR_OprDesc::vreg_base) - , _vreg_flags(NULL, 0, num_vreg_flags) { + , _vreg_flags(num_vreg_flags) { init(); } diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.cpp b/hotspot/src/share/vm/c1/c1_LinearScan.cpp index 82e162c2225..991daa0791b 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp @@ -88,7 +88,7 @@ LinearScan::LinearScan(IR* ir, LIRGenerator* gen, FrameMap* frame_map) , _has_info(0) , _has_call(0) , _scope_value_cache(0) // initialized later with correct length - , _interval_in_loop(0, 0) // initialized later with correct length + , _interval_in_loop(0) // initialized later with correct length , _cached_blocks(*ir->linear_scan_order()) #ifdef X86 , _fpu_stack_allocator(NULL) @@ -496,8 +496,8 @@ void LinearScan::number_instructions() { } // initialize with correct length - _lir_ops = LIR_OpArray(num_instructions); - _block_of_op = BlockBeginArray(num_instructions); + _lir_ops = LIR_OpArray(num_instructions, num_instructions, NULL); + _block_of_op = BlockBeginArray(num_instructions, num_instructions, NULL); int op_id = 0; int idx = 0; @@ -524,8 +524,8 @@ void LinearScan::number_instructions() { assert(idx == num_instructions, "must match"); assert(idx * 2 == op_id, "must match"); - _has_call = BitMap(num_instructions); _has_call.clear(); - _has_info = BitMap(num_instructions); _has_info.clear(); + _has_call.initialize(num_instructions); + _has_info.initialize(num_instructions); } @@ -568,8 +568,8 @@ void LinearScan::compute_local_live_sets() { for (int i = 0; i < num_blocks; i++) { BlockBegin* block = block_at(i); - BitMap live_gen(live_size); live_gen.clear(); - BitMap live_kill(live_size); live_kill.clear(); + ResourceBitMap live_gen(live_size); live_gen.clear(); + ResourceBitMap live_kill(live_size); live_kill.clear(); if (block->is_set(BlockBegin::exception_entry_flag)) { // Phi functions at the begin of an exception handler are @@ -715,8 +715,8 @@ void LinearScan::compute_local_live_sets() { block->set_live_gen (live_gen); block->set_live_kill(live_kill); - block->set_live_in (BitMap(live_size)); block->live_in().clear(); - block->set_live_out (BitMap(live_size)); block->live_out().clear(); + block->set_live_in (ResourceBitMap(live_size)); block->live_in().clear(); + block->set_live_out (ResourceBitMap(live_size)); block->live_out().clear(); TRACE_LINEAR_SCAN(4, tty->print("live_gen B%d ", block->block_id()); print_bitmap(block->live_gen())); TRACE_LINEAR_SCAN(4, tty->print("live_kill B%d ", block->block_id()); print_bitmap(block->live_kill())); @@ -741,7 +741,7 @@ void LinearScan::compute_global_live_sets() { bool change_occurred; bool change_occurred_in_block; int iteration_count = 0; - BitMap live_out(live_set_size()); live_out.clear(); // scratch set for calculations + ResourceBitMap live_out(live_set_size()); live_out.clear(); // scratch set for calculations // Perform a backward dataflow analysis to compute live_out and live_in for each block. // The loop is executed until a fixpoint is reached (no changes in an iteration) @@ -775,7 +775,7 @@ void LinearScan::compute_global_live_sets() { if (!block->live_out().is_same(live_out)) { // A change occurred. Swap the old and new live out sets to avoid copying. - BitMap temp = block->live_out(); + ResourceBitMap temp = block->live_out(); block->set_live_out(live_out); live_out = temp; @@ -787,7 +787,7 @@ void LinearScan::compute_global_live_sets() { if (iteration_count == 0 || change_occurred_in_block) { // live_in(block) is the union of live_gen(block) with (live_out(block) & !live_kill(block)) // note: live_in has to be computed only in first iteration or if live_out has changed! - BitMap live_in = block->live_in(); + ResourceBitMap live_in = block->live_in(); live_in.set_from(block->live_out()); live_in.set_difference(block->live_kill()); live_in.set_union(block->live_gen()); @@ -826,7 +826,7 @@ void LinearScan::compute_global_live_sets() { #endif // check that the live_in set of the first block is empty - BitMap live_in_args(ir()->start()->live_in().size()); + ResourceBitMap live_in_args(ir()->start()->live_in().size()); live_in_args.clear(); if (!ir()->start()->live_in().is_same(live_in_args)) { #ifdef ASSERT @@ -1317,7 +1317,7 @@ void LinearScan::build_intervals() { assert(block_to == instructions->at(instructions->length() - 1)->id(), "must be"); // Update intervals for registers live at the end of this block; - BitMap live = block->live_out(); + ResourceBitMap live = block->live_out(); int size = (int)live.size(); for (int number = (int)live.get_next_one_offset(0, size); number < size; number = (int)live.get_next_one_offset(number + 1, size)) { assert(live.at(number), "should not stop here otherwise"); @@ -1717,7 +1717,7 @@ void LinearScan::resolve_collect_mappings(BlockBegin* from_block, BlockBegin* to const int num_regs = num_virtual_regs(); const int size = live_set_size(); - const BitMap live_at_edge = to_block->live_in(); + const ResourceBitMap live_at_edge = to_block->live_in(); // visit all registers where the live_at_edge bit is set for (int r = (int)live_at_edge.get_next_one_offset(0, size); r < size; r = (int)live_at_edge.get_next_one_offset(r + 1, size)) { @@ -1774,8 +1774,8 @@ void LinearScan::resolve_data_flow() { int num_blocks = block_count(); MoveResolver move_resolver(this); - BitMap block_completed(num_blocks); block_completed.clear(); - BitMap already_resolved(num_blocks); already_resolved.clear(); + ResourceBitMap block_completed(num_blocks); block_completed.clear(); + ResourceBitMap already_resolved(num_blocks); already_resolved.clear(); int i; for (i = 0; i < num_blocks; i++) { @@ -2507,7 +2507,8 @@ LocationValue* _illegal_value = new (ResourceObj::C_HEAP, mtCompiler) Lo void LinearScan::init_compute_debug_info() { // cache for frequently used scope values // (cpu registers and stack slots) - _scope_value_cache = ScopeValueArray((LinearScan::nof_cpu_regs + frame_map()->argcount() + max_spills()) * 2, NULL); + int cache_size = (LinearScan::nof_cpu_regs + frame_map()->argcount() + max_spills()) * 2; + _scope_value_cache = ScopeValueArray(cache_size, cache_size, NULL); } MonitorValue* LinearScan::location_for_monitor_index(int monitor_index) { @@ -3042,7 +3043,7 @@ void LinearScan::assign_reg_num(LIR_OpList* instructions, IntervalWalker* iw) { insert_point++; } } - instructions->truncate(insert_point); + instructions->trunc_to(insert_point); } } @@ -3396,7 +3397,7 @@ void LinearScan::verify_constants() { for (int i = 0; i < num_blocks; i++) { BlockBegin* block = block_at(i); - BitMap live_at_edge = block->live_in(); + ResourceBitMap live_at_edge = block->live_in(); // visit all registers where the live_at_edge bit is set for (int r = (int)live_at_edge.get_next_one_offset(0, size); r < size; r = (int)live_at_edge.get_next_one_offset(r + 1, size)) { @@ -3446,7 +3447,7 @@ class RegisterVerifier: public StackObj { RegisterVerifier(LinearScan* allocator) : _allocator(allocator) , _work_list(16) - , _saved_states(BlockBegin::number_of_blocks(), NULL) + , _saved_states(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), NULL) { } void verify(BlockBegin* start); @@ -3748,7 +3749,7 @@ void MoveResolver::verify_before_resolve() { } - BitMap used_regs(LinearScan::nof_regs + allocator()->frame_map()->argcount() + allocator()->max_spills()); + ResourceBitMap used_regs(LinearScan::nof_regs + allocator()->frame_map()->argcount() + allocator()->max_spills()); used_regs.clear(); if (!_multiple_reads_allowed) { for (i = 0; i < _mapping_from.length(); i++) { @@ -4452,7 +4453,7 @@ Interval* Interval::split(int split_pos) { new_use_pos_and_kinds.append(_use_pos_and_kinds.at(i)); } - _use_pos_and_kinds.truncate(start_idx + 2); + _use_pos_and_kinds.trunc_to(start_idx + 2); result->_use_pos_and_kinds = _use_pos_and_kinds; _use_pos_and_kinds = new_use_pos_and_kinds; @@ -5540,7 +5541,7 @@ void LinearScanWalker::split_and_spill_intersecting_intervals(int reg, int regHi IntervalList* processed = _spill_intervals[reg]; for (int i = 0; i < _spill_intervals[regHi]->length(); i++) { Interval* it = _spill_intervals[regHi]->at(i); - if (processed->find_from_end(it) == -1) { + if (processed->find(it) == -1) { remove_from_list(it); split_and_spill_interval(it); } @@ -6211,7 +6212,7 @@ void ControlFlowOptimizer::delete_empty_blocks(BlockList* code) { _original_preds.clear(); for (j = block->number_of_preds() - 1; j >= 0; j--) { BlockBegin* pred = block->pred_at(j); - if (_original_preds.index_of(pred) == -1) { + if (_original_preds.find(pred) == -1) { _original_preds.append(pred); } } @@ -6231,7 +6232,7 @@ void ControlFlowOptimizer::delete_empty_blocks(BlockList* code) { } old_pos++; } - code->truncate(new_pos); + code->trunc_to(new_pos); DEBUG_ONLY(verify(code)); } @@ -6256,7 +6257,7 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) { TRACE_LINEAR_SCAN(3, tty->print_cr("Deleting unconditional branch at end of block B%d", block->block_id())); // delete last branch instruction - instructions->truncate(instructions->length() - 1); + instructions->trunc_to(instructions->length() - 1); } else { LIR_Op* prev_op = instructions->at(instructions->length() - 2); @@ -6295,7 +6296,7 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) { prev_branch->change_block(last_branch->block()); prev_branch->negate_cond(); prev_cmp->set_condition(prev_branch->cond()); - instructions->truncate(instructions->length() - 1); + instructions->trunc_to(instructions->length() - 1); // if we do change the condition, we have to change the cmove as well if (prev_cmove != NULL) { prev_cmove->set_condition(prev_branch->cond()); @@ -6316,7 +6317,7 @@ void ControlFlowOptimizer::delete_unnecessary_jumps(BlockList* code) { void ControlFlowOptimizer::delete_jumps_to_return(BlockList* code) { #ifdef ASSERT - BitMap return_converted(BlockBegin::number_of_blocks()); + ResourceBitMap return_converted(BlockBegin::number_of_blocks()); return_converted.clear(); #endif @@ -6378,19 +6379,19 @@ void ControlFlowOptimizer::verify(BlockList* code) { LIR_OpBranch* op_branch = instructions->at(j)->as_OpBranch(); if (op_branch != NULL) { - assert(op_branch->block() == NULL || code->index_of(op_branch->block()) != -1, "branch target not valid"); - assert(op_branch->ublock() == NULL || code->index_of(op_branch->ublock()) != -1, "branch target not valid"); + assert(op_branch->block() == NULL || code->find(op_branch->block()) != -1, "branch target not valid"); + assert(op_branch->ublock() == NULL || code->find(op_branch->ublock()) != -1, "branch target not valid"); } } for (j = 0; j < block->number_of_sux() - 1; j++) { BlockBegin* sux = block->sux_at(j); - assert(code->index_of(sux) != -1, "successor not valid"); + assert(code->find(sux) != -1, "successor not valid"); } for (j = 0; j < block->number_of_preds() - 1; j++) { BlockBegin* pred = block->pred_at(j); - assert(code->index_of(pred) != -1, "successor not valid"); + assert(code->find(pred) != -1, "successor not valid"); } } } diff --git a/hotspot/src/share/vm/c1/c1_LinearScan.hpp b/hotspot/src/share/vm/c1/c1_LinearScan.hpp index 7d296e3f674..00ed78f632a 100644 --- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp +++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp @@ -44,18 +44,9 @@ class Range; typedef GrowableArray IntervalArray; typedef GrowableArray IntervalList; - -define_array(IntervalsArray, IntervalList*) -define_stack(IntervalsList, IntervalsArray) - -define_array(OopMapArray, OopMap*) -define_stack(OopMapList, OopMapArray) - -define_array(ScopeValueArray, ScopeValue*) - -define_array(LIR_OpListArray, LIR_OpList*); -define_stack(LIR_OpListStack, LIR_OpListArray); - +typedef GrowableArray IntervalsList; +typedef GrowableArray ScopeValueArray; +typedef GrowableArray LIR_OpListStack; enum IntervalUseKind { // priority of use kinds must be ascending @@ -67,9 +58,6 @@ enum IntervalUseKind { firstValidKind = 1, lastValidKind = 3 }; -define_array(UseKindArray, IntervalUseKind) -define_stack(UseKindStack, UseKindArray) - enum IntervalKind { fixedKind = 0, // interval pre-colored by LIR_Generator @@ -152,8 +140,8 @@ class LinearScan : public CompilationResourceObj { LIR_OpArray _lir_ops; // mapping from LIR_Op id to LIR_Op node BlockBeginArray _block_of_op; // mapping from LIR_Op id to the BlockBegin containing this instruction - BitMap _has_info; // bit set for each LIR_Op id that has a CodeEmitInfo - BitMap _has_call; // bit set for each LIR_Op id that destroys all caller save registers + ResourceBitMap _has_info; // bit set for each LIR_Op id that has a CodeEmitInfo + ResourceBitMap _has_call; // bit set for each LIR_Op id that destroys all caller save registers BitMap2D _interval_in_loop; // bit set for each virtual register that is contained in each loop // cached debug info to prevent multiple creation of same object @@ -619,7 +607,7 @@ class Interval : public CompilationResourceObj { void add_range(int from, int to); Interval* split(int split_pos); Interval* split_from_start(int split_pos); - void remove_first_use_pos() { _use_pos_and_kinds.truncate(_use_pos_and_kinds.length() - 2); } + void remove_first_use_pos() { _use_pos_and_kinds.trunc_to(_use_pos_and_kinds.length() - 2); } // test intersection bool covers(int op_id, LIR_OpVisitState::OprMode mode) const; diff --git a/hotspot/src/share/vm/c1/c1_Optimizer.cpp b/hotspot/src/share/vm/c1/c1_Optimizer.cpp index 3e61edda30e..edc133a9b9a 100644 --- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp +++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp @@ -32,9 +32,7 @@ #include "utilities/bitMap.inline.hpp" #include "compiler/compileLog.hpp" -define_array(ValueSetArray, ValueSet*); -define_stack(ValueSetList, ValueSetArray); - +typedef GrowableArray ValueSetList; Optimizer::Optimizer(IR* ir) { assert(ir->is_valid(), "IR must be valid"); @@ -584,8 +582,8 @@ class NullCheckEliminator: public ValueVisitor { ValueSet* state() { return _set; } void set_state_from (ValueSet* state) { _set->set_from(state); } - ValueSet* state_for (BlockBegin* block) { return _block_states[block->block_id()]; } - void set_state_for (BlockBegin* block, ValueSet* stack) { _block_states[block->block_id()] = stack; } + ValueSet* state_for (BlockBegin* block) { return _block_states.at(block->block_id()); } + void set_state_for (BlockBegin* block, ValueSet* stack) { _block_states.at_put(block->block_id(), stack); } // Returns true if caused a change in the block's state. bool merge_state_for(BlockBegin* block, ValueSet* incoming_state); @@ -596,7 +594,7 @@ class NullCheckEliminator: public ValueVisitor { : _opt(opt) , _set(new ValueSet()) , _last_explicit_null_check(NULL) - , _block_states(BlockBegin::number_of_blocks(), NULL) + , _block_states(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), NULL) , _work_list(new BlockList()) { _visitable_instructions = new ValueSet(); _visitor.set_eliminator(this); @@ -1165,19 +1163,19 @@ void Optimizer::eliminate_null_checks() { // handlers and iterate over them as well int nblocks = BlockBegin::number_of_blocks(); BlockList blocks(nblocks); - boolArray visited_block(nblocks, false); + boolArray visited_block(nblocks, nblocks, false); blocks.push(ir()->start()); - visited_block[ir()->start()->block_id()] = true; + visited_block.at_put(ir()->start()->block_id(), true); for (int i = 0; i < blocks.length(); i++) { - BlockBegin* b = blocks[i]; + BlockBegin* b = blocks.at(i); // exception handlers need to be treated as additional roots for (int e = b->number_of_exception_handlers(); e-- > 0; ) { BlockBegin* excp = b->exception_handler_at(e); int id = excp->block_id(); - if (!visited_block[id]) { + if (!visited_block.at(id)) { blocks.push(excp); - visited_block[id] = true; + visited_block.at_put(id, true); nce.iterate(excp); } } @@ -1186,9 +1184,9 @@ void Optimizer::eliminate_null_checks() { for (int s = end->number_of_sux(); s-- > 0; ) { BlockBegin* next = end->sux_at(s); int id = next->block_id(); - if (!visited_block[id]) { + if (!visited_block.at(id)) { blocks.push(next); - visited_block[id] = true; + visited_block.at_put(id, true); } } } diff --git a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp index 71e9de00b30..0ec8d49ef33 100644 --- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp +++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -53,8 +53,8 @@ void RangeCheckElimination::eliminate(IR *ir) { // Constructor RangeCheckEliminator::RangeCheckEliminator(IR *ir) : - _bounds(Instruction::number_of_instructions(), NULL), - _access_indexed_info(Instruction::number_of_instructions(), NULL) + _bounds(Instruction::number_of_instructions(), Instruction::number_of_instructions(), NULL), + _access_indexed_info(Instruction::number_of_instructions(), Instruction::number_of_instructions(), NULL) { _visitor.set_range_check_eliminator(this); _ir = ir; @@ -303,28 +303,28 @@ RangeCheckEliminator::Bound *RangeCheckEliminator::get_bound(Value v) { // Wrong type or NULL -> No bound if (!v || (!v->type()->as_IntType() && !v->type()->as_ObjectType())) return NULL; - if (!_bounds[v->id()]) { + if (!_bounds.at(v->id())) { // First (default) bound is calculated // Create BoundStack - _bounds[v->id()] = new BoundStack(); + _bounds.at_put(v->id(), new BoundStack()); _visitor.clear_bound(); Value visit_value = v; visit_value->visit(&_visitor); Bound *bound = _visitor.bound(); if (bound) { - _bounds[v->id()]->push(bound); + _bounds.at(v->id())->push(bound); } - if (_bounds[v->id()]->length() == 0) { + if (_bounds.at(v->id())->length() == 0) { assert(!(v->as_Constant() && v->type()->as_IntConstant()), "constants not handled here"); - _bounds[v->id()]->push(new Bound()); + _bounds.at(v->id())->push(new Bound()); } - } else if (_bounds[v->id()]->length() == 0) { + } else if (_bounds.at(v->id())->length() == 0) { // To avoid endless loops, bound is currently in calculation -> nothing known about it return new Bound(); } // Return bound - return _bounds[v->id()]->top(); + return _bounds.at(v->id())->top(); } // Update bound @@ -353,28 +353,28 @@ void RangeCheckEliminator::update_bound(IntegerStack &pushed, Value v, Bound *bo // No bound update for constants return; } - if (!_bounds[v->id()]) { + if (!_bounds.at(v->id())) { get_bound(v); - assert(_bounds[v->id()], "Now Stack must exist"); + assert(_bounds.at(v->id()), "Now Stack must exist"); } Bound *top = NULL; - if (_bounds[v->id()]->length() > 0) { - top = _bounds[v->id()]->top(); + if (_bounds.at(v->id())->length() > 0) { + top = _bounds.at(v->id())->top(); } if (top) { bound->and_op(top); } - _bounds[v->id()]->push(bound); + _bounds.at(v->id())->push(bound); pushed.append(v->id()); } // Add instruction + idx for in block motion void RangeCheckEliminator::add_access_indexed_info(InstructionList &indices, int idx, Value instruction, AccessIndexed *ai) { int id = instruction->id(); - AccessIndexedInfo *aii = _access_indexed_info[id]; + AccessIndexedInfo *aii = _access_indexed_info.at(id); if (aii == NULL) { aii = new AccessIndexedInfo(); - _access_indexed_info[id] = aii; + _access_indexed_info.at_put(id, aii); indices.append(instruction); aii->_min = idx; aii->_max = idx; @@ -461,7 +461,7 @@ void RangeCheckEliminator::in_block_motion(BlockBegin *block, AccessIndexedList if (_optimistic) { for (int i = 0; i < indices.length(); i++) { Instruction *index_instruction = indices.at(i); - AccessIndexedInfo *info = _access_indexed_info[index_instruction->id()]; + AccessIndexedInfo *info = _access_indexed_info.at(index_instruction->id()); assert(info != NULL, "Info must not be null"); // if idx < 0, max > 0, max + idx may fall between 0 and @@ -562,7 +562,7 @@ void RangeCheckEliminator::in_block_motion(BlockBegin *block, AccessIndexedList // Clear data structures for next array for (int i = 0; i < indices.length(); i++) { Instruction *index_instruction = indices.at(i); - _access_indexed_info[index_instruction->id()] = NULL; + _access_indexed_info.at_put(index_instruction->id(), NULL); } indices.clear(); } @@ -1005,7 +1005,7 @@ void RangeCheckEliminator::calc_bounds(BlockBegin *block, BlockBegin *loop_heade // Reset stack for (int i=0; ipop(); + _bounds.at(pushed.at(i))->pop(); } } @@ -1051,7 +1051,7 @@ void RangeCheckEliminator::dump_condition_stack(BlockBegin *block) { #endif // Verification or the IR -RangeCheckEliminator::Verification::Verification(IR *ir) : _used(BlockBegin::number_of_blocks(), false) { +RangeCheckEliminator::Verification::Verification(IR *ir) : _used(BlockBegin::number_of_blocks(), BlockBegin::number_of_blocks(), false) { this->_ir = ir; ir->iterate_linear_scan_order(this); } @@ -1146,14 +1146,14 @@ bool RangeCheckEliminator::Verification::can_reach(BlockBegin *start, BlockBegin if (start == end) return start != dont_use; // Simple BSF from start to end // BlockBeginList _current; - for (int i=0; i<_used.length(); i++) { - _used[i] = false; + for (int i=0; i < _used.length(); i++) { + _used.at_put(i, false); } - _current.truncate(0); - _successors.truncate(0); + _current.trunc_to(0); + _successors.trunc_to(0); if (start != dont_use) { _current.push(start); - _used[start->block_id()] = true; + _used.at_put(start->block_id(), true); } // BlockBeginList _successors; @@ -1180,17 +1180,17 @@ bool RangeCheckEliminator::Verification::can_reach(BlockBegin *start, BlockBegin } } for (int i=0; i<_successors.length(); i++) { - BlockBegin *sux = _successors[i]; + BlockBegin *sux = _successors.at(i); assert(sux != NULL, "Successor must not be NULL!"); if (sux == end) { return true; } - if (sux != dont_use && !_used[sux->block_id()]) { - _used[sux->block_id()] = true; + if (sux != dont_use && !_used.at(sux->block_id())) { + _used.at_put(sux->block_id(), true); _current.push(sux); } } - _successors.truncate(0); + _successors.trunc_to(0); } return false; diff --git a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp index 0552125b8dc..0fb97a113b2 100644 --- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp +++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -40,10 +40,8 @@ private: bool _optimistic; // Insert predicates and deoptimize when they fail IR *_ir; - define_array(BlockBeginArray, BlockBegin*) - define_stack(BlockBeginList, BlockBeginArray) - define_stack(IntegerStack, intArray) - define_array(IntegerMap, IntegerStack*) + typedef GrowableArray BlockBeginList; + typedef GrowableArray IntegerStack; class Verification : public BlockClosure { // RangeCheckEliminator::Verification should never get instatiated on the heap. @@ -180,13 +178,10 @@ public: void add_assertions(Bound *bound, Instruction *instruction, Instruction *position); #endif - define_array(BoundArray, Bound *) - define_stack(BoundStack, BoundArray) - define_array(BoundMap, BoundStack *) - define_array(AccessIndexedArray, AccessIndexed *) - define_stack(AccessIndexedList, AccessIndexedArray) - define_array(InstructionArray, Instruction *) - define_stack(InstructionList, InstructionArray) + typedef GrowableArray BoundStack; + typedef GrowableArray BoundMap; + typedef GrowableArray AccessIndexedList; + typedef GrowableArray InstructionList; class AccessIndexedInfo : public CompilationResourceObj { public: @@ -195,7 +190,7 @@ public: int _max; }; - define_array(AccessIndexedInfoArray, AccessIndexedInfo *) + typedef GrowableArray AccessIndexedInfoArray; BoundMap _bounds; // Mapping from Instruction's id to current bound AccessIndexedInfoArray _access_indexed_info; // Mapping from Instruction's id to AccessIndexedInfo for in block motion Visitor _visitor; diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index 56531ae9ea3..be57ef53e78 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -318,11 +318,15 @@ const char* Runtime1::name_for_address(address entry) { FUNCTION_CASE(entry, TRACE_TIME_METHOD); #endif FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32()); + FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32C()); + FUNCTION_CASE(entry, StubRoutines::vectorizedMismatch()); FUNCTION_CASE(entry, StubRoutines::dexp()); FUNCTION_CASE(entry, StubRoutines::dlog()); + FUNCTION_CASE(entry, StubRoutines::dlog10()); FUNCTION_CASE(entry, StubRoutines::dpow()); FUNCTION_CASE(entry, StubRoutines::dsin()); FUNCTION_CASE(entry, StubRoutines::dcos()); + FUNCTION_CASE(entry, StubRoutines::dtan()); #undef FUNCTION_CASE diff --git a/hotspot/src/share/vm/c1/c1_ValueMap.cpp b/hotspot/src/share/vm/c1/c1_ValueMap.cpp index fb52819facc..fb277a5616b 100644 --- a/hotspot/src/share/vm/c1/c1_ValueMap.cpp +++ b/hotspot/src/share/vm/c1/c1_ValueMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -46,7 +46,7 @@ ValueMap::ValueMap() : _nesting(0) - , _entries(ValueMapInitialSize, NULL) + , _entries(ValueMapInitialSize, ValueMapInitialSize, NULL) , _killed_values() , _entry_count(0) { @@ -56,7 +56,7 @@ ValueMap::ValueMap() ValueMap::ValueMap(ValueMap* old) : _nesting(old->_nesting + 1) - , _entries(old->_entries.length()) + , _entries(old->_entries.length(), old->_entries.length(), NULL) , _killed_values() , _entry_count(old->_entry_count) { @@ -72,7 +72,7 @@ void ValueMap::increase_table_size() { int new_size = old_size * 2 + 1; ValueMapEntryList worklist(8); - ValueMapEntryArray new_entries(new_size, NULL); + ValueMapEntryArray new_entries(new_size, new_size, NULL); int new_entry_count = 0; TRACE_VALUE_NUMBERING(tty->print_cr("increasing table size from %d to %d", old_size, new_size)); @@ -486,7 +486,7 @@ bool ShortLoopOptimizer::process(BlockBegin* loop_header) { GlobalValueNumbering::GlobalValueNumbering(IR* ir) : _current_map(NULL) - , _value_maps(ir->linear_scan_order()->length(), NULL) + , _value_maps(ir->linear_scan_order()->length(), ir->linear_scan_order()->length(), NULL) , _compilation(ir->compilation()) { TRACE_VALUE_NUMBERING(tty->print_cr("****** start of global value numbering")); diff --git a/hotspot/src/share/vm/c1/c1_ValueMap.hpp b/hotspot/src/share/vm/c1/c1_ValueMap.hpp index 3b3b02ee4b7..e2e1c1b15fe 100644 --- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp +++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp @@ -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 @@ -53,8 +53,8 @@ class ValueMapEntry: public CompilationResourceObj { void set_next(ValueMapEntry* next) { _next = next; } }; -define_array(ValueMapEntryArray, ValueMapEntry*) -define_stack(ValueMapEntryList, ValueMapEntryArray) +typedef GrowableArray ValueMapEntryArray; +typedef GrowableArray ValueMapEntryList; // ValueMap implements nested hash tables for value numbering. It // maintains a set _killed_values which represents the instructions @@ -129,8 +129,7 @@ class ValueMap: public CompilationResourceObj { #endif }; -define_array(ValueMapArray, ValueMap*) - +typedef GrowableArray ValueMapArray; class ValueNumberingVisitor: public InstructionVisitor { protected: diff --git a/hotspot/src/share/vm/c1/c1_ValueSet.hpp b/hotspot/src/share/vm/c1/c1_ValueSet.hpp index 2e8dd095d11..50538121cf8 100644 --- a/hotspot/src/share/vm/c1/c1_ValueSet.hpp +++ b/hotspot/src/share/vm/c1/c1_ValueSet.hpp @@ -36,7 +36,7 @@ class ValueSet: public CompilationResourceObj { private: - BitMap _map; + ResourceBitMap _map; public: ValueSet(); diff --git a/hotspot/src/share/vm/c1/c1_ValueStack.cpp b/hotspot/src/share/vm/c1/c1_ValueStack.cpp index fcf8ba2ce46..139451138b7 100644 --- a/hotspot/src/share/vm/c1/c1_ValueStack.cpp +++ b/hotspot/src/share/vm/c1/c1_ValueStack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, 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 @@ -35,7 +35,7 @@ ValueStack::ValueStack(IRScope* scope, ValueStack* caller_state) , _caller_state(caller_state) , _bci(-99) , _kind(Parsing) -, _locals(scope->method()->max_locals(), NULL) +, _locals(scope->method()->max_locals(), scope->method()->max_locals(), NULL) , _stack(scope->method()->max_stack()) , _locks() { @@ -178,7 +178,7 @@ void ValueStack::setup_phi_for_stack(BlockBegin* b, int index) { ValueType* t = stack_at(index)->type(); Value phi = new Phi(t, b, -index - 1); - _stack[index] = phi; + _stack.at_put(index, phi); assert(!t->is_double_word() || _stack.at(index + 1) == NULL, "hi-word of doubleword value must be NULL"); } @@ -225,7 +225,7 @@ void ValueStack::print() { if (locals_size() > 0) { InstructionPrinter ip; for (int i = 0; i < locals_size();) { - Value l = _locals[i]; + Value l = _locals.at(i); tty->print("local %d ", i); if (l == NULL) { tty->print("null"); diff --git a/hotspot/src/share/vm/c1/c1_globals.cpp b/hotspot/src/share/vm/c1/c1_globals.cpp index 18e324f5f8b..58bd059520f 100644 --- a/hotspot/src/share/vm/c1/c1_globals.cpp +++ b/hotspot/src/share/vm/c1/c1_globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -25,4 +25,12 @@ #include "precompiled.hpp" #include "c1/c1_globals.hpp" -C1_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG, IGNORE_RANGE, IGNORE_CONSTRAINT) +C1_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ + MATERIALIZE_PD_DEVELOPER_FLAG, \ + MATERIALIZE_PRODUCT_FLAG, \ + MATERIALIZE_PD_PRODUCT_FLAG, \ + MATERIALIZE_DIAGNOSTIC_FLAG, \ + MATERIALIZE_NOTPRODUCT_FLAG, \ + IGNORE_RANGE, \ + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp index ad6548e4928..a1e8ce45655 100644 --- a/hotspot/src/share/vm/c1/c1_globals.hpp +++ b/hotspot/src/share/vm/c1/c1_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -60,7 +60,15 @@ // // Defines all global flags used by the client compiler. // -#define C1_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, range, constraint) \ +#define C1_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ /* Printing */ \ notproduct(bool, PrintC1Statistics, false, \ @@ -176,7 +184,7 @@ product(bool, InlineSynchronizedMethods, true, \ "Inline synchronized methods") \ \ - develop(bool, InlineNIOCheckIndex, true, \ + diagnostic(bool, InlineNIOCheckIndex, true, \ "Intrinsify java.nio.Buffer.checkIndex") \ \ develop(bool, CanonicalizeNodes, true, \ @@ -350,6 +358,7 @@ C1_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_DIAGNOSTIC_FLAG, \ DECLARE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // SHARE_VM_C1_C1_GLOBALS_HPP diff --git a/hotspot/src/share/vm/ci/ciConstant.hpp b/hotspot/src/share/vm/ci/ciConstant.hpp index 5af058f4e9b..513653392d1 100644 --- a/hotspot/src/share/vm/ci/ciConstant.hpp +++ b/hotspot/src/share/vm/ci/ciConstant.hpp @@ -124,6 +124,9 @@ public: } } + bool is_valid() const { + return basic_type() != T_ILLEGAL; + } // Debugging output void print(); }; diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index 697c559151f..001c7fd13ea 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -1055,14 +1055,14 @@ void ciEnv::register_method(ciMethod* target, if (entry_bci == InvocationEntryBci) { if (TieredCompilation) { // If there is an old version we're done with it - nmethod* old = method->code(); + CompiledMethod* old = method->code(); if (TraceMethodReplacement && old != NULL) { ResourceMark rm; char *method_name = method->name_and_sig_as_C_string(); tty->print_cr("Replacing method %s", method_name); } if (old != NULL) { - old->make_not_entrant(); + old->make_not_used(); } } if (TraceNMethodInstalls) { diff --git a/hotspot/src/share/vm/ci/ciField.cpp b/hotspot/src/share/vm/ci/ciField.cpp index 0078f44ed21..4d37c923ffe 100644 --- a/hotspot/src/share/vm/ci/ciField.cpp +++ b/hotspot/src/share/vm/ci/ciField.cpp @@ -235,96 +235,77 @@ void ciField::initialize_from(fieldDescriptor* fd) { _holder = CURRENT_ENV->get_instance_klass(fd->field_holder()); // Check to see if the field is constant. - bool is_final = this->is_final(); - bool is_stable = FoldStableValues && this->is_stable(); - if (_holder->is_initialized() && (is_final || is_stable)) { - if (!this->is_static()) { - // A field can be constant if it's a final static field or if - // it's a final non-static field of a trusted class (classes in - // java.lang.invoke and sun.invoke packages and subpackages). - if (is_stable || trust_final_non_static_fields(_holder)) { - _is_constant = true; - return; - } - _is_constant = false; - return; - } - - // This field just may be constant. The only case where it will - // not be constant is when the field is a *special* static&final field - // whose value may change. The three examples are java.lang.System.in, - // java.lang.System.out, and java.lang.System.err. - - KlassHandle k = _holder->get_Klass(); - assert( SystemDictionary::System_klass() != NULL, "Check once per vm"); - if( k() == SystemDictionary::System_klass() ) { - // Check offsets for case 2: System.in, System.out, or System.err - if( _offset == java_lang_System::in_offset_in_bytes() || - _offset == java_lang_System::out_offset_in_bytes() || - _offset == java_lang_System::err_offset_in_bytes() ) { - _is_constant = false; - return; - } - } - - Handle mirror = k->java_mirror(); - - switch(type()->basic_type()) { - case T_BYTE: - _constant_value = ciConstant(type()->basic_type(), mirror->byte_field(_offset)); - break; - case T_CHAR: - _constant_value = ciConstant(type()->basic_type(), mirror->char_field(_offset)); - break; - case T_SHORT: - _constant_value = ciConstant(type()->basic_type(), mirror->short_field(_offset)); - break; - case T_BOOLEAN: - _constant_value = ciConstant(type()->basic_type(), mirror->bool_field(_offset)); - break; - case T_INT: - _constant_value = ciConstant(type()->basic_type(), mirror->int_field(_offset)); - break; - case T_FLOAT: - _constant_value = ciConstant(mirror->float_field(_offset)); - break; - case T_DOUBLE: - _constant_value = ciConstant(mirror->double_field(_offset)); - break; - case T_LONG: - _constant_value = ciConstant(mirror->long_field(_offset)); - break; - case T_OBJECT: - case T_ARRAY: - { - oop o = mirror->obj_field(_offset); - - // A field will be "constant" if it is known always to be - // a non-null reference to an instance of a particular class, - // or to a particular array. This can happen even if the instance - // or array is not perm. In such a case, an "unloaded" ciArray - // or ciInstance is created. The compiler may be able to use - // information about the object's class (which is exact) or length. - - if (o == NULL) { - _constant_value = ciConstant(type()->basic_type(), ciNullObject::make()); - } else { - _constant_value = ciConstant(type()->basic_type(), CURRENT_ENV->get_object(o)); - assert(_constant_value.as_object() == CURRENT_ENV->get_object(o), "check interning"); + Klass* k = _holder->get_Klass(); + bool is_stable_field = FoldStableValues && is_stable(); + if (is_final() || is_stable_field) { + if (is_static()) { + // This field just may be constant. The only case where it will + // not be constant is when the field is a *special* static & final field + // whose value may change. The three examples are java.lang.System.in, + // java.lang.System.out, and java.lang.System.err. + assert(SystemDictionary::System_klass() != NULL, "Check once per vm"); + if (k == SystemDictionary::System_klass()) { + // Check offsets for case 2: System.in, System.out, or System.err + if( _offset == java_lang_System::in_offset_in_bytes() || + _offset == java_lang_System::out_offset_in_bytes() || + _offset == java_lang_System::err_offset_in_bytes() ) { + _is_constant = false; + return; } } - } - if (is_stable && _constant_value.is_null_or_zero()) { - // It is not a constant after all; treat it as uninitialized. - _is_constant = false; - } else { _is_constant = true; + } else { + // An instance field can be constant if it's a final static field or if + // it's a final non-static field of a trusted class (classes in + // java.lang.invoke and sun.invoke packages and subpackages). + _is_constant = is_stable_field || trust_final_non_static_fields(_holder); } } else { - _is_constant = false; + // For CallSite objects treat the target field as a compile time constant. + assert(SystemDictionary::CallSite_klass() != NULL, "should be already initialized"); + if (k == SystemDictionary::CallSite_klass() && + _offset == java_lang_invoke_CallSite::target_offset_in_bytes()) { + _is_constant = true; + } else { + // Non-final & non-stable fields are not constants. + _is_constant = false; + } } } +// ------------------------------------------------------------------ +// ciField::constant_value +// Get the constant value of a this static field. +ciConstant ciField::constant_value() { + assert(is_static() && is_constant(), "illegal call to constant_value()"); + if (!_holder->is_initialized()) { + return ciConstant(); // Not initialized yet + } + if (_constant_value.basic_type() == T_ILLEGAL) { + // Static fields are placed in mirror objects. + VM_ENTRY_MARK; + ciInstance* mirror = CURRENT_ENV->get_instance(_holder->get_Klass()->java_mirror()); + _constant_value = mirror->field_value_impl(type()->basic_type(), offset()); + } + if (FoldStableValues && is_stable() && _constant_value.is_null_or_zero()) { + return ciConstant(); + } + return _constant_value; +} + +// ------------------------------------------------------------------ +// ciField::constant_value_of +// Get the constant value of non-static final field in the given object. +ciConstant ciField::constant_value_of(ciObject* object) { + assert(!is_static() && is_constant(), "only if field is non-static constant"); + assert(object->is_instance(), "must be instance"); + ciConstant field_value = object->as_instance()->field_value(this); + if (FoldStableValues && is_stable() && field_value.is_null_or_zero()) { + return ciConstant(); + } + return field_value; +} + // ------------------------------------------------------------------ // ciField::compute_type // diff --git a/hotspot/src/share/vm/ci/ciField.hpp b/hotspot/src/share/vm/ci/ciField.hpp index dd07a9973f9..f30e7144e12 100644 --- a/hotspot/src/share/vm/ci/ciField.hpp +++ b/hotspot/src/share/vm/ci/ciField.hpp @@ -62,7 +62,7 @@ private: void initialize_from(fieldDescriptor* fd); public: - ciFlags flags() { return _flags; } + ciFlags flags() const { return _flags; } // Of which klass is this field a member? // @@ -89,13 +89,13 @@ public: // // In that case the declared holder of f would be B and // the canonical holder of f would be A. - ciInstanceKlass* holder() { return _holder; } + ciInstanceKlass* holder() const { return _holder; } // Name of this field? - ciSymbol* name() { return _name; } + ciSymbol* name() const { return _name; } // Signature of this field? - ciSymbol* signature() { return _signature; } + ciSymbol* signature() const { return _signature; } // Of what type is this field? ciType* type() { return (_type == NULL) ? compute_type() : _type; } @@ -107,13 +107,13 @@ public: int size_in_bytes() { return type2aelembytes(layout_type()); } // What is the offset of this field? - int offset() { + int offset() const { assert(_offset >= 1, "illegal call to offset()"); return _offset; } // Same question, explicit units. (Fields are aligned to the byte level.) - int offset_in_bytes() { + int offset_in_bytes() const { return offset(); } @@ -127,31 +127,27 @@ public: // // Clarification: A field is considered constant if: // 1. The field is both static and final - // 2. The canonical holder of the field has undergone - // static initialization. - // 3. The field is not one of the special static/final + // 2. The field is not one of the special static/final // non-constant fields. These are java.lang.System.in // and java.lang.System.out. Abomination. // // A field is also considered constant if it is marked @Stable // and is non-null (or non-zero, if a primitive). - // For non-static fields, the null/zero check must be - // arranged by the user, as constant_value().is_null_or_zero(). - bool is_constant() { return _is_constant; } + // + // A user should also check the field value (constant_value().is_valid()), since + // constant fields of non-initialized classes don't have values yet. + bool is_constant() const { return _is_constant; } - // Get the constant value of this field. - ciConstant constant_value() { - assert(is_static() && is_constant(), "illegal call to constant_value()"); - return _constant_value; + // Get the constant value of the static field. + ciConstant constant_value(); + + bool is_static_constant() { + return is_static() && is_constant() && constant_value().is_valid(); } // Get the constant value of non-static final field in the given // object. - ciConstant constant_value_of(ciObject* object) { - assert(!is_static() && is_constant(), "only if field is non-static constant"); - assert(object->is_instance(), "must be instance"); - return object->as_instance()->field_value(this); - } + ciConstant constant_value_of(ciObject* object); // Check for link time errors. Accessing a field from a // certain class via a certain bytecode may or may not be legal. @@ -165,14 +161,14 @@ public: Bytecodes::Code bc); // Java access flags - bool is_public () { return flags().is_public(); } - bool is_private () { return flags().is_private(); } - bool is_protected () { return flags().is_protected(); } - bool is_static () { return flags().is_static(); } - bool is_final () { return flags().is_final(); } - bool is_stable () { return flags().is_stable(); } - bool is_volatile () { return flags().is_volatile(); } - bool is_transient () { return flags().is_transient(); } + bool is_public () const { return flags().is_public(); } + bool is_private () const { return flags().is_private(); } + bool is_protected () const { return flags().is_protected(); } + bool is_static () const { return flags().is_static(); } + bool is_final () const { return flags().is_final(); } + bool is_stable () const { return flags().is_stable(); } + bool is_volatile () const { return flags().is_volatile(); } + bool is_transient () const { return flags().is_transient(); } bool is_call_site_target() { ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass(); diff --git a/hotspot/src/share/vm/ci/ciInstance.cpp b/hotspot/src/share/vm/ci/ciInstance.cpp index f276a53fb5d..d2073abdbf1 100644 --- a/hotspot/src/share/vm/ci/ciInstance.cpp +++ b/hotspot/src/share/vm/ci/ciInstance.cpp @@ -56,49 +56,21 @@ ciType* ciInstance::java_mirror_type() { } // ------------------------------------------------------------------ -// ciInstance::field_value -// -// Constant value of a field. -ciConstant ciInstance::field_value(ciField* field) { - assert(is_loaded(), "invalid access - must be loaded"); - assert(field->holder()->is_loaded(), "invalid access - holder must be loaded"); - assert(klass()->is_subclass_of(field->holder()), "invalid access - must be subclass"); - - VM_ENTRY_MARK; - ciConstant result; +// ciInstance::field_value_impl +ciConstant ciInstance::field_value_impl(BasicType field_btype, int offset) { Handle obj = get_oop(); assert(!obj.is_null(), "bad oop"); - BasicType field_btype = field->type()->basic_type(); - int offset = field->offset(); - switch(field_btype) { - case T_BYTE: - return ciConstant(field_btype, obj->byte_field(offset)); - break; - case T_CHAR: - return ciConstant(field_btype, obj->char_field(offset)); - break; - case T_SHORT: - return ciConstant(field_btype, obj->short_field(offset)); - break; - case T_BOOLEAN: - return ciConstant(field_btype, obj->bool_field(offset)); - break; - case T_INT: - return ciConstant(field_btype, obj->int_field(offset)); - break; - case T_FLOAT: - return ciConstant(obj->float_field(offset)); - break; - case T_DOUBLE: - return ciConstant(obj->double_field(offset)); - break; - case T_LONG: - return ciConstant(obj->long_field(offset)); - break; - case T_OBJECT: - case T_ARRAY: - { + case T_BYTE: return ciConstant(field_btype, obj->byte_field(offset)); + case T_CHAR: return ciConstant(field_btype, obj->char_field(offset)); + case T_SHORT: return ciConstant(field_btype, obj->short_field(offset)); + case T_BOOLEAN: return ciConstant(field_btype, obj->bool_field(offset)); + case T_INT: return ciConstant(field_btype, obj->int_field(offset)); + case T_FLOAT: return ciConstant(obj->float_field(offset)); + case T_DOUBLE: return ciConstant(obj->double_field(offset)); + case T_LONG: return ciConstant(obj->long_field(offset)); + case T_OBJECT: // fall through + case T_ARRAY: { oop o = obj->obj_field(offset); // A field will be "constant" if it is known always to be @@ -115,11 +87,22 @@ ciConstant ciInstance::field_value(ciField* field) { } } } - ShouldNotReachHere(); - // to shut up the compiler + fatal("no field value: %s", type2name(field_btype)); return ciConstant(); } +// ------------------------------------------------------------------ +// ciInstance::field_value +// +// Constant value of a field. +ciConstant ciInstance::field_value(ciField* field) { + assert(is_loaded(), "invalid access - must be loaded"); + assert(field->holder()->is_loaded(), "invalid access - holder must be loaded"); + assert(field->is_static() || klass()->is_subclass_of(field->holder()), "invalid access - must be subclass"); + + GUARDED_VM_ENTRY(return field_value_impl(field->type()->basic_type(), field->offset());) +} + // ------------------------------------------------------------------ // ciInstance::field_value_by_offset // diff --git a/hotspot/src/share/vm/ci/ciInstance.hpp b/hotspot/src/share/vm/ci/ciInstance.hpp index a33aabbc0ce..96c470e54ee 100644 --- a/hotspot/src/share/vm/ci/ciInstance.hpp +++ b/hotspot/src/share/vm/ci/ciInstance.hpp @@ -36,6 +36,7 @@ // instance of java.lang.Object. class ciInstance : public ciObject { CI_PACKAGE_ACCESS + friend class ciField; protected: ciInstance(instanceHandle h_i) : ciObject(h_i) { @@ -50,6 +51,8 @@ protected: void print_impl(outputStream* st); + ciConstant field_value_impl(BasicType field_btype, int offset); + public: // If this object is a java mirror, return the corresponding type. // Otherwise, return NULL. diff --git a/hotspot/src/share/vm/ci/ciKlass.cpp b/hotspot/src/share/vm/ci/ciKlass.cpp index 75c3c140a8e..ab980fafafc 100644 --- a/hotspot/src/share/vm/ci/ciKlass.cpp +++ b/hotspot/src/share/vm/ci/ciKlass.cpp @@ -88,12 +88,7 @@ bool ciKlass::is_subclass_of(ciKlass* that) { assert(this->is_loaded(), "must be loaded: %s", this->name()->as_quoted_ascii()); assert(that->is_loaded(), "must be loaded: %s", that->name()->as_quoted_ascii()); - VM_ENTRY_MARK; - Klass* this_klass = get_Klass(); - Klass* that_klass = that->get_Klass(); - bool result = this_klass->is_subclass_of(that_klass); - - return result; + GUARDED_VM_ENTRY(return get_Klass()->is_subclass_of(that->get_Klass());) } // ------------------------------------------------------------------ diff --git a/hotspot/src/share/vm/ci/ciMethod.cpp b/hotspot/src/share/vm/ci/ciMethod.cpp index cb98f25e1c3..8294024ac9e 100644 --- a/hotspot/src/share/vm/ci/ciMethod.cpp +++ b/hotspot/src/share/vm/ci/ciMethod.cpp @@ -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 @@ -202,6 +202,7 @@ void ciMethod::load_code() { _code = (address)arena->Amalloc(code_size()); memcpy(_code, me->code_base(), code_size()); +#if INCLUDE_JVMTI // Revert any breakpoint bytecodes in ci's copy if (me->number_of_breakpoints() > 0) { BreakpointInfo* bp = me->method_holder()->breakpoints(); @@ -211,6 +212,7 @@ void ciMethod::load_code() { } } } +#endif // And load the exception table. ExceptionTable exc_table(me); @@ -441,12 +443,12 @@ MethodLivenessResult ciMethod::liveness_at_bci(int bci) { // gc'ing an interpreter frame we need to use its viewpoint during // OSR when loading the locals. -BitMap ciMethod::live_local_oops_at_bci(int bci) { +ResourceBitMap ciMethod::live_local_oops_at_bci(int bci) { VM_ENTRY_MARK; InterpreterOopMap mask; OopMapCache::compute_one_oop_map(get_Method(), bci, &mask); int mask_size = max_locals(); - BitMap result(mask_size); + ResourceBitMap result(mask_size); result.clear(); int i; for (i = 0; i < mask_size ; i++ ) { @@ -461,7 +463,7 @@ BitMap ciMethod::live_local_oops_at_bci(int bci) { // ciMethod::bci_block_start // // Marks all bcis where a new basic block starts -const BitMap ciMethod::bci_block_start() { +const BitMap& ciMethod::bci_block_start() { check_is_loaded(); if (_liveness == NULL) { // Create the liveness analyzer. @@ -1115,7 +1117,7 @@ bool ciMethod::has_compiled_code() { int ciMethod::comp_level() { check_is_loaded(); VM_ENTRY_MARK; - nmethod* nm = get_Method()->code(); + CompiledMethod* nm = get_Method()->code(); if (nm != NULL) return nm->comp_level(); return 0; } @@ -1150,7 +1152,7 @@ int ciMethod::code_size_for_inlining() { int ciMethod::instructions_size() { if (_instructions_size == -1) { GUARDED_VM_ENTRY( - nmethod* code = get_Method()->code(); + CompiledMethod* code = get_Method()->code(); if (code != NULL && (code->comp_level() == CompLevel_full_optimization)) { _instructions_size = code->insts_end() - code->verified_entry_point(); } else { @@ -1165,7 +1167,7 @@ int ciMethod::instructions_size() { // ciMethod::log_nmethod_identity void ciMethod::log_nmethod_identity(xmlStream* log) { GUARDED_VM_ENTRY( - nmethod* code = get_Method()->code(); + CompiledMethod* code = get_Method()->code(); if (code != NULL) { code->log_identity(log); } diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp index 6e350b41f97..7a56f1cf2a5 100644 --- a/hotspot/src/share/vm/ci/ciMethod.hpp +++ b/hotspot/src/share/vm/ci/ciMethod.hpp @@ -36,7 +36,6 @@ class ciMethodBlocks; class MethodLiveness; -class BitMap; class Arena; class BCEscapeAnalyzer; class InlineTree; @@ -233,10 +232,10 @@ class ciMethod : public ciMetadata { // used when gc'ing an interpreter frame we need to use its viewpoint // during OSR when loading the locals. - BitMap live_local_oops_at_bci(int bci); + ResourceBitMap live_local_oops_at_bci(int bci); #ifdef COMPILER1 - const BitMap bci_block_start(); + const BitMap& bci_block_start(); #endif ciTypeFlow* get_flow_analysis(); diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp index 65e77c13f8a..8e3e6fb1ae3 100644 --- a/hotspot/src/share/vm/ci/ciReplay.cpp +++ b/hotspot/src/share/vm/ci/ciReplay.cpp @@ -546,13 +546,13 @@ class CompileReplay : public StackObj { } } // Make sure the existence of a prior compile doesn't stop this one - nmethod* nm = (entry_bci != InvocationEntryBci) ? method->lookup_osr_nmethod_for(entry_bci, comp_level, true) : method->code(); + CompiledMethod* nm = (entry_bci != InvocationEntryBci) ? method->lookup_osr_nmethod_for(entry_bci, comp_level, true) : method->code(); if (nm != NULL) { nm->make_not_entrant(); } replay_state = this; CompileBroker::compile_method(method, entry_bci, comp_level, - methodHandle(), 0, "replay", THREAD); + methodHandle(), 0, CompileTask::Reason_Replay, THREAD); replay_state = NULL; reset(); } diff --git a/hotspot/src/share/vm/ci/ciStreams.cpp b/hotspot/src/share/vm/ci/ciStreams.cpp index 76520fdff10..a4eaf473984 100644 --- a/hotspot/src/share/vm/ci/ciStreams.cpp +++ b/hotspot/src/share/vm/ci/ciStreams.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, 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 @@ -361,14 +361,14 @@ int ciBytecodeStream::get_method_index() { ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) { VM_ENTRY_MARK; ciEnv* env = CURRENT_ENV; - constantPoolHandle cpool(_method->get_Method()->constants()); + constantPoolHandle cpool(THREAD, _method->get_Method()->constants()); ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder); will_link = m->is_loaded(); // Use the MethodType stored in the CP cache to create a signature // with correct types (in respect to class loaders). if (has_method_type()) { - ciSymbol* sig_sym = env->get_symbol(cpool->symbol_at(get_method_signature_index())); + ciSymbol* sig_sym = env->get_symbol(cpool->symbol_at(get_method_signature_index(cpool))); ciKlass* pool_holder = env->get_klass(cpool->pool_holder()); ciMethodType* method_type = get_method_type(); ciSignature* declared_signature = new (env->arena()) ciSignature(pool_holder, sig_sym, method_type); @@ -465,9 +465,8 @@ int ciBytecodeStream::get_method_holder_index() { // Get the constant pool index of the signature of the method // referenced by the current bytecode. Used for generating // deoptimization information. -int ciBytecodeStream::get_method_signature_index() { +int ciBytecodeStream::get_method_signature_index(const constantPoolHandle& cpool) { GUARDED_VM_ENTRY( - ConstantPool* cpool = _holder->get_instanceKlass()->constants(); const int method_index = get_method_index(); const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index); return cpool->signature_ref_index_at(name_and_type_index); diff --git a/hotspot/src/share/vm/ci/ciStreams.hpp b/hotspot/src/share/vm/ci/ciStreams.hpp index 091aa1bdf53..07e573b5963 100644 --- a/hotspot/src/share/vm/ci/ciStreams.hpp +++ b/hotspot/src/share/vm/ci/ciStreams.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -264,7 +264,7 @@ public: ciMethodType* get_method_type(); ciKlass* get_declared_method_holder(); int get_method_holder_index(); - int get_method_signature_index(); + int get_method_signature_index(const constantPoolHandle& cpool); // Get the resolved references arrays from the constant pool ciObjArray* get_resolved_references(); diff --git a/hotspot/src/share/vm/ci/ciSymbol.cpp b/hotspot/src/share/vm/ci/ciSymbol.cpp index f141832df14..fa4c165bbef 100644 --- a/hotspot/src/share/vm/ci/ciSymbol.cpp +++ b/hotspot/src/share/vm/ci/ciSymbol.cpp @@ -58,9 +58,7 @@ ciSymbol::ciSymbol(Symbol* s) // // The text of the symbol as a null-terminated C string. const char* ciSymbol::as_utf8() { - VM_QUICK_ENTRY_MARK; - Symbol* s = get_symbol(); - return s->as_utf8(); + GUARDED_VM_QUICK_ENTRY(return get_symbol()->as_utf8();) } // The text of the symbol as a null-terminated C string. diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 5a735d525e5..e561cdcf160 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -2925,7 +2925,7 @@ static const intArray* sort_methods(Array* methods) { // If JVMTI original method ordering or sharing is enabled construct int // array remembering the original ordering if (JvmtiExport::can_maintain_original_method_order() || DumpSharedSpaces) { - method_ordering = new intArray(length); + method_ordering = new intArray(length, length, -1); for (int index = 0; index < length; index++) { Method* const m = methods->at(index); const int old_index = m->vtable_index(); @@ -3967,7 +3967,7 @@ void ClassFileParser::layout_fields(ConstantPool* cp, next_nonstatic_padded_offset += ContendedPaddingWidth; // collect all contended groups - BitMap bm(cp->size()); + ResourceBitMap bm(cp->size()); for (AllFieldStream fs(_fields, cp); !fs.done(); fs.next()) { // skip already laid out fields if (fs.is_offset_set()) continue; @@ -5349,7 +5349,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa ClassLoadingService::notify_class_loaded(ik, false /* not shared class */); if (!is_internal()) { - if (log_is_enabled(Info, classload)) { + if (log_is_enabled(Info, class, load)) { ResourceMark rm; const char* module_name = NULL; static const size_t modules_image_name_len = strlen(MODULES_IMAGE_NAME); @@ -5361,21 +5361,21 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa module_name = module_entry->name()->as_C_string(); } - if (log_is_enabled(Info, classload)) { + if (log_is_enabled(Info, class, load)) { ik->print_loading_log(LogLevel::Info, _loader_data, module_name, _stream); } // No 'else' here as logging levels are not mutually exclusive - if (log_is_enabled(Debug, classload)) { + if (log_is_enabled(Debug, class, load)) { ik->print_loading_log(LogLevel::Debug, _loader_data, module_name, _stream); } } - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { ResourceMark rm; // print out the superclass. const char * from = ik->external_name(); if (ik->java_super() != NULL) { - log_debug(classresolve)("%s %s (super)", + log_debug(class, resolve)("%s %s (super)", from, ik->java_super()->external_name()); } @@ -5386,7 +5386,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, bool changed_by_loa for (int i = 0; i < length; i++) { const Klass* const k = local_interfaces->at(i); const char * to = k->external_name(); - log_debug(classresolve)("%s %s (interface)", from, to); + log_debug(class, resolve)("%s %s (interface)", from, to); } } } @@ -5696,9 +5696,9 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream, } if (!is_internal()) { - if (log_is_enabled(Debug, classload, preorder)){ + if (log_is_enabled(Debug, class, preorder)){ ResourceMark rm(THREAD); - outputStream* log = Log(classload, preorder)::debug_stream(); + outputStream* log = Log(class, preorder)::debug_stream(); log->print("%s", _class_name->as_klass_external_name()); if (stream->source() != NULL) { log->print(" source: %s", stream->source()); @@ -5708,8 +5708,10 @@ void ClassFileParser::parse_stream(const ClassFileStream* const stream, #if INCLUDE_CDS if (DumpLoadedClassList != NULL && stream->source() != NULL && classlist_file->is_open()) { - // Only dump the classes that can be stored into CDS archive - if (SystemDictionaryShared::is_sharing_possible(_loader_data)) { + // Only dump the classes that can be stored into CDS archive. + // Anonymous classes such as generated LambdaForm classes are also not included. + if (SystemDictionaryShared::is_sharing_possible(_loader_data) && + _host_klass == NULL) { ResourceMark rm(THREAD); classlist_file->print_cr("%s", _class_name->as_C_string()); classlist_file->flush(); @@ -5800,8 +5802,8 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st guarantee_property(super_class_name == vmSymbols::java_lang_Object(), "Interfaces must have java.lang.Object as superclass in class file %s", CHECK); - } - _super_klass = (const InstanceKlass*) + } + _super_klass = (const InstanceKlass*) SystemDictionary::resolve_super_or_fail(_class_name, super_class_name, _loader_data->class_loader(), diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp index 3ee99df2e3b..47ec53940b2 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.hpp +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -42,7 +42,6 @@ class FieldInfo; template class GrowableArray; class InstanceKlass; -class intArray; class Symbol; class TempNewSymbol; diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp index ebd7d84b457..d77aef277eb 100644 --- a/hotspot/src/share/vm/classfile/classLoader.cpp +++ b/hotspot/src/share/vm/classfile/classLoader.cpp @@ -320,7 +320,7 @@ u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_ter #if INCLUDE_CDS u1* ClassPathZipEntry::open_versioned_entry(const char* name, jint* filesize, TRAPS) { u1* buffer = NULL; - if (DumpSharedSpaces) { + if (DumpSharedSpaces && !_is_boot_append) { // We presume default is multi-release enabled const char* multi_ver = Arguments::get_property("jdk.util.jar.enableMultiRelease"); const char* verstr = Arguments::get_property("jdk.util.jar.version"); @@ -539,7 +539,7 @@ bool ClassPathImageEntry::is_jrt() { #if INCLUDE_CDS void ClassLoader::exit_with_path_failure(const char* error, const char* message) { assert(DumpSharedSpaces, "only called at dump time"); - tty->print_cr("Hint: enable -Xlog:classpath=info to diagnose the failure"); + tty->print_cr("Hint: enable -Xlog:class+path=info to diagnose the failure"); vm_exit_during_initialization(error, message); } #endif @@ -572,9 +572,9 @@ void ModuleClassPathList::add_to_list(ClassPathEntry* new_entry) { } void ClassLoader::trace_class_path(const char* msg, const char* name) { - if (log_is_enabled(Info, classpath)) { + if (log_is_enabled(Info, class, path)) { ResourceMark rm; - outputStream* out = Log(classpath)::info_stream(); + outputStream* out = Log(class, path)::info_stream(); if (msg) { out->print("%s", msg); } @@ -795,12 +795,12 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str } } } - log_info(classpath)("opened: %s", path); - log_info(classload)("opened: %s", path); + log_info(class, path)("opened: %s", path); + log_info(class, load)("opened: %s", path); } else { // Directory new_entry = new ClassPathDirEntry(path); - log_info(classload)("path: %s", path); + log_info(class, load)("path: %s", path); } return new_entry; } @@ -1046,6 +1046,10 @@ int ClassLoader::crc32(int crc, const char* buf, int len) { #if INCLUDE_CDS void ClassLoader::initialize_module_loader_map(JImageFile* jimage) { + if (!DumpSharedSpaces) { + return; // only needed for CDS dump time + } + ResourceMark rm; jlong size; JImageLocationRef location = (*JImageFindResource)(jimage, "java.base", get_jimage_version_string(), MODULE_LOADER_MAP, &size); @@ -1053,7 +1057,8 @@ void ClassLoader::initialize_module_loader_map(JImageFile* jimage) { vm_exit_during_initialization( "Cannot find ModuleLoaderMap location from modules jimage.", NULL); } - char* buffer = NEW_RESOURCE_ARRAY(char, size); + char* buffer = NEW_RESOURCE_ARRAY(char, size + 1); + buffer[size] = '\0'; jlong read = (*JImageGetResource)(jimage, location, buffer, size); if (read != size) { vm_exit_during_initialization( @@ -1190,6 +1195,7 @@ objArrayOop ClassLoader::get_system_packages(TRAPS) { #if INCLUDE_CDS s2 ClassLoader::module_to_classloader(const char* module_name) { + assert(DumpSharedSpaces, "dump time only"); assert(_boot_modules_array != NULL, "_boot_modules_array is NULL"); assert(_platform_modules_array != NULL, "_platform_modules_array is NULL"); @@ -1209,10 +1215,10 @@ s2 ClassLoader::module_to_classloader(const char* module_name) { return APP_LOADER; } -#endif s2 ClassLoader::classloader_type(Symbol* class_name, ClassPathEntry* e, int classpath_index, TRAPS) { -#if INCLUDE_CDS + assert(DumpSharedSpaces, "Only used for CDS dump time"); + // obtain the classloader type based on the class name. // First obtain the package name based on the class name. Then obtain // the classloader type based on the package name from the jimage using @@ -1237,10 +1243,8 @@ s2 ClassLoader::classloader_type(Symbol* class_name, ClassPathEntry* e, int clas loader_type = ClassLoader::BOOT_LOADER; } return loader_type; -#endif - return ClassLoader::BOOT_LOADER; // the classloader type is ignored in non-CDS cases } - +#endif // caller needs ResourceMark const char* ClassLoader::file_name_for_class_name(const char* class_name, @@ -1424,8 +1428,7 @@ instanceKlassHandle ClassLoader::load_class(Symbol* name, bool search_append_onl return NULL; } - jshort loader_type = classloader_type(name, e, classpath_index, CHECK_NULL); - return context.record_result(classpath_index, loader_type, e, result, THREAD); + return context.record_result(name, e, classpath_index, result, THREAD); } // Initialize the class loader's access to methods in libzip. Parse and @@ -1831,7 +1834,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { } // Force compilation CompileBroker::compile_method(m, InvocationEntryBci, comp_level, - methodHandle(), 0, "CTW", THREAD); + methodHandle(), 0, CompileTask::Reason_CTW, THREAD); if (HAS_PENDING_EXCEPTION) { clear_pending_exception_if_not_oom(CHECK); tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string()); @@ -1840,14 +1843,14 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { } if (TieredCompilation && TieredStopAtLevel >= CompLevel_full_optimization) { // Clobber the first compile and force second tier compilation - nmethod* nm = m->code(); + CompiledMethod* nm = m->code(); if (nm != NULL && !m->is_method_handle_intrinsic()) { // Throw out the code so that the code cache doesn't fill up nm->make_not_entrant(); m->clear_code(); } CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization, - methodHandle(), 0, "CTW", THREAD); + methodHandle(), 0, CompileTask::Reason_CTW, THREAD); if (HAS_PENDING_EXCEPTION) { clear_pending_exception_if_not_oom(CHECK); tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string()); @@ -1859,7 +1862,7 @@ void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) { tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_class_counter, m->name_and_sig_as_C_string()); } - nmethod* nm = m->code(); + CompiledMethod* nm = m->code(); if (nm != NULL && !m->is_method_handle_intrinsic()) { // Throw out the code so that the code cache doesn't fill up nm->make_not_entrant(); diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp index 1168f322486..1688373f2cc 100644 --- a/hotspot/src/share/vm/classfile/classLoader.hpp +++ b/hotspot/src/share/vm/classfile/classLoader.hpp @@ -406,9 +406,9 @@ class ClassLoader: AllStatic { static s2 module_to_classloader(const char* module_name); static void initialize_module_loader_map(JImageFile* jimage); -#endif static s2 classloader_type(Symbol* class_name, ClassPathEntry* e, - int classpath_index, TRAPS); + int classpath_index, TRAPS); +#endif static void trace_class_path(const char* msg, const char* name = NULL); diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp index 0c0eb37196f..3ca97efb7a0 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp @@ -84,7 +84,7 @@ ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Depen // An anonymous class loader data doesn't have anything to keep // it from being unloaded during parsing of the anonymous class. // The null-class-loader should always be kept alive. - _keep_alive(is_anonymous || h_class_loader.is_null()), + _keep_alive((is_anonymous || h_class_loader.is_null()) ? 1 : 0), _metaspace(NULL), _unloading(false), _klasses(NULL), _modules(NULL), _packages(NULL), _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL), @@ -114,6 +114,21 @@ bool ClassLoaderData::claim() { return (int) Atomic::cmpxchg(1, &_claimed, 0) == 0; } +// Anonymous classes have their own ClassLoaderData that is marked to keep alive +// while the class is being parsed, and if the class appears on the module fixup list. +// Due to the uniqueness that no other class shares the anonymous class' name or +// ClassLoaderData, no other non-GC thread has knowledge of the anonymous class while +// it is being defined, therefore _keep_alive is not volatile or atomic. +void ClassLoaderData::inc_keep_alive() { + assert(_keep_alive >= 0, "Invalid keep alive count"); + _keep_alive++; +} + +void ClassLoaderData::dec_keep_alive() { + assert(_keep_alive > 0, "Invalid keep alive count"); + _keep_alive--; +} + void ClassLoaderData::oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim) { if (must_claim && !claim()) { return; @@ -318,7 +333,7 @@ void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) { if (publicize && k->class_loader_data() != NULL) { ResourceMark rm; - log_trace(classloaderdata)("Adding k: " PTR_FORMAT " %s to CLD: " + log_trace(class, loader, data)("Adding k: " PTR_FORMAT " %s to CLD: " PTR_FORMAT " loader: " PTR_FORMAT " %s", p2i(k), k->external_name(), @@ -356,9 +371,9 @@ void ClassLoaderData::unload() { // Tell serviceability tools these classes are unloading classes_do(InstanceKlass::notify_unload_class); - if (log_is_enabled(Debug, classloaderdata)) { + if (log_is_enabled(Debug, class, loader, data)) { ResourceMark rm; - outputStream* log = Log(classloaderdata)::debug_stream(); + outputStream* log = Log(class, loader, data)::debug_stream(); log->print(": unload loader data " INTPTR_FORMAT, p2i(this)); log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()), loader_name()); @@ -491,12 +506,12 @@ Metaspace* ClassLoaderData::metaspace_non_null() { set_metaspace(new Metaspace(_metaspace_lock, Metaspace::BootMetaspaceType)); } else if (is_anonymous()) { if (class_loader() != NULL) { - log_trace(classloaderdata)("is_anonymous: %s", class_loader()->klass()->internal_name()); + log_trace(class, loader, data)("is_anonymous: %s", class_loader()->klass()->internal_name()); } set_metaspace(new Metaspace(_metaspace_lock, Metaspace::AnonymousMetaspaceType)); } else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) { if (class_loader() != NULL) { - log_trace(classloaderdata)("is_reflection: %s", class_loader()->klass()->internal_name()); + log_trace(class, loader, data)("is_reflection: %s", class_loader()->klass()->internal_name()); } set_metaspace(new Metaspace(_metaspace_lock, Metaspace::ReflectionMetaspaceType)); } else { @@ -687,7 +702,7 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRA cld->set_next(next); ClassLoaderData* exchanged = (ClassLoaderData*)Atomic::cmpxchg_ptr(cld, list_head, next); if (exchanged == next) { - if (log_is_enabled(Debug, classloaderdata)) { + if (log_is_enabled(Debug, class, loader, data)) { PauseNoSafepointVerifier pnsv(&no_safepoints); // Need safe points for JavaCalls::call_virtual log_creation(loader, cld, CHECK_NULL); } @@ -715,7 +730,7 @@ void ClassLoaderDataGraph::log_creation(Handle loader, ClassLoaderData* cld, TRA } ResourceMark rm; - outputStream* log = Log(classloaderdata)::debug_stream(); + outputStream* log = Log(class, loader, data)::debug_stream(); log->print("create class loader data " INTPTR_FORMAT, p2i(cld)); log->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()), cld->loader_name()); @@ -856,8 +871,8 @@ GrowableArray* ClassLoaderDataGraph::new_clds() { if (!curr->claimed()) { array->push(curr); - if (log_is_enabled(Debug, classloaderdata)) { - outputStream* log = Log(classloaderdata)::debug_stream(); + if (log_is_enabled(Debug, class, loader, data)) { + outputStream* log = Log(class, loader, data)::debug_stream(); log->print("found new CLD: "); curr->print_value_on(log); log->cr(); diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp index 4b6d24722d3..b1a136a77c1 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp @@ -175,8 +175,11 @@ class ClassLoaderData : public CHeapObj { // classes in the class loader are allocated. Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. bool _unloading; // true if this class loader goes away - bool _keep_alive; // if this CLD is kept alive without a keep_alive_object(). bool _is_anonymous; // if this CLD is for an anonymous class + int _keep_alive; // if this CLD is kept alive without a keep_alive_object(). + // Currently used solely for anonymous classes. + // _keep_alive does not need to be volatile or + // atomic since there is one unique CLD per anonymous class. volatile int _claimed; // true if claimed, for example during GC traces. // To avoid applying oop closure more than once. // Has to be an int because we cas it. @@ -224,7 +227,7 @@ class ClassLoaderData : public CHeapObj { bool claim(); void unload(); - bool keep_alive() const { return _keep_alive; } + bool keep_alive() const { return _keep_alive > 0; } void classes_do(void f(Klass*)); void loaded_classes_do(KlassClosure* klass_closure); void classes_do(void f(InstanceKlass*)); @@ -286,8 +289,8 @@ class ClassLoaderData : public CHeapObj { return _unloading; } - // Used to make sure that this CLD is not unloaded. - void set_keep_alive(bool value) { _keep_alive = value; } + void inc_keep_alive(); + void dec_keep_alive(); inline unsigned int identity_hash() const; diff --git a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp index 2427838890f..3da00ad8bb7 100644 --- a/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderData.inline.hpp @@ -45,7 +45,7 @@ inline ClassLoaderData* ClassLoaderData::class_loader_data(oop loader) { inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader, TRAPS) { - assert(loader() != NULL,"Must be a class loader"); + guarantee(loader() != NULL && loader()->is_oop(), "Loader must be oop"); // Gets the class loader data out of the java/lang/ClassLoader object, if non-null // it's already in the loader_data, so no need to add ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data(loader()); diff --git a/hotspot/src/share/vm/classfile/classLoaderExt.hpp b/hotspot/src/share/vm/classfile/classLoaderExt.hpp index 7fa11b2f614..24426d10552 100644 --- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp +++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp @@ -49,12 +49,14 @@ public: return false; } - instanceKlassHandle record_result(const s2 classpath_index, - const jshort classloader_type, - const ClassPathEntry* e, + instanceKlassHandle record_result(Symbol* class_name, + ClassPathEntry* e, + const s2 classpath_index, instanceKlassHandle result, TRAPS) { if (ClassLoader::add_package(_file_name, classpath_index, THREAD)) { if (DumpSharedSpaces) { + s2 classloader_type = ClassLoader::classloader_type( + class_name, e, classpath_index, CHECK_(result)); result->set_shared_classpath_index(classpath_index); result->set_class_loader_type(classloader_type); } diff --git a/hotspot/src/share/vm/classfile/compactHashtable.cpp b/hotspot/src/share/vm/classfile/compactHashtable.cpp index a2c507d3078..c64a166fa1c 100644 --- a/hotspot/src/share/vm/classfile/compactHashtable.cpp +++ b/hotspot/src/share/vm/classfile/compactHashtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/compactHashtable.inline.hpp" #include "classfile/javaClasses.hpp" +#include "memory/metadataFactory.hpp" #include "memory/metaspaceShared.hpp" #include "prims/jvm.h" #include "utilities/numberSeq.hpp" @@ -34,270 +35,259 @@ // // The compact hash table writer implementations // -CompactHashtableWriter::CompactHashtableWriter(int table_type, - int num_entries, +CompactHashtableWriter::CompactHashtableWriter(int num_buckets, CompactHashtableStats* stats) { assert(DumpSharedSpaces, "dump-time only"); - _type = table_type; - _num_entries = num_entries; - _num_buckets = number_of_buckets(_num_entries); - _buckets = NEW_C_HEAP_ARRAY(Entry*, _num_buckets, mtSymbol); - memset(_buckets, 0, sizeof(Entry*) * _num_buckets); + _num_buckets = num_buckets; + _num_entries = 0; + _buckets = NEW_C_HEAP_ARRAY(GrowableArray*, _num_buckets, mtSymbol); + for (int i=0; i<_num_buckets; i++) { + _buckets[i] = new (ResourceObj::C_HEAP, mtSymbol) GrowableArray(0, true, mtSymbol); + } - /* bucket sizes table */ - _bucket_sizes = NEW_C_HEAP_ARRAY(juint, _num_buckets, mtSymbol); - memset(_bucket_sizes, 0, sizeof(juint) * _num_buckets); - - stats->hashentry_count = _num_entries; - // Compact buckets' entries will have only the 4-byte offset, but - // we don't know how many there will be at this point. So use a - // conservative estimate here. The size is adjusted later when we - // write out the buckets. - stats->hashentry_bytes = _num_entries * 8; - stats->bucket_count = _num_buckets; - stats->bucket_bytes = (_num_buckets + 1) * (sizeof(juint)); + stats->bucket_count = _num_buckets; + stats->bucket_bytes = (_num_buckets + 1) * (sizeof(u4)); _stats = stats; - - // See compactHashtable.hpp for table layout - _required_bytes = sizeof(juint) * 2; // _base_address, written as 2 juints - _required_bytes+= sizeof(juint) + // num_entries - sizeof(juint) + // num_buckets - stats->hashentry_bytes + - stats->bucket_bytes; + _compact_buckets = NULL; + _compact_entries = NULL; + _num_empty_buckets = 0; + _num_value_only_buckets = 0; + _num_other_buckets = 0; } CompactHashtableWriter::~CompactHashtableWriter() { for (int index = 0; index < _num_buckets; index++) { - Entry* next = NULL; - for (Entry* tent = _buckets[index]; tent; tent = next) { - next = tent->next(); - delete tent; - } + GrowableArray* bucket = _buckets[index]; + delete bucket; } - FREE_C_HEAP_ARRAY(juint, _bucket_sizes); - FREE_C_HEAP_ARRAY(Entry*, _buckets); -} - -// Calculate the number of buckets in the temporary hash table -int CompactHashtableWriter::number_of_buckets(int num_entries) { - const int buksize = (int)SharedSymbolTableBucketSize; - int num_buckets = (num_entries + buksize - 1) / buksize; - num_buckets = (num_buckets + 1) & (~0x01); - - return num_buckets; + FREE_C_HEAP_ARRAY(GrowableArray*, _buckets); } // Add a symbol entry to the temporary hash table -void CompactHashtableWriter::add(unsigned int hash, Entry* entry) { +void CompactHashtableWriter::add(unsigned int hash, u4 value) { int index = hash % _num_buckets; - entry->set_next(_buckets[index]); - _buckets[index] = entry; - _bucket_sizes[index] ++; + _buckets[index]->append_if_missing(Entry(hash, value)); + _num_entries++; } -// Write the compact table's bucket infos -juint* CompactHashtableWriter::dump_table(juint* p, juint** first_bucket, - NumberSeq* summary) { - int index; - juint* compact_table = p; - // Compute the start of the buckets, include the compact_bucket_infos table - // and the table end offset. - juint offset = _num_buckets + 1; - *first_bucket = compact_table + offset; +void CompactHashtableWriter::allocate_table() { + int entries_space = 0; + for (int index = 0; index < _num_buckets; index++) { + GrowableArray* bucket = _buckets[index]; + int bucket_size = bucket->length(); + if (bucket_size == 1) { + entries_space++; + } else { + entries_space += 2 * bucket_size; + } + } - for (index = 0; index < _num_buckets; index++) { - int bucket_size = _bucket_sizes[index]; + if (entries_space & ~BUCKET_OFFSET_MASK) { + vm_exit_during_initialization("CompactHashtableWriter::allocate_table: Overflow! " + "Too many entries."); + } + + Thread* THREAD = VMThread::vm_thread(); + ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data(); + _compact_buckets = MetadataFactory::new_array(loader_data, _num_buckets + 1, THREAD); + _compact_entries = MetadataFactory::new_array(loader_data, entries_space, THREAD); + + _stats->hashentry_count = _num_entries; + _stats->hashentry_bytes = entries_space * sizeof(u4); +} + +// Write the compact table's buckets +void CompactHashtableWriter::dump_table(NumberSeq* summary) { + u4 offset = 0; + for (int index = 0; index < _num_buckets; index++) { + GrowableArray* bucket = _buckets[index]; + int bucket_size = bucket->length(); if (bucket_size == 1) { // bucket with one entry is compacted and only has the symbol offset - compact_table[index] = BUCKET_INFO(offset, COMPACT_BUCKET_TYPE); - offset += bucket_size; // each entry contains symbol offset only + _compact_buckets->at_put(index, BUCKET_INFO(offset, VALUE_ONLY_BUCKET_TYPE)); + + Entry ent = bucket->at(0); + _compact_entries->at_put(offset++, ent.value()); + _num_value_only_buckets++; } else { // regular bucket, each entry is a symbol (hash, offset) pair - compact_table[index] = BUCKET_INFO(offset, REGULAR_BUCKET_TYPE); - offset += bucket_size * 2; // each hash entry is 2 juints - } - if (offset & ~BUCKET_OFFSET_MASK) { - vm_exit_during_initialization("CompactHashtableWriter::dump_table: Overflow! " - "Too many symbols."); + _compact_buckets->at_put(index, BUCKET_INFO(offset, REGULAR_BUCKET_TYPE)); + + for (int i=0; iat(i); + _compact_entries->at_put(offset++, u4(ent.hash())); // write entry hash + _compact_entries->at_put(offset++, ent.value()); + } + if (bucket_size == 0) { + _num_empty_buckets++; + } else { + _num_other_buckets++; + } } summary->add(bucket_size); } - // Mark the end of the table - compact_table[_num_buckets] = BUCKET_INFO(offset, TABLEEND_BUCKET_TYPE); - return compact_table; + // Mark the end of the buckets + _compact_buckets->at_put(_num_buckets, BUCKET_INFO(offset, TABLEEND_BUCKET_TYPE)); + assert(offset == (u4)_compact_entries->length(), "sanity"); } -// Write the compact table's entries -juint* CompactHashtableWriter::dump_buckets(juint* compact_table, juint* p, - NumberSeq* summary) { - uintx base_address = 0; - uintx max_delta = 0; - int num_compact_buckets = 0; - if (_type == CompactHashtable::_symbol_table) { - base_address = uintx(MetaspaceShared::shared_rs()->base()); - max_delta = uintx(MetaspaceShared::shared_rs()->size()); - assert(max_delta <= MAX_SHARED_DELTA, "range check"); - } else { - assert((_type == CompactHashtable::_string_table), "unknown table"); - assert(UseCompressedOops, "UseCompressedOops is required"); - } - - assert(p != NULL, "sanity"); - for (int index = 0; index < _num_buckets; index++) { - juint count = 0; - int bucket_size = _bucket_sizes[index]; - int bucket_type = BUCKET_TYPE(compact_table[index]); - - if (bucket_size == 1) { - assert(bucket_type == COMPACT_BUCKET_TYPE, "Bad bucket type"); - num_compact_buckets ++; - } - for (Entry* tent = _buckets[index]; tent; - tent = tent->next()) { - if (bucket_type == REGULAR_BUCKET_TYPE) { - *p++ = juint(tent->hash()); // write entry hash - } - if (_type == CompactHashtable::_symbol_table) { - uintx deltax = uintx(tent->value()) - base_address; - assert(deltax < max_delta, "range check"); - juint delta = juint(deltax); - *p++ = delta; // write entry offset - } else { - *p++ = oopDesc::encode_heap_oop(tent->string()); - } - count ++; - } - assert(count == _bucket_sizes[index], "sanity"); - } - - // Adjust the hashentry_bytes in CompactHashtableStats. Each compact - // bucket saves 4-byte. - _stats->hashentry_bytes -= num_compact_buckets * 4; - - return p; -} // Write the compact table -void CompactHashtableWriter::dump(char** top, char* end) { +void CompactHashtableWriter::dump(SimpleCompactHashtable *cht, const char* table_name) { NumberSeq summary; - char* old_top = *top; - juint* p = (juint*)(*top); + allocate_table(); + dump_table(&summary); - uintx base_address = uintx(MetaspaceShared::shared_rs()->base()); - - // Now write the following at the beginning of the table: - // base_address (uintx) - // num_entries (juint) - // num_buckets (juint) - *p++ = high(base_address); - *p++ = low (base_address); // base address - *p++ = _num_entries; // number of entries in the table - *p++ = _num_buckets; // number of buckets in the table - - juint* first_bucket = NULL; - juint* compact_table = dump_table(p, &first_bucket, &summary); - juint* bucket_end = dump_buckets(compact_table, first_bucket, &summary); - - assert(bucket_end <= (juint*)end, "cannot write past end"); - *top = (char*)bucket_end; + int table_bytes = _stats->bucket_bytes + _stats->hashentry_bytes; + address base_address = address(MetaspaceShared::shared_rs()->base()); + cht->init(base_address, _num_entries, _num_buckets, + _compact_buckets->data(), _compact_entries->data()); if (PrintSharedSpaces) { double avg_cost = 0.0; if (_num_entries > 0) { - avg_cost = double(_required_bytes)/double(_num_entries); + avg_cost = double(table_bytes)/double(_num_entries); } tty->print_cr("Shared %s table stats -------- base: " PTR_FORMAT, - table_name(), (intptr_t)base_address); + table_name, (intptr_t)base_address); tty->print_cr("Number of entries : %9d", _num_entries); - tty->print_cr("Total bytes used : %9d", (int)((*top) - old_top)); + tty->print_cr("Total bytes used : %9d", table_bytes); tty->print_cr("Average bytes per entry : %9.3f", avg_cost); tty->print_cr("Average bucket size : %9.3f", summary.avg()); tty->print_cr("Variance of bucket size : %9.3f", summary.variance()); tty->print_cr("Std. dev. of bucket size: %9.3f", summary.sd()); - tty->print_cr("Maximum bucket size : %9d", (int)summary.maximum()); + tty->print_cr("Empty buckets : %9d", _num_empty_buckets); + tty->print_cr("Value_Only buckets : %9d", _num_value_only_buckets); + tty->print_cr("Other buckets : %9d", _num_other_buckets); } } -const char* CompactHashtableWriter::table_name() { - switch (_type) { - case CompactHashtable::_symbol_table: return "symbol"; - case CompactHashtable::_string_table: return "string"; - default: - ; - } - return "unknown"; +///////////////////////////////////////////////////////////// +// +// Customization for dumping Symbol and String tables + +void CompactSymbolTableWriter::add(unsigned int hash, Symbol *symbol) { + address base_address = address(MetaspaceShared::shared_rs()->base()); + uintx max_delta = uintx(MetaspaceShared::shared_rs()->size()); + assert(max_delta <= MAX_SHARED_DELTA, "range check"); + + uintx deltax = address(symbol) - base_address; + assert(deltax < max_delta, "range check"); + u4 delta = u4(deltax); + + CompactHashtableWriter::add(hash, delta); +} + +void CompactStringTableWriter::add(unsigned int hash, oop string) { + CompactHashtableWriter::add(hash, oopDesc::encode_heap_oop(string)); +} + +void CompactSymbolTableWriter::dump(CompactHashtable *cht) { + CompactHashtableWriter::dump(cht, "symbol"); +} + +void CompactStringTableWriter::dump(CompactHashtable *cht) { + CompactHashtableWriter::dump(cht, "string"); } ///////////////////////////////////////////////////////////// // // The CompactHashtable implementation // -template const char* CompactHashtable::init( - CompactHashtableType type, const char* buffer) { - assert(!DumpSharedSpaces, "run-time only"); - _type = type; - juint*p = (juint*)buffer; - juint upper = *p++; - juint lower = *p++; - _base_address = uintx(jlong_from(upper, lower)); - _entry_count = *p++; - _bucket_count = *p++; - _buckets = p; - _table_end_offset = BUCKET_OFFSET(p[_bucket_count]); // located at the end of the bucket_info table - juint *end = _buckets + _table_end_offset; - return (const char*)end; +void SimpleCompactHashtable::serialize(SerializeClosure* soc) { + soc->do_ptr((void**)&_base_address); + soc->do_u4(&_entry_count); + soc->do_u4(&_bucket_count); + soc->do_ptr((void**)&_buckets); + soc->do_ptr((void**)&_entries); } +bool SimpleCompactHashtable::exists(u4 value) { + assert(!DumpSharedSpaces, "run-time only"); + + if (_entry_count == 0) { + return false; + } + + unsigned int hash = (unsigned int)value; + int index = hash % _bucket_count; + u4 bucket_info = _buckets[index]; + u4 bucket_offset = BUCKET_OFFSET(bucket_info); + int bucket_type = BUCKET_TYPE(bucket_info); + u4* entry = _entries + bucket_offset; + + if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { + return (entry[0] == value); + } else { + u4*entry_max = _entries + BUCKET_OFFSET(_buckets[index + 1]); + while (entry +inline void SimpleCompactHashtable::iterate(const I& iterator) { + assert(!DumpSharedSpaces, "run-time only"); + for (u4 i = 0; i < _bucket_count; i++) { + u4 bucket_info = _buckets[i]; + u4 bucket_offset = BUCKET_OFFSET(bucket_info); + int bucket_type = BUCKET_TYPE(bucket_info); + u4* entry = _entries + bucket_offset; + + if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { + iterator.do_value(_base_address, entry[0]); + } else { + u4*entry_max = _entries + BUCKET_OFFSET(_buckets[i + 1]); + while (entry < entry_max) { + iterator.do_value(_base_address, entry[0]); + entry += 2; + } + } + } +} + +template void CompactHashtable::serialize(SerializeClosure* soc) { + SimpleCompactHashtable::serialize(soc); + soc->do_u4(&_type); +} + +class CompactHashtable_SymbolIterator { + SymbolClosure* const _closure; +public: + CompactHashtable_SymbolIterator(SymbolClosure *cl) : _closure(cl) {} + inline void do_value(address base_address, u4 offset) const { + Symbol* sym = (Symbol*)((void*)(base_address + offset)); + _closure->do_symbol(&sym); + } +}; + template void CompactHashtable::symbols_do(SymbolClosure *cl) { - assert(!DumpSharedSpaces, "run-time only"); - for (juint i = 0; i < _bucket_count; i ++) { - juint bucket_info = _buckets[i]; - juint bucket_offset = BUCKET_OFFSET(bucket_info); - int bucket_type = BUCKET_TYPE(bucket_info); - juint* bucket = _buckets + bucket_offset; - juint* bucket_end = _buckets; - - Symbol* sym; - if (bucket_type == COMPACT_BUCKET_TYPE) { - sym = (Symbol*)((void*)(_base_address + bucket[0])); - cl->do_symbol(&sym); - } else { - bucket_end += BUCKET_OFFSET(_buckets[i + 1]); - while (bucket < bucket_end) { - sym = (Symbol*)((void*)(_base_address + bucket[1])); - cl->do_symbol(&sym); - bucket += 2; - } - } - } + CompactHashtable_SymbolIterator iterator(cl); + iterate(iterator); } -template void CompactHashtable::oops_do(OopClosure* f) { - assert(!DumpSharedSpaces, "run-time only"); - assert(_type == _string_table || _bucket_count == 0, "sanity"); - for (juint i = 0; i < _bucket_count; i ++) { - juint bucket_info = _buckets[i]; - juint bucket_offset = BUCKET_OFFSET(bucket_info); - int bucket_type = BUCKET_TYPE(bucket_info); - juint* bucket = _buckets + bucket_offset; - juint* bucket_end = _buckets; - - narrowOop o; - if (bucket_type == COMPACT_BUCKET_TYPE) { - o = (narrowOop)bucket[0]; - f->do_oop(&o); - } else { - bucket_end += BUCKET_OFFSET(_buckets[i + 1]); - while (bucket < bucket_end) { - o = (narrowOop)bucket[1]; - f->do_oop(&o); - bucket += 2; - } - } +class CompactHashtable_OopIterator { + OopClosure* const _closure; +public: + CompactHashtable_OopIterator(OopClosure *cl) : _closure(cl) {} + inline void do_value(address base_address, u4 offset) const { + narrowOop o = (narrowOop)offset; + _closure->do_oop(&o); } +}; + +template void CompactHashtable::oops_do(OopClosure* cl) { + assert(_type == _string_table || _bucket_count == 0, "sanity"); + CompactHashtable_OopIterator iterator(cl); + iterate(iterator); } // Explicitly instantiate these types @@ -360,7 +350,7 @@ bool HashtableTextDump::skip_newline() { } else { corrupted(_p, "Unexpected character"); } - _line_no ++; + _line_no++; return true; } @@ -390,7 +380,7 @@ void HashtableTextDump::check_version(const char* ver) { } void HashtableTextDump::scan_prefix_type() { - _p ++; + _p++; if (strncmp(_p, "SECTION: String", 15) == 0) { _p += 15; _prefix_type = StringPrefix; diff --git a/hotspot/src/share/vm/classfile/compactHashtable.hpp b/hotspot/src/share/vm/classfile/compactHashtable.hpp index ea602229d94..3dd870c1158 100644 --- a/hotspot/src/share/vm/classfile/compactHashtable.hpp +++ b/hotspot/src/share/vm/classfile/compactHashtable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -31,7 +31,10 @@ #include "services/diagnosticCommand.hpp" #include "utilities/hashtable.hpp" +template class CompactHashtable; class NumberSeq; +class SimpleCompactHashtable; +class SerializeClosure; // Stats for symbol tables in the CDS archive class CompactHashtableStats VALUE_OBJ_CLASS_SPEC { @@ -70,66 +73,74 @@ public: // class CompactHashtableWriter: public StackObj { public: - class Entry: public CHeapObj { - Entry* _next; + class Entry VALUE_OBJ_CLASS_SPEC { unsigned int _hash; - void* _literal; + u4 _value; public: - Entry(unsigned int hash, Symbol *symbol) : _next(NULL), _hash(hash), _literal(symbol) {} - Entry(unsigned int hash, oop string) : _next(NULL), _hash(hash), _literal(string) {} + Entry() {} + Entry(unsigned int hash, u4 val) : _hash(hash), _value(val) {} - void *value() { - return _literal; - } - Symbol *symbol() { - return (Symbol*)_literal; - } - oop string() { - return (oop)_literal; + u4 value() { + return _value; } unsigned int hash() { return _hash; } - Entry *next() {return _next;} - void set_next(Entry *p) {_next = p;} + + bool operator==(const CompactHashtableWriter::Entry& other) { + return (_value == other._value && _hash == other._hash); + } }; // class CompactHashtableWriter::Entry private: - static int number_of_buckets(int num_entries); - - int _type; int _num_entries; int _num_buckets; - juint* _bucket_sizes; - Entry** _buckets; - int _required_bytes; + int _num_empty_buckets; + int _num_value_only_buckets; + int _num_other_buckets; + GrowableArray** _buckets; CompactHashtableStats* _stats; + Array* _compact_buckets; + Array* _compact_entries; public: // This is called at dump-time only - CompactHashtableWriter(int table_type, int num_entries, CompactHashtableStats* stats); + CompactHashtableWriter(int num_buckets, CompactHashtableStats* stats); ~CompactHashtableWriter(); - int get_required_bytes() { - return _required_bytes; + void add(unsigned int hash, u4 value); + void add(u4 value) { + add((unsigned int)value, value); } - inline void add(unsigned int hash, Symbol* symbol); - inline void add(unsigned int hash, oop string); - private: - void add(unsigned int hash, Entry* entry); - juint* dump_table(juint* p, juint** first_bucket, NumberSeq* summary); - juint* dump_buckets(juint* table, juint* p, NumberSeq* summary); + void allocate_table(); + void dump_table(NumberSeq* summary); public: - void dump(char** top, char* end); + void dump(SimpleCompactHashtable *cht, const char* table_name); const char* table_name(); }; +class CompactSymbolTableWriter: public CompactHashtableWriter { +public: + CompactSymbolTableWriter(int num_buckets, CompactHashtableStats* stats) : + CompactHashtableWriter(num_buckets, stats) {} + void add(unsigned int hash, Symbol *symbol); + void dump(CompactHashtable *cht); +}; + +class CompactStringTableWriter: public CompactHashtableWriter { +public: + CompactStringTableWriter(int num_entries, CompactHashtableStats* stats) : + CompactHashtableWriter(num_entries, stats) {} + void add(unsigned int hash, oop string); + void dump(CompactHashtable *cht); +}; + #define REGULAR_BUCKET_TYPE 0 -#define COMPACT_BUCKET_TYPE 1 +#define VALUE_ONLY_BUCKET_TYPE 1 #define TABLEEND_BUCKET_TYPE 3 #define BUCKET_OFFSET_MASK 0x3FFFFFFF #define BUCKET_OFFSET(info) ((info) & BUCKET_OFFSET_MASK) @@ -146,90 +157,106 @@ public: // and tend to have large number of entries, we try to minimize the footprint // cost per entry. // -// Layout of compact table in the shared archive: +// The CompactHashtable is split into two arrays // -// uintx base_address; -// juint num_entries; -// juint num_buckets; -// juint bucket_infos[num_buckets+1]; // bit[31,30]: type; bit[29-0]: offset -// juint table[] +// u4 buckets[num_buckets+1]; // bit[31,30]: type; bit[29-0]: offset +// u4 entries[] // -// ----------------------------------- -// | base_address | num_entries | -// |---------------------------------| -// | num_buckets | bucket_info0 | -// |---------------------------------| -// | bucket_info1 | bucket_info2 | -// | bucket_info3 ... | -// | .... | table_end_info | -// |---------------------------------| -// | entry0 | -// | entry1 | -// | entry2 | -// | | -// | ... | -// ----------------------------------- -// -// The size of the bucket_info table is 'num_buckets + 1'. Each entry of the -// bucket_info table is a 32-bit encoding of the bucket type and bucket offset, +// The size of buckets[] is 'num_buckets + 1'. Each entry of +// buckets[] is a 32-bit encoding of the bucket type and bucket offset, // with the type in the left-most 2-bit and offset in the remaining 30-bit. -// The last entry is a special type. It contains the offset of the last -// bucket end. We use that information when traversing the compact table. +// The last entry is a special type. It contains the end of the last +// bucket. // -// There are two types of buckets, regular buckets and compact buckets. The -// compact buckets have '01' in their highest 2-bit, and regular buckets have +// There are two types of buckets, regular buckets and value_only buckets. The +// value_only buckets have '01' in their highest 2-bit, and regular buckets have // '00' in their highest 2-bit. // -// For normal buckets, each entry is 8 bytes in the table[]: -// juint hash; /* symbol/string hash */ +// For normal buckets, each entry is 8 bytes in the entries[]: +// u4 hash; /* symbol/string hash */ // union { -// juint offset; /* Symbol* sym = (Symbol*)(base_address + offset) */ +// u4 offset; /* Symbol* sym = (Symbol*)(base_address + offset) */ // narrowOop str; /* String narrowOop encoding */ // } // // -// For compact buckets, each entry has only the 4-byte 'offset' in the table[]. +// For value_only buckets, each entry has only the 4-byte 'offset' in the entries[]. +// +// Example -- note that the second bucket is a VALUE_ONLY_BUCKET_TYPE so the hash code +// is skipped. +// buckets[0, 4, 5, ....] +// | | | +// | | +---+ +// | | | +// | +----+ | +// v v v +// entries[H,O,H,O,O,H,O,H,O.....] // // See CompactHashtable::lookup() for how the table is searched at runtime. // See CompactHashtableWriter::dump() for how the table is written at CDS // dump time. // -template class CompactHashtable VALUE_OBJ_CLASS_SPEC { +class SimpleCompactHashtable VALUE_OBJ_CLASS_SPEC { +protected: + address _base_address; + u4 _bucket_count; + u4 _entry_count; + u4* _buckets; + u4* _entries; + +public: + SimpleCompactHashtable() { + _entry_count = 0; + _bucket_count = 0; + _buckets = 0; + _entries = 0; + } + + void reset() { + _bucket_count = 0; + _entry_count = 0; + _buckets = 0; + _entries = 0; + } + + void init(address base_address, u4 entry_count, u4 bucket_count, u4* buckets, u4* entries) { + _base_address = base_address; + _bucket_count = bucket_count; + _entry_count = entry_count; + _buckets = buckets; + _entries = entries; + } + + template inline void iterate(const I& iterator); + + bool exists(u4 value); + + // For reading from/writing to the CDS archive + void serialize(SerializeClosure* soc); +}; + +template class CompactHashtable : public SimpleCompactHashtable { friend class VMStructs; - public: +public: enum CompactHashtableType { _symbol_table = 0, _string_table = 1 }; private: - CompactHashtableType _type; - uintx _base_address; - juint _entry_count; - juint _bucket_count; - juint _table_end_offset; - juint* _buckets; + u4 _type; - inline Symbol* lookup_entry(CompactHashtable* const t, - juint* addr, const char* name, int len); + inline Symbol* decode_entry(CompactHashtable* const t, + u4 offset, const char* name, int len); - inline oop lookup_entry(CompactHashtable* const t, - juint* addr, const char* name, int len); + inline oop decode_entry(CompactHashtable* const t, + u4 offset, const char* name, int len); public: - CompactHashtable() { - _entry_count = 0; - _bucket_count = 0; - _table_end_offset = 0; - _buckets = 0; - } - const char* init(CompactHashtableType type, const char *buffer); + CompactHashtable() : SimpleCompactHashtable() {} - void reset() { - _entry_count = 0; - _bucket_count = 0; - _table_end_offset = 0; - _buckets = 0; + void set_type(CompactHashtableType type) { + _type = (u4)type; } // Lookup an entry from the compact table @@ -240,6 +267,9 @@ public: // iterate over strings void oops_do(OopClosure* f); + + // For reading from/writing to the CDS archive + void serialize(SerializeClosure* soc); }; //////////////////////////////////////////////////////////////////////// @@ -293,7 +323,7 @@ public: u8 n = 0; while (p < end) { - char c = *p ++; + char c = *p++; if ('0' <= c && c <= '9') { n = n * 10 + (c - '0'); if (n > (u8)INT_MAX) { diff --git a/hotspot/src/share/vm/classfile/compactHashtable.inline.hpp b/hotspot/src/share/vm/classfile/compactHashtable.inline.hpp index 96aeb551ccd..24dbba11f33 100644 --- a/hotspot/src/share/vm/classfile/compactHashtable.inline.hpp +++ b/hotspot/src/share/vm/classfile/compactHashtable.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -30,9 +30,9 @@ #include "oops/oop.inline.hpp" template -inline Symbol* CompactHashtable::lookup_entry(CompactHashtable* const t, - juint* addr, const char* name, int len) { - Symbol* sym = (Symbol*)((void*)(_base_address + *addr)); +inline Symbol* CompactHashtable::decode_entry(CompactHashtable* const t, + u4 offset, const char* name, int len) { + Symbol* sym = (Symbol*)(_base_address + offset); if (sym->equals(name, len)) { assert(sym->refcount() == -1, "must be shared"); return sym; @@ -42,9 +42,9 @@ inline Symbol* CompactHashtable::lookup_entry(CompactHashtable -inline oop CompactHashtable::lookup_entry(CompactHashtable* const t, - juint* addr, const char* name, int len) { - narrowOop obj = (narrowOop)(*addr); +inline oop CompactHashtable::decode_entry(CompactHashtable* const t, + u4 offset, const char* name, int len) { + narrowOop obj = (narrowOop)offset; oop string = oopDesc::decode_heap_oop(obj); if (java_lang_String::equals(string, (jchar*)name, len)) { return string; @@ -56,17 +56,14 @@ inline oop CompactHashtable::lookup_entry(CompactHashtable* con template inline T CompactHashtable::lookup(const N* name, unsigned int hash, int len) { if (_entry_count > 0) { - assert(!DumpSharedSpaces, "run-time only"); int index = hash % _bucket_count; - juint bucket_info = _buckets[index]; - juint bucket_offset = BUCKET_OFFSET(bucket_info); - int bucket_type = BUCKET_TYPE(bucket_info); - juint* bucket = _buckets + bucket_offset; - juint* bucket_end = _buckets; + u4 bucket_info = _buckets[index]; + u4 bucket_offset = BUCKET_OFFSET(bucket_info); + int bucket_type = BUCKET_TYPE(bucket_info); + u4* entry = _entries + bucket_offset; - if (bucket_type == COMPACT_BUCKET_TYPE) { - // the compact bucket has one entry with entry offset only - T res = lookup_entry(this, &bucket[0], name, len); + if (bucket_type == VALUE_ONLY_BUCKET_TYPE) { + T res = decode_entry(this, entry[0], name, len); if (res != NULL) { return res; } @@ -74,29 +71,20 @@ inline T CompactHashtable::lookup(const N* name, unsigned int hash, int len // This is a regular bucket, which has more than one // entries. Each entry is a pair of entry (hash, offset). // Seek until the end of the bucket. - bucket_end += BUCKET_OFFSET(_buckets[index + 1]); - while (bucket < bucket_end) { - unsigned int h = (unsigned int)(bucket[0]); + u4* entry_max = _entries + BUCKET_OFFSET(_buckets[index + 1]); + while (entry < entry_max) { + unsigned int h = (unsigned int)(entry[0]); if (h == hash) { - T res = lookup_entry(this, &bucket[1], name, len); + T res = decode_entry(this, entry[1], name, len); if (res != NULL) { return res; } } - bucket += 2; + entry += 2; } } } return NULL; } -inline void CompactHashtableWriter::add(unsigned int hash, Symbol* symbol) { - add(hash, new Entry(hash, symbol)); -} - -inline void CompactHashtableWriter::add(unsigned int hash, oop string) { - add(hash, new Entry(hash, string)); -} - - #endif // SHARE_VM_CLASSFILE_COMPACTHASHTABLE_INLINE_HPP diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp index ee351942cb5..c7ea145c3d2 100644 --- a/hotspot/src/share/vm/classfile/dictionary.cpp +++ b/hotspot/src/share/vm/classfile/dictionary.cpp @@ -31,7 +31,6 @@ #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/orderAccess.inline.hpp" #include "utilities/hashtable.inline.hpp" diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp index 6b3e45c85d8..b99c918996d 100644 --- a/hotspot/src/share/vm/classfile/javaClasses.cpp +++ b/hotspot/src/share/vm/classfile/javaClasses.cpp @@ -45,7 +45,6 @@ #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "oops/typeArrayOop.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/fieldDescriptor.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" @@ -131,7 +130,7 @@ compute_offset(int &dest_offset, tty->print_cr(" name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int()); } #endif //PRODUCT - vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:classload=info to see the origin of the problem class"); + vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:class+load=info to see the origin of the problem class"); } dest_offset = fd.offset(); } @@ -852,6 +851,7 @@ void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader, new (ResourceObj::C_HEAP, mtClass) GrowableArray(500, true); set_fixup_module_field_list(list); } + k->class_loader_data()->inc_keep_alive(); fixup_module_field_list()->push(k()); } } else { @@ -1798,7 +1798,7 @@ static void print_stack_element_to_stream(outputStream* st, Handle mirror, int m // Neither sourcename nor linenumber sprintf(buf + (int)strlen(buf), "Unknown Source)"); } - nmethod* nm = method->code(); + CompiledMethod* nm = method->code(); if (WizardMode && nm != NULL) { sprintf(buf + (int)strlen(buf), "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm); } @@ -1920,7 +1920,7 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHand int total_count = 0; RegisterMap map(thread, false); int decode_offset = 0; - nmethod* nm = NULL; + CompiledMethod* nm = NULL; bool skip_fillInStackTrace_check = false; bool skip_throwableInit_check = false; bool skip_hidden = !ShowHiddenFrames; @@ -1948,10 +1948,10 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHand // HMMM QQQ might be nice to have frame return nm as NULL if cb is non-NULL // but non nmethod fr = fr.sender(&map); - if (cb == NULL || !cb->is_nmethod()) { + if (cb == NULL || !cb->is_compiled()) { continue; } - nm = (nmethod*)cb; + nm = cb->as_compiled_method(); if (nm->method()->is_native()) { method = nm->method(); bci = 0; @@ -4058,7 +4058,7 @@ int InjectedField::compute_offset() { tty->print_cr(" name: %s, sig: %s, flags: %08x", fs.name()->as_C_string(), fs.signature()->as_C_string(), fs.access_flags().as_int()); } #endif //PRODUCT - vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:classload=info to see the origin of the problem class"); + vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:class+load=info to see the origin of the problem class"); return -1; } diff --git a/hotspot/src/share/vm/classfile/loaderConstraints.cpp b/hotspot/src/share/vm/classfile/loaderConstraints.cpp index 3e5b033acb4..5dfe4e33ae4 100644 --- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp +++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp @@ -111,9 +111,9 @@ void LoaderConstraintTable::purge_loader_constraints() { if (klass != NULL && klass->class_loader_data()->is_unloading()) { probe->set_klass(NULL); - if (log_is_enabled(Info, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("purging class object from constraint for name %s," " loader list:", probe->name()->as_C_string()); @@ -127,9 +127,9 @@ void LoaderConstraintTable::purge_loader_constraints() { int n = 0; while (n < probe->num_loaders()) { if (probe->loader_data(n)->is_unloading()) { - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("purging loader %s from constraint for name %s", probe->loader_data(n)->loader_name(), probe->name()->as_C_string() @@ -142,9 +142,9 @@ void LoaderConstraintTable::purge_loader_constraints() { probe->set_loader_data(n, probe->loader_data(num)); probe->set_loader_data(num, NULL); - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("new loader list:"); for (int i = 0; i < probe->num_loaders(); i++) { out->print_cr(" [%d]: %s", i, @@ -159,9 +159,9 @@ void LoaderConstraintTable::purge_loader_constraints() { } // Check whether entry should be purged if (probe->num_loaders() < 2) { - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("purging complete constraint for name %s", probe->name()->as_C_string()); } @@ -231,9 +231,9 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name, p->set_klass(klass); p->set_next(bucket(index)); set_entry(index, p); - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("adding new constraint for name: %s, loader[0]: %s," " loader[1]: %s", class_name->as_C_string(), @@ -245,9 +245,9 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name, /* constraint already imposed */ if ((*pp1)->klass() == NULL) { (*pp1)->set_klass(klass); - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("setting class object in existing constraint for" " name: %s and loader %s", class_name->as_C_string(), @@ -267,9 +267,9 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name, } } - if (failure_code != 0 && log_is_enabled(Info, classload, constraints)) { + if (failure_code != 0 && log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); const char* reason = ""; switch(failure_code) { case 1: reason = "the class objects presented by loader[0] and loader[1]" @@ -300,9 +300,9 @@ bool LoaderConstraintTable::check_or_update(instanceKlassHandle k, Symbol* name) { LoaderConstraintEntry* p = *(find_loader_constraint(name, loader)); if (p && p->klass() != NULL && p->klass() != k()) { - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("constraint check failed for name %s, loader %s: " "the presented class object differs from that stored", name->as_C_string(), @@ -312,9 +312,9 @@ bool LoaderConstraintTable::check_or_update(instanceKlassHandle k, } else { if (p && p->klass() == NULL) { p->set_klass(k()); - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("updating constraint for name %s, loader %s, " "by setting class object", name->as_C_string(), @@ -362,9 +362,9 @@ void LoaderConstraintTable::extend_loader_constraint(LoaderConstraintEntry* p, int num = p->num_loaders(); p->set_loader(num, loader()); p->set_num_loaders(num + 1); - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("extending constraint for name %s by adding loader[%d]: %s %s", p->name()->as_C_string(), num, @@ -402,9 +402,9 @@ void LoaderConstraintTable::merge_loader_constraints( p1->set_num_loaders(num + 1); } - if (log_is_enabled(Info, classload, constraints)) { + if (log_is_enabled(Info, class, loader, constraints)) { ResourceMark rm; - outputStream* out = Log(classload, constraints)::info_stream(); + outputStream* out = Log(class, loader, constraints)::info_stream(); out->print_cr("merged constraints for name %s, new loader list:", p1->name()->as_C_string() ); diff --git a/hotspot/src/share/vm/classfile/metadataOnStackMark.cpp b/hotspot/src/share/vm/classfile/metadataOnStackMark.cpp index 6df2d434ccf..3a62c789702 100644 --- a/hotspot/src/share/vm/classfile/metadataOnStackMark.cpp +++ b/hotspot/src/share/vm/classfile/metadataOnStackMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -56,7 +56,7 @@ MetadataOnStackMark::MetadataOnStackMark(bool redefinition_walk) { if (redefinition_walk) { Threads::metadata_do(Metadata::mark_on_stack); - CodeCache::alive_nmethods_do(nmethod::mark_on_stack); + CodeCache::metadata_do(Metadata::mark_on_stack); CompileBroker::mark_on_stack(); JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack); ThreadService::metadata_do(Metadata::mark_on_stack); diff --git a/hotspot/src/share/vm/classfile/moduleEntry.cpp b/hotspot/src/share/vm/classfile/moduleEntry.cpp index 3386dc43c1e..f26b95ab690 100644 --- a/hotspot/src/share/vm/classfile/moduleEntry.cpp +++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp @@ -354,6 +354,7 @@ void ModuleEntryTable::patch_javabase_entries(Handle module_handle) { Thread* THREAD = Thread::current(); KlassHandle kh(THREAD, k); java_lang_Class::fixup_module_field(kh, module_handle); + k->class_loader_data()->dec_keep_alive(); } delete java_lang_Class::fixup_module_field_list(); diff --git a/hotspot/src/share/vm/classfile/modules.cpp b/hotspot/src/share/vm/classfile/modules.cpp index 10319b1c499..7c510bc9315 100644 --- a/hotspot/src/share/vm/classfile/modules.cpp +++ b/hotspot/src/share/vm/classfile/modules.cpp @@ -158,7 +158,7 @@ static void add_to_exploded_build_list(char *module_name, TRAPS) { HandleMark hm; Handle loader_lock = Handle(THREAD, SystemDictionary::system_loader_lock()); ObjectLocker ol(loader_lock, THREAD); - log_info(classload)("opened: %s", path); + log_info(class, load)("opened: %s", path); ClassLoader::add_to_list(path); } } @@ -240,6 +240,11 @@ static void define_javabase_module(jobject module, jstring version, { MutexLocker m1(Module_lock, THREAD); + if (ModuleEntryTable::javabase_defined()) { + THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), + "Module java.base is already defined"); + } + // Verify that all java.base packages created during bootstrapping are in // pkg_list. If any are not in pkg_list, than a non-java.base class was // loaded erroneously pre java.base module definition. diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp index 302bb45284f..36cf234c2d1 100644 --- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp +++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp @@ -34,7 +34,7 @@ #include "utilities/ostream.hpp" void SharedPathsMiscInfo::add_path(const char* path, int type) { - log_info(classpath)("type=%s ", type_name(type)); + log_info(class, path)("type=%s ", type_name(type)); ClassLoader::trace_class_path("add misc shared path ", path); write(path, strlen(path) + 1); write_jint(jint(type)); @@ -75,7 +75,7 @@ bool SharedPathsMiscInfo::fail(const char* msg, const char* name) { void SharedPathsMiscInfo::print_path(int type, const char* path) { ResourceMark rm; - outputStream* out = Log(classpath)::info_stream(); + outputStream* out = Log(class, path)::info_stream(); switch (type) { case BOOT: out->print("Expecting BOOT path=%s", path); @@ -109,7 +109,7 @@ bool SharedPathsMiscInfo::check() { if (!read_jint(&type)) { return fail("Corrupted archive file header"); } - log_info(classpath)("type=%s ", type_name(type)); + log_info(class, path)("type=%s ", type_name(type)); print_path(type, path); if (!check(type, path)) { if (!PrintSharedArchiveAndExit) { diff --git a/hotspot/src/share/vm/classfile/stringTable.cpp b/hotspot/src/share/vm/classfile/stringTable.cpp index 11aa5548cf5..5031a9c0d70 100644 --- a/hotspot/src/share/vm/classfile/stringTable.cpp +++ b/hotspot/src/share/vm/classfile/stringTable.cpp @@ -662,7 +662,7 @@ int StringtableDCmd::num_arguments() { // Sharing bool StringTable::copy_shared_string(GrowableArray *string_space, - CompactHashtableWriter* ch_table) { + CompactStringTableWriter* writer) { #if INCLUDE_CDS && INCLUDE_ALL_GCS && defined(_LP64) && !defined(_WINDOWS) assert(UseG1GC, "Only support G1 GC"); assert(UseCompressedOops && UseCompressedClassPointers, @@ -713,7 +713,7 @@ bool StringTable::copy_shared_string(GrowableArray *string_space, } // add to the compact table - ch_table->add(hash, new_s); + writer->add(hash, new_s); } } @@ -723,40 +723,45 @@ bool StringTable::copy_shared_string(GrowableArray *string_space, return true; } -bool StringTable::copy_compact_table(char** top, char *end, GrowableArray *string_space, - size_t* space_size) { +void StringTable::serialize(SerializeClosure* soc, GrowableArray *string_space, + size_t* space_size) { #if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS) - if (!(UseG1GC && UseCompressedOops && UseCompressedClassPointers)) { - if (PrintSharedSpaces) { - tty->print_cr("Shared strings are excluded from the archive as UseG1GC, " - "UseCompressedOops and UseCompressedClassPointers are required."); + _shared_table.reset(); + if (soc->writing()) { + if (!(UseG1GC && UseCompressedOops && UseCompressedClassPointers)) { + if (PrintSharedSpaces) { + tty->print_cr( + "Shared strings are excluded from the archive as UseG1GC, " + "UseCompressedOops and UseCompressedClassPointers are required." + "Current settings: UseG1GC=%s, UseCompressedOops=%s, UseCompressedClassPointers=%s.", + BOOL_TO_STR(UseG1GC), BOOL_TO_STR(UseCompressedOops), + BOOL_TO_STR(UseCompressedClassPointers)); + } + } else { + int num_buckets = the_table()->number_of_entries() / + SharedSymbolTableBucketSize; + CompactStringTableWriter writer(num_buckets, + &MetaspaceShared::stats()->string); + + // Copy the interned strings into the "string space" within the java heap + if (copy_shared_string(string_space, &writer)) { + for (int i = 0; i < string_space->length(); i++) { + *space_size += string_space->at(i).byte_size(); + } + writer.dump(&_shared_table); + } } - return true; } - CompactHashtableWriter ch_table(CompactHashtable::_string_table, - the_table()->number_of_entries(), - &MetaspaceShared::stats()->string); + _shared_table.set_type(CompactHashtable::_string_table); + _shared_table.serialize(soc); - // Copy the interned strings into the "string space" within the java heap - if (!copy_shared_string(string_space, &ch_table)) { - return false; + if (soc->writing()) { + _shared_table.reset(); // Sanity. Make sure we don't use the shared table at dump time + } else if (_ignore_shared_strings) { + _shared_table.reset(); } - - for (int i = 0; i < string_space->length(); i++) { - *space_size += string_space->at(i).byte_size(); - } - - // Now dump the compact table - if (*top + ch_table.get_required_bytes() > end) { - // not enough space left - return false; - } - ch_table.dump(top, end); - *top = (char*)align_ptr_up(*top, sizeof(void*)); - #endif - return true; } void StringTable::shared_oops_do(OopClosure* f) { @@ -765,25 +770,3 @@ void StringTable::shared_oops_do(OopClosure* f) { #endif } -const char* StringTable::init_shared_table(FileMapInfo *mapinfo, char *buffer) { -#if INCLUDE_CDS && defined(_LP64) && !defined(_WINDOWS) - if (mapinfo->space_capacity(MetaspaceShared::first_string) == 0) { - // no shared string data - return buffer; - } - - // initialize the shared table - juint *p = (juint*)buffer; - const char* end = _shared_table.init( - CompactHashtable::_string_table, (char*)p); - const char* aligned_end = (const char*)align_ptr_up(end, sizeof(void*)); - - if (_ignore_shared_strings) { - _shared_table.reset(); - } - - return aligned_end; -#endif - - return buffer; -} diff --git a/hotspot/src/share/vm/classfile/stringTable.hpp b/hotspot/src/share/vm/classfile/stringTable.hpp index 0840ba28180..397cbbd6f9e 100644 --- a/hotspot/src/share/vm/classfile/stringTable.hpp +++ b/hotspot/src/share/vm/classfile/stringTable.hpp @@ -29,8 +29,9 @@ #include "utilities/hashtable.hpp" template class CompactHashtable; -class CompactHashtableWriter; +class CompactStringTableWriter; class FileMapInfo; +class SerializeClosure; class StringTable : public RehashableHashtable { friend class VMStructs; @@ -155,10 +156,9 @@ public: static bool shared_string_ignored() { return _ignore_shared_strings; } static void shared_oops_do(OopClosure* f); static bool copy_shared_string(GrowableArray *string_space, - CompactHashtableWriter* ch_table); - static bool copy_compact_table(char** top, char* end, GrowableArray *string_space, - size_t* space_size); - static const char* init_shared_table(FileMapInfo *mapinfo, char* buffer); + CompactStringTableWriter* ch_table); + static void serialize(SerializeClosure* soc, GrowableArray *string_space, + size_t* space_size); static void reverse() { the_table()->Hashtable::reverse(); } diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp index 56d1dfb8f8a..ffbef4c2455 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.cpp +++ b/hotspot/src/share/vm/classfile/symbolTable.cpp @@ -537,37 +537,42 @@ void SymbolTable::dump(outputStream* st, bool verbose) { } } -bool SymbolTable::copy_compact_table(char** top, char*end) { +void SymbolTable::serialize(SerializeClosure* soc) { #if INCLUDE_CDS - CompactHashtableWriter ch_table(CompactHashtable::_symbol_table, - the_table()->number_of_entries(), - &MetaspaceShared::stats()->symbol); - if (*top + ch_table.get_required_bytes() > end) { - // not enough space left - return false; - } - - for (int i = 0; i < the_table()->table_size(); ++i) { - HashtableEntry* p = the_table()->bucket(i); - for ( ; p != NULL; p = p->next()) { - Symbol* s = (Symbol*)(p->literal()); + _shared_table.reset(); + if (soc->writing()) { + int num_buckets = the_table()->number_of_entries() / + SharedSymbolTableBucketSize; + CompactSymbolTableWriter writer(num_buckets, + &MetaspaceShared::stats()->symbol); + for (int i = 0; i < the_table()->table_size(); ++i) { + HashtableEntry* p = the_table()->bucket(i); + for ( ; p != NULL; p = p->next()) { + Symbol* s = (Symbol*)(p->literal()); unsigned int fixed_hash = hash_shared_symbol((char*)s->bytes(), s->utf8_length()); - assert(fixed_hash == p->hash(), "must not rehash during dumping"); - ch_table.add(fixed_hash, s); + assert(fixed_hash == p->hash(), "must not rehash during dumping"); + writer.add(fixed_hash, s); + } } + + writer.dump(&_shared_table); } - ch_table.dump(top, end); + _shared_table.set_type(CompactHashtable::_symbol_table); + _shared_table.serialize(soc); - *top = (char*)align_ptr_up(*top, sizeof(void*)); + if (soc->writing()) { + // Verify table is correct + Symbol* sym = vmSymbols::java_lang_Object(); + const char* name = (const char*)sym->bytes(); + int len = sym->utf8_length(); + unsigned int hash = hash_symbol(name, len); + assert(sym == _shared_table.lookup(name, hash, len), "sanity"); + + // Sanity. Make sure we don't use the shared table at dump time + _shared_table.reset(); + } #endif - return true; -} - -const char* SymbolTable::init_shared_table(const char* buffer) { - const char* end = _shared_table.init( - CompactHashtable::_symbol_table, buffer); - return (const char*)align_ptr_up(end, sizeof(void*)); } //--------------------------------------------------------------------------- diff --git a/hotspot/src/share/vm/classfile/symbolTable.hpp b/hotspot/src/share/vm/classfile/symbolTable.hpp index f29698ad575..5a7db595335 100644 --- a/hotspot/src/share/vm/classfile/symbolTable.hpp +++ b/hotspot/src/share/vm/classfile/symbolTable.hpp @@ -41,6 +41,7 @@ class BoolObjectClosure; class outputStream; +class SerializeClosure; // TempNewSymbol acts as a handle class in a handle/body idiom and is // responsible for proper resource management of the body (which is a Symbol*). @@ -251,8 +252,7 @@ public: static void read(const char* filename, TRAPS); // Sharing - static bool copy_compact_table(char** top, char* end); - static const char* init_shared_table(const char* buffer); + static void serialize(SerializeClosure* soc); // Rehash the symbol table if it gets out of balance static void rehash_table(); diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 34c43946e52..ede6d4f1df9 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -1388,12 +1388,12 @@ instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik, ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh)); } - if (log_is_enabled(Info, classload)) { + if (log_is_enabled(Info, class, load)) { ik()->print_loading_log(LogLevel::Info, loader_data, NULL, NULL); } // No 'else' here as logging levels are not mutually exclusive - if (log_is_enabled(Debug, classload)) { + if (log_is_enabled(Debug, class, load)) { ik()->print_loading_log(LogLevel::Debug, loader_data, NULL, NULL); } diff --git a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp index 50b5dd80920..51db47c3387 100644 --- a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp @@ -29,6 +29,7 @@ #include "classfile/dictionary.hpp" class ClassFileStream; +class SerializeClosure; class SystemDictionaryShared: public SystemDictionary { public: @@ -77,6 +78,7 @@ public: TRAPS) { return NULL; } + static void serialize(SerializeClosure* soc) {} }; #endif // SHARE_VM_CLASSFILE_SYSTEMDICTIONARYSHARED_HPP diff --git a/hotspot/src/share/vm/classfile/verificationType.cpp b/hotspot/src/share/vm/classfile/verificationType.cpp index 6245fcee68f..be4594f6ac5 100644 --- a/hotspot/src/share/vm/classfile/verificationType.cpp +++ b/hotspot/src/share/vm/classfile/verificationType.cpp @@ -61,7 +61,7 @@ bool VerificationType::is_reference_assignable_from( Klass* obj = SystemDictionary::resolve_or_fail( name(), Handle(THREAD, klass->class_loader()), Handle(THREAD, klass->protection_domain()), true, CHECK_false); - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { Verifier::trace_class_resolution(obj, klass()); } @@ -80,7 +80,7 @@ bool VerificationType::is_reference_assignable_from( Klass* from_class = SystemDictionary::resolve_or_fail( from.name(), Handle(THREAD, klass->class_loader()), Handle(THREAD, klass->protection_domain()), true, CHECK_false); - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { Verifier::trace_class_resolution(from_class, klass()); } return InstanceKlass::cast(from_class)->is_subclass_of(this_class()); diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index 600ca8e911f..58200d11e03 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -107,9 +107,9 @@ void Verifier::trace_class_resolution(Klass* resolve_class, InstanceKlass* verif const char* resolve = resolve_class->external_name(); // print in a single call to reduce interleaving between threads if (source_file != NULL) { - log_debug(classresolve)("%s %s %s (verification)", verify, resolve, source_file); + log_debug(class, resolve)("%s %s %s (verification)", verify, resolve, source_file); } else { - log_debug(classresolve)("%s %s (verification)", verify, resolve); + log_debug(class, resolve)("%s %s (verification)", verify, resolve); } } @@ -169,7 +169,7 @@ bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool shoul bool can_failover = FailOverToOldVerifier && klass->major_version() < NOFAILOVER_MAJOR_VERSION; - log_info(classinit)("Start class verification for: %s", klassName); + log_info(class, init)("Start class verification for: %s", klassName); if (klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) { ClassVerifier split_verifier(klass, THREAD); split_verifier.verify_class(THREAD); @@ -178,7 +178,7 @@ bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool shoul (exception_name == vmSymbols::java_lang_VerifyError() || exception_name == vmSymbols::java_lang_ClassFormatError())) { log_info(verification)("Fail over class verification to old verifier for: %s", klassName); - log_info(classinit)("Fail over class verification to old verifier for: %s", klassName); + log_info(class, init)("Fail over class verification to old verifier for: %s", klassName); exception_name = inference_verify( klass, message_buffer, message_buffer_len, THREAD); } @@ -190,8 +190,8 @@ bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool shoul klass, message_buffer, message_buffer_len, THREAD); } - if (log_is_enabled(Info, classinit)){ - log_end_verification(Log(classinit)::info_stream(), klassName, exception_name, THREAD); + if (log_is_enabled(Info, class, init)){ + log_end_verification(Log(class, init)::info_stream(), klassName, exception_name, THREAD); } if (log_is_enabled(Info, verification)){ log_end_verification(Log(verification)::info_stream(), klassName, exception_name, THREAD); @@ -205,7 +205,7 @@ bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool shoul ResourceMark rm(THREAD); instanceKlassHandle kls = SystemDictionary::resolve_or_fail(exception_name, true, CHECK_false); - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { Verifier::trace_class_resolution(kls(), klass()); } @@ -601,7 +601,7 @@ void ClassVerifier::verify_class(TRAPS) { if (was_recursively_verified()){ log_info(verification)("Recursive verification detected for: %s", _klass->external_name()); - log_info(classinit)("Recursive verification detected for: %s", + log_info(class, init)("Recursive verification detected for: %s", _klass->external_name()); } } @@ -1994,7 +1994,7 @@ Klass* ClassVerifier::load_class(Symbol* name, TRAPS) { name, Handle(THREAD, loader), Handle(THREAD, protection_domain), true, THREAD); - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { instanceKlassHandle cur_class = current_class(); Verifier::trace_class_resolution(kls, cur_class()); } diff --git a/hotspot/src/share/vm/classfile/verifier.hpp b/hotspot/src/share/vm/classfile/verifier.hpp index 531ef93f21a..a613c62a3d5 100644 --- a/hotspot/src/share/vm/classfile/verifier.hpp +++ b/hotspot/src/share/vm/classfile/verifier.hpp @@ -61,7 +61,7 @@ class Verifier : AllStatic { // Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2. static bool relax_verify_for(oop class_loader); - // Print output for classresolve + // Print output for class+resolve static void trace_class_resolution(Klass* resolve_class, InstanceKlass* verify_class); private: diff --git a/hotspot/src/share/vm/classfile/vmSymbols.cpp b/hotspot/src/share/vm/classfile/vmSymbols.cpp index 42555054305..95fa81712f1 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.cpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp @@ -353,6 +353,7 @@ bool vmIntrinsics::preserves_state(vmIntrinsics::ID id) { case vmIntrinsics::_updateCRC32: case vmIntrinsics::_updateBytesCRC32: case vmIntrinsics::_updateByteBufferCRC32: + case vmIntrinsics::_vectorizedMismatch: return true; default: return false; @@ -384,6 +385,7 @@ bool vmIntrinsics::can_trap(vmIntrinsics::ID id) { case vmIntrinsics::_updateCRC32: case vmIntrinsics::_updateBytesCRC32: case vmIntrinsics::_updateByteBufferCRC32: + case vmIntrinsics::_vectorizedMismatch: return false; default: return true; @@ -578,20 +580,6 @@ bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) { case vmIntrinsics::_putLongOpaque: case vmIntrinsics::_putFloatOpaque: case vmIntrinsics::_putDoubleOpaque: - case vmIntrinsics::_getByte_raw: - case vmIntrinsics::_getShort_raw: - case vmIntrinsics::_getChar_raw: - case vmIntrinsics::_getInt_raw: - case vmIntrinsics::_getLong_raw: - case vmIntrinsics::_getFloat_raw: - case vmIntrinsics::_getDouble_raw: - case vmIntrinsics::_putByte_raw: - case vmIntrinsics::_putShort_raw: - case vmIntrinsics::_putChar_raw: - case vmIntrinsics::_putInt_raw: - case vmIntrinsics::_putLong_raw: - case vmIntrinsics::_putFloat_raw: - case vmIntrinsics::_putDouble_raw: case vmIntrinsics::_getAndAddInt: case vmIntrinsics::_getAndAddLong: case vmIntrinsics::_getAndSetInt: @@ -632,8 +620,6 @@ bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) { case vmIntrinsics::_putIntUnaligned: case vmIntrinsics::_putLongUnaligned: case vmIntrinsics::_allocateInstance: - case vmIntrinsics::_getAddress_raw: - case vmIntrinsics::_putAddress_raw: if (!InlineUnsafeOps || !UseUnalignedAccesses) return true; break; case vmIntrinsics::_hashCode: @@ -669,6 +655,9 @@ bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) { case vmIntrinsics::_updateDirectByteBufferCRC32C: if (!UseCRC32CIntrinsics) return true; break; + case vmIntrinsics::_vectorizedMismatch: + if (!UseVectorizedMismatchIntrinsic) return true; + break; case vmIntrinsics::_updateBytesAdler32: case vmIntrinsics::_updateByteBufferAdler32: if (!UseAdler32Intrinsics) return true; @@ -734,9 +723,6 @@ bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) { case vmIntrinsics::_montgomerySquare: if (!UseMontgomerySquareIntrinsic) return true; break; - case vmIntrinsics::_vectorizedMismatch: - if (!UseVectorizedMismatchIntrinsic) return true; - break; case vmIntrinsics::_addExactI: case vmIntrinsics::_addExactL: case vmIntrinsics::_decrementExactI: diff --git a/hotspot/src/share/vm/classfile/vmSymbols.hpp b/hotspot/src/share/vm/classfile/vmSymbols.hpp index 7586786e6cf..6f69aaf5495 100644 --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp @@ -117,6 +117,7 @@ template(java_util_Hashtable, "java/util/Hashtable") \ template(java_lang_Compiler, "java/lang/Compiler") \ template(jdk_internal_misc_Signal, "jdk/internal/misc/Signal") \ + template(jdk_internal_util_Preconditions, "jdk/internal/util/Preconditions") \ template(java_lang_AssertionStatusDirectives, "java/lang/AssertionStatusDirectives") \ template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \ template(jdk_internal_vm_PostVMInitHook, "jdk/internal/vm/PostVMInitHook") \ @@ -876,6 +877,10 @@ do_name( newArray_name, "newArray") \ do_signature(newArray_signature, "(Ljava/lang/Class;I)Ljava/lang/Object;") \ \ + do_intrinsic(_onSpinWait, java_lang_Thread, onSpinWait_name, onSpinWait_signature, F_S) \ + do_name( onSpinWait_name, "onSpinWait") \ + do_alias( onSpinWait_signature, void_method_signature) \ + \ do_intrinsic(_copyOf, java_util_Arrays, copyOf_name, copyOf_signature, F_S) \ do_name( copyOf_name, "copyOf") \ do_signature(copyOf_signature, "([Ljava/lang/Object;ILjava/lang/Class;)[Ljava/lang/Object;") \ @@ -930,8 +935,8 @@ do_intrinsic(_equalsL, java_lang_StringLatin1,equals_name, equalsB_signature, F_S) \ do_intrinsic(_equalsU, java_lang_StringUTF16, equals_name, equalsB_signature, F_S) \ \ - do_intrinsic(_Objects_checkIndex, java_util_Objects, checkIndex_name, Objects_checkIndex_signature, F_S) \ - do_signature(Objects_checkIndex_signature, "(IILjava/util/function/BiFunction;)I") \ + do_intrinsic(_Preconditions_checkIndex, jdk_internal_util_Preconditions, checkIndex_name, Preconditions_checkIndex_signature, F_S) \ + do_signature(Preconditions_checkIndex_signature, "(IILjava/util/function/BiFunction;)I") \ \ do_class(java_nio_Buffer, "java/nio/Buffer") \ do_intrinsic(_checkIndex, java_nio_Buffer, checkIndex_name, int_int_signature, F_R) \ @@ -1227,43 +1232,6 @@ do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \ do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \ \ - /* %%% these are redundant except perhaps for getAddress, but Unsafe has native methods for them */ \ - do_signature(getByte_raw_signature, "(J)B") \ - do_signature(putByte_raw_signature, "(JB)V") \ - do_signature(getShort_raw_signature, "(J)S") \ - do_signature(putShort_raw_signature, "(JS)V") \ - do_signature(getChar_raw_signature, "(J)C") \ - do_signature(putChar_raw_signature, "(JC)V") \ - do_signature(putInt_raw_signature, "(JI)V") \ - do_alias(getLong_raw_signature, /*(J)J*/ long_long_signature) \ - do_alias(putLong_raw_signature, /*(JJ)V*/ long_long_void_signature) \ - do_signature(getFloat_raw_signature, "(J)F") \ - do_signature(putFloat_raw_signature, "(JF)V") \ - do_alias(getDouble_raw_signature, /*(J)D*/ long_double_signature) \ - do_signature(putDouble_raw_signature, "(JD)V") \ - do_alias(getAddress_raw_signature, /*(J)J*/ long_long_signature) \ - do_alias(putAddress_raw_signature, /*(JJ)V*/ long_long_void_signature) \ - \ - do_name( getAddress_name, "getAddress") \ - do_name( putAddress_name, "putAddress") \ - \ - do_intrinsic(_getByte_raw, jdk_internal_misc_Unsafe, getByte_name, getByte_raw_signature, F_R) \ - do_intrinsic(_getShort_raw, jdk_internal_misc_Unsafe, getShort_name, getShort_raw_signature, F_R) \ - do_intrinsic(_getChar_raw, jdk_internal_misc_Unsafe, getChar_name, getChar_raw_signature, F_R) \ - do_intrinsic(_getInt_raw, jdk_internal_misc_Unsafe, getInt_name, long_int_signature, F_R) \ - do_intrinsic(_getLong_raw, jdk_internal_misc_Unsafe, getLong_name, getLong_raw_signature, F_R) \ - do_intrinsic(_getFloat_raw, jdk_internal_misc_Unsafe, getFloat_name, getFloat_raw_signature, F_R) \ - do_intrinsic(_getDouble_raw, jdk_internal_misc_Unsafe, getDouble_name, getDouble_raw_signature, F_R) \ - do_intrinsic(_getAddress_raw, jdk_internal_misc_Unsafe, getAddress_name, getAddress_raw_signature, F_R) \ - do_intrinsic(_putByte_raw, jdk_internal_misc_Unsafe, putByte_name, putByte_raw_signature, F_R) \ - do_intrinsic(_putShort_raw, jdk_internal_misc_Unsafe, putShort_name, putShort_raw_signature, F_R) \ - do_intrinsic(_putChar_raw, jdk_internal_misc_Unsafe, putChar_name, putChar_raw_signature, F_R) \ - do_intrinsic(_putInt_raw, jdk_internal_misc_Unsafe, putInt_name, putInt_raw_signature, F_R) \ - do_intrinsic(_putLong_raw, jdk_internal_misc_Unsafe, putLong_name, putLong_raw_signature, F_R) \ - do_intrinsic(_putFloat_raw, jdk_internal_misc_Unsafe, putFloat_name, putFloat_raw_signature, F_R) \ - do_intrinsic(_putDouble_raw, jdk_internal_misc_Unsafe, putDouble_name, putDouble_raw_signature, F_R) \ - do_intrinsic(_putAddress_raw, jdk_internal_misc_Unsafe, putAddress_name, putAddress_raw_signature, F_R) \ - \ do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \ do_signature(compareAndExchangeObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \ do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \ @@ -1287,12 +1255,15 @@ do_name(weakCompareAndSwapObject_name, "weakCompareAndSwapObject") \ do_name(weakCompareAndSwapObjectAcquire_name, "weakCompareAndSwapObjectAcquire") \ do_name(weakCompareAndSwapObjectRelease_name, "weakCompareAndSwapObjectRelease") \ + do_name(weakCompareAndSwapObjectVolatile_name, "weakCompareAndSwapObjectVolatile") \ do_name(weakCompareAndSwapLong_name, "weakCompareAndSwapLong") \ do_name(weakCompareAndSwapLongAcquire_name, "weakCompareAndSwapLongAcquire") \ do_name(weakCompareAndSwapLongRelease_name, "weakCompareAndSwapLongRelease") \ + do_name(weakCompareAndSwapLongVolatile_name, "weakCompareAndSwapLongVolatile") \ do_name(weakCompareAndSwapInt_name, "weakCompareAndSwapInt") \ do_name(weakCompareAndSwapIntAcquire_name, "weakCompareAndSwapIntAcquire") \ do_name(weakCompareAndSwapIntRelease_name, "weakCompareAndSwapIntRelease") \ + do_name(weakCompareAndSwapIntVolatile_name, "weakCompareAndSwapIntVolatile") \ \ do_intrinsic(_compareAndSwapObject, jdk_internal_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_RN) \ do_intrinsic(_compareAndExchangeObjectVolatile, jdk_internal_misc_Unsafe, compareAndExchangeObjectVolatile_name, compareAndExchangeObject_signature, F_RN) \ @@ -1310,12 +1281,15 @@ do_intrinsic(_weakCompareAndSwapObject, jdk_internal_misc_Unsafe, weakCompareAndSwapObject_name, compareAndSwapObject_signature, F_R) \ do_intrinsic(_weakCompareAndSwapObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectAcquire_name, compareAndSwapObject_signature, F_R) \ do_intrinsic(_weakCompareAndSwapObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectRelease_name, compareAndSwapObject_signature, F_R) \ + do_intrinsic(_weakCompareAndSwapObjectVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectVolatile_name, compareAndSwapObject_signature, F_R) \ do_intrinsic(_weakCompareAndSwapLong, jdk_internal_misc_Unsafe, weakCompareAndSwapLong_name, compareAndSwapLong_signature, F_R) \ do_intrinsic(_weakCompareAndSwapLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapLongAcquire_name, compareAndSwapLong_signature, F_R) \ do_intrinsic(_weakCompareAndSwapLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapLongRelease_name, compareAndSwapLong_signature, F_R) \ + do_intrinsic(_weakCompareAndSwapLongVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapLongVolatile_name, compareAndSwapLong_signature, F_R) \ do_intrinsic(_weakCompareAndSwapInt, jdk_internal_misc_Unsafe, weakCompareAndSwapInt_name, compareAndSwapInt_signature, F_R) \ do_intrinsic(_weakCompareAndSwapIntAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapIntAcquire_name, compareAndSwapInt_signature, F_R) \ do_intrinsic(_weakCompareAndSwapIntRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapIntRelease_name, compareAndSwapInt_signature, F_R) \ + do_intrinsic(_weakCompareAndSwapIntVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapIntVolatile_name, compareAndSwapInt_signature, F_R) \ \ do_intrinsic(_getAndAddInt, jdk_internal_misc_Unsafe, getAndAddInt_name, getAndAddInt_signature, F_R) \ do_name( getAndAddInt_name, "getAndAddInt") \ diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp index 38cae60350a..91d231e6a5f 100644 --- a/hotspot/src/share/vm/code/codeBlob.cpp +++ b/hotspot/src/share/vm/code/codeBlob.cpp @@ -65,12 +65,67 @@ unsigned int CodeBlob::allocation_size(CodeBuffer* cb, int header_size) { return size; } +CodeBlob::CodeBlob(const char* name, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments) : + _name(name), + _size(layout.size()), + _header_size(layout.header_size()), + _frame_complete_offset(frame_complete_offset), + _data_offset(layout.data_offset()), + _frame_size(frame_size), + _strings(CodeStrings()), + _oop_maps(oop_maps), + _caller_must_gc_arguments(caller_must_gc_arguments), + _code_begin(layout.code_begin()), + _code_end(layout.code_end()), + _data_end(layout.data_end()), + _relocation_begin(layout.relocation_begin()), + _relocation_end(layout.relocation_end()), + _content_begin(layout.content_begin()) +{ + assert(layout.size() == round_to(layout.size(), oopSize), "unaligned size"); + assert(layout.header_size() == round_to(layout.header_size(), oopSize), "unaligned size"); + assert(layout.relocation_size() == round_to(layout.relocation_size(), oopSize), "unaligned size"); + assert(layout.code_end() == layout.content_end(), "must be the same - see code_end()"); +#ifdef COMPILER1 + // probably wrong for tiered + assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs"); +#endif // COMPILER1 +} + +CodeBlob::CodeBlob(const char* name, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments) : + _name(name), + _size(layout.size()), + _header_size(layout.header_size()), + _frame_complete_offset(frame_complete_offset), + _data_offset(layout.data_offset()), + _frame_size(frame_size), + _strings(CodeStrings()), + _caller_must_gc_arguments(caller_must_gc_arguments), + _code_begin(layout.code_begin()), + _code_end(layout.code_end()), + _data_end(layout.data_end()), + _relocation_begin(layout.relocation_begin()), + _relocation_end(layout.relocation_end()), + _content_begin(layout.content_begin()) +{ + assert(_size == round_to(_size, oopSize), "unaligned size"); + assert(_header_size == round_to(_header_size, oopSize), "unaligned size"); + assert(_data_offset <= _size, "codeBlob is too small"); + assert(layout.code_end() == layout.content_end(), "must be the same - see code_end()"); + + set_oop_maps(oop_maps); +#ifdef COMPILER1 + // probably wrong for tiered + assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs"); +#endif // COMPILER1 +} + // Creates a simple CodeBlob. Sets up the size of the different regions. -CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) { - assert(size == round_to(size, oopSize), "unaligned size"); +RuntimeBlob::RuntimeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size) + : CodeBlob(name, CodeBlobLayout((address) this, size, header_size, locs_size, size), frame_complete, 0, NULL, false /* caller_must_gc_arguments */) +{ assert(locs_size == round_to(locs_size, oopSize), "unaligned size"); - assert(header_size == round_to(header_size, oopSize), "unaligned size"); assert(!UseRelocIndex, "no space allocated for reloc index yet"); // Note: If UseRelocIndex is enabled, there needs to be (at least) one @@ -79,55 +134,31 @@ CodeBlob::CodeBlob(const char* name, int header_size, int size, int frame_comple // mentation is not easily understandable and thus it is not clear // what exactly the format is supposed to be. For now, we just turn // off the use of this table (gri 7/6/2000). - - _name = name; - _size = size; - _frame_complete_offset = frame_complete; - _header_size = header_size; - _relocation_size = locs_size; - _content_offset = align_code_offset(header_size + _relocation_size); - _code_offset = _content_offset; - _data_offset = size; - _frame_size = 0; - set_oop_maps(NULL); - _strings = CodeStrings(); } -// Creates a CodeBlob from a CodeBuffer. Sets up the size of the different regions, +// Creates a RuntimeBlob from a CodeBuffer // and copy code and relocation info. -CodeBlob::CodeBlob( +RuntimeBlob::RuntimeBlob( const char* name, CodeBuffer* cb, int header_size, int size, int frame_complete, int frame_size, - OopMapSet* oop_maps -) { - assert(size == round_to(size, oopSize), "unaligned size"); - assert(header_size == round_to(header_size, oopSize), "unaligned size"); - - _name = name; - _size = size; - _frame_complete_offset = frame_complete; - _header_size = header_size; - _relocation_size = round_to(cb->total_relocation_size(), oopSize); - _content_offset = align_code_offset(header_size + _relocation_size); - _code_offset = _content_offset + cb->total_offset_of(cb->insts()); - _data_offset = _content_offset + round_to(cb->total_content_size(), oopSize); - assert(_data_offset <= size, "codeBlob is too small"); - _strings = CodeStrings(); - + OopMapSet* oop_maps, + bool caller_must_gc_arguments +) : CodeBlob(name, CodeBlobLayout((address) this, size, header_size, cb), cb, frame_complete, frame_size, oop_maps, caller_must_gc_arguments) { cb->copy_code_and_locs_to(this); - set_oop_maps(oop_maps); - _frame_size = frame_size; -#ifdef COMPILER1 - // probably wrong for tiered - assert(_frame_size >= -1, "must use frame size or -1 for runtime stubs"); -#endif // COMPILER1 } +void CodeBlob::flush() { + if (_oop_maps) { + FREE_C_HEAP_ARRAY(unsigned char, _oop_maps); + _oop_maps = NULL; + } + _strings.free(); +} void CodeBlob::set_oop_maps(OopMapSet* p) { // Danger Will Robinson! This method allocates a big @@ -140,7 +171,7 @@ void CodeBlob::set_oop_maps(OopMapSet* p) { } -void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* name2) { +void RuntimeBlob::trace_new_stub(RuntimeBlob* stub, const char* name1, const char* name2) { // Do not hold the CodeCache lock during name formatting. assert(!CodeCache_lock->owned_by_self(), "release CodeCache before registering the stub"); @@ -167,19 +198,9 @@ void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* nam MemoryService::track_code_cache_memory_usage(); } - -void CodeBlob::flush() { - if (_oop_maps) { - FREE_C_HEAP_ARRAY(unsigned char, _oop_maps); - _oop_maps = NULL; - } - _strings.free(); -} - - const ImmutableOopMap* CodeBlob::oop_map_for_return_address(address return_address) { - assert(oop_maps() != NULL, "nope"); - return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin()); + assert(_oop_maps != NULL, "nope"); + return _oop_maps->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin()); } void CodeBlob::print_code() { @@ -193,7 +214,7 @@ void CodeBlob::print_code() { BufferBlob::BufferBlob(const char* name, int size) -: CodeBlob(name, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, /*locs_size:*/ 0) +: RuntimeBlob(name, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, /*locs_size:*/ 0) {} BufferBlob* BufferBlob::create(const char* name, int buffer_size) { @@ -203,7 +224,7 @@ BufferBlob* BufferBlob::create(const char* name, int buffer_size) { unsigned int size = sizeof(BufferBlob); CodeCacheExtensions::size_blob(name, &buffer_size); // align the size to CodeEntryAlignment - size = align_code_offset(size); + size = CodeBlob::align_code_offset(size); size += round_to(buffer_size, oopSize); assert(name != NULL, "must provide a name"); { @@ -218,14 +239,14 @@ BufferBlob* BufferBlob::create(const char* name, int buffer_size) { BufferBlob::BufferBlob(const char* name, int size, CodeBuffer* cb) - : CodeBlob(name, cb, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, 0, NULL) + : RuntimeBlob(name, cb, sizeof(BufferBlob), size, CodeOffsets::frame_never_safe, 0, NULL) {} BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) { ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock BufferBlob* blob = NULL; - unsigned int size = allocation_size(cb, sizeof(BufferBlob)); + unsigned int size = CodeBlob::allocation_size(cb, sizeof(BufferBlob)); assert(name != NULL, "must provide a name"); { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); @@ -246,7 +267,7 @@ void BufferBlob::free(BufferBlob *blob) { blob->flush(); { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - CodeCache::free((CodeBlob*)blob); + CodeCache::free((RuntimeBlob*)blob); } // Track memory usage statistic after releasing CodeCache_lock MemoryService::track_code_cache_memory_usage(); @@ -265,7 +286,7 @@ AdapterBlob* AdapterBlob::create(CodeBuffer* cb) { ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock AdapterBlob* blob = NULL; - unsigned int size = allocation_size(cb, sizeof(AdapterBlob)); + unsigned int size = CodeBlob::allocation_size(cb, sizeof(AdapterBlob)); { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); blob = new (size) AdapterBlob(size, cb); @@ -287,7 +308,7 @@ MethodHandlesAdapterBlob* MethodHandlesAdapterBlob::create(int buffer_size) { unsigned int size = sizeof(MethodHandlesAdapterBlob); CodeCacheExtensions::size_blob("MethodHandles adapters", &buffer_size); // align the size to CodeEntryAlignment - size = align_code_offset(size); + size = CodeBlob::align_code_offset(size); size += round_to(buffer_size, oopSize); { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); @@ -314,12 +335,10 @@ RuntimeStub::RuntimeStub( OopMapSet* oop_maps, bool caller_must_gc_arguments ) -: CodeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps) +: RuntimeBlob(name, cb, sizeof(RuntimeStub), size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments) { - _caller_must_gc_arguments = caller_must_gc_arguments; } - RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name, CodeBuffer* cb, int frame_complete, @@ -332,7 +351,7 @@ RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name, if (!CodeCacheExtensions::skip_code_generation()) { // bypass useless code generation MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - unsigned int size = allocation_size(cb, sizeof(RuntimeStub)); + unsigned int size = CodeBlob::allocation_size(cb, sizeof(RuntimeStub)); stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments); } stub = (RuntimeStub*) CodeCacheExtensions::handle_generated_blob(stub, stub_name); @@ -392,7 +411,7 @@ DeoptimizationBlob* DeoptimizationBlob::create( ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - unsigned int size = allocation_size(cb, sizeof(DeoptimizationBlob)); + unsigned int size = CodeBlob::allocation_size(cb, sizeof(DeoptimizationBlob)); blob = new (size) DeoptimizationBlob(cb, size, oop_maps, @@ -431,7 +450,7 @@ UncommonTrapBlob* UncommonTrapBlob::create( ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - unsigned int size = allocation_size(cb, sizeof(UncommonTrapBlob)); + unsigned int size = CodeBlob::allocation_size(cb, sizeof(UncommonTrapBlob)); blob = new (size) UncommonTrapBlob(cb, size, oop_maps, frame_size); } @@ -467,7 +486,7 @@ ExceptionBlob* ExceptionBlob::create( ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - unsigned int size = allocation_size(cb, sizeof(ExceptionBlob)); + unsigned int size = CodeBlob::allocation_size(cb, sizeof(ExceptionBlob)); blob = new (size) ExceptionBlob(cb, size, oop_maps, frame_size); } @@ -502,7 +521,7 @@ SafepointBlob* SafepointBlob::create( ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - unsigned int size = allocation_size(cb, sizeof(SafepointBlob)); + unsigned int size = CodeBlob::allocation_size(cb, sizeof(SafepointBlob)); blob = new (size) SafepointBlob(cb, size, oop_maps, frame_size); } @@ -515,10 +534,6 @@ SafepointBlob* SafepointBlob::create( //---------------------------------------------------------------------------------------------------- // Verification and printing -void CodeBlob::verify() { - ShouldNotReachHere(); -} - void CodeBlob::print_on(outputStream* st) const { st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", p2i(this)); st->print_cr("Framesize: %d", _frame_size); @@ -528,12 +543,16 @@ void CodeBlob::print_value_on(outputStream* st) const { st->print_cr("[CodeBlob]"); } +void RuntimeBlob::verify() { + ShouldNotReachHere(); +} + void BufferBlob::verify() { // unimplemented } void BufferBlob::print_on(outputStream* st) const { - CodeBlob::print_on(st); + RuntimeBlob::print_on(st); print_value_on(st); } @@ -547,10 +566,10 @@ void RuntimeStub::verify() { void RuntimeStub::print_on(outputStream* st) const { ttyLocker ttyl; - CodeBlob::print_on(st); + RuntimeBlob::print_on(st); st->print("Runtime Stub (" INTPTR_FORMAT "): ", p2i(this)); st->print_cr("%s", name()); - Disassembler::decode((CodeBlob*)this, st); + Disassembler::decode((RuntimeBlob*)this, st); } void RuntimeStub::print_value_on(outputStream* st) const { @@ -563,9 +582,9 @@ void SingletonBlob::verify() { void SingletonBlob::print_on(outputStream* st) const { ttyLocker ttyl; - CodeBlob::print_on(st); + RuntimeBlob::print_on(st); st->print_cr("%s", name()); - Disassembler::decode((CodeBlob*)this, st); + Disassembler::decode((RuntimeBlob*)this, st); } void SingletonBlob::print_value_on(outputStream* st) const { diff --git a/hotspot/src/share/vm/code/codeBlob.hpp b/hotspot/src/share/vm/code/codeBlob.hpp index 4a45f6b96f4..30105e334bf 100644 --- a/hotspot/src/share/vm/code/codeBlob.hpp +++ b/hotspot/src/share/vm/code/codeBlob.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,12 +45,14 @@ struct CodeBlobType { // CodeBlob - superclass for all entries in the CodeCache. // -// Suptypes are: -// nmethod : Compiled Java methods (include method that calls to native code) -// RuntimeStub : Call to VM runtime methods -// DeoptimizationBlob : Used for deoptimizatation -// ExceptionBlob : Used for stack unrolling -// SafepointBlob : Used to handle illegal instruction exceptions +// Subtypes are: +// CompiledMethod : Compiled Java methods (include method that calls to native code) +// nmethod : JIT Compiled Java methods +// RuntimeBlob : Non-compiled method code; generated glue code +// RuntimeStub : Call to VM runtime methods +// DeoptimizationBlob : Used for deoptimization +// ExceptionBlob : Used for stack unrolling +// SafepointBlob : Used to handle illegal instruction exceptions // // // Layout: @@ -59,90 +61,79 @@ struct CodeBlobType { // - content space // - instruction space // - data space -class DeoptimizationBlob; + + +class CodeBlobLayout; class CodeBlob VALUE_OBJ_CLASS_SPEC { - friend class VMStructs; friend class JVMCIVMStructs; friend class CodeCacheDumper; - private: +protected: const char* _name; int _size; // total size of CodeBlob in bytes int _header_size; // size of header (depends on subclass) - int _relocation_size; // size of relocation - int _content_offset; // offset to where content region begins (this includes consts, insts, stubs) - int _code_offset; // offset to where instructions region begins (this includes insts, stubs) int _frame_complete_offset; // instruction offsets in [0.._frame_complete_offset) have // not finished setting up their frame. Beware of pc's in // that range. There is a similar range(s) on returns // which we don't detect. int _data_offset; // offset to where data region begins int _frame_size; // size of stack frame - ImmutableOopMapSet* _oop_maps; // OopMap for this CodeBlob - CodeStrings _strings; - public: + address _code_begin; + address _code_end; + address _content_begin; // address to where content region begins (this includes consts, insts, stubs) + // address _content_end - not required, for all CodeBlobs _code_end == _content_end for now + address _data_end; + address _relocation_begin; + address _relocation_end; + + ImmutableOopMapSet* _oop_maps; // OopMap for this CodeBlob + bool _caller_must_gc_arguments; + CodeStrings _strings; + + CodeBlob(const char* name, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments); + CodeBlob(const char* name, const CodeBlobLayout& layout, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments); +public: // Returns the space needed for CodeBlob static unsigned int allocation_size(CodeBuffer* cb, int header_size); static unsigned int align_code_offset(int offset); - // Creation - // a) simple CodeBlob - // frame_complete is the offset from the beginning of the instructions - // to where the frame setup (from stackwalk viewpoint) is complete. - CodeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size); - - // b) full CodeBlob - CodeBlob( - const char* name, - CodeBuffer* cb, - int header_size, - int size, - int frame_complete, - int frame_size, - OopMapSet* oop_maps - ); - // Deletion - void flush(); + virtual void flush(); // Typing - virtual bool is_buffer_blob() const { return false; } - virtual bool is_nmethod() const { return false; } - virtual bool is_runtime_stub() const { return false; } - virtual bool is_deoptimization_stub() const { return false; } - virtual bool is_uncommon_trap_stub() const { return false; } - virtual bool is_exception_stub() const { return false; } + virtual bool is_buffer_blob() const { return false; } + virtual bool is_nmethod() const { return false; } + virtual bool is_runtime_stub() const { return false; } + virtual bool is_deoptimization_stub() const { return false; } + virtual bool is_uncommon_trap_stub() const { return false; } + virtual bool is_exception_stub() const { return false; } virtual bool is_safepoint_stub() const { return false; } virtual bool is_adapter_blob() const { return false; } virtual bool is_method_handles_adapter_blob() const { return false; } + virtual bool is_compiled() const { return false; } virtual bool is_compiled_by_c2() const { return false; } virtual bool is_compiled_by_c1() const { return false; } virtual bool is_compiled_by_jvmci() const { return false; } // Casting - nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; } + nmethod* as_nmethod_or_null() { return is_nmethod() ? (nmethod*) this : NULL; } + nmethod* as_nmethod() { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; } + CompiledMethod* as_compiled_method_or_null() { return is_compiled() ? (CompiledMethod*) this : NULL; } + CompiledMethod* as_compiled_method() { assert(is_compiled(), "must be compiled"); return (CompiledMethod*) this; } // Boundaries - address header_begin() const { return (address) this; } - address header_end() const { return ((address) this) + _header_size; }; - relocInfo* relocation_begin() const { return (relocInfo*) header_end(); }; - relocInfo* relocation_end() const { return (relocInfo*)(header_end() + _relocation_size); } - address content_begin() const { return (address) header_begin() + _content_offset; } - address content_end() const { return (address) header_begin() + _data_offset; } - address code_begin() const { return (address) header_begin() + _code_offset; } - address code_end() const { return (address) header_begin() + _data_offset; } - address data_begin() const { return (address) header_begin() + _data_offset; } - address data_end() const { return (address) header_begin() + _size; } - - // Offsets - int relocation_offset() const { return _header_size; } - int content_offset() const { return _content_offset; } - int code_offset() const { return _code_offset; } - int data_offset() const { return _data_offset; } + address header_begin() const { return (address) this; } + relocInfo* relocation_begin() const { return (relocInfo*) _relocation_begin; }; + relocInfo* relocation_end() const { return (relocInfo*) _relocation_end; } + address content_begin() const { return _content_begin; } + address content_end() const { return _code_end; } // _code_end == _content_end is true for all types of blobs for now, it is also checked in the constructor + address code_begin() const { return _code_begin; } + address code_end() const { return _code_end; } + address data_end() const { return _data_end; } // Sizes int size() const { return _size; } @@ -150,17 +141,12 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC { int relocation_size() const { return (address) relocation_end() - (address) relocation_begin(); } int content_size() const { return content_end() - content_begin(); } int code_size() const { return code_end() - code_begin(); } - int data_size() const { return data_end() - data_begin(); } // Containment bool blob_contains(address addr) const { return header_begin() <= addr && addr < data_end(); } - bool relocation_contains(relocInfo* addr) const{ return relocation_begin() <= addr && addr < relocation_end(); } - bool content_contains(address addr) const { return content_begin() <= addr && addr < content_end(); } bool code_contains(address addr) const { return code_begin() <= addr && addr < code_end(); } - bool data_contains(address addr) const { return data_begin() <= addr && addr < data_end(); } - bool contains(address addr) const { return content_contains(addr); } - bool is_frame_complete_at(address addr) const { return code_contains(addr) && - addr >= code_begin() + _frame_complete_offset; } + bool contains(address addr) const { return content_begin() <= addr && addr < content_end(); } + bool is_frame_complete_at(address addr) const { return code_contains(addr) && addr >= code_begin() + _frame_complete_offset; } // CodeCache support: really only used by the nmethods, but in order to get // asserts and certain bookkeeping to work in the CodeCache they are defined @@ -178,29 +164,26 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC { ImmutableOopMapSet* oop_maps() const { return _oop_maps; } void set_oop_maps(OopMapSet* p); const ImmutableOopMap* oop_map_for_return_address(address return_address); - virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); } + virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) = 0; // Frame support int frame_size() const { return _frame_size; } void set_frame_size(int size) { _frame_size = size; } // Returns true, if the next frame is responsible for GC'ing oops passed as arguments - virtual bool caller_must_gc_arguments(JavaThread* thread) const { return false; } + bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; } // Naming const char* name() const { return _name; } void set_name(const char* name) { _name = name; } // Debugging - virtual void verify(); - void print() const { print_on(tty); } + virtual void verify() = 0; + virtual void print() const { print_on(tty); }; virtual void print_on(outputStream* st) const; virtual void print_value_on(outputStream* st) const; void print_code(); - // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService. - static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = ""); - // Print the comment associated with offset on stream, if there is one virtual void print_block_comment(outputStream* stream, address block_begin) const { intptr_t offset = (intptr_t)(block_begin - code_begin()); @@ -221,11 +204,142 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC { } }; +class CodeBlobLayout : public StackObj { +private: + int _size; + int _header_size; + int _relocation_size; + int _content_offset; + int _code_offset; + int _data_offset; + address _code_begin; + address _code_end; + address _content_begin; + address _content_end; + address _data_end; + address _relocation_begin; + address _relocation_end; + +public: + CodeBlobLayout(address code_begin, address code_end, address content_begin, address content_end, address data_end, address relocation_begin, address relocation_end) : + _size(0), + _header_size(0), + _relocation_size(0), + _content_offset(0), + _code_offset(0), + _data_offset(0), + _content_begin(content_begin), + _content_end(content_end), + _code_begin(code_begin), + _code_end(code_end), + _data_end(data_end), + _relocation_begin(relocation_begin), + _relocation_end(relocation_end) + { + } + + CodeBlobLayout(const address start, int size, int header_size, int relocation_size, int data_offset) : + _size(size), + _header_size(header_size), + _relocation_size(relocation_size), + _content_offset(CodeBlob::align_code_offset(_header_size + _relocation_size)), + _code_offset(_content_offset), + _data_offset(data_offset) + { + assert(_relocation_size == round_to(_relocation_size, oopSize), "unaligned size"); + + _code_begin = (address) start + _code_offset; + _code_end = (address) start + _data_offset; + + _content_begin = (address) start + _content_offset; + _content_end = (address) start + _data_offset; + + _data_end = (address) start + _size; + _relocation_begin = (address) start + _header_size; + _relocation_end = _relocation_begin + _relocation_size; + } + + CodeBlobLayout(const address start, int size, int header_size, const CodeBuffer* cb) : + _size(size), + _header_size(header_size), + _relocation_size(round_to(cb->total_relocation_size(), oopSize)), + _content_offset(CodeBlob::align_code_offset(_header_size + _relocation_size)), + _code_offset(_content_offset + cb->total_offset_of(cb->insts())), + _data_offset(_content_offset + round_to(cb->total_content_size(), oopSize)) + { + assert(_relocation_size == round_to(_relocation_size, oopSize), "unaligned size"); + + _code_begin = (address) start + _code_offset; + _code_end = (address) start + _data_offset; + + _content_begin = (address) start + _content_offset; + _content_end = (address) start + _data_offset; + + _data_end = (address) start + _size; + _relocation_begin = (address) start + _header_size; + _relocation_end = _relocation_begin + _relocation_size; + } + + int size() const { return _size; } + int header_size() const { return _header_size; } + int relocation_size() const { return _relocation_size; } + int content_offset() const { return _content_offset; } + int code_offset() const { return _code_offset; } + int data_offset() const { return _data_offset; } + address code_begin() const { return _code_begin; } + address code_end() const { return _code_end; } + address data_end() const { return _data_end; } + address relocation_begin() const { return _relocation_begin; } + address relocation_end() const { return _relocation_end; } + address content_begin() const { return _content_begin; } + address content_end() const { return _content_end; } +}; + + +class RuntimeBlob : public CodeBlob { + friend class VMStructs; + public: + + // Creation + // a) simple CodeBlob + // frame_complete is the offset from the beginning of the instructions + // to where the frame setup (from stackwalk viewpoint) is complete. + RuntimeBlob(const char* name, int header_size, int size, int frame_complete, int locs_size); + + // b) full CodeBlob + RuntimeBlob( + const char* name, + CodeBuffer* cb, + int header_size, + int size, + int frame_complete, + int frame_size, + OopMapSet* oop_maps, + bool caller_must_gc_arguments = false + ); + + // GC support + virtual bool is_alive() const = 0; + + void verify(); + + // OopMap for frame + virtual void preserve_callee_argument_oops(frame fr, const RegisterMap* reg_map, OopClosure* f) { ShouldNotReachHere(); } + + // Debugging + void print() const { print_on(tty); } + virtual void print_on(outputStream* st) const { CodeBlob::print_on(st); } + virtual void print_value_on(outputStream* st) const { CodeBlob::print_value_on(st); } + + // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService. + static void trace_new_stub(RuntimeBlob* blob, const char* name1, const char* name2 = ""); +}; + class WhiteBox; //---------------------------------------------------------------------------------------------------- // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc. -class BufferBlob: public CodeBlob { +class BufferBlob: public RuntimeBlob { friend class VMStructs; friend class AdapterBlob; friend class MethodHandlesAdapterBlob; @@ -293,11 +407,9 @@ public: //---------------------------------------------------------------------------------------------------- // RuntimeStub: describes stubs used by compiled code to call a (static) C++ runtime routine -class RuntimeStub: public CodeBlob { +class RuntimeStub: public RuntimeBlob { friend class VMStructs; private: - bool _caller_must_gc_arguments; - // Creation support RuntimeStub( const char* name, @@ -325,10 +437,7 @@ class RuntimeStub: public CodeBlob { // Typing bool is_runtime_stub() const { return true; } - // GC support - bool caller_must_gc_arguments(JavaThread* thread) const { return _caller_must_gc_arguments; } - - address entry_point() { return code_begin(); } + address entry_point() const { return code_begin(); } // GC/Verification support void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } @@ -343,7 +452,7 @@ class RuntimeStub: public CodeBlob { //---------------------------------------------------------------------------------------------------- // Super-class for all blobs that exist in only one instance. Implements default behaviour. -class SingletonBlob: public CodeBlob { +class SingletonBlob: public RuntimeBlob { friend class VMStructs; protected: @@ -358,13 +467,15 @@ class SingletonBlob: public CodeBlob { int frame_size, OopMapSet* oop_maps ) - : CodeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) + : RuntimeBlob(name, cb, header_size, size, CodeOffsets::frame_never_safe, frame_size, oop_maps) {}; address entry_point() { return code_begin(); } bool is_alive() const { return true; } + // GC/Verification support + void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { /* nothing to do */ } void verify(); // does nothing void print_on(outputStream* st) const; void print_value_on(outputStream* st) const; diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp index f2dfcee02b5..36e33c4c5aa 100644 --- a/hotspot/src/share/vm/code/codeCache.cpp +++ b/hotspot/src/share/vm/code/codeCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -336,7 +336,7 @@ bool CodeCache::heap_available(int code_blob_type) { if (!SegmentedCodeCache) { // No segmentation: use a single code heap return (code_blob_type == CodeBlobType::All); - } else if (Arguments::mode() == Arguments::_int) { + } else if (Arguments::is_interpreter_only()) { // Interpreter only: we don't need any method code heaps return (code_blob_type == CodeBlobType::NonNMethod); } else if (TieredCompilation && (TieredStopAtLevel > CompLevel_simple)) { @@ -561,12 +561,12 @@ CodeBlob* CodeCache::find_blob(void* start) { // what you are doing) CodeBlob* CodeCache::find_blob_unsafe(void* start) { // NMT can walk the stack before code cache is created - if (_heaps == NULL || _heaps->is_empty()) return NULL; - - FOR_ALL_HEAPS(heap) { - CodeBlob* result = (CodeBlob*) (*heap)->find_start(start); - if (result != NULL && result->blob_contains((address)start)) { - return result; + if (_heaps != NULL && !_heaps->is_empty()) { + FOR_ALL_HEAPS(heap) { + CodeBlob* result = (CodeBlob*) (*heap)->find_start(start); + if (result != NULL && result->blob_contains((address)start)) { + return result; + } } } return NULL; @@ -595,11 +595,11 @@ void CodeCache::nmethods_do(void f(nmethod* nm)) { } } -void CodeCache::alive_nmethods_do(void f(nmethod* nm)) { +void CodeCache::metadata_do(void f(Metadata* m)) { assert_locked_or_safepoint(CodeCache_lock); NMethodIterator iter; while(iter.next_alive()) { - f(iter.method()); + iter.method()->metadata_do(f); } } @@ -614,7 +614,7 @@ int CodeCache::alignment_offset() { // Mark nmethods for unloading if they contain otherwise unreachable oops. void CodeCache::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) { assert_locked_or_safepoint(CodeCache_lock); - NMethodIterator iter; + CompiledMethodIterator iter; while(iter.next_alive()) { iter.method()->do_unloading(is_alive, unloading_occurred); } @@ -841,17 +841,18 @@ void CodeCache::gc_prologue() { void CodeCache::gc_epilogue() { assert_locked_or_safepoint(CodeCache_lock); NOT_DEBUG(if (needs_cache_clean())) { - NMethodIterator iter; + CompiledMethodIterator iter; while(iter.next_alive()) { - nmethod* nm = iter.method(); - assert(!nm->is_unloaded(), "Tautology"); + CompiledMethod* cm = iter.method(); + assert(!cm->is_unloaded(), "Tautology"); DEBUG_ONLY(if (needs_cache_clean())) { - nm->cleanup_inline_caches(); + cm->cleanup_inline_caches(); } - DEBUG_ONLY(nm->verify()); - DEBUG_ONLY(nm->verify_oop_relocations()); + DEBUG_ONLY(cm->verify()); + DEBUG_ONLY(cm->verify_oop_relocations()); } } + set_needs_cache_clean(false); prune_scavenge_root_nmethods(); @@ -1036,7 +1037,7 @@ int CodeCache::number_of_nmethods_with_dependencies() { void CodeCache::clear_inline_caches() { assert_locked_or_safepoint(CodeCache_lock); - NMethodIterator iter; + CompiledMethodIterator iter; while(iter.next_alive()) { iter.method()->clear_inline_caches(); } @@ -1083,6 +1084,11 @@ int CodeCache::mark_for_deoptimization(KlassDepChange& changes) { return number_of_marked_CodeBlobs; } +CompiledMethod* CodeCache::find_compiled(void* start) { + CodeBlob *cb = find_blob(start); + assert(cb == NULL || cb->is_compiled(), "did not find an compiled_method"); + return (CompiledMethod*)cb; +} #ifdef HOTSWAP int CodeCache::mark_for_evol_deoptimization(instanceKlassHandle dependee) { @@ -1094,16 +1100,16 @@ int CodeCache::mark_for_evol_deoptimization(instanceKlassHandle dependee) { for (int i = 0; i < old_methods->length(); i++) { ResourceMark rm; Method* old_method = old_methods->at(i); - nmethod *nm = old_method->code(); + CompiledMethod* nm = old_method->code(); if (nm != NULL) { nm->mark_for_deoptimization(); number_of_marked_CodeBlobs++; } } - NMethodIterator iter; + CompiledMethodIterator iter; while(iter.next_alive()) { - nmethod* nm = iter.method(); + CompiledMethod* nm = iter.method(); if (nm->is_marked_for_deoptimization()) { // ...Already marked in the previous pass; don't count it again. } else if (nm->is_evol_dependent_on(dependee())) { @@ -1124,9 +1130,9 @@ int CodeCache::mark_for_evol_deoptimization(instanceKlassHandle dependee) { // Deoptimize all methods void CodeCache::mark_all_nmethods_for_deoptimization() { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - NMethodIterator iter; + CompiledMethodIterator iter; while(iter.next_alive()) { - nmethod* nm = iter.method(); + CompiledMethod* nm = iter.method(); if (!nm->method()->is_method_handle_intrinsic()) { nm->mark_for_deoptimization(); } @@ -1137,9 +1143,9 @@ int CodeCache::mark_for_deoptimization(Method* dependee) { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); int number_of_marked_CodeBlobs = 0; - NMethodIterator iter; + CompiledMethodIterator iter; while(iter.next_alive()) { - nmethod* nm = iter.method(); + CompiledMethod* nm = iter.method(); if (nm->is_dependent_on_method(dependee)) { ResourceMark rm; nm->mark_for_deoptimization(); @@ -1152,9 +1158,9 @@ int CodeCache::mark_for_deoptimization(Method* dependee) { void CodeCache::make_marked_nmethods_not_entrant() { assert_locked_or_safepoint(CodeCache_lock); - NMethodIterator iter; + CompiledMethodIterator iter; while(iter.next_alive()) { - nmethod* nm = iter.method(); + CompiledMethod* nm = iter.method(); if (nm->is_marked_for_deoptimization()) { nm->make_not_entrant(); } @@ -1549,3 +1555,36 @@ void CodeCache::log_state(outputStream* st) { blob_count(), nmethod_count(), adapter_count(), unallocated_capacity()); } + +// Initialize iterator to given compiled method +void CompiledMethodIterator::initialize(CompiledMethod* cm) { + _code_blob = (CodeBlob*)cm; + if (!SegmentedCodeCache) { + // Iterate over all CodeBlobs + _code_blob_type = CodeBlobType::All; + } else if (cm != NULL) { + _code_blob_type = CodeCache::get_code_blob_type(cm); + } else { + // Only iterate over method code heaps, starting with non-profiled + _code_blob_type = CodeBlobType::MethodNonProfiled; + } +} + +// Advance iterator to the next compiled method in the current code heap +bool CompiledMethodIterator::next_compiled_method() { + // Get first method CodeBlob + if (_code_blob == NULL) { + _code_blob = CodeCache::first_blob(_code_blob_type); + if (_code_blob == NULL) { + return false; + } else if (_code_blob->is_nmethod()) { + return true; + } + } + // Search for next method CodeBlob + _code_blob = CodeCache::next_blob(_code_blob); + while (_code_blob != NULL && !_code_blob->is_compiled()) { + _code_blob = CodeCache::next_blob(_code_blob); + } + return _code_blob != NULL; +} diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp index 47d2a7f3b1f..ba81a8ab1a9 100644 --- a/hotspot/src/share/vm/code/codeCache.hpp +++ b/hotspot/src/share/vm/code/codeCache.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -78,6 +78,7 @@ class CodeCache : AllStatic { friend class VMStructs; friend class JVMCIVMStructs; friend class NMethodIterator; + friend class CompiledMethodIterator; friend class WhiteBox; friend class CodeCacheLoader; private: @@ -134,12 +135,13 @@ class CodeCache : AllStatic { static void blobs_do(void f(CodeBlob* cb)); // iterates over all CodeBlobs static void blobs_do(CodeBlobClosure* f); // iterates over all CodeBlobs static void nmethods_do(void f(nmethod* nm)); // iterates over all nmethods - static void alive_nmethods_do(void f(nmethod* nm)); // iterates over all alive nmethods + static void metadata_do(void f(Metadata* m)); // iterates over metadata in alive nmethods // Lookup static CodeBlob* find_blob(void* start); // Returns the CodeBlob containing the given address static CodeBlob* find_blob_unsafe(void* start); // Same as find_blob but does not fail if looking up a zombie method static nmethod* find_nmethod(void* start); // Returns the nmethod containing the given address + static CompiledMethod* find_compiled(void* start); static int blob_count(); // Returns the total number of CodeBlobs in the cache static int blob_count(int code_blob_type); @@ -207,8 +209,8 @@ class CodeCache : AllStatic { static bool heap_available(int code_blob_type); // Returns the CodeBlobType for the given nmethod - static int get_code_blob_type(nmethod* nm) { - return get_code_heap(nm)->code_blob_type(); + static int get_code_blob_type(CompiledMethod* cm) { + return get_code_heap(cm)->code_blob_type(); } // Returns the CodeBlobType for the given compilation level @@ -337,4 +339,53 @@ private: } }; +// Iterator to iterate over compiled methods in the CodeCache. +class CompiledMethodIterator : public StackObj { + private: + CodeBlob* _code_blob; // Current CodeBlob + int _code_blob_type; // Refers to current CodeHeap + + public: + CompiledMethodIterator() { + initialize(NULL); // Set to NULL, initialized by first call to next() + } + + CompiledMethodIterator(CompiledMethod* cm) { + initialize(cm); + } + + // Advance iterator to next compiled method + bool next() { + assert_locked_or_safepoint(CodeCache_lock); + assert(_code_blob_type < CodeBlobType::NumTypes, "end reached"); + + bool result = next_compiled_method(); + while (!result && (_code_blob_type < CodeBlobType::MethodProfiled)) { + // Advance to next code heap if segmented code cache + _code_blob_type++; + result = next_compiled_method(); + } + return result; + } + + // Advance iterator to next alive compiled method + bool next_alive() { + bool result = next(); + while(result && !_code_blob->is_alive()) { + result = next(); + } + return result; + } + + bool end() const { return _code_blob == NULL; } + CompiledMethod* method() const { return (_code_blob != NULL) ? _code_blob->as_compiled_method() : NULL; } + +private: + // Initialize iterator to given compiled method + void initialize(CompiledMethod* cm); + + // Advance iterator to the next compiled method in the current code heap + bool next_compiled_method(); +}; + #endif // SHARE_VM_CODE_CODECACHE_HPP diff --git a/hotspot/src/share/vm/code/compiledIC.cpp b/hotspot/src/share/vm/code/compiledIC.cpp index f3808bd041b..748589ef0a3 100644 --- a/hotspot/src/share/vm/code/compiledIC.cpp +++ b/hotspot/src/share/vm/code/compiledIC.cpp @@ -103,7 +103,7 @@ void CompiledIC::internal_set_ic_destination(address entry_point, bool is_icstub MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag); #ifdef ASSERT CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call); - assert(cb != NULL && cb->is_nmethod(), "must be nmethod"); + assert(cb != NULL && cb->is_compiled(), "must be compiled"); #endif _ic_call->set_destination_mt_safe(entry_point); } @@ -182,17 +182,17 @@ void CompiledIC::initialize_from_iter(RelocIterator* iter) { } } -CompiledIC::CompiledIC(nmethod* nm, NativeCall* call) +CompiledIC::CompiledIC(CompiledMethod* cm, NativeCall* call) : _ic_call(call) { address ic_call = _ic_call->instruction_address(); assert(ic_call != NULL, "ic_call address must be set"); - assert(nm != NULL, "must pass nmethod"); - assert(nm->contains(ic_call), "must be in nmethod"); + assert(cm != NULL, "must pass compiled method"); + assert(cm->contains(ic_call), "must be in compiled method"); // Search for the ic_call at the given address. - RelocIterator iter(nm, ic_call, ic_call+1); + RelocIterator iter(cm, ic_call, ic_call+1); bool ret = iter.next(); assert(ret == true, "relocInfo must exist at this address"); assert(iter.addr() == ic_call, "must find ic_call"); @@ -205,10 +205,10 @@ CompiledIC::CompiledIC(RelocIterator* iter) { address ic_call = _ic_call->instruction_address(); - nmethod* nm = iter->code(); + CompiledMethod* nm = iter->code(); assert(ic_call != NULL, "ic_call address must be set"); - assert(nm != NULL, "must pass nmethod"); - assert(nm->contains(ic_call), "must be in nmethod"); + assert(nm != NULL, "must pass compiled method"); + assert(nm->contains(ic_call), "must be in compiled method"); initialize_from_iter(iter); } @@ -278,7 +278,7 @@ bool CompiledIC::is_call_to_compiled() const { // method is guaranteed to still exist, since we only remove methods after all inline caches // has been cleaned up CodeBlob* cb = CodeCache::find_blob_unsafe(ic_destination()); - bool is_monomorphic = (cb != NULL && cb->is_nmethod()); + bool is_monomorphic = (cb != NULL && cb->is_compiled()); // Check that the cached_value is a klass for non-optimized monomorphic calls // This assertion is invalid for compiler1: a call that does not look optimized (no static stub) can be used // for calling directly to vep without using the inline cache (i.e., cached_value == NULL). @@ -423,7 +423,7 @@ void CompiledIC::set_to_monomorphic(CompiledICInfo& info) { bool static_bound = info.is_optimized() || (info.cached_metadata() == NULL); #ifdef ASSERT CodeBlob* cb = CodeCache::find_blob_unsafe(info.entry()); - assert (cb->is_nmethod(), "must be compiled!"); + assert (cb->is_compiled(), "must be compiled!"); #endif /* ASSERT */ // This is MT safe if we come from a clean-cache and go through a @@ -469,9 +469,11 @@ void CompiledIC::compute_monomorphic_entry(const methodHandle& method, bool static_bound, CompiledICInfo& info, TRAPS) { - nmethod* method_code = method->code(); + CompiledMethod* method_code = method->code(); + address entry = NULL; if (method_code != NULL && method_code->is_in_use()) { + assert(method_code->is_compiled(), "must be compiled"); // Call to compiled code if (static_bound || is_optimized) { entry = method_code->verified_entry_point(); @@ -520,6 +522,7 @@ void CompiledIC::compute_monomorphic_entry(const methodHandle& method, info.set_interpreter_entry(method()->get_c2i_entry(), method()); } else { // Use icholder entry + assert(method_code == NULL || method_code->is_compiled(), "must be compiled"); CompiledICHolder* holder = new CompiledICHolder(method(), receiver_klass()); info.set_icholder_entry(method()->get_c2i_unverified_entry(), holder); } @@ -533,6 +536,22 @@ bool CompiledIC::is_icholder_entry(address entry) { return (cb != NULL && cb->is_adapter_blob()); } +// Release the CompiledICHolder* associated with this call site is there is one. +void CompiledIC::cleanup_call_site(virtual_call_Relocation* call_site) { + // This call site might have become stale so inspect it carefully. + NativeCall* call = nativeCall_at(call_site->addr()); + if (is_icholder_entry(call->destination())) { + NativeMovConstReg* value = nativeMovConstReg_at(call_site->cached_value()); + InlineCacheBuffer::queue_for_release((CompiledICHolder*)value->data()); + } +} + +bool CompiledIC::is_icholder_call_site(virtual_call_Relocation* call_site) { + // This call site might have become stale so inspect it carefully. + NativeCall* call = nativeCall_at(call_site->addr()); + return is_icholder_entry(call->destination()); +} + // ---------------------------------------------------------------------------- void CompiledStaticCall::set_to_clean() { @@ -541,7 +560,7 @@ void CompiledStaticCall::set_to_clean() { MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag); #ifdef ASSERT CodeBlob* cb = CodeCache::find_blob_unsafe(this); - assert(cb != NULL && cb->is_nmethod(), "must be nmethod"); + assert(cb != NULL && cb->is_compiled(), "must be compiled"); #endif set_destination_mt_safe(SharedRuntime::get_resolve_static_call_stub()); @@ -563,8 +582,8 @@ bool CompiledStaticCall::is_call_to_compiled() const { bool CompiledStaticCall::is_call_to_interpreted() const { // It is a call to interpreted, if it calls to a stub. Hence, the destination // must be in the stub part of the nmethod that contains the call - nmethod* nm = CodeCache::find_nmethod(instruction_address()); - return nm->stub_contains(destination()); + CompiledMethod* cm = CodeCache::find_compiled(instruction_address()); + return cm->stub_contains(destination()); } void CompiledStaticCall::set(const StaticCallInfo& info) { @@ -596,7 +615,7 @@ void CompiledStaticCall::set(const StaticCallInfo& info) { // Compute settings for a CompiledStaticCall. Since we might have to set // the stub when calling to the interpreter, we need to return arguments. void CompiledStaticCall::compute_entry(const methodHandle& m, StaticCallInfo& info) { - nmethod* m_code = m->code(); + CompiledMethod* m_code = m->code(); info._callee = m; if (m_code != NULL && m_code->is_in_use()) { info._to_interpreter = false; diff --git a/hotspot/src/share/vm/code/compiledIC.hpp b/hotspot/src/share/vm/code/compiledIC.hpp index cd1edbbaa36..e4786c87680 100644 --- a/hotspot/src/share/vm/code/compiledIC.hpp +++ b/hotspot/src/share/vm/code/compiledIC.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -135,7 +135,7 @@ class CompiledIC: public ResourceObj { NativeMovConstReg* _value; // patchable value cell for this IC bool _is_optimized; // an optimized virtual call (i.e., no compiled IC) - CompiledIC(nmethod* nm, NativeCall* ic_call); + CompiledIC(CompiledMethod* cm, NativeCall* ic_call); CompiledIC(RelocIterator* iter); void initialize_from_iter(RelocIterator* iter); @@ -169,8 +169,8 @@ class CompiledIC: public ResourceObj { public: // conversion (machine PC to CompiledIC*) - friend CompiledIC* CompiledIC_before(nmethod* nm, address return_addr); - friend CompiledIC* CompiledIC_at(nmethod* nm, address call_site); + friend CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr); + friend CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site); friend CompiledIC* CompiledIC_at(Relocation* call_site); friend CompiledIC* CompiledIC_at(RelocIterator* reloc_iter); @@ -234,13 +234,13 @@ class CompiledIC: public ResourceObj { void verify() PRODUCT_RETURN; }; -inline CompiledIC* CompiledIC_before(nmethod* nm, address return_addr) { +inline CompiledIC* CompiledIC_before(CompiledMethod* nm, address return_addr) { CompiledIC* c_ic = new CompiledIC(nm, nativeCall_before(return_addr)); c_ic->verify(); return c_ic; } -inline CompiledIC* CompiledIC_at(nmethod* nm, address call_site) { +inline CompiledIC* CompiledIC_at(CompiledMethod* nm, address call_site) { CompiledIC* c_ic = new CompiledIC(nm, nativeCall_at(call_site)); c_ic->verify(); return c_ic; diff --git a/hotspot/src/share/vm/code/compiledMethod.cpp b/hotspot/src/share/vm/code/compiledMethod.cpp new file mode 100644 index 00000000000..5ca594579ce --- /dev/null +++ b/hotspot/src/share/vm/code/compiledMethod.cpp @@ -0,0 +1,707 @@ +/* + * Copyright (c) 2015, 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. + * + */ + +#include "precompiled.hpp" +#include "code/compiledIC.hpp" +#include "code/scopeDesc.hpp" +#include "code/codeCache.hpp" +#include "prims/methodHandles.hpp" +#include "interpreter/bytecode.hpp" +#include "memory/resourceArea.hpp" +#include "runtime/mutexLocker.hpp" + +CompiledMethod::CompiledMethod(Method* method, const char* name, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments) + : CodeBlob(name, layout, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments), + _method(method), _mark_for_deoptimization_status(not_marked) { + init_defaults(); +} + +CompiledMethod::CompiledMethod(Method* method, const char* name, int size, int header_size, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments) + : CodeBlob(name, CodeBlobLayout((address) this, size, header_size, cb), cb, frame_complete_offset, frame_size, oop_maps, caller_must_gc_arguments), + _method(method), _mark_for_deoptimization_status(not_marked) { + init_defaults(); +} + +void CompiledMethod::init_defaults() { + _has_unsafe_access = 0; + _has_method_handle_invokes = 0; + _lazy_critical_native = 0; + _has_wide_vectors = 0; + _unloading_clock = 0; +} + +bool CompiledMethod::is_method_handle_return(address return_pc) { + if (!has_method_handle_invokes()) return false; + PcDesc* pd = pc_desc_at(return_pc); + if (pd == NULL) + return false; + return pd->is_method_handle_invoke(); +} + +// When using JVMCI the address might be off by the size of a call instruction. +bool CompiledMethod::is_deopt_entry(address pc) { + return pc == deopt_handler_begin() +#if INCLUDE_JVMCI + || pc == (deopt_handler_begin() + NativeCall::instruction_size) +#endif + ; +} + +// Returns a string version of the method state. +const char* CompiledMethod::state() const { + int state = get_state(); + switch (state) { + case in_use: + return "in use"; + case not_used: + return "not_used"; + case not_entrant: + return "not_entrant"; + case zombie: + return "zombie"; + case unloaded: + return "unloaded"; + default: + fatal("unexpected method state: %d", state); + return NULL; + } +} + +//----------------------------------------------------------------------------- + +void CompiledMethod::add_exception_cache_entry(ExceptionCache* new_entry) { + assert(ExceptionCache_lock->owned_by_self(),"Must hold the ExceptionCache_lock"); + assert(new_entry != NULL,"Must be non null"); + assert(new_entry->next() == NULL, "Must be null"); + + ExceptionCache *ec = exception_cache(); + if (ec != NULL) { + new_entry->set_next(ec); + } + release_set_exception_cache(new_entry); +} + +void CompiledMethod::clean_exception_cache(BoolObjectClosure* is_alive) { + ExceptionCache* prev = NULL; + ExceptionCache* curr = exception_cache(); + + while (curr != NULL) { + ExceptionCache* next = curr->next(); + + Klass* ex_klass = curr->exception_type(); + if (ex_klass != NULL && !ex_klass->is_loader_alive(is_alive)) { + if (prev == NULL) { + set_exception_cache(next); + } else { + prev->set_next(next); + } + delete curr; + // prev stays the same. + } else { + prev = curr; + } + + curr = next; + } +} + +// public method for accessing the exception cache +// These are the public access methods. +address CompiledMethod::handler_for_exception_and_pc(Handle exception, address pc) { + // We never grab a lock to read the exception cache, so we may + // have false negatives. This is okay, as it can only happen during + // the first few exception lookups for a given nmethod. + ExceptionCache* ec = exception_cache(); + while (ec != NULL) { + address ret_val; + if ((ret_val = ec->match(exception,pc)) != NULL) { + return ret_val; + } + ec = ec->next(); + } + return NULL; +} + +void CompiledMethod::add_handler_for_exception_and_pc(Handle exception, address pc, address handler) { + // There are potential race conditions during exception cache updates, so we + // must own the ExceptionCache_lock before doing ANY modifications. Because + // we don't lock during reads, it is possible to have several threads attempt + // to update the cache with the same data. We need to check for already inserted + // copies of the current data before adding it. + + MutexLocker ml(ExceptionCache_lock); + ExceptionCache* target_entry = exception_cache_entry_for_exception(exception); + + if (target_entry == NULL || !target_entry->add_address_and_handler(pc,handler)) { + target_entry = new ExceptionCache(exception,pc,handler); + add_exception_cache_entry(target_entry); + } +} + +//-------------end of code for ExceptionCache-------------- + +// private method for handling exception cache +// These methods are private, and used to manipulate the exception cache +// directly. +ExceptionCache* CompiledMethod::exception_cache_entry_for_exception(Handle exception) { + ExceptionCache* ec = exception_cache(); + while (ec != NULL) { + if (ec->match_exception_with_space(exception)) { + return ec; + } + ec = ec->next(); + } + return NULL; +} + +bool CompiledMethod::is_at_poll_return(address pc) { + RelocIterator iter(this, pc, pc+1); + while (iter.next()) { + if (iter.type() == relocInfo::poll_return_type) + return true; + } + return false; +} + + +bool CompiledMethod::is_at_poll_or_poll_return(address pc) { + RelocIterator iter(this, pc, pc+1); + while (iter.next()) { + relocInfo::relocType t = iter.type(); + if (t == relocInfo::poll_return_type || t == relocInfo::poll_type) + return true; + } + return false; +} + +void CompiledMethod::verify_oop_relocations() { + // Ensure sure that the code matches the current oop values + RelocIterator iter(this, NULL, NULL); + while (iter.next()) { + if (iter.type() == relocInfo::oop_type) { + oop_Relocation* reloc = iter.oop_reloc(); + if (!reloc->oop_is_immediate()) { + reloc->verify_oop_relocation(); + } + } + } +} + + +ScopeDesc* CompiledMethod::scope_desc_at(address pc) { + PcDesc* pd = pc_desc_at(pc); + guarantee(pd != NULL, "scope must be present"); + return new ScopeDesc(this, pd->scope_decode_offset(), + pd->obj_decode_offset(), pd->should_reexecute(), pd->rethrow_exception(), + pd->return_oop()); +} + +void CompiledMethod::cleanup_inline_caches(bool clean_all/*=false*/) { + assert_locked_or_safepoint(CompiledIC_lock); + + // If the method is not entrant or zombie then a JMP is plastered over the + // first few bytes. If an oop in the old code was there, that oop + // should not get GC'd. Skip the first few bytes of oops on + // not-entrant methods. + address low_boundary = verified_entry_point(); + if (!is_in_use() && is_nmethod()) { + low_boundary += NativeJump::instruction_size; + // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. + // This means that the low_boundary is going to be a little too high. + // This shouldn't matter, since oops of non-entrant methods are never used. + // In fact, why are we bothering to look at oops in a non-entrant method?? + } + + // Find all calls in an nmethod and clear the ones that point to non-entrant, + // zombie and unloaded nmethods. + ResourceMark rm; + RelocIterator iter(this, low_boundary); + while(iter.next()) { + switch(iter.type()) { + case relocInfo::virtual_call_type: + case relocInfo::opt_virtual_call_type: { + CompiledIC *ic = CompiledIC_at(&iter); + // Ok, to lookup references to zombies here + CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); + if( cb != NULL && cb->is_compiled() ) { + CompiledMethod* nm = cb->as_compiled_method(); + // Clean inline caches pointing to zombie, non-entrant and unloaded methods + if (clean_all || !nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(is_alive()); + } + break; + } + case relocInfo::static_call_type: { + CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc()); + CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination()); + if( cb != NULL && cb->is_compiled() ) { + CompiledMethod* cm = cb->as_compiled_method(); + // Clean inline caches pointing to zombie, non-entrant and unloaded methods + if (clean_all || !cm->is_in_use() || (cm->method()->code() != cm)) { + csc->set_to_clean(); + } + } + break; + } + } + } +} + +int CompiledMethod::verify_icholder_relocations() { + ResourceMark rm; + int count = 0; + + RelocIterator iter(this); + while(iter.next()) { + if (iter.type() == relocInfo::virtual_call_type) { + if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) { + CompiledIC *ic = CompiledIC_at(&iter); + if (TraceCompiledIC) { + tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder())); + ic->print(); + } + assert(ic->cached_icholder() != NULL, "must be non-NULL"); + count++; + } + } + } + + return count; +} + +// Method that knows how to preserve outgoing arguments at call. This method must be +// called with a frame corresponding to a Java invoke +void CompiledMethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { +#ifndef SHARK + if (method() != NULL && !method()->is_native()) { + address pc = fr.pc(); + SimpleScopeDesc ssd(this, pc); + Bytecode_invoke call(ssd.method(), ssd.bci()); + bool has_receiver = call.has_receiver(); + bool has_appendix = call.has_appendix(); + Symbol* signature = call.signature(); + + // The method attached by JIT-compilers should be used, if present. + // Bytecode can be inaccurate in such case. + Method* callee = attached_method_before_pc(pc); + if (callee != NULL) { + has_receiver = !(callee->access_flags().is_static()); + has_appendix = false; + signature = callee->signature(); + } + + fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f); + } +#endif // !SHARK +} + +// ----------------------------------------------------------------------------- +// CompiledMethod::get_deopt_original_pc +// +// Return the original PC for the given PC if: +// (a) the given PC belongs to a nmethod and +// (b) it is a deopt PC +address CompiledMethod::get_deopt_original_pc(const frame* fr) { + if (fr->cb() == NULL) return NULL; + + CompiledMethod* cm = fr->cb()->as_compiled_method_or_null(); + if (cm != NULL && cm->is_deopt_pc(fr->pc())) + return cm->get_original_pc(fr); + + return NULL; +} + +Method* CompiledMethod::attached_method(address call_instr) { + assert(code_contains(call_instr), "not part of the nmethod"); + RelocIterator iter(this, call_instr, call_instr + 1); + while (iter.next()) { + if (iter.addr() == call_instr) { + switch(iter.type()) { + case relocInfo::static_call_type: return iter.static_call_reloc()->method_value(); + case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->method_value(); + case relocInfo::virtual_call_type: return iter.virtual_call_reloc()->method_value(); + } + } + } + return NULL; // not found +} + +Method* CompiledMethod::attached_method_before_pc(address pc) { + if (NativeCall::is_call_before(pc)) { + NativeCall* ncall = nativeCall_before(pc); + return attached_method(ncall->instruction_address()); + } + return NULL; // not a call +} + +void CompiledMethod::clear_inline_caches() { + assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint"); + if (is_zombie()) { + return; + } + + RelocIterator iter(this); + while (iter.next()) { + iter.reloc()->clear_inline_cache(); + } +} + +// Clear ICStubs of all compiled ICs +void CompiledMethod::clear_ic_stubs() { + assert_locked_or_safepoint(CompiledIC_lock); + RelocIterator iter(this); + while(iter.next()) { + if (iter.type() == relocInfo::virtual_call_type) { + CompiledIC* ic = CompiledIC_at(&iter); + ic->clear_ic_stub(); + } + } +} + +#ifdef ASSERT + +class CheckClass : AllStatic { + static BoolObjectClosure* _is_alive; + + // Check class_loader is alive for this bit of metadata. + static void check_class(Metadata* md) { + Klass* klass = NULL; + if (md->is_klass()) { + klass = ((Klass*)md); + } else if (md->is_method()) { + klass = ((Method*)md)->method_holder(); + } else if (md->is_methodData()) { + klass = ((MethodData*)md)->method()->method_holder(); + } else { + md->print(); + ShouldNotReachHere(); + } + assert(klass->is_loader_alive(_is_alive), "must be alive"); + } + public: + static void do_check_class(BoolObjectClosure* is_alive, CompiledMethod* nm) { + assert(SafepointSynchronize::is_at_safepoint(), "this is only ok at safepoint"); + _is_alive = is_alive; + nm->metadata_do(check_class); + } +}; + +// This is called during a safepoint so can use static data +BoolObjectClosure* CheckClass::_is_alive = NULL; +#endif // ASSERT + +void CompiledMethod::clean_ic_if_metadata_is_dead(CompiledIC *ic, BoolObjectClosure *is_alive) { + if (ic->is_icholder_call()) { + // The only exception is compiledICHolder oops which may + // yet be marked below. (We check this further below). + CompiledICHolder* cichk_oop = ic->cached_icholder(); + + if (cichk_oop->holder_method()->method_holder()->is_loader_alive(is_alive) && + cichk_oop->holder_klass()->is_loader_alive(is_alive)) { + return; + } + } else { + Metadata* ic_oop = ic->cached_metadata(); + if (ic_oop != NULL) { + if (ic_oop->is_klass()) { + if (((Klass*)ic_oop)->is_loader_alive(is_alive)) { + return; + } + } else if (ic_oop->is_method()) { + if (((Method*)ic_oop)->method_holder()->is_loader_alive(is_alive)) { + return; + } + } else { + ShouldNotReachHere(); + } + } + } + + ic->set_to_clean(); +} + +unsigned char CompiledMethod::_global_unloading_clock = 0; + +void CompiledMethod::increase_unloading_clock() { + _global_unloading_clock++; + if (_global_unloading_clock == 0) { + // _nmethods are allocated with _unloading_clock == 0, + // so 0 is never used as a clock value. + _global_unloading_clock = 1; + } +} + +void CompiledMethod::set_unloading_clock(unsigned char unloading_clock) { + OrderAccess::release_store((volatile jubyte*)&_unloading_clock, unloading_clock); +} + +unsigned char CompiledMethod::unloading_clock() { + return (unsigned char)OrderAccess::load_acquire((volatile jubyte*)&_unloading_clock); +} + +// Processing of oop references should have been sufficient to keep +// all strong references alive. Any weak references should have been +// cleared as well. Visit all the metadata and ensure that it's +// really alive. +void CompiledMethod::verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive) { +#ifdef ASSERT + RelocIterator iter(this, low_boundary); + while (iter.next()) { + // static_stub_Relocations may have dangling references to + // Method*s so trim them out here. Otherwise it looks like + // compiled code is maintaining a link to dead metadata. + address static_call_addr = NULL; + if (iter.type() == relocInfo::opt_virtual_call_type) { + CompiledIC* cic = CompiledIC_at(&iter); + if (!cic->is_call_to_interpreted()) { + static_call_addr = iter.addr(); + } + } else if (iter.type() == relocInfo::static_call_type) { + CompiledStaticCall* csc = compiledStaticCall_at(iter.reloc()); + if (!csc->is_call_to_interpreted()) { + static_call_addr = iter.addr(); + } + } + if (static_call_addr != NULL) { + RelocIterator sciter(this, low_boundary); + while (sciter.next()) { + if (sciter.type() == relocInfo::static_stub_type && + sciter.static_stub_reloc()->static_call() == static_call_addr) { + sciter.static_stub_reloc()->clear_inline_cache(); + } + } + } + } + // Check that the metadata embedded in the nmethod is alive + CheckClass::do_check_class(is_alive, this); +#endif +} + +// This is called at the end of the strong tracing/marking phase of a +// GC to unload an nmethod if it contains otherwise unreachable +// oops. + +void CompiledMethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) { + // Make sure the oop's ready to receive visitors + assert(!is_zombie() && !is_unloaded(), + "should not call follow on zombie or unloaded nmethod"); + + // If the method is not entrant then a JMP is plastered over the + // first few bytes. If an oop in the old code was there, that oop + // should not get GC'd. Skip the first few bytes of oops on + // not-entrant methods. + address low_boundary = verified_entry_point(); + if (is_not_entrant()) { + low_boundary += NativeJump::instruction_size; + // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. + // (See comment above.) + } + + // The RedefineClasses() API can cause the class unloading invariant + // to no longer be true. See jvmtiExport.hpp for details. + // Also, leave a debugging breadcrumb in local flag. + if (JvmtiExport::has_redefined_a_class()) { + // This set of the unloading_occurred flag is done before the + // call to post_compiled_method_unload() so that the unloading + // of this nmethod is reported. + unloading_occurred = true; + } + + // Exception cache + clean_exception_cache(is_alive); + + // If class unloading occurred we first iterate over all inline caches and + // clear ICs where the cached oop is referring to an unloaded klass or method. + // The remaining live cached oops will be traversed in the relocInfo::oop_type + // iteration below. + if (unloading_occurred) { + RelocIterator iter(this, low_boundary); + while(iter.next()) { + if (iter.type() == relocInfo::virtual_call_type) { + CompiledIC *ic = CompiledIC_at(&iter); + clean_ic_if_metadata_is_dead(ic, is_alive); + } + } + } + + if (do_unloading_oops(low_boundary, is_alive, unloading_occurred)) { + return; + } + +#if INCLUDE_JVMCI + if (do_unloading_jvmci(is_alive, unloading_occurred)) { + return; + } +#endif + + // Ensure that all metadata is still alive + verify_metadata_loaders(low_boundary, is_alive); +} + +template +static bool clean_if_nmethod_is_unloaded(CompiledICorStaticCall *ic, address addr, BoolObjectClosure *is_alive, CompiledMethod* from) { + // Ok, to lookup references to zombies here + CodeBlob *cb = CodeCache::find_blob_unsafe(addr); + CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; + if (nm != NULL) { + if (nm->unloading_clock() != CompiledMethod::global_unloading_clock()) { + // The nmethod has not been processed yet. + return true; + } + + // Clean inline caches pointing to both zombie and not_entrant methods + if (!nm->is_in_use() || (nm->method()->code() != nm)) { + ic->set_to_clean(); + assert(ic->is_clean(), "nmethod " PTR_FORMAT "not clean %s", p2i(from), from->method()->name_and_sig_as_C_string()); + } + } + + return false; +} + +static bool clean_if_nmethod_is_unloaded(CompiledIC *ic, BoolObjectClosure *is_alive, CompiledMethod* from) { + return clean_if_nmethod_is_unloaded(ic, ic->ic_destination(), is_alive, from); +} + +static bool clean_if_nmethod_is_unloaded(CompiledStaticCall *csc, BoolObjectClosure *is_alive, CompiledMethod* from) { + return clean_if_nmethod_is_unloaded(csc, csc->destination(), is_alive, from); +} + +bool CompiledMethod::do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_occurred) { + ResourceMark rm; + + // Make sure the oop's ready to receive visitors + assert(!is_zombie() && !is_unloaded(), + "should not call follow on zombie or unloaded nmethod"); + + // If the method is not entrant then a JMP is plastered over the + // first few bytes. If an oop in the old code was there, that oop + // should not get GC'd. Skip the first few bytes of oops on + // not-entrant methods. + address low_boundary = verified_entry_point(); + if (is_not_entrant()) { + low_boundary += NativeJump::instruction_size; + // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. + // (See comment above.) + } + + // The RedefineClasses() API can cause the class unloading invariant + // to no longer be true. See jvmtiExport.hpp for details. + // Also, leave a debugging breadcrumb in local flag. + if (JvmtiExport::has_redefined_a_class()) { + // This set of the unloading_occurred flag is done before the + // call to post_compiled_method_unload() so that the unloading + // of this nmethod is reported. + unloading_occurred = true; + } + + // Exception cache + clean_exception_cache(is_alive); + + bool postponed = false; + + RelocIterator iter(this, low_boundary); + while(iter.next()) { + + switch (iter.type()) { + + case relocInfo::virtual_call_type: + if (unloading_occurred) { + // If class unloading occurred we first iterate over all inline caches and + // clear ICs where the cached oop is referring to an unloaded klass or method. + clean_ic_if_metadata_is_dead(CompiledIC_at(&iter), is_alive); + } + + postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); + break; + + case relocInfo::opt_virtual_call_type: + postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); + break; + + case relocInfo::static_call_type: + postponed |= clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), is_alive, this); + break; + + case relocInfo::oop_type: + // handled by do_unloading_oops below + break; + + case relocInfo::metadata_type: + break; // nothing to do. + } + } + + if (do_unloading_oops(low_boundary, is_alive, unloading_occurred)) { + return postponed; + } + +#if INCLUDE_JVMCI + if (do_unloading_jvmci(is_alive, unloading_occurred)) { + return postponed; + } +#endif + + // Ensure that all metadata is still alive + verify_metadata_loaders(low_boundary, is_alive); + + return postponed; +} + +void CompiledMethod::do_unloading_parallel_postponed(BoolObjectClosure* is_alive, bool unloading_occurred) { + ResourceMark rm; + + // Make sure the oop's ready to receive visitors + assert(!is_zombie(), + "should not call follow on zombie nmethod"); + + // If the method is not entrant then a JMP is plastered over the + // first few bytes. If an oop in the old code was there, that oop + // should not get GC'd. Skip the first few bytes of oops on + // not-entrant methods. + address low_boundary = verified_entry_point(); + if (is_not_entrant()) { + low_boundary += NativeJump::instruction_size; + // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. + // (See comment above.) + } + + RelocIterator iter(this, low_boundary); + while(iter.next()) { + + switch (iter.type()) { + + case relocInfo::virtual_call_type: + clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); + break; + + case relocInfo::opt_virtual_call_type: + clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); + break; + + case relocInfo::static_call_type: + clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), is_alive, this); + break; + } + } +} diff --git a/hotspot/src/share/vm/code/compiledMethod.hpp b/hotspot/src/share/vm/code/compiledMethod.hpp new file mode 100644 index 00000000000..01485e74a28 --- /dev/null +++ b/hotspot/src/share/vm/code/compiledMethod.hpp @@ -0,0 +1,391 @@ +/* + * Copyright (c) 2015, 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. + * + */ + +#ifndef SHARE_VM_CODE_COMPILEDMETHOD_HPP +#define SHARE_VM_CODE_COMPILEDMETHOD_HPP + +#include "code/codeBlob.hpp" +#include "code/pcDesc.hpp" +#include "oops/metadata.hpp" + +class Dependencies; +class ExceptionHandlerTable; +class ImplicitExceptionTable; +class AbstractCompiler; +class xmlStream; +class CompiledStaticCall; + +// This class is used internally by nmethods, to cache +// exception/pc/handler information. + +class ExceptionCache : public CHeapObj { + friend class VMStructs; + private: + enum { cache_size = 16 }; + Klass* _exception_type; + address _pc[cache_size]; + address _handler[cache_size]; + volatile int _count; + ExceptionCache* _next; + + address pc_at(int index) { assert(index >= 0 && index < count(),""); return _pc[index]; } + void set_pc_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _pc[index] = a; } + address handler_at(int index) { assert(index >= 0 && index < count(),""); return _handler[index]; } + void set_handler_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _handler[index] = a; } + int count() { return OrderAccess::load_acquire(&_count); } + // increment_count is only called under lock, but there may be concurrent readers. + void increment_count() { OrderAccess::release_store(&_count, _count + 1); } + + public: + + ExceptionCache(Handle exception, address pc, address handler); + + Klass* exception_type() { return _exception_type; } + ExceptionCache* next() { return _next; } + void set_next(ExceptionCache *ec) { _next = ec; } + + address match(Handle exception, address pc); + bool match_exception_with_space(Handle exception) ; + address test_address(address addr); + bool add_address_and_handler(address addr, address handler) ; +}; + +class nmethod; + +// cache pc descs found in earlier inquiries +class PcDescCache VALUE_OBJ_CLASS_SPEC { + friend class VMStructs; + private: + enum { cache_size = 4 }; + // The array elements MUST be volatile! Several threads may modify + // and read from the cache concurrently. find_pc_desc_internal has + // returned wrong results. C++ compiler (namely xlC12) may duplicate + // C++ field accesses if the elements are not volatile. + typedef PcDesc* PcDescPtr; + volatile PcDescPtr _pc_descs[cache_size]; // last cache_size pc_descs found + public: + PcDescCache() { debug_only(_pc_descs[0] = NULL); } + void reset_to(PcDesc* initial_pc_desc); + PcDesc* find_pc_desc(int pc_offset, bool approximate); + void add_pc_desc(PcDesc* pc_desc); + PcDesc* last_pc_desc() { return _pc_descs[0]; } +}; + +class PcDescSearch { +private: + address _code_begin; + PcDesc* _lower; + PcDesc* _upper; +public: + PcDescSearch(address code, PcDesc* lower, PcDesc* upper) : + _code_begin(code), _lower(lower), _upper(upper) + { + } + + address code_begin() const { return _code_begin; } + PcDesc* scopes_pcs_begin() const { return _lower; } + PcDesc* scopes_pcs_end() const { return _upper; } +}; + +class PcDescContainer VALUE_OBJ_CLASS_SPEC { +private: + PcDescCache _pc_desc_cache; +public: + PcDescContainer() {} + + PcDesc* find_pc_desc_internal(address pc, bool approximate, const PcDescSearch& search); + void reset_to(PcDesc* initial_pc_desc) { _pc_desc_cache.reset_to(initial_pc_desc); } + + PcDesc* find_pc_desc(address pc, bool approximate, const PcDescSearch& search) { + address base_address = search.code_begin(); + PcDesc* desc = _pc_desc_cache.last_pc_desc(); + if (desc != NULL && desc->pc_offset() == pc - base_address) { + return desc; + } + return find_pc_desc_internal(pc, approximate, search); + } +}; + + +class CompiledMethod : public CodeBlob { + friend class VMStructs; + friend class NMethodSweeper; + + void init_defaults(); +protected: + enum MarkForDeoptimizationStatus { + not_marked, + deoptimize, + deoptimize_noupdate + }; + + MarkForDeoptimizationStatus _mark_for_deoptimization_status; // Used for stack deoptimization + + bool _is_far_code; // Code is far from CodeCache. + // Have to use far call instructions to call it from code in CodeCache. + // set during construction + unsigned int _has_unsafe_access:1; // May fault due to unsafe access. + unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes? + unsigned int _lazy_critical_native:1; // Lazy JNI critical native + unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints + + Method* _method; + address _scopes_data_begin; + // All deoptee's will resume execution at this location described by + // this address. + address _deopt_handler_begin; + // All deoptee's at a MethodHandle call site will resume execution + // at this location described by this offset. + address _deopt_mh_handler_begin; + + PcDescContainer _pc_desc_container; + ExceptionCache * volatile _exception_cache; + + virtual void flush() = 0; +protected: + CompiledMethod(Method* method, const char* name, const CodeBlobLayout& layout, int frame_complete_offset, int frame_size, ImmutableOopMapSet* oop_maps, bool caller_must_gc_arguments); + CompiledMethod(Method* method, const char* name, int size, int header_size, CodeBuffer* cb, int frame_complete_offset, int frame_size, OopMapSet* oop_maps, bool caller_must_gc_arguments); + +public: + virtual bool is_compiled() const { return true; } + + bool has_unsafe_access() const { return _has_unsafe_access; } + void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } + + bool has_method_handle_invokes() const { return _has_method_handle_invokes; } + void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } + + bool is_lazy_critical_native() const { return _lazy_critical_native; } + void set_lazy_critical_native(bool z) { _lazy_critical_native = z; } + + bool has_wide_vectors() const { return _has_wide_vectors; } + void set_has_wide_vectors(bool z) { _has_wide_vectors = z; } + + enum { in_use = 0, // executable nmethod + not_used = 1, // not entrant, but revivable + not_entrant = 2, // marked for deoptimization but activations may still exist, + // will be transformed to zombie when all activations are gone + zombie = 3, // no activations exist, nmethod is ready for purge + unloaded = 4 // there should be no activations, should not be called, + // will be transformed to zombie immediately + }; + + virtual AbstractCompiler* compiler() const = 0; + virtual bool is_in_use() const = 0; + virtual int comp_level() const = 0; + virtual int compile_id() const = 0; + + + virtual address verified_entry_point() const = 0; + virtual void log_identity(xmlStream* log) const = 0; + virtual void log_state_change() const = 0; + virtual bool make_not_used() = 0; + virtual bool make_not_entrant() = 0; + virtual bool make_entrant() = 0; + virtual address entry_point() const = 0; + virtual bool make_zombie() = 0; + virtual bool is_osr_method() const = 0; + virtual int osr_entry_bci() const = 0; + Method* method() const { return _method; } + virtual void print_pcs() = 0; + bool is_native_method() const { return _method != NULL && _method->is_native(); } + bool is_java_method() const { return _method != NULL && !_method->is_native(); } + + // ScopeDesc retrieval operation + PcDesc* pc_desc_at(address pc) { return find_pc_desc(pc, false); } + // pc_desc_near returns the first PcDesc at or after the givne pc. + PcDesc* pc_desc_near(address pc) { return find_pc_desc(pc, true); } + + // ScopeDesc for an instruction + ScopeDesc* scope_desc_at(address pc); + + bool is_at_poll_return(address pc); + bool is_at_poll_or_poll_return(address pc); + + bool is_marked_for_deoptimization() const { return _mark_for_deoptimization_status != not_marked; } + void mark_for_deoptimization(bool inc_recompile_counts = true) { + _mark_for_deoptimization_status = (inc_recompile_counts ? deoptimize : deoptimize_noupdate); + } + bool update_recompile_counts() const { + // Update recompile counts when either the update is explicitly requested (deoptimize) + // or the nmethod is not marked for deoptimization at all (not_marked). + // The latter happens during uncommon traps when deoptimized nmethod is made not entrant. + return _mark_for_deoptimization_status != deoptimize_noupdate; + } + + // tells whether frames described by this nmethod can be deoptimized + // note: native wrappers cannot be deoptimized. + bool can_be_deoptimized() const { return is_java_method(); } + + virtual oop oop_at(int index) const = 0; + virtual Metadata* metadata_at(int index) const = 0; + + address scopes_data_begin() const { return _scopes_data_begin; } + virtual address scopes_data_end() const = 0; + int scopes_data_size() const { return scopes_data_end() - scopes_data_begin(); } + + virtual PcDesc* scopes_pcs_begin() const = 0; + virtual PcDesc* scopes_pcs_end() const = 0; + int scopes_pcs_size() const { return (intptr_t) scopes_pcs_end() - (intptr_t) scopes_pcs_begin(); } + + address insts_begin() const { return code_begin(); } + address insts_end() const { return stub_begin(); } + bool insts_contains(address addr) const { return insts_begin() <= addr && addr < insts_end(); } + int insts_size() const { return insts_end() - insts_begin(); } + + virtual address consts_begin() const = 0; + virtual address consts_end() const = 0; + bool consts_contains(address addr) const { return consts_begin() <= addr && addr < consts_end(); } + int consts_size() const { return consts_end() - consts_begin(); } + + virtual address stub_begin() const = 0; + virtual address stub_end() const = 0; + bool stub_contains(address addr) const { return stub_begin() <= addr && addr < stub_end(); } + int stub_size() const { return stub_end() - stub_begin(); } + + virtual address handler_table_begin() const = 0; + virtual address handler_table_end() const = 0; + bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); } + int handler_table_size() const { return handler_table_end() - handler_table_begin(); } + + virtual address nul_chk_table_begin() const = 0; + virtual address nul_chk_table_end() const = 0; + bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); } + int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); } + + virtual oop* oop_addr_at(int index) const = 0; + virtual Metadata** metadata_addr_at(int index) const = 0; + virtual void set_original_pc(const frame* fr, address pc) = 0; + + // Exception cache support + // Note: _exception_cache may be read concurrently. We rely on memory_order_consume here. + ExceptionCache* exception_cache() const { return _exception_cache; } + void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; } + void release_set_exception_cache(ExceptionCache *ec) { OrderAccess::release_store_ptr(&_exception_cache, ec); } + address handler_for_exception_and_pc(Handle exception, address pc); + void add_handler_for_exception_and_pc(Handle exception, address pc, address handler); + void clean_exception_cache(BoolObjectClosure* is_alive); + + void add_exception_cache_entry(ExceptionCache* new_entry); + ExceptionCache* exception_cache_entry_for_exception(Handle exception); + + // MethodHandle + bool is_method_handle_return(address return_pc); + address deopt_mh_handler_begin() const { return _deopt_mh_handler_begin; } + + address deopt_handler_begin() const { return _deopt_handler_begin; } + virtual address get_original_pc(const frame* fr) = 0; + // Deopt + // Return true is the PC is one would expect if the frame is being deopted. + bool is_deopt_pc (address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); } + bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); } + bool is_deopt_entry(address pc); + + virtual bool can_convert_to_zombie() = 0; + virtual const char* compile_kind() const = 0; + virtual int get_state() const = 0; + + const char* state() const; + + bool is_far_code() const { return _is_far_code; } + + bool inlinecache_check_contains(address addr) const { + return (addr >= code_begin() && addr < verified_entry_point()); + } + + void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f); + + // implicit exceptions support + virtual address continuation_for_implicit_exception(address pc) { return NULL; } + + static address get_deopt_original_pc(const frame* fr); + + // Inline cache support + void cleanup_inline_caches(bool clean_all = false); + virtual void clear_inline_caches(); + void clear_ic_stubs(); + + // Verify and count cached icholder relocations. + int verify_icholder_relocations(); + void verify_oop_relocations(); + + virtual bool is_evol_dependent_on(Klass* dependee) = 0; + // Fast breakpoint support. Tells if this compiled method is + // dependent on the given method. Returns true if this nmethod + // corresponds to the given method as well. + virtual bool is_dependent_on_method(Method* dependee) = 0; + + Method* attached_method(address call_pc); + Method* attached_method_before_pc(address pc); + + virtual void metadata_do(void f(Metadata*)) = 0; + + // GC support + + void set_unloading_next(CompiledMethod* next) { _unloading_next = next; } + CompiledMethod* unloading_next() { return _unloading_next; } + + void static clean_ic_if_metadata_is_dead(CompiledIC *ic, BoolObjectClosure *is_alive); + + // Check that all metadata is still alive + void verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive); + + virtual void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred); + // The parallel versions are used by G1. + virtual bool do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_occurred); + virtual void do_unloading_parallel_postponed(BoolObjectClosure* is_alive, bool unloading_occurred); + + static unsigned char global_unloading_clock() { return _global_unloading_clock; } + static void increase_unloading_clock(); + + void set_unloading_clock(unsigned char unloading_clock); + unsigned char unloading_clock(); + +protected: + virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred) = 0; +#if INCLUDE_JVMCI + virtual bool do_unloading_jvmci(BoolObjectClosure* is_alive, bool unloading_occurred) = 0; +#endif + +private: + // GC support to help figure out if an nmethod has been + // cleaned/unloaded by the current GC. + static unsigned char _global_unloading_clock; + + volatile unsigned char _unloading_clock; // Incremented after GC unloaded/cleaned the nmethod + + PcDesc* find_pc_desc(address pc, bool approximate) { + return _pc_desc_container.find_pc_desc(pc, approximate, PcDescSearch(code_begin(), scopes_pcs_begin(), scopes_pcs_end())); + } + +protected: + union { + // Used by G1 to chain nmethods. + CompiledMethod* _unloading_next; + // Used by non-G1 GCs to chain nmethods. + nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods + }; +}; + +#endif //SHARE_VM_CODE_COMPILEDMETHOD_HPP diff --git a/hotspot/src/share/vm/code/debugInfo.hpp b/hotspot/src/share/vm/code/debugInfo.hpp index 7a1b666e5e0..ad59edeb546 100644 --- a/hotspot/src/share/vm/code/debugInfo.hpp +++ b/hotspot/src/share/vm/code/debugInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -261,11 +261,11 @@ class MonitorValue: public ResourceObj { class DebugInfoReadStream : public CompressedReadStream { private: - const nmethod* _code; - const nmethod* code() const { return _code; } + const CompiledMethod* _code; + const CompiledMethod* code() const { return _code; } GrowableArray* _obj_pool; public: - DebugInfoReadStream(const nmethod* code, int offset, GrowableArray* obj_pool = NULL) : + DebugInfoReadStream(const CompiledMethod* code, int offset, GrowableArray* obj_pool = NULL) : CompressedReadStream(code->scopes_data_begin(), offset) { _code = code; _obj_pool = obj_pool; diff --git a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp index b2247b89523..5308c23b4fa 100644 --- a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp +++ b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp @@ -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 @@ -65,9 +65,9 @@ ExceptionHandlerTable::ExceptionHandlerTable(int initial_size) { } -ExceptionHandlerTable::ExceptionHandlerTable(const nmethod* nm) { - _table = (HandlerTableEntry*)nm->handler_table_begin(); - _length = nm->handler_table_size() / sizeof(HandlerTableEntry); +ExceptionHandlerTable::ExceptionHandlerTable(const CompiledMethod* cm) { + _table = (HandlerTableEntry*)cm->handler_table_begin(); + _length = cm->handler_table_size() / sizeof(HandlerTableEntry); _size = 0; // no space allocated by ExeptionHandlerTable! } @@ -98,9 +98,9 @@ void ExceptionHandlerTable::add_subtable( } -void ExceptionHandlerTable::copy_to(nmethod* nm) { - assert(size_in_bytes() == nm->handler_table_size(), "size of space allocated in nmethod incorrect"); - copy_bytes_to(nm->handler_table_begin()); +void ExceptionHandlerTable::copy_to(CompiledMethod* cm) { + assert(size_in_bytes() == cm->handler_table_size(), "size of space allocated in compiled method incorrect"); + copy_bytes_to(cm->handler_table_begin()); } void ExceptionHandlerTable::copy_bytes_to(address addr) { diff --git a/hotspot/src/share/vm/code/exceptionHandlerTable.hpp b/hotspot/src/share/vm/code/exceptionHandlerTable.hpp index 338e8d56800..4fc4fdcb4b5 100644 --- a/hotspot/src/share/vm/code/exceptionHandlerTable.hpp +++ b/hotspot/src/share/vm/code/exceptionHandlerTable.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -98,7 +98,7 @@ class ExceptionHandlerTable VALUE_OBJ_CLASS_SPEC { ExceptionHandlerTable(int initial_size = 8); // (run-time) construction from nmethod - ExceptionHandlerTable(const nmethod* nm); + ExceptionHandlerTable(const CompiledMethod* nm); // (compile-time) add entries void add_subtable( @@ -115,7 +115,7 @@ class ExceptionHandlerTable VALUE_OBJ_CLASS_SPEC { // nmethod support int size_in_bytes() const { return round_to(_length * sizeof(HandlerTableEntry), oopSize); } - void copy_to(nmethod* nm); + void copy_to(CompiledMethod* nm); void copy_bytes_to(address addr); // lookup diff --git a/hotspot/src/share/vm/code/icBuffer.cpp b/hotspot/src/share/vm/code/icBuffer.cpp index 65ea0b83ccd..abbe781737d 100644 --- a/hotspot/src/share/vm/code/icBuffer.cpp +++ b/hotspot/src/share/vm/code/icBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -49,8 +49,8 @@ int InlineCacheBuffer::_pending_count = 0; void ICStub::finalize() { if (!is_empty()) { ResourceMark rm; - CompiledIC *ic = CompiledIC_at(CodeCache::find_nmethod(ic_site()), ic_site()); - assert(CodeCache::find_nmethod(ic->instruction_address()) != NULL, "inline cache in non-nmethod?"); + CompiledIC *ic = CompiledIC_at(CodeCache::find_compiled(ic_site()), ic_site()); + assert(CodeCache::find_compiled(ic->instruction_address()) != NULL, "inline cache in non-compiled?"); assert(this == ICStub_from_destination_address(ic->stub_address()), "wrong owner of ic buffer"); ic->set_ic_destination_and_value(destination(), cached_value()); diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index 77939f06e20..e15e7324cf9 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -36,10 +36,10 @@ #include "compiler/directivesParser.hpp" #include "compiler/disassembler.hpp" #include "interpreter/bytecode.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "oops/methodData.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiImpl.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/orderAccess.inline.hpp" @@ -73,8 +73,6 @@ #include "jvmci/jvmciJavaClasses.hpp" #endif -unsigned char nmethod::_global_unloading_clock = 0; - #ifdef DTRACE_ENABLED // Only bother with this argument setup if dtrace is available @@ -313,7 +311,8 @@ bool ExceptionCache::match_exception_with_space(Handle exception) { address ExceptionCache::test_address(address addr) { - for (int i=0; imatch_exception_with_space(exception)) { - return ec; - } - ec = ec->next(); - } - return NULL; -} - - //----------------------------------------------------------------------------- @@ -434,81 +416,6 @@ static int adjust_pcs_size(int pcs_size) { return nsize; } -//----------------------------------------------------------------------------- - - -void nmethod::add_exception_cache_entry(ExceptionCache* new_entry) { - assert(ExceptionCache_lock->owned_by_self(),"Must hold the ExceptionCache_lock"); - assert(new_entry != NULL,"Must be non null"); - assert(new_entry->next() == NULL, "Must be null"); - - if (exception_cache() != NULL) { - new_entry->set_next(exception_cache()); - } - set_exception_cache(new_entry); -} - -void nmethod::clean_exception_cache(BoolObjectClosure* is_alive) { - ExceptionCache* prev = NULL; - ExceptionCache* curr = exception_cache(); - - while (curr != NULL) { - ExceptionCache* next = curr->next(); - - Klass* ex_klass = curr->exception_type(); - if (ex_klass != NULL && !ex_klass->is_loader_alive(is_alive)) { - if (prev == NULL) { - set_exception_cache(next); - } else { - prev->set_next(next); - } - delete curr; - // prev stays the same. - } else { - prev = curr; - } - - curr = next; - } -} - -// public method for accessing the exception cache -// These are the public access methods. -address nmethod::handler_for_exception_and_pc(Handle exception, address pc) { - // We never grab a lock to read the exception cache, so we may - // have false negatives. This is okay, as it can only happen during - // the first few exception lookups for a given nmethod. - ExceptionCache* ec = exception_cache(); - while (ec != NULL) { - address ret_val; - if ((ret_val = ec->match(exception,pc)) != NULL) { - return ret_val; - } - ec = ec->next(); - } - return NULL; -} - - -void nmethod::add_handler_for_exception_and_pc(Handle exception, address pc, address handler) { - // There are potential race conditions during exception cache updates, so we - // must own the ExceptionCache_lock before doing ANY modifications. Because - // we don't lock during reads, it is possible to have several threads attempt - // to update the cache with the same data. We need to check for already inserted - // copies of the current data before adding it. - - MutexLocker ml(ExceptionCache_lock); - ExceptionCache* target_entry = exception_cache_entry_for_exception(exception); - - if (target_entry == NULL || !target_entry->add_address_and_handler(pc,handler)) { - target_entry = new ExceptionCache(exception,pc,handler); - add_exception_cache_entry(target_entry); - } -} - - -//-------------end of code for ExceptionCache-------------- - int nmethod::total_size() const { return @@ -530,13 +437,7 @@ const char* nmethod::compile_kind() const { // Fill in default values for various flag fields void nmethod::init_defaults() { _state = in_use; - _unloading_clock = 0; _has_flushed_dependencies = 0; - _has_unsafe_access = 0; - _has_method_handle_invokes = 0; - _lazy_critical_native = 0; - _has_wide_vectors = 0; - _mark_for_deoptimization_status = not_marked; _lock_count = 0; _stack_traversal_mark = 0; _unload_reported = false; // jvmti state @@ -578,7 +479,7 @@ nmethod* nmethod::new_native_nmethod(const methodHandle& method, nmethod* nm = NULL; { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - int native_nmethod_size = allocation_size(code_buffer, sizeof(nmethod)); + int native_nmethod_size = CodeBlob::allocation_size(code_buffer, sizeof(nmethod)); CodeOffsets offsets; offsets.set_value(CodeOffsets::Verified_Entry, vep_offset); offsets.set_value(CodeOffsets::Frame_Complete, frame_complete); @@ -624,7 +525,7 @@ nmethod* nmethod::new_nmethod(const methodHandle& method, nmethod* nm = NULL; { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); int nmethod_size = - allocation_size(code_buffer, sizeof(nmethod)) + CodeBlob::allocation_size(code_buffer, sizeof(nmethod)) + adjust_pcs_size(debug_info->pcs_size()) + round_to(dependencies->size_in_bytes() , oopSize) + round_to(handler_table->size_in_bytes(), oopSize) @@ -691,31 +592,31 @@ nmethod::nmethod( ByteSize basic_lock_owner_sp_offset, ByteSize basic_lock_sp_offset, OopMapSet* oop_maps ) - : CodeBlob("native nmethod", code_buffer, sizeof(nmethod), - nmethod_size, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps), + : CompiledMethod(method, "native nmethod", nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false), _native_receiver_sp_offset(basic_lock_owner_sp_offset), _native_basic_lock_sp_offset(basic_lock_sp_offset) { { + int scopes_data_offset = 0; + int deoptimize_offset = 0; + int deoptimize_mh_offset = 0; + debug_only(NoSafepointVerifier nsv;) assert_locked_or_safepoint(CodeCache_lock); init_defaults(); - _method = method; _entry_bci = InvocationEntryBci; // We have no exception handler or deopt handler make the // values something that will never match a pc like the nmethod vtable entry _exception_offset = 0; - _deoptimize_offset = 0; - _deoptimize_mh_offset = 0; _orig_pc_offset = 0; _consts_offset = data_offset(); _stub_offset = data_offset(); _oops_offset = data_offset(); _metadata_offset = _oops_offset + round_to(code_buffer->total_oop_size(), oopSize); - _scopes_data_offset = _metadata_offset + round_to(code_buffer->total_metadata_size(), wordSize); - _scopes_pcs_offset = _scopes_data_offset; + scopes_data_offset = _metadata_offset + round_to(code_buffer->total_metadata_size(), wordSize); + _scopes_pcs_offset = scopes_data_offset; _dependencies_offset = _scopes_pcs_offset; _handler_table_offset = _dependencies_offset; _nul_chk_table_offset = _handler_table_offset; @@ -726,9 +627,14 @@ nmethod::nmethod( _verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry); _osr_entry_point = NULL; _exception_cache = NULL; - _pc_desc_cache.reset_to(NULL); + _pc_desc_container.reset_to(NULL); _hotness_counter = NMethodSweeper::hotness_counter_reset_val(); + _scopes_data_begin = (address) this + scopes_data_offset; + _deopt_handler_begin = (address) this + deoptimize_offset; + _deopt_mh_handler_begin = (address) this + deoptimize_mh_offset; + + code_buffer->copy_code_and_locs_to(this); code_buffer->copy_values_to(this); if (ScavengeRootsInCode) { if (detect_scavenge_root_oops()) { @@ -794,8 +700,7 @@ nmethod::nmethod( Handle speculation_log #endif ) - : CodeBlob("nmethod", code_buffer, sizeof(nmethod), - nmethod_size, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps), + : CompiledMethod(method, "nmethod", nmethod_size, sizeof(nmethod), code_buffer, offsets->value(CodeOffsets::Frame_Complete), frame_size, oop_maps, false), _native_receiver_sp_offset(in_ByteSize(-1)), _native_basic_lock_sp_offset(in_ByteSize(-1)) { @@ -804,8 +709,10 @@ nmethod::nmethod( debug_only(NoSafepointVerifier nsv;) assert_locked_or_safepoint(CodeCache_lock); + _deopt_handler_begin = (address) this; + _deopt_mh_handler_begin = (address) this; + init_defaults(); - _method = method; _entry_bci = entry_bci; _compile_id = compile_id; _comp_level = comp_level; @@ -829,14 +736,14 @@ nmethod::nmethod( _exception_offset = -1; } if (offsets->value(CodeOffsets::Deopt) != -1) { - _deoptimize_offset = code_offset() + offsets->value(CodeOffsets::Deopt); + _deopt_handler_begin = (address) this + code_offset() + offsets->value(CodeOffsets::Deopt); } else { - _deoptimize_offset = -1; + _deopt_handler_begin = NULL; } if (offsets->value(CodeOffsets::DeoptMH) != -1) { - _deoptimize_mh_offset = code_offset() + offsets->value(CodeOffsets::DeoptMH); + _deopt_mh_handler_begin = (address) this + code_offset() + offsets->value(CodeOffsets::DeoptMH); } else { - _deoptimize_mh_offset = -1; + _deopt_mh_handler_begin = NULL; } } else { #endif @@ -844,12 +751,12 @@ nmethod::nmethod( assert(offsets->value(CodeOffsets::Exceptions) != -1, "must be set"); assert(offsets->value(CodeOffsets::Deopt ) != -1, "must be set"); - _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions); - _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt); + _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions); + _deopt_handler_begin = (address) this + _stub_offset + offsets->value(CodeOffsets::Deopt); if (offsets->value(CodeOffsets::DeoptMH) != -1) { - _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH); + _deopt_mh_handler_begin = (address) this + _stub_offset + offsets->value(CodeOffsets::DeoptMH); } else { - _deoptimize_mh_offset = -1; + _deopt_mh_handler_begin = NULL; #if INCLUDE_JVMCI } #endif @@ -862,20 +769,23 @@ nmethod::nmethod( _oops_offset = data_offset(); _metadata_offset = _oops_offset + round_to(code_buffer->total_oop_size(), oopSize); - _scopes_data_offset = _metadata_offset + round_to(code_buffer->total_metadata_size(), wordSize); + int scopes_data_offset = _metadata_offset + round_to(code_buffer->total_metadata_size(), wordSize); - _scopes_pcs_offset = _scopes_data_offset + round_to(debug_info->data_size (), oopSize); + _scopes_pcs_offset = scopes_data_offset + round_to(debug_info->data_size (), oopSize); _dependencies_offset = _scopes_pcs_offset + adjust_pcs_size(debug_info->pcs_size()); _handler_table_offset = _dependencies_offset + round_to(dependencies->size_in_bytes (), oopSize); _nul_chk_table_offset = _handler_table_offset + round_to(handler_table->size_in_bytes(), oopSize); _nmethod_end_offset = _nul_chk_table_offset + round_to(nul_chk_table->size_in_bytes(), oopSize); - _entry_point = code_begin() + offsets->value(CodeOffsets::Entry); _verified_entry_point = code_begin() + offsets->value(CodeOffsets::Verified_Entry); _osr_entry_point = code_begin() + offsets->value(CodeOffsets::OSR_Entry); _exception_cache = NULL; - _pc_desc_cache.reset_to(scopes_pcs_begin()); + _scopes_data_begin = (address) this + scopes_data_offset; + + _pc_desc_container.reset_to(scopes_pcs_begin()); + + code_buffer->copy_code_and_locs_to(this); // Copy contents of ScopeDescRecorder to nmethod code_buffer->copy_values_to(this); debug_info->copy_to(this); @@ -1051,27 +961,6 @@ void nmethod::copy_values(GrowableArray* array) { } } -bool nmethod::is_at_poll_return(address pc) { - RelocIterator iter(this, pc, pc+1); - while (iter.next()) { - if (iter.type() == relocInfo::poll_return_type) - return true; - } - return false; -} - - -bool nmethod::is_at_poll_or_poll_return(address pc) { - RelocIterator iter(this, pc, pc+1); - while (iter.next()) { - relocInfo::relocType t = iter.type(); - if (t == relocInfo::poll_return_type || t == relocInfo::poll_type) - return true; - } - return false; -} - - void nmethod::fix_oop_relocations(address begin, address end, bool initialize_immediates) { // re-patch all oop-bearing instructions, just in case some oops moved RelocIterator iter(this, begin, end); @@ -1092,101 +981,6 @@ void nmethod::fix_oop_relocations(address begin, address end, bool initialize_im } -void nmethod::verify_oop_relocations() { - // Ensure sure that the code matches the current oop values - RelocIterator iter(this, NULL, NULL); - while (iter.next()) { - if (iter.type() == relocInfo::oop_type) { - oop_Relocation* reloc = iter.oop_reloc(); - if (!reloc->oop_is_immediate()) { - reloc->verify_oop_relocation(); - } - } - } -} - - -ScopeDesc* nmethod::scope_desc_at(address pc) { - PcDesc* pd = pc_desc_at(pc); - guarantee(pd != NULL, "scope must be present"); - return new ScopeDesc(this, pd->scope_decode_offset(), - pd->obj_decode_offset(), pd->should_reexecute(), pd->rethrow_exception(), - pd->return_oop()); -} - - -void nmethod::clear_inline_caches() { - assert(SafepointSynchronize::is_at_safepoint(), "cleaning of IC's only allowed at safepoint"); - if (is_zombie()) { - return; - } - - RelocIterator iter(this); - while (iter.next()) { - iter.reloc()->clear_inline_cache(); - } -} - -// Clear ICStubs of all compiled ICs -void nmethod::clear_ic_stubs() { - assert_locked_or_safepoint(CompiledIC_lock); - RelocIterator iter(this); - while(iter.next()) { - if (iter.type() == relocInfo::virtual_call_type) { - CompiledIC* ic = CompiledIC_at(&iter); - ic->clear_ic_stub(); - } - } -} - -void nmethod::cleanup_inline_caches(bool clean_all/*=false*/) { - assert_locked_or_safepoint(CompiledIC_lock); - - // If the method is not entrant or zombie then a JMP is plastered over the - // first few bytes. If an oop in the old code was there, that oop - // should not get GC'd. Skip the first few bytes of oops on - // not-entrant methods. - address low_boundary = verified_entry_point(); - if (!is_in_use()) { - low_boundary += NativeJump::instruction_size; - // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. - // This means that the low_boundary is going to be a little too high. - // This shouldn't matter, since oops of non-entrant methods are never used. - // In fact, why are we bothering to look at oops in a non-entrant method?? - } - - // Find all calls in an nmethod and clear the ones that point to non-entrant, - // zombie and unloaded nmethods. - ResourceMark rm; - RelocIterator iter(this, low_boundary); - while(iter.next()) { - switch(iter.type()) { - case relocInfo::virtual_call_type: - case relocInfo::opt_virtual_call_type: { - CompiledIC *ic = CompiledIC_at(&iter); - // Ok, to lookup references to zombies here - CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); - if( cb != NULL && cb->is_nmethod() ) { - nmethod* nm = (nmethod*)cb; - // Clean inline caches pointing to zombie, non-entrant and unloaded methods - if (clean_all || !nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(is_alive()); - } - break; - } - case relocInfo::static_call_type: { - CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc()); - CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination()); - if( cb != NULL && cb->is_nmethod() ) { - nmethod* nm = (nmethod*)cb; - // Clean inline caches pointing to zombie, non-entrant and unloaded methods - if (clean_all || !nm->is_in_use() || (nm->method()->code() != nm)) csc->set_to_clean(); - } - break; - } - } - } -} - void nmethod::verify_clean_inline_caches() { assert_locked_or_safepoint(CompiledIC_lock); @@ -1212,8 +1006,8 @@ void nmethod::verify_clean_inline_caches() { CompiledIC *ic = CompiledIC_at(&iter); // Ok, to lookup references to zombies here CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination()); - if( cb != NULL && cb->is_nmethod() ) { - nmethod* nm = (nmethod*)cb; + nmethod* nm = cb->as_nmethod_or_null(); + if( nm != NULL ) { // Verify that inline caches pointing to both zombie and not_entrant methods are clean if (!nm->is_in_use() || (nm->method()->code() != nm)) { assert(ic->is_clean(), "IC should be clean"); @@ -1224,8 +1018,8 @@ void nmethod::verify_clean_inline_caches() { case relocInfo::static_call_type: { CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc()); CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination()); - if( cb != NULL && cb->is_nmethod() ) { - nmethod* nm = (nmethod*)cb; + nmethod* nm = cb->as_nmethod_or_null(); + if( nm != NULL ) { // Verify that inline caches pointing to both zombie and not_entrant methods are clean if (!nm->is_in_use() || (nm->method()->code() != nm)) { assert(csc->is_clean(), "IC should be clean"); @@ -1237,27 +1031,6 @@ void nmethod::verify_clean_inline_caches() { } } -int nmethod::verify_icholder_relocations() { - int count = 0; - - RelocIterator iter(this); - while(iter.next()) { - if (iter.type() == relocInfo::virtual_call_type) { - if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) { - CompiledIC *ic = CompiledIC_at(&iter); - if (TraceCompiledIC) { - tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder())); - ic->print(); - } - assert(ic->cached_icholder() != NULL, "must be non-NULL"); - count++; - } - } - } - - return count; -} - // This is a private interface with the sweeper. void nmethod::mark_as_seen_on_stack() { assert(is_alive(), "Must be an alive method"); @@ -1290,23 +1063,6 @@ void nmethod::inc_decompile_count() { mdo->inc_decompile_count(); } -void nmethod::increase_unloading_clock() { - _global_unloading_clock++; - if (_global_unloading_clock == 0) { - // _nmethods are allocated with _unloading_clock == 0, - // so 0 is never used as a clock value. - _global_unloading_clock = 1; - } -} - -void nmethod::set_unloading_clock(unsigned char unloading_clock) { - OrderAccess::release_store((volatile jubyte*)&_unloading_clock, unloading_clock); -} - -unsigned char nmethod::unloading_clock() { - return (unsigned char)OrderAccess::load_acquire((volatile jubyte*)&_unloading_clock); -} - void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) { post_compiled_method_unload(); @@ -1320,8 +1076,8 @@ void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) { flush_dependencies(is_alive); // Break cycle between nmethod & method - if (log_is_enabled(Trace, classunload)) { - outputStream* log = Log(classunload)::trace_stream(); + if (log_is_enabled(Trace, class, unload)) { + outputStream* log = Log(class, unload)::trace_stream(); log->print_cr("making nmethod " INTPTR_FORMAT " unloadable, Method*(" INTPTR_FORMAT "), cause(" INTPTR_FORMAT ")", @@ -1607,8 +1363,7 @@ void nmethod::flush() { ((SharkCompiler *) compiler())->free_compiled_method(insts_begin()); #endif // SHARK - ((CodeBlob*)(this))->flush(); - + CodeBlob::flush(); CodeCache::free(this); } @@ -1752,171 +1507,6 @@ void nmethod::post_compiled_method_unload() { set_unload_reported(); } -void static clean_ic_if_metadata_is_dead(CompiledIC *ic, BoolObjectClosure *is_alive) { - if (ic->is_icholder_call()) { - // The only exception is compiledICHolder oops which may - // yet be marked below. (We check this further below). - CompiledICHolder* cichk_oop = ic->cached_icholder(); - - if (cichk_oop->holder_method()->method_holder()->is_loader_alive(is_alive) && - cichk_oop->holder_klass()->is_loader_alive(is_alive)) { - return; - } - } else { - Metadata* ic_oop = ic->cached_metadata(); - if (ic_oop != NULL) { - if (ic_oop->is_klass()) { - if (((Klass*)ic_oop)->is_loader_alive(is_alive)) { - return; - } - } else if (ic_oop->is_method()) { - if (((Method*)ic_oop)->method_holder()->is_loader_alive(is_alive)) { - return; - } - } else { - ShouldNotReachHere(); - } - } - } - - ic->set_to_clean(); -} - -// This is called at the end of the strong tracing/marking phase of a -// GC to unload an nmethod if it contains otherwise unreachable -// oops. - -void nmethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) { - // Make sure the oop's ready to receive visitors - assert(!is_zombie() && !is_unloaded(), - "should not call follow on zombie or unloaded nmethod"); - - // If the method is not entrant then a JMP is plastered over the - // first few bytes. If an oop in the old code was there, that oop - // should not get GC'd. Skip the first few bytes of oops on - // not-entrant methods. - address low_boundary = verified_entry_point(); - if (is_not_entrant()) { - low_boundary += NativeJump::instruction_size; - // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. - // (See comment above.) - } - - // The RedefineClasses() API can cause the class unloading invariant - // to no longer be true. See jvmtiExport.hpp for details. - // Also, leave a debugging breadcrumb in local flag. - if (JvmtiExport::has_redefined_a_class()) { - // This set of the unloading_occurred flag is done before the - // call to post_compiled_method_unload() so that the unloading - // of this nmethod is reported. - unloading_occurred = true; - } - - // Exception cache - clean_exception_cache(is_alive); - - // If class unloading occurred we first iterate over all inline caches and - // clear ICs where the cached oop is referring to an unloaded klass or method. - // The remaining live cached oops will be traversed in the relocInfo::oop_type - // iteration below. - if (unloading_occurred) { - RelocIterator iter(this, low_boundary); - while(iter.next()) { - if (iter.type() == relocInfo::virtual_call_type) { - CompiledIC *ic = CompiledIC_at(&iter); - clean_ic_if_metadata_is_dead(ic, is_alive); - } - } - } - - // Compiled code - { - RelocIterator iter(this, low_boundary); - while (iter.next()) { - if (iter.type() == relocInfo::oop_type) { - oop_Relocation* r = iter.oop_reloc(); - // In this loop, we must only traverse those oops directly embedded in - // the code. Other oops (oop_index>0) are seen as part of scopes_oops. - assert(1 == (r->oop_is_immediate()) + - (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()), - "oop must be found in exactly one place"); - if (r->oop_is_immediate() && r->oop_value() != NULL) { - if (can_unload(is_alive, r->oop_addr(), unloading_occurred)) { - return; - } - } - } - } - } - - - // Scopes - for (oop* p = oops_begin(); p < oops_end(); p++) { - if (*p == Universe::non_oop_word()) continue; // skip non-oops - if (can_unload(is_alive, p, unloading_occurred)) { - return; - } - } - -#if INCLUDE_JVMCI - // Follow JVMCI method - BarrierSet* bs = Universe::heap()->barrier_set(); - if (_jvmci_installed_code != NULL) { - if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { - if (!is_alive->do_object_b(_jvmci_installed_code)) { - clear_jvmci_installed_code(); - } - } else { - if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) { - return; - } - } - } - - if (_speculation_log != NULL) { - if (!is_alive->do_object_b(_speculation_log)) { - bs->write_ref_nmethod_pre(&_speculation_log, this); - _speculation_log = NULL; - bs->write_ref_nmethod_post(&_speculation_log, this); - } - } -#endif - - - // Ensure that all metadata is still alive - verify_metadata_loaders(low_boundary, is_alive); -} - -template -static bool clean_if_nmethod_is_unloaded(CompiledICorStaticCall *ic, address addr, BoolObjectClosure *is_alive, nmethod* from) { - // Ok, to lookup references to zombies here - CodeBlob *cb = CodeCache::find_blob_unsafe(addr); - if (cb != NULL && cb->is_nmethod()) { - nmethod* nm = (nmethod*)cb; - - if (nm->unloading_clock() != nmethod::global_unloading_clock()) { - // The nmethod has not been processed yet. - return true; - } - - // Clean inline caches pointing to both zombie and not_entrant methods - if (!nm->is_in_use() || (nm->method()->code() != nm)) { - ic->set_to_clean(); - assert(ic->is_clean(), "nmethod " PTR_FORMAT "not clean %s", p2i(from), from->method()->name_and_sig_as_C_string()); - } - } - - return false; -} - -static bool clean_if_nmethod_is_unloaded(CompiledIC *ic, BoolObjectClosure *is_alive, nmethod* from) { - return clean_if_nmethod_is_unloaded(ic, ic->ic_destination(), is_alive, from); -} - -static bool clean_if_nmethod_is_unloaded(CompiledStaticCall *csc, BoolObjectClosure *is_alive, nmethod* from) { - return clean_if_nmethod_is_unloaded(csc, csc->destination(), is_alive, from); -} - bool nmethod::unload_if_dead_at(RelocIterator* iter_at_oop, BoolObjectClosure *is_alive, bool unloading_occurred) { assert(iter_at_oop->type() == relocInfo::oop_type, "Wrong relocation type"); @@ -1936,93 +1526,36 @@ bool nmethod::unload_if_dead_at(RelocIterator* iter_at_oop, BoolObjectClosure *i return false; } - -bool nmethod::do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_occurred) { - ResourceMark rm; - - // Make sure the oop's ready to receive visitors - assert(!is_zombie() && !is_unloaded(), - "should not call follow on zombie or unloaded nmethod"); - - // If the method is not entrant then a JMP is plastered over the - // first few bytes. If an oop in the old code was there, that oop - // should not get GC'd. Skip the first few bytes of oops on - // not-entrant methods. - address low_boundary = verified_entry_point(); - if (is_not_entrant()) { - low_boundary += NativeJump::instruction_size; - // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. - // (See comment above.) - } - - // The RedefineClasses() API can cause the class unloading invariant - // to no longer be true. See jvmtiExport.hpp for details. - // Also, leave a debugging breadcrumb in local flag. - if (JvmtiExport::has_redefined_a_class()) { - // This set of the unloading_occurred flag is done before the - // call to post_compiled_method_unload() so that the unloading - // of this nmethod is reported. - unloading_occurred = true; - } - - // Exception cache - clean_exception_cache(is_alive); - - bool is_unloaded = false; - bool postponed = false; - - RelocIterator iter(this, low_boundary); - while(iter.next()) { - - switch (iter.type()) { - - case relocInfo::virtual_call_type: - if (unloading_occurred) { - // If class unloading occurred we first iterate over all inline caches and - // clear ICs where the cached oop is referring to an unloaded klass or method. - clean_ic_if_metadata_is_dead(CompiledIC_at(&iter), is_alive); - } - - postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); - break; - - case relocInfo::opt_virtual_call_type: - postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); - break; - - case relocInfo::static_call_type: - postponed |= clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), is_alive, this); - break; - - case relocInfo::oop_type: - if (!is_unloaded) { - is_unloaded = unload_if_dead_at(&iter, is_alive, unloading_occurred); - } - break; - - case relocInfo::metadata_type: - break; // nothing to do. - } - } - - if (is_unloaded) { - return postponed; - } - +bool nmethod::do_unloading_scopes(BoolObjectClosure* is_alive, bool unloading_occurred) { // Scopes for (oop* p = oops_begin(); p < oops_end(); p++) { if (*p == Universe::non_oop_word()) continue; // skip non-oops if (can_unload(is_alive, p, unloading_occurred)) { - is_unloaded = true; - break; + return true; } } + return false; +} - if (is_unloaded) { - return postponed; +bool nmethod::do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred) { + // Compiled code + { + RelocIterator iter(this, low_boundary); + while (iter.next()) { + if (iter.type() == relocInfo::oop_type) { + if (unload_if_dead_at(&iter, is_alive, unloading_occurred)) { + return true; + } + } + } } + return do_unloading_scopes(is_alive, unloading_occurred); +} + #if INCLUDE_JVMCI +bool nmethod::do_unloading_jvmci(BoolObjectClosure* is_alive, bool unloading_occurred) { + bool is_unloaded = false; // Follow JVMCI method BarrierSet* bs = Universe::heap()->barrier_set(); if (_jvmci_installed_code != NULL) { @@ -2032,7 +1565,7 @@ bool nmethod::do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_ } } else { if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) { - is_unloaded = true; + return true; } } } @@ -2044,124 +1577,10 @@ bool nmethod::do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_ bs->write_ref_nmethod_post(&_speculation_log, this); } } + return is_unloaded; +} #endif - // Ensure that all metadata is still alive - verify_metadata_loaders(low_boundary, is_alive); - - return postponed; -} - -void nmethod::do_unloading_parallel_postponed(BoolObjectClosure* is_alive, bool unloading_occurred) { - ResourceMark rm; - - // Make sure the oop's ready to receive visitors - assert(!is_zombie(), - "should not call follow on zombie nmethod"); - - // If the method is not entrant then a JMP is plastered over the - // first few bytes. If an oop in the old code was there, that oop - // should not get GC'd. Skip the first few bytes of oops on - // not-entrant methods. - address low_boundary = verified_entry_point(); - if (is_not_entrant()) { - low_boundary += NativeJump::instruction_size; - // %%% Note: On SPARC we patch only a 4-byte trap, not a full NativeJump. - // (See comment above.) - } - - RelocIterator iter(this, low_boundary); - while(iter.next()) { - - switch (iter.type()) { - - case relocInfo::virtual_call_type: - clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); - break; - - case relocInfo::opt_virtual_call_type: - clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), is_alive, this); - break; - - case relocInfo::static_call_type: - clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), is_alive, this); - break; - } - } -} - -#ifdef ASSERT - -class CheckClass : AllStatic { - static BoolObjectClosure* _is_alive; - - // Check class_loader is alive for this bit of metadata. - static void check_class(Metadata* md) { - Klass* klass = NULL; - if (md->is_klass()) { - klass = ((Klass*)md); - } else if (md->is_method()) { - klass = ((Method*)md)->method_holder(); - } else if (md->is_methodData()) { - klass = ((MethodData*)md)->method()->method_holder(); - } else { - md->print(); - ShouldNotReachHere(); - } - assert(klass->is_loader_alive(_is_alive), "must be alive"); - } - public: - static void do_check_class(BoolObjectClosure* is_alive, nmethod* nm) { - assert(SafepointSynchronize::is_at_safepoint(), "this is only ok at safepoint"); - _is_alive = is_alive; - nm->metadata_do(check_class); - } -}; - -// This is called during a safepoint so can use static data -BoolObjectClosure* CheckClass::_is_alive = NULL; -#endif // ASSERT - - -// Processing of oop references should have been sufficient to keep -// all strong references alive. Any weak references should have been -// cleared as well. Visit all the metadata and ensure that it's -// really alive. -void nmethod::verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive) { -#ifdef ASSERT - RelocIterator iter(this, low_boundary); - while (iter.next()) { - // static_stub_Relocations may have dangling references to - // Method*s so trim them out here. Otherwise it looks like - // compiled code is maintaining a link to dead metadata. - address static_call_addr = NULL; - if (iter.type() == relocInfo::opt_virtual_call_type) { - CompiledIC* cic = CompiledIC_at(&iter); - if (!cic->is_call_to_interpreted()) { - static_call_addr = iter.addr(); - } - } else if (iter.type() == relocInfo::static_call_type) { - CompiledStaticCall* csc = compiledStaticCall_at(iter.reloc()); - if (!csc->is_call_to_interpreted()) { - static_call_addr = iter.addr(); - } - } - if (static_call_addr != NULL) { - RelocIterator sciter(this, low_boundary); - while (sciter.next()) { - if (sciter.type() == relocInfo::static_stub_type && - sciter.static_stub_reloc()->static_call() == static_call_addr) { - sciter.static_stub_reloc()->clear_inline_cache(); - } - } - } - } - // Check that the metadata embedded in the nmethod is alive - CheckClass::do_check_class(is_alive, this); -#endif -} - - // Iterate over metadata calling this function. Used by RedefineClasses void nmethod::metadata_do(void f(Metadata*)) { address low_boundary = verified_entry_point(); @@ -2359,32 +1778,6 @@ bool nmethod::detect_scavenge_root_oops() { return detect_scavenge_root.detected_scavenge_root(); } -// Method that knows how to preserve outgoing arguments at call. This method must be -// called with a frame corresponding to a Java invoke -void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { -#ifndef SHARK - if (method() != NULL && !method()->is_native()) { - address pc = fr.pc(); - SimpleScopeDesc ssd(this, pc); - Bytecode_invoke call(ssd.method(), ssd.bci()); - bool has_receiver = call.has_receiver(); - bool has_appendix = call.has_appendix(); - Symbol* signature = call.signature(); - - // The method attached by JIT-compilers should be used, if present. - // Bytecode can be inaccurate in such case. - Method* callee = attached_method_before_pc(pc); - if (callee != NULL) { - has_receiver = !(callee->access_flags().is_static()); - has_appendix = false; - signature = callee->signature(); - } - - fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f); - } -#endif // !SHARK -} - inline bool includes(void* p, void* from, void* to) { return from <= p && p < to; } @@ -2414,7 +1807,7 @@ void nmethod::copy_scopes_pcs(PcDesc* pcs, int count) { break; } } - assert(has_method_handle_invokes() == (_deoptimize_mh_offset != -1), "must have deopt mh handler"); + assert(has_method_handle_invokes() == (_deopt_mh_handler_begin != NULL), "must have deopt mh handler"); int size = count * sizeof(PcDesc); assert(scopes_pcs_size() >= size, "oob"); @@ -2440,19 +1833,10 @@ void nmethod::copy_scopes_data(u_char* buffer, int size) { memcpy(scopes_data_begin(), buffer, size); } -// When using JVMCI the address might be off by the size of a call instruction. -bool nmethod::is_deopt_entry(address pc) { - return pc == deopt_handler_begin() -#if INCLUDE_JVMCI - || pc == (deopt_handler_begin() + NativeCall::instruction_size) -#endif - ; -} - #ifdef ASSERT -static PcDesc* linear_search(nmethod* nm, int pc_offset, bool approximate) { - PcDesc* lower = nm->scopes_pcs_begin(); - PcDesc* upper = nm->scopes_pcs_end(); +static PcDesc* linear_search(const PcDescSearch& search, int pc_offset, bool approximate) { + PcDesc* lower = search.scopes_pcs_begin(); + PcDesc* upper = search.scopes_pcs_end(); lower += 1; // exclude initial sentinel PcDesc* res = NULL; for (PcDesc* p = lower; p < upper; p++) { @@ -2470,8 +1854,8 @@ static PcDesc* linear_search(nmethod* nm, int pc_offset, bool approximate) { // Finds a PcDesc with real-pc equal to "pc" -PcDesc* nmethod::find_pc_desc_internal(address pc, bool approximate) { - address base_address = code_begin(); +PcDesc* PcDescContainer::find_pc_desc_internal(address pc, bool approximate, const PcDescSearch& search) { + address base_address = search.code_begin(); if ((pc < base_address) || (pc - base_address) >= (ptrdiff_t) PcDesc::upper_offset_limit) { return NULL; // PC is wildly out of range @@ -2482,7 +1866,7 @@ PcDesc* nmethod::find_pc_desc_internal(address pc, bool approximate) { // (This as an almost 100% hit rate.) PcDesc* res = _pc_desc_cache.find_pc_desc(pc_offset, approximate); if (res != NULL) { - assert(res == linear_search(this, pc_offset, approximate), "cache ok"); + assert(res == linear_search(search, pc_offset, approximate), "cache ok"); return res; } @@ -2490,8 +1874,8 @@ PcDesc* nmethod::find_pc_desc_internal(address pc, bool approximate) { // Find the last pc_offset less than the given offset. // The successor must be the required match, if there is a match at all. // (Use a fixed radix to avoid expensive affine pointer arithmetic.) - PcDesc* lower = scopes_pcs_begin(); - PcDesc* upper = scopes_pcs_end(); + PcDesc* lower = search.scopes_pcs_begin(); + PcDesc* upper = search.scopes_pcs_end(); upper -= 1; // exclude final sentinel if (lower >= upper) return NULL; // native method; no PcDescs at all @@ -2542,11 +1926,11 @@ PcDesc* nmethod::find_pc_desc_internal(address pc, bool approximate) { #undef assert_LU_OK if (match_desc(upper, pc_offset, approximate)) { - assert(upper == linear_search(this, pc_offset, approximate), "search ok"); + assert(upper == linear_search(search, pc_offset, approximate), "search ok"); _pc_desc_cache.add_pc_desc(upper); return upper; } else { - assert(NULL == linear_search(this, pc_offset, approximate), "search ok"); + assert(NULL == linear_search(search, pc_offset, approximate), "search ok"); return NULL; } } @@ -2617,15 +2001,18 @@ bool nmethod::is_evol_dependent_on(Klass* dependee) { Method* method = deps.method_argument(0); for (int j = 0; j < dependee_methods->length(); j++) { if (dependee_methods->at(j) == method) { - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x01000000, - ("Found evol dependency of nmethod %s.%s(%s) compile_id=%d on method %s.%s(%s)", - _method->method_holder()->external_name(), - _method->name()->as_C_string(), - _method->signature()->as_C_string(), compile_id(), - method->method_holder()->external_name(), - method->name()->as_C_string(), - method->signature()->as_C_string())); + if (log_is_enabled(Debug, redefine, class, nmethod)) { + ResourceMark rm; + log_debug(redefine, class, nmethod) + ("Found evol dependency of nmethod %s.%s(%s) compile_id=%d on method %s.%s(%s)", + _method->method_holder()->external_name(), + _method->name()->as_C_string(), + _method->signature()->as_C_string(), + compile_id(), + method->method_holder()->external_name(), + method->name()->as_C_string(), + method->signature()->as_C_string()); + } if (TraceDependencies || LogCompilation) deps.log_dependency(dependee); return true; @@ -2700,53 +2087,27 @@ void nmethod_init() { // QQQ might we make this work from a frame?? nmethodLocker::nmethodLocker(address pc) { CodeBlob* cb = CodeCache::find_blob(pc); - guarantee(cb != NULL && cb->is_nmethod(), "bad pc for a nmethod found"); - _nm = (nmethod*)cb; + guarantee(cb != NULL && cb->is_compiled(), "bad pc for a nmethod found"); + _nm = cb->as_compiled_method(); lock_nmethod(_nm); } // Only JvmtiDeferredEvent::compiled_method_unload_event() // should pass zombie_ok == true. -void nmethodLocker::lock_nmethod(nmethod* nm, bool zombie_ok) { - if (nm == NULL) return; +void nmethodLocker::lock_nmethod(CompiledMethod* cm, bool zombie_ok) { + if (cm == NULL) return; + nmethod* nm = cm->as_nmethod(); Atomic::inc(&nm->_lock_count); assert(zombie_ok || !nm->is_zombie(), "cannot lock a zombie method"); } -void nmethodLocker::unlock_nmethod(nmethod* nm) { - if (nm == NULL) return; +void nmethodLocker::unlock_nmethod(CompiledMethod* cm) { + if (cm == NULL) return; + nmethod* nm = cm->as_nmethod(); Atomic::dec(&nm->_lock_count); assert(nm->_lock_count >= 0, "unmatched nmethod lock/unlock"); } -// ----------------------------------------------------------------------------- -// nmethod::get_deopt_original_pc -// -// Return the original PC for the given PC if: -// (a) the given PC belongs to a nmethod and -// (b) it is a deopt PC -address nmethod::get_deopt_original_pc(const frame* fr) { - if (fr->cb() == NULL) return NULL; - - nmethod* nm = fr->cb()->as_nmethod_or_null(); - if (nm != NULL && nm->is_deopt_pc(fr->pc())) - return nm->get_original_pc(fr); - - return NULL; -} - - -// ----------------------------------------------------------------------------- -// MethodHandle - -bool nmethod::is_method_handle_return(address return_pc) { - if (!has_method_handle_invokes()) return false; - PcDesc* pd = pc_desc_at(return_pc); - if (pd == NULL) - return false; - return pd->is_method_handle_invoke(); -} - // ----------------------------------------------------------------------------- // Verification @@ -3200,7 +2561,7 @@ void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) co if (block_begin == verified_entry_point()) stream->print_cr("[Verified Entry Point]"); if (JVMCI_ONLY(_exception_offset >= 0 &&) block_begin == exception_begin()) stream->print_cr("[Exception Handler]"); if (block_begin == stub_begin()) stream->print_cr("[Stub Code]"); - if (JVMCI_ONLY(_deoptimize_offset >= 0 &&) block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]"); + if (JVMCI_ONLY(_deopt_handler_begin != NULL &&) block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]"); if (has_method_handle_invokes()) if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]"); @@ -3564,26 +2925,3 @@ char* nmethod::jvmci_installed_code_name(char* buf, size_t buflen) { } #endif -Method* nmethod::attached_method(address call_instr) { - assert(code_contains(call_instr), "not part of the nmethod"); - RelocIterator iter(this, call_instr, call_instr + 1); - while (iter.next()) { - if (iter.addr() == call_instr) { - switch(iter.type()) { - case relocInfo::static_call_type: return iter.static_call_reloc()->method_value(); - case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->method_value(); - case relocInfo::virtual_call_type: return iter.virtual_call_reloc()->method_value(); - } - } - } - return NULL; // not found -} - -Method* nmethod::attached_method_before_pc(address pc) { - if (NativeCall::is_call_before(pc)) { - NativeCall* ncall = nativeCall_before(pc); - return attached_method(ncall->instruction_address()); - } - return NULL; // not a call -} - diff --git a/hotspot/src/share/vm/code/nmethod.hpp b/hotspot/src/share/vm/code/nmethod.hpp index 1a8c82cc335..16ad01a38a5 100644 --- a/hotspot/src/share/vm/code/nmethod.hpp +++ b/hotspot/src/share/vm/code/nmethod.hpp @@ -25,67 +25,11 @@ #ifndef SHARE_VM_CODE_NMETHOD_HPP #define SHARE_VM_CODE_NMETHOD_HPP -#include "code/codeBlob.hpp" -#include "code/pcDesc.hpp" -#include "oops/metadata.hpp" +#include "code/compiledMethod.hpp" +class DepChange; class DirectiveSet; -// This class is used internally by nmethods, to cache -// exception/pc/handler information. - -class ExceptionCache : public CHeapObj { - friend class VMStructs; - private: - enum { cache_size = 16 }; - Klass* _exception_type; - address _pc[cache_size]; - address _handler[cache_size]; - int _count; - ExceptionCache* _next; - - address pc_at(int index) { assert(index >= 0 && index < count(),""); return _pc[index]; } - void set_pc_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _pc[index] = a; } - address handler_at(int index) { assert(index >= 0 && index < count(),""); return _handler[index]; } - void set_handler_at(int index, address a) { assert(index >= 0 && index < cache_size,""); _handler[index] = a; } - int count() { return _count; } - void increment_count() { _count++; } - - public: - - ExceptionCache(Handle exception, address pc, address handler); - - Klass* exception_type() { return _exception_type; } - ExceptionCache* next() { return _next; } - void set_next(ExceptionCache *ec) { _next = ec; } - - address match(Handle exception, address pc); - bool match_exception_with_space(Handle exception) ; - address test_address(address addr); - bool add_address_and_handler(address addr, address handler) ; -}; - - -// cache pc descs found in earlier inquiries -class PcDescCache VALUE_OBJ_CLASS_SPEC { - friend class VMStructs; - private: - enum { cache_size = 4 }; - // The array elements MUST be volatile! Several threads may modify - // and read from the cache concurrently. find_pc_desc_internal has - // returned wrong results. C++ compiler (namely xlC12) may duplicate - // C++ field accesses if the elements are not volatile. - typedef PcDesc* PcDescPtr; - volatile PcDescPtr _pc_descs[cache_size]; // last cache_size pc_descs found - public: - PcDescCache() { debug_only(_pc_descs[0] = NULL); } - void reset_to(PcDesc* initial_pc_desc); - PcDesc* find_pc_desc(int pc_offset, bool approximate); - void add_pc_desc(PcDesc* pc_desc); - PcDesc* last_pc_desc() { return _pc_descs[0]; } -}; - - // nmethods (native methods) are the compiled code versions of Java methods. // // An nmethod contains: @@ -107,26 +51,14 @@ class PcDescCache VALUE_OBJ_CLASS_SPEC { // [Implicit Null Pointer exception table] // - implicit null table array -class DepChange; -class Dependencies; -class ExceptionHandlerTable; -class ImplicitExceptionTable; -class AbstractCompiler; -class xmlStream; - -class nmethod : public CodeBlob { +class nmethod : public CompiledMethod { friend class VMStructs; friend class JVMCIVMStructs; friend class NMethodSweeper; friend class CodeCache; // scavengable oops private: - // GC support to help figure out if an nmethod has been - // cleaned/unloaded by the current GC. - static unsigned char _global_unloading_clock; - // Shared fields for all nmethod's - Method* _method; int _entry_bci; // != InvocationEntryBci if this nmethod is an on-stack replacement method jmethodID _jmethod_id; // Cache of method()->jmethod_id() @@ -139,13 +71,6 @@ class nmethod : public CodeBlob { // To support simple linked-list chaining of nmethods: nmethod* _osr_link; // from InstanceKlass::osr_nmethods_head - union { - // Used by G1 to chain nmethods. - nmethod* _unloading_next; - // Used by non-G1 GCs to chain nmethods. - nmethod* _scavenge_root_link; // from CodeCache::scavenge_root_nmethods - }; - static nmethod* volatile _oops_do_mark_nmethods; nmethod* volatile _oops_do_mark_link; @@ -157,13 +82,7 @@ class nmethod : public CodeBlob { address _osr_entry_point; // entry point for on stack replacement // Offsets for different nmethod parts - int _exception_offset; - // All deoptee's will resume execution at this location described by - // this offset. - int _deoptimize_offset; - // All deoptee's at a MethodHandle call site will resume execution - // at this location described by this offset. - int _deoptimize_mh_offset; + int _exception_offset; // Offset of the unwind handler if it exists int _unwind_handler_offset; @@ -178,6 +97,8 @@ class nmethod : public CodeBlob { int _nul_chk_table_offset; int _nmethod_end_offset; + int code_offset() const { return (address) code_begin() - header_begin(); } + // location in frame (offset for sp) that deopt can store the original // pc during a deopt. int _orig_pc_offset; @@ -188,27 +109,12 @@ class nmethod : public CodeBlob { // protected by CodeCache_lock bool _has_flushed_dependencies; // Used for maintenance of dependencies (CodeCache_lock) - enum MarkForDeoptimizationStatus { - not_marked, - deoptimize, - deoptimize_noupdate }; - - MarkForDeoptimizationStatus _mark_for_deoptimization_status; // Used for stack deoptimization - // used by jvmti to track if an unload event has been posted for this nmethod. bool _unload_reported; - // set during construction - unsigned int _has_unsafe_access:1; // May fault due to unsafe access. - unsigned int _has_method_handle_invokes:1; // Has this method MethodHandle invokes? - unsigned int _lazy_critical_native:1; // Lazy JNI critical native - unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints - // Protected by Patching_lock volatile unsigned char _state; // {in_use, not_entrant, zombie, unloaded} - volatile unsigned char _unloading_clock; // Incremented after GC unloaded/cleaned the nmethod - #ifdef ASSERT bool _oops_are_stale; // indicates that it's no longer safe to access oops section #endif @@ -241,9 +147,6 @@ class nmethod : public CodeBlob { // counter is decreased (by 1) while sweeping. int _hotness_counter; - ExceptionCache *_exception_cache; - PcDescCache _pc_desc_cache; - // These are used for compiled synchronized native methods to // locate the owner and stack slot for the BasicLock so that we can // properly revoke the bias of the owner if necessary. They are @@ -301,18 +204,21 @@ class nmethod : public CodeBlob { // Returns true if this thread changed the state of the nmethod or // false if another thread performed the transition. bool make_not_entrant_or_zombie(unsigned int state); + bool make_entrant() { Unimplemented(); return false; } void inc_decompile_count(); - // Used to manipulate the exception cache - void add_exception_cache_entry(ExceptionCache* new_entry); - ExceptionCache* exception_cache_entry_for_exception(Handle exception); - // Inform external interfaces that a compiled method has been unloaded void post_compiled_method_unload(); // Initailize fields to their default values void init_defaults(); + // Offsets + int content_offset() const { return content_begin() - header_begin(); } + int data_offset() const { return _data_offset; } + + address header_end() const { return (address) header_begin() + header_size(); } + public: // create nmethod with entry_bci static nmethod* new_nmethod(const methodHandle& method, @@ -333,7 +239,7 @@ class nmethod : public CodeBlob { , Handle installed_code = Handle(), Handle speculation_log = Handle() #endif - ); + ); static nmethod* new_native_nmethod(const methodHandle& method, int compile_id, @@ -346,13 +252,10 @@ class nmethod : public CodeBlob { OopMapSet* oop_maps); // accessors - Method* method() const { return _method; } AbstractCompiler* compiler() const { return _compiler; } // type info bool is_nmethod() const { return true; } - bool is_java_method() const { return !method()->is_native(); } - bool is_native_method() const { return method()->is_native(); } bool is_osr_method() const { return _entry_bci != InvocationEntryBci; } bool is_compiled_by_c1() const; @@ -362,22 +265,17 @@ class nmethod : public CodeBlob { // boundaries for different parts address consts_begin () const { return header_begin() + _consts_offset ; } - address consts_end () const { return header_begin() + code_offset() ; } - address insts_begin () const { return header_begin() + code_offset() ; } - address insts_end () const { return header_begin() + _stub_offset ; } + address consts_end () const { return code_begin() ; } address stub_begin () const { return header_begin() + _stub_offset ; } address stub_end () const { return header_begin() + _oops_offset ; } address exception_begin () const { return header_begin() + _exception_offset ; } - address deopt_handler_begin () const { return header_begin() + _deoptimize_offset ; } - address deopt_mh_handler_begin() const { return header_begin() + _deoptimize_mh_offset ; } address unwind_handler_begin () const { return _unwind_handler_offset != -1 ? (header_begin() + _unwind_handler_offset) : NULL; } oop* oops_begin () const { return (oop*) (header_begin() + _oops_offset) ; } oop* oops_end () const { return (oop*) (header_begin() + _metadata_offset) ; } Metadata** metadata_begin () const { return (Metadata**) (header_begin() + _metadata_offset) ; } - Metadata** metadata_end () const { return (Metadata**) (header_begin() + _scopes_data_offset) ; } + Metadata** metadata_end () const { return (Metadata**) _scopes_data_begin; } - address scopes_data_begin () const { return header_begin() + _scopes_data_offset ; } address scopes_data_end () const { return header_begin() + _scopes_pcs_offset ; } PcDesc* scopes_pcs_begin () const { return (PcDesc*)(header_begin() + _scopes_pcs_offset ); } PcDesc* scopes_pcs_end () const { return (PcDesc*)(header_begin() + _dependencies_offset) ; } @@ -389,16 +287,9 @@ class nmethod : public CodeBlob { address nul_chk_table_end () const { return header_begin() + _nmethod_end_offset ; } // Sizes - int consts_size () const { return consts_end () - consts_begin (); } - int insts_size () const { return insts_end () - insts_begin (); } - int stub_size () const { return stub_end () - stub_begin (); } int oops_size () const { return (address) oops_end () - (address) oops_begin (); } int metadata_size () const { return (address) metadata_end () - (address) metadata_begin (); } - int scopes_data_size () const { return scopes_data_end () - scopes_data_begin (); } - int scopes_pcs_size () const { return (intptr_t) scopes_pcs_end () - (intptr_t) scopes_pcs_begin (); } int dependencies_size () const { return dependencies_end () - dependencies_begin (); } - int handler_table_size() const { return handler_table_end() - handler_table_begin(); } - int nul_chk_table_size() const { return nul_chk_table_end() - nul_chk_table_begin(); } int oops_count() const { assert(oops_size() % oopSize == 0, ""); return (oops_size() / oopSize) + 1; } int metadata_count() const { assert(metadata_size() % wordSize == 0, ""); return (metadata_size() / wordSize) + 1; } @@ -410,15 +301,10 @@ class nmethod : public CodeBlob { int hotness_counter() const { return _hotness_counter; } // Containment - bool consts_contains (address addr) const { return consts_begin () <= addr && addr < consts_end (); } - bool insts_contains (address addr) const { return insts_begin () <= addr && addr < insts_end (); } - bool stub_contains (address addr) const { return stub_begin () <= addr && addr < stub_end (); } bool oops_contains (oop* addr) const { return oops_begin () <= addr && addr < oops_end (); } bool metadata_contains (Metadata** addr) const { return metadata_begin () <= addr && addr < metadata_end (); } bool scopes_data_contains (address addr) const { return scopes_data_begin () <= addr && addr < scopes_data_end (); } bool scopes_pcs_contains (PcDesc* addr) const { return scopes_pcs_begin () <= addr && addr < scopes_pcs_end (); } - bool handler_table_contains(address addr) const { return handler_table_begin() <= addr && addr < handler_table_end(); } - bool nul_chk_table_contains(address addr) const { return nul_chk_table_begin() <= addr && addr < nul_chk_table_end(); } // entry points address entry_point() const { return _entry_point; } // normal entry point @@ -433,24 +319,11 @@ class nmethod : public CodeBlob { // flag accessing and manipulation bool is_in_use() const { return _state == in_use; } - bool is_alive() const { return _state == in_use || _state == not_entrant; } + bool is_alive() const { unsigned char s = _state; return s < zombie; } bool is_not_entrant() const { return _state == not_entrant; } bool is_zombie() const { return _state == zombie; } bool is_unloaded() const { return _state == unloaded; } - // returns a string version of the nmethod state - const char* state() const { - switch(_state) { - case in_use: return "in use"; - case not_entrant: return "not_entrant"; - case zombie: return "zombie"; - case unloaded: return "unloaded"; - default: - fatal("unexpected nmethod state: %d", _state); - return NULL; - } - } - #if INCLUDE_RTM_OPT // rtm state accessing and manipulating RTMState rtm_state() const { return _rtm_state; } @@ -465,30 +338,15 @@ class nmethod : public CodeBlob { assert(!method()->is_method_handle_intrinsic(), "Cannot make MH intrinsic not entrant"); return make_not_entrant_or_zombie(not_entrant); } + bool make_not_used() { return make_not_entrant(); } bool make_zombie() { return make_not_entrant_or_zombie(zombie); } // used by jvmti to track if the unload event has been reported bool unload_reported() { return _unload_reported; } void set_unload_reported() { _unload_reported = true; } - void set_unloading_next(nmethod* next) { _unloading_next = next; } - nmethod* unloading_next() { return _unloading_next; } - - static unsigned char global_unloading_clock() { return _global_unloading_clock; } - static void increase_unloading_clock(); - - void set_unloading_clock(unsigned char unloading_clock); - unsigned char unloading_clock(); - - bool is_marked_for_deoptimization() const { return _mark_for_deoptimization_status != not_marked; } - void mark_for_deoptimization(bool inc_recompile_counts = true) { - _mark_for_deoptimization_status = (inc_recompile_counts ? deoptimize : deoptimize_noupdate); - } - bool update_recompile_counts() const { - // Update recompile counts when either the update is explicitly requested (deoptimize) - // or the nmethod is not marked for deoptimization at all (not_marked). - // The latter happens during uncommon traps when deoptimized nmethod is made not entrant. - return _mark_for_deoptimization_status != deoptimize_noupdate; + int get_state() const { + return _state; } void make_unloaded(BoolObjectClosure* is_alive, oop cause); @@ -501,18 +359,6 @@ class nmethod : public CodeBlob { _has_flushed_dependencies = 1; } - bool has_unsafe_access() const { return _has_unsafe_access; } - void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } - - bool has_method_handle_invokes() const { return _has_method_handle_invokes; } - void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; } - - bool is_lazy_critical_native() const { return _lazy_critical_native; } - void set_lazy_critical_native(bool z) { _lazy_critical_native = z; } - - bool has_wide_vectors() const { return _has_wide_vectors; } - void set_has_wide_vectors(bool z) { _has_wide_vectors = z; } - int comp_level() const { return _comp_level; } // Support for oops in scopes and relocs: @@ -537,9 +383,6 @@ class nmethod : public CodeBlob { void copy_values(GrowableArray* oops); void copy_values(GrowableArray* metadata); - Method* attached_method(address call_pc); - Method* attached_method_before_pc(address pc); - // Relocation support private: void fix_oop_relocations(address begin, address end, bool initialize_immediates); @@ -548,10 +391,6 @@ private: public: void fix_oop_relocations(address begin, address end) { fix_oop_relocations(begin, end, false); } void fix_oop_relocations() { fix_oop_relocations(NULL, NULL, false); } - void verify_oop_relocations(); - - bool is_at_poll_return(address pc); - bool is_at_poll_or_poll_return(address pc); // Scavengable oop support bool on_scavenge_root_list() const { return (_scavenge_root_state & 1) != 0; } @@ -575,13 +414,6 @@ public: long stack_traversal_mark() { return _stack_traversal_mark; } void set_stack_traversal_mark(long l) { _stack_traversal_mark = l; } - // Exception cache support - ExceptionCache* exception_cache() const { return _exception_cache; } - void set_exception_cache(ExceptionCache *ec) { _exception_cache = ec; } - address handler_for_exception_and_pc(Handle exception, address pc); - void add_handler_for_exception_and_pc(Handle exception, address pc, address handler); - void clean_exception_cache(BoolObjectClosure* is_alive); - // implicit exceptions support address continuation_for_implicit_exception(address pc); @@ -592,24 +424,8 @@ public: nmethod* osr_link() const { return _osr_link; } void set_osr_link(nmethod *n) { _osr_link = n; } - // tells whether frames described by this nmethod can be deoptimized - // note: native wrappers cannot be deoptimized. - bool can_be_deoptimized() const { return is_java_method(); } - - // Inline cache support - void clear_inline_caches(); - void clear_ic_stubs(); - void cleanup_inline_caches(bool clean_all = false); - bool inlinecache_check_contains(address addr) const { - return (addr >= code_begin() && addr < verified_entry_point()); - } - // Verify calls to dead methods have been cleaned. void verify_clean_inline_caches(); - // Verify and count cached icholder relocations. - int verify_icholder_relocations(); - // Check that all metadata is still alive - void verify_metadata_loaders(address low_boundary, BoolObjectClosure* is_alive); // unlink and deallocate this nmethod // Only NMethodSweeper class is expected to use this. NMethodSweeper is not @@ -650,20 +466,19 @@ public: public: #endif - // GC support - void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred); - // The parallel versions are used by G1. - bool do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_occurred); - void do_unloading_parallel_postponed(BoolObjectClosure* is_alive, bool unloading_occurred); + protected: + virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred); +#if INCLUDE_JVMCI + virtual bool do_unloading_jvmci(BoolObjectClosure* is_alive, bool unloading_occurred); +#endif private: + bool do_unloading_scopes(BoolObjectClosure* is_alive, bool unloading_occurred); // Unload a nmethod if the *root object is dead. bool can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_occurred); bool unload_if_dead_at(RelocIterator *iter_at_oop, BoolObjectClosure* is_alive, bool unloading_occurred); public: - void preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, - OopClosure* f); void oops_do(OopClosure* f) { oops_do(f, false); } void oops_do(OopClosure* f, bool allow_zombie); bool detect_scavenge_root_oops(); @@ -675,49 +490,20 @@ public: static bool oops_do_marking_is_active() { return _oops_do_mark_nmethods != NULL; } bool test_oops_do_mark() { return _oops_do_mark_link != NULL; } - // ScopeDesc for an instruction - ScopeDesc* scope_desc_at(address pc); - private: ScopeDesc* scope_desc_in(address begin, address end); address* orig_pc_addr(const frame* fr) { return (address*) ((address)fr->unextended_sp() + _orig_pc_offset); } - PcDesc* find_pc_desc_internal(address pc, bool approximate); - - PcDesc* find_pc_desc(address pc, bool approximate) { - PcDesc* desc = _pc_desc_cache.last_pc_desc(); - if (desc != NULL && desc->pc_offset() == pc - code_begin()) { - return desc; - } - return find_pc_desc_internal(pc, approximate); - } - - public: - // ScopeDesc retrieval operation - PcDesc* pc_desc_at(address pc) { return find_pc_desc(pc, false); } - // pc_desc_near returns the first PcDesc at or after the givne pc. - PcDesc* pc_desc_near(address pc) { return find_pc_desc(pc, true); } - public: // copying of debugging information void copy_scopes_pcs(PcDesc* pcs, int count); void copy_scopes_data(address buffer, int size); - // Deopt - // Return true is the PC is one would expect if the frame is being deopted. - bool is_deopt_pc (address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); } - bool is_deopt_entry (address pc); - bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); } // Accessor/mutator for the original pc of a frame before a frame was deopted. address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); } void set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; } - static address get_deopt_original_pc(const frame* fr); - - // MethodHandle - bool is_method_handle_return(address return_pc); - // jvmti support: void post_compiled_method_load_event(); jmethodID get_and_cache_jmethod_id(); @@ -767,7 +553,7 @@ public: // are numbered in an independent sequence if CICountOSR is true, // and native method wrappers are also numbered independently if // CICountNative is true. - int compile_id() const { return _compile_id; } + virtual int compile_id() const { return _compile_id; } const char* compile_kind() const; // tells if any of this method's dependencies have been invalidated @@ -786,7 +572,7 @@ public: // Fast breakpoint support. Tells if this compiled method is // dependent on the given method. Returns true if this nmethod // corresponds to the given method as well. - bool is_dependent_on_method(Method* dependee); + virtual bool is_dependent_on_method(Method* dependee); // is it ok to patch at address? bool is_patchable_at(address instr_address); @@ -804,12 +590,7 @@ public: static int osr_entry_point_offset() { return offset_of(nmethod, _osr_entry_point); } static int state_offset() { return offset_of(nmethod, _state); } - // RedefineClasses support. Mark metadata in nmethods as on_stack so that - // redefine classes doesn't purge it. - static void mark_on_stack(nmethod* nm) { - nm->metadata_do(Metadata::mark_on_stack); - } - void metadata_do(void f(Metadata*)); + virtual void metadata_do(void f(Metadata*)); }; // Locks an nmethod so its code will not get removed and it will not @@ -818,26 +599,43 @@ public: // needs to be done, then lock_nmethod() is used directly to keep the // generated code from being reused too early. class nmethodLocker : public StackObj { - nmethod* _nm; + CompiledMethod* _nm; public: // note: nm can be NULL // Only JvmtiDeferredEvent::compiled_method_unload_event() // should pass zombie_ok == true. - static void lock_nmethod(nmethod* nm, bool zombie_ok = false); - static void unlock_nmethod(nmethod* nm); // (ditto) + static void lock_nmethod(CompiledMethod* nm, bool zombie_ok = false); + static void unlock_nmethod(CompiledMethod* nm); // (ditto) nmethodLocker(address pc); // derive nm from pc nmethodLocker(nmethod *nm) { _nm = nm; lock_nmethod(_nm); } - nmethodLocker() { _nm = NULL; } - ~nmethodLocker() { unlock_nmethod(_nm); } + nmethodLocker(CompiledMethod *nm) { + _nm = nm; + lock(_nm); + } - nmethod* code() { return _nm; } - void set_code(nmethod* new_nm) { - unlock_nmethod(_nm); // note: This works even if _nm==new_nm. + static void lock(CompiledMethod* method) { + if (method == NULL) return; + lock_nmethod(method); + } + + static void unlock(CompiledMethod* method) { + if (method == NULL) return; + unlock_nmethod(method); + } + + nmethodLocker() { _nm = NULL; } + ~nmethodLocker() { + unlock(_nm); + } + + CompiledMethod* code() { return _nm; } + void set_code(CompiledMethod* new_nm) { + unlock(_nm); // note: This works even if _nm==new_nm. _nm = new_nm; - lock_nmethod(_nm); + lock(_nm); } }; diff --git a/hotspot/src/share/vm/code/pcDesc.cpp b/hotspot/src/share/vm/code/pcDesc.cpp index a860b5b804d..ebacd8f0975 100644 --- a/hotspot/src/share/vm/code/pcDesc.cpp +++ b/hotspot/src/share/vm/code/pcDesc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -36,11 +36,11 @@ PcDesc::PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset) { _flags = 0; } -address PcDesc::real_pc(const nmethod* code) const { +address PcDesc::real_pc(const CompiledMethod* code) const { return code->code_begin() + pc_offset(); } -void PcDesc::print(nmethod* code) { +void PcDesc::print(CompiledMethod* code) { #ifndef PRODUCT ResourceMark rm; tty->print_cr("PcDesc(pc=" PTR_FORMAT " offset=%x bits=%x):", p2i(real_pc(code)), pc_offset(), _flags); @@ -57,7 +57,7 @@ void PcDesc::print(nmethod* code) { #endif } -bool PcDesc::verify(nmethod* code) { +bool PcDesc::verify(CompiledMethod* code) { //Unimplemented(); return true; } diff --git a/hotspot/src/share/vm/code/pcDesc.hpp b/hotspot/src/share/vm/code/pcDesc.hpp index 83734c8f0b8..435c8af8182 100644 --- a/hotspot/src/share/vm/code/pcDesc.hpp +++ b/hotspot/src/share/vm/code/pcDesc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -30,7 +30,7 @@ // PcDescs map a physical PC (given as offset from start of nmethod) to // the corresponding source scope and byte code index. -class nmethod; +class CompiledMethod; class PcDesc VALUE_OBJ_CLASS_SPEC { friend class VMStructs; @@ -91,10 +91,10 @@ class PcDesc VALUE_OBJ_CLASS_SPEC { void set_return_oop(bool z) { set_flag(PCDESC_return_oop, z); } // Returns the real pc - address real_pc(const nmethod* code) const; + address real_pc(const CompiledMethod* code) const; - void print(nmethod* code); - bool verify(nmethod* code); + void print(CompiledMethod* code); + bool verify(CompiledMethod* code); }; #endif // SHARE_VM_CODE_PCDESC_HPP diff --git a/hotspot/src/share/vm/code/relocInfo.cpp b/hotspot/src/share/vm/code/relocInfo.cpp index 444c91c46be..45a39db8360 100644 --- a/hotspot/src/share/vm/code/relocInfo.cpp +++ b/hotspot/src/share/vm/code/relocInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -81,7 +81,6 @@ relocInfo* relocInfo::finish_prefix(short* prefix_limit) { return (relocInfo*)prefix_limit; } - void relocInfo::set_type(relocType t) { int old_offset = addr_offset(); int old_format = format(); @@ -91,6 +90,9 @@ void relocInfo::set_type(relocType t) { assert(format()==old_format, "sanity check"); } +nmethod* RelocIterator::code_as_nmethod() const { + return _code->as_nmethod(); +} void relocInfo::set_format(int f) { int old_offset = addr_offset(); @@ -121,13 +123,13 @@ void relocInfo::remove_reloc_info_for_address(RelocIterator *itr, address pc, re // ---------------------------------------------------------------------------------------------------- // Implementation of RelocIterator -void RelocIterator::initialize(nmethod* nm, address begin, address limit) { +void RelocIterator::initialize(CompiledMethod* nm, address begin, address limit) { initialize_misc(); if (nm == NULL && begin != NULL) { // allow nmethod to be deduced from beginning address CodeBlob* cb = CodeCache::find_blob(begin); - nm = cb->as_nmethod_or_null(); + nm = cb->as_compiled_method_or_null(); } assert(nm != NULL, "must be able to deduce nmethod from other arguments"); diff --git a/hotspot/src/share/vm/code/relocInfo.hpp b/hotspot/src/share/vm/code/relocInfo.hpp index 86a454c153f..deaa38c2c1c 100644 --- a/hotspot/src/share/vm/code/relocInfo.hpp +++ b/hotspot/src/share/vm/code/relocInfo.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -28,6 +28,8 @@ #include "memory/allocation.hpp" #include "runtime/os.hpp" +class nmethod; +class CompiledMethod; class Metadata; class NativeMovConstReg; @@ -539,7 +541,7 @@ class RelocIterator : public StackObj { address _limit; // stop producing relocations after this _addr relocInfo* _current; // the current relocation information relocInfo* _end; // end marker; we're done iterating when _current == _end - nmethod* _code; // compiled method containing _addr + CompiledMethod* _code; // compiled method containing _addr address _addr; // instruction to which the relocation applies short _databuf; // spare buffer for compressed data short* _data; // pointer to the relocation's data @@ -570,13 +572,13 @@ class RelocIterator : public StackObj { void initialize_misc(); - void initialize(nmethod* nm, address begin, address limit); + void initialize(CompiledMethod* nm, address begin, address limit); RelocIterator() { initialize_misc(); } public: // constructor - RelocIterator(nmethod* nm, address begin = NULL, address limit = NULL); + RelocIterator(CompiledMethod* nm, address begin = NULL, address limit = NULL); RelocIterator(CodeSection* cb, address begin = NULL, address limit = NULL); // get next reloc info, return !eos @@ -611,7 +613,8 @@ class RelocIterator : public StackObj { relocType type() const { return current()->type(); } int format() const { return (relocInfo::have_format) ? current()->format() : 0; } address addr() const { return _addr; } - nmethod* code() const { return _code; } + CompiledMethod* code() const { return _code; } + nmethod* code_as_nmethod() const; short* data() const { return _data; } int datalen() const { return _datalen; } bool has_current() const { return _datalen >= 0; } @@ -810,9 +813,10 @@ class Relocation VALUE_OBJ_CLASS_SPEC { public: // accessors which only make sense for a bound Relocation - address addr() const { return binding()->addr(); } - nmethod* code() const { return binding()->code(); } - bool addr_in_const() const { return binding()->addr_in_const(); } + address addr() const { return binding()->addr(); } + CompiledMethod* code() const { return binding()->code(); } + nmethod* code_as_nmethod() const { return binding()->code_as_nmethod(); } + bool addr_in_const() const { return binding()->addr_in_const(); } protected: short* data() const { return binding()->data(); } int datalen() const { return binding()->datalen(); } @@ -1371,7 +1375,7 @@ inline name##_Relocation* RelocIterator::name##_reloc() { \ APPLY_TO_RELOCATIONS(EACH_CASE); #undef EACH_CASE -inline RelocIterator::RelocIterator(nmethod* nm, address begin, address limit) { +inline RelocIterator::RelocIterator(CompiledMethod* nm, address begin, address limit) { initialize(nm, begin, limit); } diff --git a/hotspot/src/share/vm/code/scopeDesc.cpp b/hotspot/src/share/vm/code/scopeDesc.cpp index 55d4eb9830e..27eb37ad550 100644 --- a/hotspot/src/share/vm/code/scopeDesc.cpp +++ b/hotspot/src/share/vm/code/scopeDesc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -30,7 +30,7 @@ #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" -ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) { +ScopeDesc::ScopeDesc(const CompiledMethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) { _code = code; _decode_offset = decode_offset; _objects = decode_object_values(obj_decode_offset); @@ -40,7 +40,7 @@ ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offs decode_body(); } -ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) { +ScopeDesc::ScopeDesc(const CompiledMethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) { _code = code; _decode_offset = decode_offset; _objects = decode_object_values(DebugInformationRecorder::serialized_null); diff --git a/hotspot/src/share/vm/code/scopeDesc.hpp b/hotspot/src/share/vm/code/scopeDesc.hpp index 57082c08350..d1eaaac7426 100644 --- a/hotspot/src/share/vm/code/scopeDesc.hpp +++ b/hotspot/src/share/vm/code/scopeDesc.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -41,7 +41,7 @@ class SimpleScopeDesc : public StackObj { int _bci; public: - SimpleScopeDesc(nmethod* code, address pc) { + SimpleScopeDesc(CompiledMethod* code, address pc) { PcDesc* pc_desc = code->pc_desc_at(pc); assert(pc_desc != NULL, "Must be able to find matching PcDesc"); DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset()); @@ -60,12 +60,12 @@ class SimpleScopeDesc : public StackObj { class ScopeDesc : public ResourceObj { public: // Constructor - ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop); + ScopeDesc(const CompiledMethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop); // Calls above, giving default value of "serialized_null" to the // "obj_decode_offset" argument. (We don't use a default argument to // avoid a .hpp-.hpp dependency.) - ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop); + ScopeDesc(const CompiledMethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop); // JVM state Method* method() const { return _method; } @@ -110,7 +110,7 @@ class ScopeDesc : public ResourceObj { GrowableArray* _objects; // Nmethod information - const nmethod* _code; + const CompiledMethod* _code; // Decoding operations void decode_body(); diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp index c4758b2e183..22934de31aa 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.cpp +++ b/hotspot/src/share/vm/compiler/compileBroker.cpp @@ -169,6 +169,8 @@ long CompileBroker::_peak_compilation_time = 0; CompileQueue* CompileBroker::_c2_compile_queue = NULL; CompileQueue* CompileBroker::_c1_compile_queue = NULL; + + class CompilationLog : public StringEventLog { public: CompilationLog() : StringEventLog("Compilation events") { @@ -844,7 +846,7 @@ void CompileBroker::compile_method_base(const methodHandle& method, int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, + CompileTask::CompileReason compile_reason, bool blocking, Thread* thread) { guarantee(!method->is_abstract(), "cannot compile abstract methods"); @@ -860,7 +862,7 @@ void CompileBroker::compile_method_base(const methodHandle& method, if (osr_bci != InvocationEntryBci) { tty->print(" osr_bci: %d", osr_bci); } - tty->print(" level: %d comment: %s count: %d", comp_level, comment, hot_count); + tty->print(" level: %d comment: %s count: %d", comp_level, CompileTask::reason_name(compile_reason), hot_count); if (!hot_method.is_null()) { tty->print(" hot: "); if (hot_method() != method()) { @@ -1024,7 +1026,7 @@ void CompileBroker::compile_method_base(const methodHandle& method, task = create_compile_task(queue, compile_id, method, osr_bci, comp_level, - hot_method, hot_count, comment, + hot_method, hot_count, compile_reason, blocking); } @@ -1036,15 +1038,18 @@ void CompileBroker::compile_method_base(const methodHandle& method, nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, Thread* THREAD) { - // do nothing if compilebroker is not available - if (!_initialized) { + CompileTask::CompileReason compile_reason, + Thread* THREAD) { + // Do nothing if compilebroker is not initalized or compiles are submitted on level none + if (!_initialized || comp_level == CompLevel_none) { return NULL; } + AbstractCompiler *comp = CompileBroker::compiler(comp_level); - assert(comp != NULL, "Ensure we don't compile before compilebroker init"); + assert(comp != NULL, "Ensure we have a compiler"); + DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp); - nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, comment, directive, THREAD); + nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, directive, THREAD); DirectivesStack::release(directive); return nm; } @@ -1052,7 +1057,8 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, DirectiveSet* directive, + CompileTask::CompileReason compile_reason, + DirectiveSet* directive, Thread* THREAD) { // make sure arguments make sense @@ -1060,6 +1066,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); + assert(!TieredCompilation || comp_level <= TieredStopAtLevel, "Invalid compilation level"); // allow any levels for WhiteBox assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); // return quickly if possible @@ -1074,10 +1081,10 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, if (osr_bci == InvocationEntryBci) { // standard compilation - nmethod* method_code = method->code(); - if (method_code != NULL) { + CompiledMethod* method_code = method->code(); + if (method_code != NULL && method_code->is_nmethod()) { if (compilation_is_complete(method, osr_bci, comp_level)) { - return method_code; + return (nmethod*) method_code; } } if (method->is_not_compilable(comp_level)) { @@ -1177,13 +1184,18 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci, return NULL; } bool is_blocking = !directive->BackgroundCompilationOption || CompileTheWorld || ReplayCompiles; - compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, is_blocking, THREAD); + compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, is_blocking, THREAD); } // return requested nmethod // We accept a higher level osr method if (osr_bci == InvocationEntryBci) { - return method->code(); + CompiledMethod* code = method->code(); + if (code == NULL) { + return (nmethod*) code; + } else { + return code->as_nmethod_or_null(); + } } return method->lookup_osr_nmethod_for(osr_bci, comp_level, false); } @@ -1208,7 +1220,7 @@ bool CompileBroker::compilation_is_complete(const methodHandle& method, if (method->is_not_compilable(comp_level)) { return true; } else { - nmethod* result = method->code(); + CompiledMethod* result = method->code(); if (result == NULL) return false; return comp_level == result->comp_level(); } @@ -1336,11 +1348,11 @@ CompileTask* CompileBroker::create_compile_task(CompileQueue* queue, int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, + CompileTask::CompileReason compile_reason, bool blocking) { CompileTask* new_task = CompileTask::allocate(); new_task->initialize(compile_id, method, osr_bci, comp_level, - hot_method, hot_count, comment, + hot_method, hot_count, compile_reason, blocking); queue->add(new_task); return new_task; diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp index 01a85b59dd0..b399078e973 100644 --- a/hotspot/src/share/vm/compiler/compileBroker.hpp +++ b/hotspot/src/share/vm/compiler/compileBroker.hpp @@ -232,7 +232,7 @@ class CompileBroker: AllStatic { int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, + CompileTask::CompileReason compile_reason, bool blocking); static void wait_for_completion(CompileTask* task); #if INCLUDE_JVMCI @@ -251,7 +251,7 @@ class CompileBroker: AllStatic { int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, + CompileTask::CompileReason compile_reason, bool blocking, Thread* thread); @@ -289,14 +289,15 @@ public: int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, Thread* thread); + CompileTask::CompileReason compile_reason, + Thread* thread); static nmethod* compile_method(const methodHandle& method, int osr_bci, int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, + CompileTask::CompileReason compile_reason, DirectiveSet* directive, Thread* thread); diff --git a/hotspot/src/share/vm/compiler/compileTask.cpp b/hotspot/src/share/vm/compiler/compileTask.cpp index 75dbd83d6a1..9c3ea04a3ad 100644 --- a/hotspot/src/share/vm/compiler/compileTask.cpp +++ b/hotspot/src/share/vm/compiler/compileTask.cpp @@ -82,7 +82,7 @@ void CompileTask::initialize(int compile_id, int comp_level, const methodHandle& hot_method, int hot_count, - const char* comment, + CompileTask::CompileReason compile_reason, bool is_blocking) { assert(!_lock->is_locked(), "bad locking"); @@ -104,7 +104,7 @@ void CompileTask::initialize(int compile_id, _hot_method_holder = NULL; _hot_count = hot_count; _time_queued = 0; // tidy - _comment = comment; + _compile_reason = compile_reason; _failure_reason = NULL; if (LogCompilation) { @@ -135,7 +135,11 @@ AbstractCompiler* CompileTask::compiler() { // nmethod* CompileTask::code() const { if (_code_handle == NULL) return NULL; - return _code_handle->code(); + CodeBlob *blob = _code_handle->code(); + if (blob != NULL) { + return blob->as_nmethod(); + } + return NULL; } void CompileTask::set_code(nmethod* nm) { @@ -305,9 +309,9 @@ void CompileTask::log_task_queued() { xtty->begin_elem("task_queued"); log_task(xtty); - if (_comment != NULL) { - xtty->print(" comment='%s'", _comment); - } + assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values"); + xtty->print(" comment='%s'", reason_name(_compile_reason)); + if (_hot_method != NULL) { methodHandle hot(thread, _hot_method); methodHandle method(thread, _method); @@ -436,3 +440,5 @@ void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int i } st->cr(); } + + diff --git a/hotspot/src/share/vm/compiler/compileTask.hpp b/hotspot/src/share/vm/compiler/compileTask.hpp index 1725b83fe32..79a75b51826 100644 --- a/hotspot/src/share/vm/compiler/compileTask.hpp +++ b/hotspot/src/share/vm/compiler/compileTask.hpp @@ -40,6 +40,39 @@ class CompileTask : public CHeapObj { friend class VMStructs; friend class JVMCIVMStructs; + public: + // Different reasons for a compilation + // The order is important - Reason_Whitebox and higher can not become + // stale, see CompileTask::can_become_stale() + // Also mapped to reason_names[] + enum CompileReason { + Reason_None, + Reason_InvocationCount, // Simple/StackWalk-policy + Reason_BackedgeCount, // Simple/StackWalk-policy + Reason_Tiered, // Tiered-policy + Reason_CTW, // Compile the world + Reason_Replay, // ciReplay + Reason_Whitebox, // Whitebox API + Reason_MustBeCompiled, // Java callHelper, LinkResolver + Reason_Bootstrap, // JVMCI bootstrap + Reason_Count + }; + + static const char* reason_name(CompileTask::CompileReason compile_reason) { + static const char* reason_names[] = { + "no_reason", + "count", + "backedge_count", + "tiered", + "CTW", + "replay", + "whitebox", + "must_be_compiled", + "bootstrap" + }; + return reason_names[compile_reason]; + } + private: static CompileTask* _task_free_list; #ifdef ASSERT @@ -69,7 +102,7 @@ class CompileTask : public CHeapObj { Method* _hot_method; // which method actually triggered this task jobject _hot_method_holder; int _hot_count; // information about its invocation counter - const char* _comment; // more info about the task + CompileReason _compile_reason; // more info about the task const char* _failure_reason; public: @@ -78,8 +111,8 @@ class CompileTask : public CHeapObj { } void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level, - const methodHandle& hot_method, int hot_count, const char* comment, - bool is_blocking); + const methodHandle& hot_method, int hot_count, + CompileTask::CompileReason compile_reason, bool is_blocking); static CompileTask* allocate(); static void free(CompileTask* task); @@ -91,6 +124,15 @@ class CompileTask : public CHeapObj { bool is_complete() const { return _is_complete; } bool is_blocking() const { return _is_blocking; } bool is_success() const { return _is_success; } + bool can_become_stale() const { + switch (_compile_reason) { + case Reason_BackedgeCount: + case Reason_InvocationCount: + case Reason_Tiered: + return !_is_blocking; + } + return false; + } #if INCLUDE_JVMCI bool has_waiter() const { return _has_waiter; } void clear_waiter() { _has_waiter = false; } diff --git a/hotspot/src/share/vm/compiler/directivesParser.cpp b/hotspot/src/share/vm/compiler/directivesParser.cpp index 60a935be5a2..036357fc7f7 100644 --- a/hotspot/src/share/vm/compiler/directivesParser.cpp +++ b/hotspot/src/share/vm/compiler/directivesParser.cpp @@ -57,7 +57,7 @@ void DirectivesParser::clean_tmp() { } int DirectivesParser::parse_string(const char* text, outputStream* st) { - DirectivesParser cd(text, st); + DirectivesParser cd(text, st, false); if (cd.valid()) { return cd.install_directives(); } else { @@ -132,8 +132,8 @@ int DirectivesParser::install_directives() { } } -DirectivesParser::DirectivesParser(const char* text, outputStream* st) -: JSON(text, false, st), depth(0), current_directive(NULL), current_directiveset(NULL), _tmp_top(NULL), _tmp_depth(0) { +DirectivesParser::DirectivesParser(const char* text, outputStream* st, bool silent) +: JSON(text, silent, st), depth(0), current_directive(NULL), current_directiveset(NULL), _tmp_top(NULL), _tmp_depth(0) { #ifndef PRODUCT memset(stack, 0, MAX_DEPTH * sizeof(stack[0])); #endif @@ -594,7 +594,7 @@ bool DirectivesParser::callback(JSON_TYPE t, JSON_VAL* v, uint rlimit) { #ifndef PRODUCT void DirectivesParser::test(const char* text, bool should_pass) { - DirectivesParser cd(text, tty); + DirectivesParser cd(text, tty, !VerboseInternalVMTests); if (should_pass) { assert(cd.valid() == true, "failed on a valid DirectivesParser string"); if (VerboseInternalVMTests) { diff --git a/hotspot/src/share/vm/compiler/directivesParser.hpp b/hotspot/src/share/vm/compiler/directivesParser.hpp index e7c404b5b3d..ef0b48b20be 100644 --- a/hotspot/src/share/vm/compiler/directivesParser.hpp +++ b/hotspot/src/share/vm/compiler/directivesParser.hpp @@ -55,7 +55,7 @@ public: int install_directives(); private: - DirectivesParser(const char* text, outputStream* st); + DirectivesParser(const char* text, outputStream* st, bool silent); ~DirectivesParser(); bool callback(JSON_TYPE t, JSON_VAL* v, uint level); diff --git a/hotspot/src/share/vm/compiler/methodLiveness.cpp b/hotspot/src/share/vm/compiler/methodLiveness.cpp index 177c72fee9c..e68d1244f75 100644 --- a/hotspot/src/share/vm/compiler/methodLiveness.cpp +++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp @@ -131,13 +131,13 @@ elapsedTimer MethodLiveness::_time_total; MethodLiveness::MethodLiveness(Arena* arena, ciMethod* method) #ifdef COMPILER1 - : _bci_block_start((uintptr_t*)arena->Amalloc((method->code_size() >> LogBitsPerByte) + 1), method->code_size()) + : _bci_block_start(arena, method->code_size()) #endif { _arena = arena; _method = method; _bit_map_size_bits = method->max_locals(); - _bit_map_size_words = (_bit_map_size_bits / sizeof(unsigned int)) + 1; + #ifdef COMPILER1 _bci_block_start.clear(); @@ -475,7 +475,7 @@ MethodLivenessResult MethodLiveness::get_liveness_at(int entry_bci) { bci = 0; } - MethodLivenessResult answer((BitMap::bm_word_t*)NULL,0); + MethodLivenessResult answer; if (_block_count > 0) { if (TimeLivenessAnalysis) _time_total.start(); @@ -574,16 +574,11 @@ void MethodLiveness::print_times() { MethodLiveness::BasicBlock::BasicBlock(MethodLiveness *analyzer, int start, int limit) : - _gen((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()), - analyzer->bit_map_size_bits()), - _kill((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()), - analyzer->bit_map_size_bits()), - _entry((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()), - analyzer->bit_map_size_bits()), - _normal_exit((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()), - analyzer->bit_map_size_bits()), - _exception_exit((uintptr_t*)analyzer->arena()->Amalloc(BytesPerWord * analyzer->bit_map_size_words()), - analyzer->bit_map_size_bits()), + _gen(analyzer->arena(), analyzer->bit_map_size_bits()), + _kill(analyzer->arena(), analyzer->bit_map_size_bits()), + _entry(analyzer->arena(), analyzer->bit_map_size_bits()), + _normal_exit(analyzer->arena(), analyzer->bit_map_size_bits()), + _exception_exit(analyzer->arena(), analyzer->bit_map_size_bits()), _last_bci(-1) { _analyzer = analyzer; _start_bci = start; @@ -991,17 +986,16 @@ void MethodLiveness::BasicBlock::propagate(MethodLiveness *ml) { } } -bool MethodLiveness::BasicBlock::merge_normal(BitMap other) { +bool MethodLiveness::BasicBlock::merge_normal(const BitMap& other) { return _normal_exit.set_union_with_result(other); } -bool MethodLiveness::BasicBlock::merge_exception(BitMap other) { +bool MethodLiveness::BasicBlock::merge_exception(const BitMap& other) { return _exception_exit.set_union_with_result(other); } MethodLivenessResult MethodLiveness::BasicBlock::get_liveness_at(ciMethod* method, int bci) { - MethodLivenessResult answer(NEW_RESOURCE_ARRAY(BitMap::bm_word_t, _analyzer->bit_map_size_words()), - _analyzer->bit_map_size_bits()); + MethodLivenessResult answer(_analyzer->bit_map_size_bits()); answer.set_is_valid(); #ifndef ASSERT @@ -1013,8 +1007,8 @@ MethodLivenessResult MethodLiveness::BasicBlock::get_liveness_at(ciMethod* metho #ifdef ASSERT ResourceMark rm; - BitMap g(_gen.size()); g.set_from(_gen); - BitMap k(_kill.size()); k.set_from(_kill); + ResourceBitMap g(_gen.size()); g.set_from(_gen); + ResourceBitMap k(_kill.size()); k.set_from(_kill); #endif if (_last_bci != bci || trueInDebug) { ciBytecodeStream bytes(method); diff --git a/hotspot/src/share/vm/compiler/methodLiveness.hpp b/hotspot/src/share/vm/compiler/methodLiveness.hpp index 0a63d2a19dd..60ad42a70e6 100644 --- a/hotspot/src/share/vm/compiler/methodLiveness.hpp +++ b/hotspot/src/share/vm/compiler/methodLiveness.hpp @@ -30,18 +30,18 @@ class ciMethod; -class MethodLivenessResult : public BitMap { +class MethodLivenessResult : public ResourceBitMap { private: bool _is_valid; public: - MethodLivenessResult(BitMap::bm_word_t* map, idx_t size_in_bits) - : BitMap(map, size_in_bits) + MethodLivenessResult() + : ResourceBitMap() , _is_valid(false) {} MethodLivenessResult(idx_t size_in_bits) - : BitMap(size_in_bits) + : ResourceBitMap(size_in_bits) , _is_valid(false) {} @@ -66,23 +66,23 @@ class MethodLiveness : public ResourceObj { int _limit_bci; // The liveness at the start of the block; - BitMap _entry; + ArenaBitMap _entry; // The summarized liveness effects of our direct successors reached // by normal control flow - BitMap _normal_exit; + ArenaBitMap _normal_exit; // The summarized liveness effects of our direct successors reached // by exceptional control flow - BitMap _exception_exit; + ArenaBitMap _exception_exit; // These members hold the results of the last call to // compute_gen_kill_range(). _gen is the set of locals // used before they are defined in the range. _kill is the // set of locals defined before they are used. - BitMap _gen; - BitMap _kill; - int _last_bci; + ArenaBitMap _gen; + ArenaBitMap _kill; + int _last_bci; // A list of all blocks which could come directly before this one // in normal (non-exceptional) control flow. We propagate liveness @@ -100,11 +100,11 @@ class MethodLiveness : public ResourceObj { // Our successors call this method to merge liveness information into // our _normal_exit member. - bool merge_normal(BitMap other); + bool merge_normal(const BitMap& other); // Our successors call this method to merge liveness information into // our _exception_exit member. - bool merge_exception(BitMap other); + bool merge_exception(const BitMap& other); // This helper routine is used to help compute the gen/kill pair for // the block. It is also used to answer queries. @@ -181,7 +181,6 @@ class MethodLiveness : public ResourceObj { // The size of a BitMap. int _bit_map_size_bits; - int _bit_map_size_words; // A list of all BasicBlocks. BasicBlock **_block_list; @@ -198,7 +197,7 @@ class MethodLiveness : public ResourceObj { #ifdef COMPILER1 // bcis where blocks start are marked - BitMap _bci_block_start; + ArenaBitMap _bci_block_start; #endif // COMPILER1 // -- Graph construction & Analysis @@ -218,7 +217,6 @@ class MethodLiveness : public ResourceObj { // And accessors. int bit_map_size_bits() const { return _bit_map_size_bits; } - int bit_map_size_words() const { return _bit_map_size_words; } // Work list manipulation routines. Called internally by BasicBlock. BasicBlock *work_list_get(); @@ -270,7 +268,7 @@ class MethodLiveness : public ResourceObj { MethodLivenessResult get_liveness_at(int bci); #ifdef COMPILER1 - const BitMap get_bci_block_start() const { return _bci_block_start; } + const BitMap& get_bci_block_start() const { return _bci_block_start; } #endif // COMPILER1 static void print_times() PRODUCT_RETURN; diff --git a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp index 9e67c9b39e3..af5e47dc2d7 100644 --- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp @@ -1019,7 +1019,7 @@ ConcurrentMarkSweepGeneration::par_promote(int thread_num, return NULL; } } - assert(promoInfo->has_spooling_space(), "Control point invariant"); + assert(!promoInfo->tracking() || promoInfo->has_spooling_space(), "Control point invariant"); const size_t alloc_sz = CompactibleFreeListSpace::adjustObjectSize(word_sz); HeapWord* obj_ptr = ps->lab.alloc(alloc_sz); if (obj_ptr == NULL) { @@ -1094,6 +1094,12 @@ par_oop_since_save_marks_iterate_done(int thread_num) { CMSParGCThreadState* ps = _par_gc_thread_states[thread_num]; ParScanWithoutBarrierClosure* dummy_cl = NULL; ps->promo.promoted_oops_iterate_nv(dummy_cl); + + // Because card-scanning has been completed, subsequent phases + // (e.g., reference processing) will not need to recognize which + // objects have been promoted during this GC. So, we can now disable + // promotion tracking. + ps->promo.stopTrackingPromotions(); } bool ConcurrentMarkSweepGeneration::should_collect(bool full, @@ -2032,6 +2038,12 @@ void ConcurrentMarkSweepGeneration::gc_prologue(bool full) { _capacity_at_prologue = capacity(); _used_at_prologue = used(); + // We enable promotion tracking so that card-scanning can recognize + // which objects have been promoted during this GC and skip them. + for (uint i = 0; i < ParallelGCThreads; i++) { + _par_gc_thread_states[i]->promo.startTrackingPromotions(); + } + // Delegate to CMScollector which knows how to coordinate between // this and any other CMS generations that it is responsible for // collecting. @@ -2118,9 +2130,15 @@ void CMSCollector::gc_epilogue(bool full) { void ConcurrentMarkSweepGeneration::gc_epilogue(bool full) { collector()->gc_epilogue(full); - // Also reset promotion tracking in par gc thread states. + // When using ParNew, promotion tracking should have already been + // disabled. However, the prologue (which enables promotion + // tracking) and epilogue are called irrespective of the type of + // GC. So they will also be called before and after Full GCs, during + // which promotion tracking will not be explicitly disabled. So, + // it's safer to also disable it here too (to be symmetric with + // enabling it in the prologue). for (uint i = 0; i < ParallelGCThreads; i++) { - _par_gc_thread_states[i]->promo.stopTrackingPromotions(i); + _par_gc_thread_states[i]->promo.stopTrackingPromotions(); } } @@ -2431,9 +2449,6 @@ void CMSCollector::verify_after_remark_work_2() { void ConcurrentMarkSweepGeneration::save_marks() { // delegate to CMS space cmsSpace()->save_marks(); - for (uint i = 0; i < ParallelGCThreads; i++) { - _par_gc_thread_states[i]->promo.startTrackingPromotions(); - } } bool ConcurrentMarkSweepGeneration::no_allocs_since_save_marks() { @@ -2769,10 +2784,10 @@ class CMSParMarkTask : public AbstractGangTask { _collector(collector), _n_workers(n_workers) {} // Work method in support of parallel rescan ... of young gen spaces - void do_young_space_rescan(uint worker_id, OopsInGenClosure* cl, + void do_young_space_rescan(OopsInGenClosure* cl, ContiguousSpace* space, HeapWord** chunk_array, size_t chunk_top); - void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl); + void work_on_young_gen_roots(OopsInGenClosure* cl); }; // Parallel initial mark task @@ -4255,7 +4270,7 @@ void CMSParInitialMarkTask::work(uint worker_id) { // ---------- young gen roots -------------- { - work_on_young_gen_roots(worker_id, &par_mri_cl); + work_on_young_gen_roots(&par_mri_cl); _timer.stop(); log_trace(gc, task)("Finished young gen initial mark scan work in %dth thread: %3.3f sec", worker_id, _timer.seconds()); } @@ -4346,7 +4361,7 @@ class RemarkKlassClosure : public KlassClosure { } }; -void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) { +void CMSParMarkTask::work_on_young_gen_roots(OopsInGenClosure* cl) { ParNewGeneration* young_gen = _collector->_young_gen; ContiguousSpace* eden_space = young_gen->eden(); ContiguousSpace* from_space = young_gen->from(); @@ -4360,9 +4375,9 @@ void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* c assert(ect <= _collector->_eden_chunk_capacity, "out of bounds"); assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds"); - do_young_space_rescan(worker_id, cl, to_space, NULL, 0); - do_young_space_rescan(worker_id, cl, from_space, sca, sct); - do_young_space_rescan(worker_id, cl, eden_space, eca, ect); + do_young_space_rescan(cl, to_space, NULL, 0); + do_young_space_rescan(cl, from_space, sca, sct); + do_young_space_rescan(cl, eden_space, eca, ect); } // work_queue(i) is passed to the closure @@ -4389,7 +4404,7 @@ void CMSParRemarkTask::work(uint worker_id) { // work first. // ---------- young gen roots -------------- { - work_on_young_gen_roots(worker_id, &par_mrias_cl); + work_on_young_gen_roots(&par_mrias_cl); _timer.stop(); log_trace(gc, task)("Finished young gen rescan work in %dth thread: %3.3f sec", worker_id, _timer.seconds()); } @@ -4471,9 +4486,8 @@ void CMSParRemarkTask::work(uint worker_id) { log_trace(gc, task)("Finished work stealing in %dth thread: %3.3f sec", worker_id, _timer.seconds()); } -// Note that parameter "i" is not used. void -CMSParMarkTask::do_young_space_rescan(uint worker_id, +CMSParMarkTask::do_young_space_rescan( OopsInGenClosure* cl, ContiguousSpace* space, HeapWord** chunk_array, size_t chunk_top) { // Until all tasks completed: @@ -5667,10 +5681,9 @@ bool CMSBitMap::allocate(MemRegion mr) { } assert(_virtual_space.committed_size() == brs.size(), "didn't reserve backing store for all of CMS bit map?"); - _bm.set_map((BitMap::bm_word_t*)_virtual_space.low()); assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >= _bmWordSize, "inconsistency in bit map sizing"); - _bm.set_size(_bmWordSize >> _shifter); + _bm = BitMapView((BitMap::bm_word_t*)_virtual_space.low(), _bmWordSize >> _shifter); // bm.clear(); // can we rely on getting zero'd memory? verify below assert(isAllClear(), diff --git a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp index 29636c60060..cedd3e431d4 100644 --- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp @@ -83,13 +83,12 @@ class SerialOldTracer; class CMSBitMap VALUE_OBJ_CLASS_SPEC { friend class VMStructs; - HeapWord* _bmStartWord; // base address of range covered by map - size_t _bmWordSize; // map size (in #HeapWords covered) - const int _shifter; // shifts to convert HeapWord to bit position + HeapWord* _bmStartWord; // base address of range covered by map + size_t _bmWordSize; // map size (in #HeapWords covered) + const int _shifter; // shifts to convert HeapWord to bit position VirtualSpace _virtual_space; // underlying the bit map - BitMap _bm; // the bit map itself - public: - Mutex* const _lock; // mutex protecting _bm; + BitMapView _bm; // the bit map itself + Mutex* const _lock; // mutex protecting _bm; public: // constructor diff --git a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp index ff88d1541be..adf515623bf 100644 --- a/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc/cms/parNewGeneration.cpp @@ -287,7 +287,7 @@ void ParScanThreadState::print_promotion_failure_size() { } } -class ParScanThreadStateSet: private ResourceArray { +class ParScanThreadStateSet: StackObj { public: // Initializes states for the specified number of threads; ParScanThreadStateSet(int num_threads, @@ -322,8 +322,10 @@ private: ParallelTaskTerminator& _term; ParNewGeneration& _young_gen; Generation& _old_gen; + ParScanThreadState* _per_thread_states; + const int _num_threads; public: - bool is_valid(int id) const { return id < length(); } + bool is_valid(int id) const { return id < _num_threads; } ParallelTaskTerminator* terminator() { return &_term; } }; @@ -336,30 +338,31 @@ ParScanThreadStateSet::ParScanThreadStateSet(int num_threads, PreservedMarksSet& preserved_marks_set, size_t desired_plab_sz, ParallelTaskTerminator& term) - : ResourceArray(sizeof(ParScanThreadState), num_threads), - _young_gen(young_gen), + : _young_gen(young_gen), _old_gen(old_gen), - _term(term) + _term(term), + _per_thread_states(NEW_RESOURCE_ARRAY(ParScanThreadState, num_threads)), + _num_threads(num_threads) { assert(num_threads > 0, "sanity check!"); assert(ParGCUseLocalOverflow == (overflow_stacks != NULL), "overflow_stack allocation mismatch"); // Initialize states. for (int i = 0; i < num_threads; ++i) { - new ((ParScanThreadState*)_data + i) - ParScanThreadState(&to_space, &young_gen, &old_gen, i, &queue_set, - overflow_stacks, preserved_marks_set.get(i), - desired_plab_sz, term); + new(_per_thread_states + i) + ParScanThreadState(&to_space, &young_gen, &old_gen, i, &queue_set, + overflow_stacks, preserved_marks_set.get(i), + desired_plab_sz, term); } } inline ParScanThreadState& ParScanThreadStateSet::thread_state(int i) { - assert(i >= 0 && i < length(), "sanity check!"); - return ((ParScanThreadState*)_data)[i]; + assert(i >= 0 && i < _num_threads, "sanity check!"); + return _per_thread_states[i]; } void ParScanThreadStateSet::trace_promotion_failed(const YoungGCTracer* gc_tracer) { - for (int i = 0; i < length(); ++i) { + for (int i = 0; i < _num_threads; ++i) { if (thread_state(i).promotion_failed()) { gc_tracer->report_promotion_failed(thread_state(i).promotion_failed_info()); thread_state(i).promotion_failed_info().reset(); @@ -370,7 +373,7 @@ void ParScanThreadStateSet::trace_promotion_failed(const YoungGCTracer* gc_trace void ParScanThreadStateSet::reset(uint active_threads, bool promotion_failed) { _term.reset_for_reuse(active_threads); if (promotion_failed) { - for (int i = 0; i < length(); ++i) { + for (int i = 0; i < _num_threads; ++i) { thread_state(i).print_promotion_failure_size(); } } @@ -385,7 +388,7 @@ void ParScanThreadState::reset_stats() { } void ParScanThreadStateSet::reset_stats() { - for (int i = 0; i < length(); ++i) { + for (int i = 0; i < _num_threads; ++i) { thread_state(i).reset_stats(); } } @@ -408,7 +411,7 @@ void ParScanThreadStateSet::print_termination_stats() { print_termination_stats_hdr(st); - for (int i = 0; i < length(); ++i) { + for (int i = 0; i < _num_threads; ++i) { const ParScanThreadState & pss = thread_state(i); const double elapsed_ms = pss.elapsed_time() * 1000.0; const double s_roots_ms = pss.strong_roots_time() * 1000.0; @@ -436,7 +439,7 @@ void ParScanThreadStateSet::print_taskqueue_stats() { print_taskqueue_stats_hdr(st); TaskQueueStats totals; - for (int i = 0; i < length(); ++i) { + for (int i = 0; i < _num_threads; ++i) { const ParScanThreadState & pss = thread_state(i); const TaskQueueStats & stats = pss.taskqueue_stats(); st->print("%3d ", i); stats.print(st); st->cr(); @@ -459,7 +462,7 @@ void ParScanThreadStateSet::flush() { // possible since this might otherwise become a bottleneck // to scaling. Should we add heavy-weight work into this // loop, consider parallelizing the loop into the worker threads. - for (int i = 0; i < length(); ++i) { + for (int i = 0; i < _num_threads; ++i) { ParScanThreadState& par_scan_state = thread_state(i); // Flush stats related to To-space PLAB activity and @@ -473,7 +476,6 @@ void ParScanThreadStateSet::flush() { // Inform old gen that we're done. _old_gen.par_promote_alloc_done(i); - _old_gen.par_oop_since_save_marks_iterate_done(i); } if (UseConcMarkSweepGC) { @@ -616,6 +618,16 @@ void ParNewGenTask::work(uint worker_id) { // "evacuate followers". par_scan_state.evacuate_followers_closure().do_void(); + + // This will collapse this worker's promoted object list that's + // created during the main ParNew parallel phase of ParNew. This has + // to be called after all workers have finished promoting objects + // and scanning promoted objects. It should be safe calling it from + // here, given that we can only reach here after all thread have + // offered termination, i.e., after there is no more work to be + // done. It will also disable promotion tracking for the rest of + // this GC as it's not necessary to be on during reference processing. + _old_gen->par_oop_since_save_marks_iterate_done((int) worker_id); } ParNewGeneration::ParNewGeneration(ReservedSpace rs, size_t initial_byte_size) diff --git a/hotspot/src/share/vm/gc/cms/promotionInfo.cpp b/hotspot/src/share/vm/gc/cms/promotionInfo.cpp index 92c5725361f..40b4b3916dc 100644 --- a/hotspot/src/share/vm/gc/cms/promotionInfo.cpp +++ b/hotspot/src/share/vm/gc/cms/promotionInfo.cpp @@ -252,13 +252,15 @@ SpoolBlock* PromotionInfo::getSpoolBlock() { } void PromotionInfo::startTrackingPromotions() { + assert(noPromotions(), "sanity"); assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex, "spooling inconsistency?"); _firstIndex = _nextIndex = 1; _tracking = true; } -void PromotionInfo::stopTrackingPromotions(uint worker_id) { +void PromotionInfo::stopTrackingPromotions() { + assert(noPromotions(), "we should have torn down the lists by now"); assert(_spoolHead == _spoolTail && _firstIndex == _nextIndex, "spooling inconsistency?"); _firstIndex = _nextIndex = 1; diff --git a/hotspot/src/share/vm/gc/cms/promotionInfo.hpp b/hotspot/src/share/vm/gc/cms/promotionInfo.hpp index 387da17ed95..90ca0626e50 100644 --- a/hotspot/src/share/vm/gc/cms/promotionInfo.hpp +++ b/hotspot/src/share/vm/gc/cms/promotionInfo.hpp @@ -144,7 +144,7 @@ class PromotionInfo VALUE_OBJ_CLASS_SPEC { return _promoHead == NULL; } void startTrackingPromotions(); - void stopTrackingPromotions(uint worker_id = 0); + void stopTrackingPromotions(); bool tracking() const { return _tracking; } void track(PromotedObject* trackOop); // keep track of a promoted oop // The following variant must be used when trackOop is not fully diff --git a/hotspot/src/share/vm/gc/cms/vmStructs_cms.hpp b/hotspot/src/share/vm/gc/cms/vmStructs_cms.hpp index e312d6b59db..5c9351bf83a 100644 --- a/hotspot/src/share/vm/gc/cms/vmStructs_cms.hpp +++ b/hotspot/src/share/vm/gc/cms/vmStructs_cms.hpp @@ -33,7 +33,7 @@ \ nonstatic_field(CMSBitMap, _bmWordSize, size_t) \ nonstatic_field(CMSBitMap, _shifter, const int) \ - nonstatic_field(CMSBitMap, _bm, BitMap) \ + nonstatic_field(CMSBitMap, _bm, BitMapView) \ nonstatic_field(CMSBitMap, _virtual_space, VirtualSpace) \ nonstatic_field(CMSCollector, _markBitMap, CMSBitMap) \ nonstatic_field(ConcurrentMarkSweepGeneration, _cmsSpace, CompactibleFreeListSpace*) \ diff --git a/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp b/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp index caa45950f62..cc9dbf46e67 100644 --- a/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp +++ b/hotspot/src/share/vm/gc/g1/collectionSetChooser.cpp @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "gc/g1/collectionSetChooser.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/shared/space.inline.hpp" #include "runtime/atomic.inline.hpp" diff --git a/hotspot/src/share/vm/gc/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc/g1/concurrentG1Refine.cpp index e67c8932a8b..06b3f1cae5f 100644 --- a/hotspot/src/share/vm/gc/g1/concurrentG1Refine.cpp +++ b/hotspot/src/share/vm/gc/g1/concurrentG1Refine.cpp @@ -25,10 +25,10 @@ #include "precompiled.hpp" #include "gc/g1/concurrentG1Refine.hpp" #include "gc/g1/concurrentG1RefineThread.hpp" -#include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1HotCardCache.hpp" -#include "gc/g1/g1Predictions.hpp" +#include "gc/g1/g1YoungRemSetSamplingThread.hpp" +#include "logging/log.hpp" #include "runtime/java.hpp" +#include "runtime/thread.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/pair.hpp" @@ -112,8 +112,7 @@ static Thresholds calc_thresholds(size_t green_zone, green_zone + deactivate_offset); } -ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h, - size_t green_zone, +ConcurrentG1Refine::ConcurrentG1Refine(size_t green_zone, size_t yellow_zone, size_t red_zone, size_t min_yellow_zone_size) : @@ -123,8 +122,7 @@ ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h, _green_zone(green_zone), _yellow_zone(yellow_zone), _red_zone(red_zone), - _min_yellow_zone_size(min_yellow_zone_size), - _hot_card_cache(g1h) + _min_yellow_zone_size(min_yellow_zone_size) { assert_zone_constraints_gyr(green_zone, yellow_zone, red_zone); } @@ -171,8 +169,7 @@ static size_t calc_init_red_zone(size_t green, size_t yellow) { return MIN2(yellow + size, max_red_zone); } -ConcurrentG1Refine* ConcurrentG1Refine::create(G1CollectedHeap* g1h, - CardTableEntryClosure* refine_closure, +ConcurrentG1Refine* ConcurrentG1Refine::create(CardTableEntryClosure* refine_closure, jint* ecode) { size_t min_yellow_zone_size = calc_min_yellow_zone_size(); size_t green_zone = calc_init_green_zone(); @@ -186,8 +183,7 @@ ConcurrentG1Refine* ConcurrentG1Refine::create(G1CollectedHeap* g1h, "min yellow size: " SIZE_FORMAT, green_zone, yellow_zone, red_zone, min_yellow_zone_size); - ConcurrentG1Refine* cg1r = new ConcurrentG1Refine(g1h, - green_zone, + ConcurrentG1Refine* cg1r = new ConcurrentG1Refine(green_zone, yellow_zone, red_zone, min_yellow_zone_size); @@ -241,10 +237,6 @@ ConcurrentG1Refine* ConcurrentG1Refine::create(G1CollectedHeap* g1h, return cg1r; } -void ConcurrentG1Refine::init(G1RegionToSpaceMapper* card_counts_storage) { - _hot_card_cache.initialize(card_counts_storage); -} - void ConcurrentG1Refine::stop() { for (uint i = 0; i < _n_worker_threads; i++) { _threads[i]->stop(); diff --git a/hotspot/src/share/vm/gc/g1/concurrentG1Refine.hpp b/hotspot/src/share/vm/gc/g1/concurrentG1Refine.hpp index 098d49e801d..9c3461ea107 100644 --- a/hotspot/src/share/vm/gc/g1/concurrentG1Refine.hpp +++ b/hotspot/src/share/vm/gc/g1/concurrentG1Refine.hpp @@ -25,20 +25,15 @@ #ifndef SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP #define SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP -#include "gc/g1/g1HotCardCache.hpp" -#include "gc/g1/g1YoungRemSetSamplingThread.hpp" #include "memory/allocation.hpp" -#include "runtime/thread.hpp" #include "utilities/globalDefinitions.hpp" // Forward decl +class CardTableEntryClosure; class ConcurrentG1RefineThread; -class G1CollectedHeap; -class G1HotCardCache; -class G1Predictions; -class G1RegionToSpaceMapper; -class G1RemSet; -class DirtyCardQueue; +class G1YoungRemSetSamplingThread; +class outputStream; +class ThreadClosure; class ConcurrentG1Refine: public CHeapObj { G1YoungRemSetSamplingThread* _sample_thread; @@ -67,11 +62,7 @@ class ConcurrentG1Refine: public CHeapObj { size_t _red_zone; size_t _min_yellow_zone_size; - // We delay the refinement of 'hot' cards using the hot card cache. - G1HotCardCache _hot_card_cache; - - ConcurrentG1Refine(G1CollectedHeap* g1h, - size_t green_zone, + ConcurrentG1Refine(size_t green_zone, size_t yellow_zone, size_t red_zone, size_t min_yellow_zone_size); @@ -89,9 +80,8 @@ class ConcurrentG1Refine: public CHeapObj { // Returns ConcurrentG1Refine instance if succeeded to create/initialize ConcurrentG1Refine and ConcurrentG1RefineThread. // Otherwise, returns NULL with error code. - static ConcurrentG1Refine* create(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure, jint* ecode); + static ConcurrentG1Refine* create(CardTableEntryClosure* refine_closure, jint* ecode); - void init(G1RegionToSpaceMapper* card_counts_storage); void stop(); void adjust(double update_rs_time, size_t update_rs_processed_buffers, double goal_ms); @@ -112,10 +102,6 @@ class ConcurrentG1Refine: public CHeapObj { size_t green_zone() const { return _green_zone; } size_t yellow_zone() const { return _yellow_zone; } size_t red_zone() const { return _red_zone; } - - G1HotCardCache* hot_card_cache() { return &_hot_card_cache; } - - static bool hot_card_cache_enabled() { return G1HotCardCache::default_use_cache(); } }; #endif // SHARE_VM_GC_G1_CONCURRENTG1REFINE_HPP diff --git a/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp b/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp index 8f9ebfbfb68..24826d50f74 100644 --- a/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp +++ b/hotspot/src/share/vm/gc/g1/concurrentG1RefineThread.cpp @@ -26,7 +26,6 @@ #include "gc/g1/concurrentG1Refine.hpp" #include "gc/g1/concurrentG1RefineThread.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/suspendibleThreadSet.hpp" #include "logging/log.hpp" #include "memory/resourceArea.hpp" diff --git a/hotspot/src/share/vm/gc/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc/g1/concurrentMarkThread.cpp index 9727b023268..469412245bf 100644 --- a/hotspot/src/share/vm/gc/g1/concurrentMarkThread.cpp +++ b/hotspot/src/share/vm/gc/g1/concurrentMarkThread.cpp @@ -27,9 +27,9 @@ #include "gc/g1/concurrentMarkThread.inline.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1MMUTracker.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/suspendibleThreadSet.hpp" #include "gc/g1/vm_operations_g1.hpp" #include "gc/shared/gcId.hpp" @@ -80,7 +80,7 @@ public: }; // Marking pauses can be scheduled flexibly, so we might delay marking to meet MMU. -void ConcurrentMarkThread::delay_to_keep_mmu(G1CollectorPolicy* g1_policy, bool remark) { +void ConcurrentMarkThread::delay_to_keep_mmu(G1Policy* g1_policy, bool remark) { const G1Analytics* analytics = g1_policy->analytics(); if (g1_policy->adaptive_young_list_length()) { double now = os::elapsedTime(); @@ -111,7 +111,7 @@ void ConcurrentMarkThread::run_service() { _vtime_start = os::elapsedVTime(); G1CollectedHeap* g1h = G1CollectedHeap::heap(); - G1CollectorPolicy* g1_policy = g1h->g1_policy(); + G1Policy* g1_policy = g1h->g1_policy(); while (!should_terminate()) { // wait until started is set. diff --git a/hotspot/src/share/vm/gc/g1/concurrentMarkThread.hpp b/hotspot/src/share/vm/gc/g1/concurrentMarkThread.hpp index 2bdd7f3116d..be24fe8cfcb 100644 --- a/hotspot/src/share/vm/gc/g1/concurrentMarkThread.hpp +++ b/hotspot/src/share/vm/gc/g1/concurrentMarkThread.hpp @@ -31,7 +31,7 @@ // as well as handling various marking cleanup. class G1ConcurrentMark; -class G1CollectorPolicy; +class G1Policy; class ConcurrentMarkThread: public ConcurrentGCThread { friend class VMStructs; @@ -51,7 +51,7 @@ class ConcurrentMarkThread: public ConcurrentGCThread { volatile State _state; void sleepBeforeNextCycle(); - void delay_to_keep_mmu(G1CollectorPolicy* g1_policy, bool remark); + void delay_to_keep_mmu(G1Policy* g1_policy, bool remark); void run_service(); void stop_service(); diff --git a/hotspot/src/share/vm/gc/g1/g1Allocator.cpp b/hotspot/src/share/vm/gc/g1/g1Allocator.cpp index ad5aa0c556c..92c00936dff 100644 --- a/hotspot/src/share/vm/gc/g1/g1Allocator.cpp +++ b/hotspot/src/share/vm/gc/g1/g1Allocator.cpp @@ -27,7 +27,6 @@ #include "gc/g1/g1AllocRegion.inline.hpp" #include "gc/g1/g1EvacStats.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1MarkSweep.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionSet.inline.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1Analytics.cpp b/hotspot/src/share/vm/gc/g1/g1Analytics.cpp index 16d4af949ce..c43b4169e49 100644 --- a/hotspot/src/share/vm/gc/g1/g1Analytics.cpp +++ b/hotspot/src/share/vm/gc/g1/g1Analytics.cpp @@ -284,6 +284,10 @@ double G1Analytics::predict_object_copy_time_ms(size_t bytes_to_copy, bool durin } } +double G1Analytics::predict_cost_per_byte_ms() const { + return get_new_prediction(_cost_per_byte_ms_seq); +} + double G1Analytics::predict_constant_other_time_ms() const { return get_new_prediction(_constant_other_time_ms_seq); } @@ -326,4 +330,3 @@ void G1Analytics::update_recent_gc_times(double end_time_sec, void G1Analytics::report_concurrent_mark_cleanup_times_ms(double ms) { _concurrent_mark_cleanup_times_ms->add(ms); } - diff --git a/hotspot/src/share/vm/gc/g1/g1Analytics.hpp b/hotspot/src/share/vm/gc/g1/g1Analytics.hpp index 603a751c198..a22d0dd72bd 100644 --- a/hotspot/src/share/vm/gc/g1/g1Analytics.hpp +++ b/hotspot/src/share/vm/gc/g1/g1Analytics.hpp @@ -149,6 +149,8 @@ public: size_t predict_rs_lengths() const; size_t predict_pending_cards() const; + double predict_cost_per_byte_ms() const; + // Add a new GC of the given duration and end time to the record. void update_recent_gc_times(double end_time_sec, double elapsed_ms); void compute_pause_time_ratio(double interval_ms, double pause_time_ms); diff --git a/hotspot/src/share/vm/gc/g1/g1CardCounts.cpp b/hotspot/src/share/vm/gc/g1/g1CardCounts.cpp index af078c2b9b8..efa35bce179 100644 --- a/hotspot/src/share/vm/gc/g1/g1CardCounts.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CardCounts.cpp @@ -25,8 +25,6 @@ #include "precompiled.hpp" #include "gc/g1/g1CardCounts.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" -#include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/shared/cardTableModRefBS.hpp" #include "services/memTracker.hpp" #include "utilities/copy.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp b/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp index 0a2ed25a29b..100b894ecc1 100644 --- a/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp @@ -28,6 +28,7 @@ #include "gc/g1/g1CardLiveData.inline.hpp" #include "gc/g1/suspendibleThreadSet.hpp" #include "gc/shared/workgroup.hpp" +#include "logging/log.hpp" #include "memory/universe.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/globals.hpp" @@ -38,6 +39,7 @@ G1CardLiveData::G1CardLiveData() : _max_capacity(0), _cards_per_region(0), + _gc_timestamp_at_create(0), _live_regions(NULL), _live_regions_size_in_bits(0), _live_cards(NULL), @@ -58,7 +60,7 @@ G1CardLiveData::bm_word_t* G1CardLiveData::allocate_large_bitmap(size_t size_in_ } void G1CardLiveData::free_large_bitmap(bm_word_t* bitmap, size_t size_in_bits) { - MmapArrayAllocator::free(bitmap, size_in_bits / BitsPerWord); + MmapArrayAllocator::free(bitmap, BitMap::calc_size_in_words(size_in_bits)); } void G1CardLiveData::initialize(size_t max_capacity, uint num_max_regions) { @@ -93,8 +95,8 @@ size_t G1CardLiveData::live_card_bitmap_size_in_bits() const { // information. class G1CardLiveDataHelper VALUE_OBJ_CLASS_SPEC { private: - BitMap _region_bm; - BitMap _card_bm; + BitMapView _region_bm; + BitMapView _card_bm; // The card number of the bottom of the G1 heap. // Used in biasing indices into accounting card bitmaps. @@ -127,6 +129,13 @@ private: // lots of work most of the time. BitMap::idx_t _last_marked_bit_idx; + void clear_card_bitmap_range(HeapWord* start, HeapWord* end) { + BitMap::idx_t start_idx = card_live_bitmap_index_for(start); + BitMap::idx_t end_idx = card_live_bitmap_index_for((HeapWord*)align_ptr_up(end, CardTableModRefBS::card_size)); + + _card_bm.clear_range(start_idx, end_idx); + } + // Mark the card liveness bitmap for the object spanning from start to end. void mark_card_bitmap_range(HeapWord* start, HeapWord* end) { BitMap::idx_t start_idx = card_live_bitmap_index_for(start); @@ -169,6 +178,10 @@ public: _region_bm.par_set_bit(hr->hrm_index()); } + void reset_live_data(HeapRegion* hr) { + clear_card_bitmap_range(hr->next_top_at_mark_start(), hr->end()); + } + // Mark the range of bits covered by allocations done since the last marking // in the given heap region, i.e. from NTAMS to top of the given region. // Returns if there has been some allocation in this region since the last marking. @@ -305,6 +318,8 @@ public: }; void G1CardLiveData::create(WorkGang* workers, G1CMBitMap* mark_bitmap) { + _gc_timestamp_at_create = G1CollectedHeap::heap()->get_gc_time_stamp(); + uint n_workers = workers->active_workers(); G1CreateCardLiveDataTask cl(mark_bitmap, @@ -322,14 +337,24 @@ class G1FinalizeCardLiveDataTask: public AbstractGangTask { class G1FinalizeCardLiveDataClosure: public HeapRegionClosure { private: G1CardLiveDataHelper _helper; + + uint _gc_timestamp_at_create; + + bool has_been_reclaimed(HeapRegion* hr) const { + return hr->get_gc_time_stamp() > _gc_timestamp_at_create; + } public: G1FinalizeCardLiveDataClosure(G1CollectedHeap* g1h, G1CMBitMap* bitmap, G1CardLiveData* live_data) : HeapRegionClosure(), - _helper(live_data, g1h->reserved_region().start()) { } + _helper(live_data, g1h->reserved_region().start()), + _gc_timestamp_at_create(live_data->gc_timestamp_at_create()) { } bool doHeapRegion(HeapRegion* hr) { + if (has_been_reclaimed(hr)) { + _helper.reset_live_data(hr); + } bool allocated_since_marking = _helper.mark_allocated_since_marking(hr); if (allocated_since_marking || hr->next_marked_bytes() > 0) { _helper.set_bit_for_region(hr); @@ -368,11 +393,11 @@ void G1CardLiveData::finalize(WorkGang* workers, G1CMBitMap* mark_bitmap) { } class G1ClearCardLiveDataTask : public AbstractGangTask { - BitMap _bitmap; - size_t _num_chunks; - size_t _cur_chunk; + BitMapView _bitmap; + size_t _num_chunks; + size_t _cur_chunk; public: - G1ClearCardLiveDataTask(BitMap bitmap, size_t num_tasks) : + G1ClearCardLiveDataTask(const BitMapView& bitmap, size_t num_tasks) : AbstractGangTask("G1 Clear Card Live Data"), _bitmap(bitmap), _num_chunks(num_tasks), @@ -399,9 +424,12 @@ void G1CardLiveData::clear(WorkGang* workers) { guarantee(Universe::is_fully_initialized(), "Should not call this during initialization."); size_t const num_chunks = align_size_up(live_cards_bm().size_in_bytes(), G1ClearCardLiveDataTask::chunk_size()) / G1ClearCardLiveDataTask::chunk_size(); + uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers()); G1ClearCardLiveDataTask cl(live_cards_bm(), num_chunks); - workers->run_task(&cl); + + log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks); + workers->run_task(&cl, num_workers); // The region live bitmap is always very small, even for huge heaps. Clear // directly. @@ -459,27 +487,26 @@ class G1VerifyCardLiveDataTask: public AbstractGangTask { // Verify the marked bytes for this region. if (exp_marked_bytes != act_marked_bytes) { + log_error(gc)("Expected marked bytes " SIZE_FORMAT " != actual marked bytes " SIZE_FORMAT " in region %u", exp_marked_bytes, act_marked_bytes, hr->hrm_index()); failures += 1; } else if (exp_marked_bytes > HeapRegion::GrainBytes) { + log_error(gc)("Expected marked bytes " SIZE_FORMAT " larger than possible " SIZE_FORMAT " in region %u", exp_marked_bytes, HeapRegion::GrainBytes, hr->hrm_index()); failures += 1; } // Verify the bit, for this region, in the actual and expected // (which was just calculated) region bit maps. - // We're not OK if the bit in the calculated expected region - // bitmap is set and the bit in the actual region bitmap is not. uint index = hr->hrm_index(); bool expected = _exp_live_data->is_region_live(index); bool actual = _act_live_data->is_region_live(index); - if (expected && !actual) { + if (expected != actual) { + log_error(gc)("Expected liveness %d not equal actual %d in region %u", expected, actual, hr->hrm_index()); failures += 1; } // Verify that the card bit maps for the cards spanned by the current - // region match. We have an error if we have a set bit in the expected - // bit map and the corresponding bit in the actual bitmap is not set. - + // region match. BitMap::idx_t start_idx = _helper.card_live_bitmap_index_for(hr->bottom()); BitMap::idx_t end_idx = _helper.card_live_bitmap_index_for(hr->top()); @@ -487,7 +514,8 @@ class G1VerifyCardLiveDataTask: public AbstractGangTask { expected = _exp_live_data->is_card_live_at(i); actual = _act_live_data->is_card_live_at(i); - if (expected && !actual) { + if (expected != actual) { + log_error(gc)("Expected card liveness %d not equal actual card liveness %d at card " SIZE_FORMAT " in region %u", expected, actual, i, hr->hrm_index()); failures += 1; } } diff --git a/hotspot/src/share/vm/gc/g1/g1CardLiveData.hpp b/hotspot/src/share/vm/gc/g1/g1CardLiveData.hpp index d76fa66d3c4..6672d45e7b4 100644 --- a/hotspot/src/share/vm/gc/g1/g1CardLiveData.hpp +++ b/hotspot/src/share/vm/gc/g1/g1CardLiveData.hpp @@ -46,6 +46,17 @@ private: size_t _max_capacity; size_t _cards_per_region; + // Regions may be reclaimed while concurrently creating live data (e.g. due to humongous + // eager reclaim). This results in wrong live data for these regions at the end. + // So we need to somehow detect these regions, and during live data finalization completely + // recreate their information. + // This _gc_timestamp_at_create tracks the global timestamp when live data creation + // has started. Any regions with a higher time stamp have been cleared after that + // point in time, and need re-finalization. + // Unsynchronized access to this variable is okay, since this value is only set during a + // concurrent phase, and read only at the Cleanup safepoint. I.e. there is always + // full memory synchronization inbetween. + uint _gc_timestamp_at_create; // The per-card liveness bitmap. bm_word_t* _live_cards; size_t _live_cards_size_in_bits; @@ -54,21 +65,23 @@ private: size_t _live_regions_size_in_bits; // The bits in this bitmap contain for every card whether it contains // at least part of at least one live object. - BitMap live_cards_bm() const { return BitMap(_live_cards, _live_cards_size_in_bits); } + BitMapView live_cards_bm() const { return BitMapView(_live_cards, _live_cards_size_in_bits); } // The bits in this bitmap indicate that a given region contains some live objects. - BitMap live_regions_bm() const { return BitMap(_live_regions, _live_regions_size_in_bits); } + BitMapView live_regions_bm() const { return BitMapView(_live_regions, _live_regions_size_in_bits); } // Allocate a "large" bitmap from virtual memory with the given size in bits. bm_word_t* allocate_large_bitmap(size_t size_in_bits); void free_large_bitmap(bm_word_t* map, size_t size_in_bits); - inline BitMap live_card_bitmap(uint region); + inline BitMapView live_card_bitmap(uint region); inline bool is_card_live_at(BitMap::idx_t idx) const; size_t live_region_bitmap_size_in_bits() const; size_t live_card_bitmap_size_in_bits() const; public: + uint gc_timestamp_at_create() const { return _gc_timestamp_at_create; } + inline bool is_region_live(uint region) const; inline void remove_nonlive_cards(uint region, BitMap* bm); diff --git a/hotspot/src/share/vm/gc/g1/g1CardLiveData.inline.hpp b/hotspot/src/share/vm/gc/g1/g1CardLiveData.inline.hpp index fc14ed8bcf3..b524d5942b7 100644 --- a/hotspot/src/share/vm/gc/g1/g1CardLiveData.inline.hpp +++ b/hotspot/src/share/vm/gc/g1/g1CardLiveData.inline.hpp @@ -29,8 +29,8 @@ #include "utilities/bitMap.inline.hpp" #include "utilities/globalDefinitions.hpp" -inline BitMap G1CardLiveData::live_card_bitmap(uint region) { - return BitMap(_live_cards + ((size_t)region * _cards_per_region >> LogBitsPerWord), _cards_per_region); +inline BitMapView G1CardLiveData::live_card_bitmap(uint region) { + return BitMapView(_live_cards + ((size_t)region * _cards_per_region >> LogBitsPerWord), _cards_per_region); } inline bool G1CardLiveData::is_card_live_at(BitMap::idx_t idx) const { diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp index 3a775d5bca1..90a7d35c144 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp @@ -42,9 +42,11 @@ #include "gc/g1/g1HeapSizingPolicy.hpp" #include "gc/g1/g1HeapTransition.hpp" #include "gc/g1/g1HeapVerifier.hpp" +#include "gc/g1/g1HotCardCache.hpp" #include "gc/g1/g1MarkSweep.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1ParScanThreadState.inline.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RegionToSpaceMapper.hpp" #include "gc/g1/g1RemSet.inline.hpp" #include "gc/g1/g1RootClosures.hpp" @@ -64,6 +66,7 @@ #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/generationSpec.hpp" #include "gc/shared/isGCActiveMark.hpp" +#include "gc/shared/preservedMarks.inline.hpp" #include "gc/shared/referenceProcessor.inline.hpp" #include "gc/shared/taskqueue.inline.hpp" #include "logging/log.hpp" @@ -97,7 +100,7 @@ public: RefineCardTableEntryClosure() : _concurrent(true) { } bool do_card_ptr(jbyte* card_ptr, uint worker_i) { - bool oops_into_cset = G1CollectedHeap::heap()->g1_rem_set()->refine_card(card_ptr, worker_i, false); + bool oops_into_cset = G1CollectedHeap::heap()->g1_rem_set()->refine_card(card_ptr, worker_i, NULL); // This path is executed by the concurrent refine or mutator threads, // concurrently, and so we do not care if card_ptr contains references // that point into the collection set. @@ -161,59 +164,6 @@ void G1RegionMappingChangedListener::on_commit(uint start_idx, size_t num_region reset_from_card_cache(start_idx, num_regions); } -void G1CollectedHeap::push_dirty_cards_region(HeapRegion* hr) -{ - // Claim the right to put the region on the dirty cards region list - // by installing a self pointer. - HeapRegion* next = hr->get_next_dirty_cards_region(); - if (next == NULL) { - HeapRegion* res = (HeapRegion*) - Atomic::cmpxchg_ptr(hr, hr->next_dirty_cards_region_addr(), - NULL); - if (res == NULL) { - HeapRegion* head; - do { - // Put the region to the dirty cards region list. - head = _dirty_cards_region_list; - next = (HeapRegion*) - Atomic::cmpxchg_ptr(hr, &_dirty_cards_region_list, head); - if (next == head) { - assert(hr->get_next_dirty_cards_region() == hr, - "hr->get_next_dirty_cards_region() != hr"); - if (next == NULL) { - // The last region in the list points to itself. - hr->set_next_dirty_cards_region(hr); - } else { - hr->set_next_dirty_cards_region(next); - } - } - } while (next != head); - } - } -} - -HeapRegion* G1CollectedHeap::pop_dirty_cards_region() -{ - HeapRegion* head; - HeapRegion* hr; - do { - head = _dirty_cards_region_list; - if (head == NULL) { - return NULL; - } - HeapRegion* new_head = head->get_next_dirty_cards_region(); - if (head == new_head) { - // The last region. - new_head = NULL; - } - hr = (HeapRegion*)Atomic::cmpxchg_ptr(new_head, &_dirty_cards_region_list, - head); - } while (hr != head); - assert(hr != NULL, "invariant"); - hr->set_next_dirty_cards_region(NULL); - return hr; -} - // Returns true if the reference points to an object that // can move in an incremental collection. bool G1CollectedHeap::is_scavengable(const void* p) { @@ -1373,10 +1323,9 @@ bool G1CollectedHeap::do_full_collection(bool explicit_gc, // the compaction events. print_hrm_post_compaction(); - G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); - if (hot_card_cache->use_cache()) { - hot_card_cache->reset_card_counts(); - hot_card_cache->reset_hot_cache(); + if (_hot_card_cache->use_cache()) { + _hot_card_cache->reset_card_counts(); + _hot_card_cache->reset_hot_cache(); } // Rebuild remembered sets of all regions. @@ -1406,8 +1355,7 @@ bool G1CollectedHeap::do_full_collection(bool explicit_gc, // At this point there should be no regions in the // entire heap tagged as young. - assert(check_young_list_empty(true /* check_heap */), - "young list should be empty at this point"); + assert(check_young_list_empty(), "young list should be empty at this point"); // Update the number of full collections that have been completed. increment_old_marking_cycles_completed(false /* concurrent */); @@ -1744,19 +1692,23 @@ void G1CollectedHeap::shrink(size_t shrink_bytes) { // Public methods. -G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : +G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* collector_policy) : CollectedHeap(), - _g1_policy(policy_), - _collection_set(this), + _collector_policy(collector_policy), + _g1_policy(create_g1_policy()), + _collection_set(this, _g1_policy), _dirty_card_queue_set(false), _is_alive_closure_cm(this), _is_alive_closure_stw(this), _ref_processor_cm(NULL), _ref_processor_stw(NULL), _bot(NULL), + _hot_card_cache(NULL), + _g1_rem_set(NULL), _cg1r(NULL), _g1mm(NULL), _refine_cte_cl(NULL), + _preserved_marks_set(true /* in_c_heap */), _secondary_free_list("Secondary Free List", new SecondaryFreeRegionListMtSafeChecker()), _old_set("Old Set", false /* humongous */, new OldRegionSetMtSafeChecker()), _humongous_set("Master Humongous Set", true /* humongous */, new HumongousRegionSetMtSafeChecker()), @@ -1764,7 +1716,6 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : _has_humongous_reclaim_candidates(false), _archive_allocator(NULL), _free_regions_coming(false), - _young_list(new YoungList(this)), _gc_time_stamp(0), _summary_bytes_used(0), _survivor_evac_stats("Young", YoungPLABSize, PLABWeight), @@ -1773,7 +1724,6 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : _old_marking_cycles_started(0), _old_marking_cycles_completed(0), _in_cset_fast_test(), - _dirty_cards_region_list(NULL), _worker_cset_start_region(NULL), _worker_cset_start_region_time_stamp(NULL), _gc_timer_stw(new (ResourceObj::C_HEAP, mtGC) STWGCTimer()), @@ -1867,7 +1817,7 @@ jint G1CollectedHeap::initialize() { _refine_cte_cl = new RefineCardTableEntryClosure(); jint ecode = JNI_OK; - _cg1r = ConcurrentG1Refine::create(this, _refine_cte_cl, &ecode); + _cg1r = ConcurrentG1Refine::create(_refine_cte_cl, &ecode); if (_cg1r == NULL) { return ecode; } @@ -1897,8 +1847,11 @@ jint G1CollectedHeap::initialize() { assert(bs->is_a(BarrierSet::G1SATBCTLogging), "sanity"); set_barrier_set(bs); + // Create the hot card cache. + _hot_card_cache = new G1HotCardCache(this); + // Also create a G1 rem set. - _g1_rem_set = new G1RemSet(this, g1_barrier_set()); + _g1_rem_set = new G1RemSet(this, g1_barrier_set(), _hot_card_cache); // Carve out the G1 part of the heap. ReservedSpace g1_rs = heap_rs.first_part(max_byte_size); @@ -1943,8 +1896,8 @@ jint G1CollectedHeap::initialize() { _hrm.initialize(heap_storage, prev_bitmap_storage, next_bitmap_storage, bot_storage, cardtable_storage, card_counts_storage); g1_barrier_set()->initialize(cardtable_storage); - // Do later initialization work for concurrent refinement. - _cg1r->init(card_counts_storage); + // Do later initialization work for concurrent refinement. + _hot_card_cache->initialize(card_counts_storage); // 6843694 - ensure that the maximum region index can fit // in the remembered set structures. @@ -1987,7 +1940,7 @@ jint G1CollectedHeap::initialize() { } // Perform any initialization actions delegated to the policy. - g1_policy()->init(); + g1_policy()->init(this, &_collection_set); JavaThread::satb_mark_queue_set().initialize(SATB_Q_CBL_mon, SATB_Q_FL_lock, @@ -2032,10 +1985,7 @@ jint G1CollectedHeap::initialize() { G1StringDedup::initialize(); - _preserved_objs = NEW_C_HEAP_ARRAY(OopAndMarkOopStack, ParallelGCThreads, mtGC); - for (uint i = 0; i < ParallelGCThreads; i++) { - new (&_preserved_objs[i]) OopAndMarkOopStack(); - } + _preserved_marks_set.init(ParallelGCThreads); return JNI_OK; } @@ -2056,7 +2006,6 @@ size_t G1CollectedHeap::conservative_max_heap_alignment() { } void G1CollectedHeap::post_initialize() { - CollectedHeap::post_initialize(); ref_processing_init(); } @@ -2134,7 +2083,7 @@ void G1CollectedHeap::ref_processing_init() { } CollectorPolicy* G1CollectedHeap::collector_policy() const { - return g1_policy(); + return _collector_policy; } size_t G1CollectedHeap::capacity() const { @@ -2177,7 +2126,7 @@ void G1CollectedHeap::check_gc_time_stamps() { #endif // PRODUCT void G1CollectedHeap::iterate_hcc_closure(CardTableEntryClosure* cl, uint worker_i) { - _cg1r->hot_card_cache()->drain(cl, worker_i); + _hot_card_cache->drain(cl, worker_i); } void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl, uint worker_i) { @@ -2612,11 +2561,11 @@ bool G1CollectedHeap::supports_tlab_allocation() const { } size_t G1CollectedHeap::tlab_capacity(Thread* ignored) const { - return (_g1_policy->young_list_target_length() - young_list()->survivor_length()) * HeapRegion::GrainBytes; + return (_g1_policy->young_list_target_length() - _survivor.length()) * HeapRegion::GrainBytes; } size_t G1CollectedHeap::tlab_used(Thread* ignored) const { - return young_list()->eden_used_bytes(); + return _eden.length() * HeapRegion::GrainBytes; } // For G1 TLABs should not contain humongous objects, so the maximum TLAB size @@ -2701,10 +2650,10 @@ void G1CollectedHeap::print_on(outputStream* st) const { p2i(_hrm.reserved().end())); st->cr(); st->print(" region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K); - uint young_regions = _young_list->length(); + uint young_regions = young_regions_count(); st->print("%u young (" SIZE_FORMAT "K), ", young_regions, (size_t) young_regions * HeapRegion::GrainBytes / K); - uint survivor_regions = _young_list->survivor_length(); + uint survivor_regions = survivor_regions_count(); st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions, (size_t) survivor_regions * HeapRegion::GrainBytes / K); st->cr(); @@ -2761,7 +2710,6 @@ void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const { void G1CollectedHeap::print_tracing_info() const { g1_rem_set()->print_summary_info(); concurrent_mark()->print_summary_info(); - g1_policy()->print_yg_surv_rate_info(); } #ifndef PRODUCT @@ -2814,10 +2762,9 @@ void G1CollectedHeap::print_all_rsets() { #endif // PRODUCT G1HeapSummary G1CollectedHeap::create_g1_heap_summary() { - YoungList* young_list = heap()->young_list(); - size_t eden_used_bytes = young_list->eden_used_bytes(); - size_t survivor_used_bytes = young_list->survivor_used_bytes(); + size_t eden_used_bytes = heap()->eden_regions_count() * HeapRegion::GrainBytes; + size_t survivor_used_bytes = heap()->survivor_regions_count() * HeapRegion::GrainBytes; size_t heap_used = Heap_lock->owned_by_self() ? used() : used_unlocked(); size_t eden_capacity_bytes = @@ -3088,28 +3035,6 @@ class VerifyRegionRemSetClosure : public HeapRegionClosure { } }; -#ifdef ASSERT -class VerifyCSetClosure: public HeapRegionClosure { -public: - bool doHeapRegion(HeapRegion* hr) { - // Here we check that the CSet region's RSet is ready for parallel - // iteration. The fields that we'll verify are only manipulated - // when the region is part of a CSet and is collected. Afterwards, - // we reset these fields when we clear the region's RSet (when the - // region is freed) so they are ready when the region is - // re-allocated. The only exception to this is if there's an - // evacuation failure and instead of freeing the region we leave - // it in the heap. In that case, we reset these fields during - // evacuation failure handling. - guarantee(hr->rem_set()->verify_ready_for_par_iteration(), "verification"); - - // Here's a good place to add any other checks we'd like to - // perform on CSet regions. - return false; - } -}; -#endif // ASSERT - uint G1CollectedHeap::num_task_queues() const { return _task_queues->size(); } @@ -3182,6 +3107,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { SvcGCMarker sgcm(SvcGCMarker::MINOR); ResourceMark rm; + g1_policy()->note_gc_start(); + wait_for_root_region_scanning(); print_heap_before_gc(); @@ -3241,8 +3168,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { Threads::number_of_non_daemon_threads()); workers()->set_active_workers(active_workers); - g1_policy()->note_gc_start(); - TraceCollectorStats tcs(g1mm()->incremental_collection_counters()); TraceMemoryManagerStats tms(false /* fullGC */, gc_cause()); @@ -3259,8 +3184,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { G1HeapTransition heap_transition(this); size_t heap_used_bytes_before_gc = used(); - assert(check_young_list_well_formed(), "young list should be well formed"); - // Don't dynamically change the number of GC threads this early. A value of // 0 is used to indicate serial work. When parallel work is done, // it will be set. @@ -3324,7 +3247,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { concurrent_mark()->checkpointRootsInitialPre(); } - g1_policy()->finalize_collection_set(target_pause_time_ms); + g1_policy()->finalize_collection_set(target_pause_time_ms, &_survivor); evacuation_info.set_collectionset_regions(collection_set()->region_length()); @@ -3352,11 +3275,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { } } -#ifdef ASSERT - VerifyCSetClosure cl; - collection_set_iterate(&cl); -#endif // ASSERT - // Initialize the GC alloc regions. _allocator->init_gc_alloc_regions(evacuation_info); @@ -3384,14 +3302,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { clear_cset_fast_test(); - // Don't check the whole heap at this point as the - // GC alloc regions from this pause have been tagged - // as survivors and moved on to the survivor list. - // Survivor regions will fail the !is_young() check. - assert(check_young_list_empty(false /* check_heap */), - "young list should be empty"); - - _young_list->reset_auxilary_lists(); + guarantee(_eden.length() == 0, "eden should have been cleared"); + g1_policy()->transfer_survivors_to_cset(survivor()); if (evacuation_failed()) { set_used(recalculate_used()); @@ -3553,11 +3465,6 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) { return true; } -void G1CollectedHeap::restore_preserved_marks() { - G1RestorePreservedMarksTask rpm_task(_preserved_objs); - workers()->run_task(&rpm_task); -} - void G1CollectedHeap::remove_self_forwarding_pointers() { G1ParRemoveSelfForwardPtrsTask rsfp_task; workers()->run_task(&rsfp_task); @@ -3567,7 +3474,7 @@ void G1CollectedHeap::restore_after_evac_failure() { double remove_self_forwards_start = os::elapsedTime(); remove_self_forwarding_pointers(); - restore_preserved_marks(); + _preserved_marks_set.restore(workers()); g1_policy()->phase_times()->record_evac_fail_remove_self_forwards((os::elapsedTime() - remove_self_forwards_start) * 1000.0); } @@ -3578,13 +3485,7 @@ void G1CollectedHeap::preserve_mark_during_evac_failure(uint worker_id, oop obj, } _evacuation_failed_info_array[worker_id].register_copy_failure(obj->size()); - - // We want to call the "for_promotion_failure" version only in the - // case of a promotion failure. - if (m->must_be_preserved_for_promotion_failure(obj)) { - OopAndMarkOop elem(obj, m); - _preserved_objs[worker_id].push(elem); - } + _preserved_marks_set.get(worker_id)->push_if_necessary(obj, m); } bool G1ParEvacuateFollowersClosure::offer_termination() { @@ -3801,12 +3702,12 @@ private: const uint _num_workers; // Variables used to claim nmethods. - nmethod* _first_nmethod; - volatile nmethod* _claimed_nmethod; + CompiledMethod* _first_nmethod; + volatile CompiledMethod* _claimed_nmethod; // The list of nmethods that need to be processed by the second pass. - volatile nmethod* _postponed_list; - volatile uint _num_entered_barrier; + volatile CompiledMethod* _postponed_list; + volatile uint _num_entered_barrier; public: G1CodeCacheUnloadingTask(uint num_workers, BoolObjectClosure* is_alive, bool unloading_occurred) : @@ -3818,13 +3719,13 @@ private: _postponed_list(NULL), _num_entered_barrier(0) { - nmethod::increase_unloading_clock(); + CompiledMethod::increase_unloading_clock(); // Get first alive nmethod - NMethodIterator iter = NMethodIterator(); + CompiledMethodIterator iter = CompiledMethodIterator(); if(iter.next_alive()) { _first_nmethod = iter.method(); } - _claimed_nmethod = (volatile nmethod*)_first_nmethod; + _claimed_nmethod = (volatile CompiledMethod*)_first_nmethod; } ~G1CodeCacheUnloadingTask() { @@ -3837,15 +3738,15 @@ private: } private: - void add_to_postponed_list(nmethod* nm) { - nmethod* old; + void add_to_postponed_list(CompiledMethod* nm) { + CompiledMethod* old; do { - old = (nmethod*)_postponed_list; + old = (CompiledMethod*)_postponed_list; nm->set_unloading_next(old); - } while ((nmethod*)Atomic::cmpxchg_ptr(nm, &_postponed_list, old) != old); + } while ((CompiledMethod*)Atomic::cmpxchg_ptr(nm, &_postponed_list, old) != old); } - void clean_nmethod(nmethod* nm) { + void clean_nmethod(CompiledMethod* nm) { bool postponed = nm->do_unloading_parallel(_is_alive, _unloading_occurred); if (postponed) { @@ -3855,24 +3756,24 @@ private: // Mark that this thread has been cleaned/unloaded. // After this call, it will be safe to ask if this nmethod was unloaded or not. - nm->set_unloading_clock(nmethod::global_unloading_clock()); + nm->set_unloading_clock(CompiledMethod::global_unloading_clock()); } - void clean_nmethod_postponed(nmethod* nm) { + void clean_nmethod_postponed(CompiledMethod* nm) { nm->do_unloading_parallel_postponed(_is_alive, _unloading_occurred); } static const int MaxClaimNmethods = 16; - void claim_nmethods(nmethod** claimed_nmethods, int *num_claimed_nmethods) { - nmethod* first; - NMethodIterator last; + void claim_nmethods(CompiledMethod** claimed_nmethods, int *num_claimed_nmethods) { + CompiledMethod* first; + CompiledMethodIterator last; do { *num_claimed_nmethods = 0; - first = (nmethod*)_claimed_nmethod; - last = NMethodIterator(first); + first = (CompiledMethod*)_claimed_nmethod; + last = CompiledMethodIterator(first); if (first != NULL) { @@ -3885,22 +3786,22 @@ private: } } - } while ((nmethod*)Atomic::cmpxchg_ptr(last.method(), &_claimed_nmethod, first) != first); + } while ((CompiledMethod*)Atomic::cmpxchg_ptr(last.method(), &_claimed_nmethod, first) != first); } - nmethod* claim_postponed_nmethod() { - nmethod* claim; - nmethod* next; + CompiledMethod* claim_postponed_nmethod() { + CompiledMethod* claim; + CompiledMethod* next; do { - claim = (nmethod*)_postponed_list; + claim = (CompiledMethod*)_postponed_list; if (claim == NULL) { return NULL; } next = claim->unloading_next(); - } while ((nmethod*)Atomic::cmpxchg_ptr(next, &_postponed_list, claim) != claim); + } while ((CompiledMethod*)Atomic::cmpxchg_ptr(next, &_postponed_list, claim) != claim); return claim; } @@ -3936,7 +3837,7 @@ private: } int num_claimed_nmethods; - nmethod* claimed_nmethods[MaxClaimNmethods]; + CompiledMethod* claimed_nmethods[MaxClaimNmethods]; while (true) { claim_nmethods(claimed_nmethods, &num_claimed_nmethods); @@ -3952,7 +3853,7 @@ private: } void work_second_pass(uint worker_id) { - nmethod* nm; + CompiledMethod* nm; // Take care of postponed nmethods. while ((nm = claim_postponed_nmethod()) != NULL) { clean_nmethod_postponed(nm); @@ -4602,11 +4503,11 @@ void G1CollectedHeap::pre_evacuate_collection_set() { _evacuation_failed = false; // Disable the hot card cache. - G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); - hot_card_cache->reset_hot_cache_claimed_index(); - hot_card_cache->set_use_cache(false); + _hot_card_cache->reset_hot_cache_claimed_index(); + _hot_card_cache->set_use_cache(false); g1_rem_set()->prepare_for_oops_into_collection_set_do(); + _preserved_marks_set.assert_empty(); } void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* per_thread_states) { @@ -4684,6 +4585,8 @@ void G1CollectedHeap::post_evacuate_collection_set(EvacuationInfo& evacuation_in NOT_PRODUCT(reset_evacuation_should_fail();) } + _preserved_marks_set.assert_empty(); + // Enqueue any remaining references remaining on the STW // reference processor's discovered lists. We need to do // this after the card table is cleaned (and verified) as @@ -4704,9 +4607,8 @@ void G1CollectedHeap::post_evacuate_collection_set(EvacuationInfo& evacuation_in // Reset and re-enable the hot card cache. // Note the counts for the cards in the regions in the // collection set are reset when the collection set is freed. - G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); - hot_card_cache->reset_hot_cache(); - hot_card_cache->set_use_cache(true); + _hot_card_cache->reset_hot_cache(); + _hot_card_cache->set_use_cache(true); purge_code_root_memory(); @@ -4741,7 +4643,7 @@ void G1CollectedHeap::free_region(HeapRegion* hr, // Note: we only need to do this if the region is not young // (since we don't refine cards in young regions). if (!hr->is_young()) { - _cg1r->hot_card_cache()->reset_card_counts(hr); + _hot_card_cache->reset_card_counts(hr); } hr->hr_clear(par, true /* clear_space */, locked /* locked */); free_list->add_ordered(hr); @@ -4778,31 +4680,6 @@ void G1CollectedHeap::decrement_summary_bytes(size_t bytes) { decrease_used(bytes); } -class G1ParCleanupCTTask : public AbstractGangTask { - G1SATBCardTableModRefBS* _ct_bs; - G1CollectedHeap* _g1h; - HeapRegion* volatile _su_head; -public: - G1ParCleanupCTTask(G1SATBCardTableModRefBS* ct_bs, - G1CollectedHeap* g1h) : - AbstractGangTask("G1 Par Cleanup CT Task"), - _ct_bs(ct_bs), _g1h(g1h) { } - - void work(uint worker_id) { - HeapRegion* r; - while (r = _g1h->pop_dirty_cards_region()) { - clear_cards(r); - } - } - - void clear_cards(HeapRegion* r) { - // Cards of the survivors should have already been dirtied. - if (!r->is_survivor()) { - _ct_bs->clear(MemRegion(r->bottom(), r->end())); - } - } -}; - class G1ParScrubRemSetTask: public AbstractGangTask { protected: G1RemSet* _g1rs; @@ -4826,27 +4703,6 @@ void G1CollectedHeap::scrub_rem_set() { workers()->run_task(&g1_par_scrub_rs_task); } -void G1CollectedHeap::cleanUpCardTable() { - G1SATBCardTableModRefBS* ct_bs = g1_barrier_set(); - double start = os::elapsedTime(); - - { - // Iterate over the dirty cards region list. - G1ParCleanupCTTask cleanup_task(ct_bs, this); - - workers()->run_task(&cleanup_task); -#ifndef PRODUCT - // Need to synchronize with concurrent cleanup since it needs to - // finish its card table clearing before we can verify. - wait_while_free_regions_coming(); - _verifier->verify_card_table_cleanup(); -#endif - } - - double elapsed = os::elapsedTime() - start; - g1_policy()->phase_times()->record_clear_ct_time(elapsed * 1000.0); -} - void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& evacuation_info, const size_t* surviving_young_words) { size_t pre_used = 0; FreeRegionList local_free_list("Local List for CSet Freeing"); @@ -4854,12 +4710,9 @@ void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& e double young_time_ms = 0.0; double non_young_time_ms = 0.0; - // Since the collection set is a superset of the the young list, - // all we need to do to clear the young list is clear its - // head and length, and unlink any young regions in the code below - _young_list->clear(); + _eden.clear(); - G1CollectorPolicy* policy = g1_policy(); + G1Policy* policy = g1_policy(); double start_sec = os::elapsedTime(); bool non_young = true; @@ -4904,11 +4757,6 @@ void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& e size_t words_survived = surviving_young_words[index]; cur->record_surv_words_in_group(words_survived); - // At this point the we have 'popped' cur from the collection set - // (linked via next_in_collection_set()) but it is still in the - // young list (linked via next_young_region()). Clear the - // _next_young_region field. - cur->set_next_young_region(NULL); } else { int index = cur->young_index_in_cset(); assert(index == -1, "invariant"); @@ -5175,9 +5023,12 @@ bool G1CollectedHeap::is_old_gc_alloc_region(HeapRegion* hr) { } void G1CollectedHeap::set_region_short_lived_locked(HeapRegion* hr) { - _young_list->push_region(hr); + _eden.add(hr); + _g1_policy->set_region_eden(hr); } +#ifdef ASSERT + class NoYoungRegionsClosure: public HeapRegionClosure { private: bool _success; @@ -5194,18 +5045,18 @@ public: bool success() { return _success; } }; -bool G1CollectedHeap::check_young_list_empty(bool check_heap) { - bool ret = _young_list->check_list_empty(); +bool G1CollectedHeap::check_young_list_empty() { + bool ret = (young_regions_count() == 0); - if (check_heap) { - NoYoungRegionsClosure closure; - heap_region_iterate(&closure); - ret = ret && closure.success(); - } + NoYoungRegionsClosure closure; + heap_region_iterate(&closure); + ret = ret && closure.success(); return ret; } +#endif // ASSERT + class TearDownRegionSetsClosure : public HeapRegionClosure { private: HeapRegionSet *_old_set; @@ -5216,12 +5067,13 @@ public: bool doHeapRegion(HeapRegion* r) { if (r->is_old()) { _old_set->remove(r); + } else if(r->is_young()) { + r->uninstall_surv_rate_group(); } else { // We ignore free regions, we'll empty the free list afterwards. - // We ignore young regions, we'll empty the young list afterwards. // We ignore humongous regions, we're not tearing down the // humongous regions set. - assert(r->is_free() || r->is_young() || r->is_humongous(), + assert(r->is_free() || r->is_humongous(), "it cannot be another type"); } return false; @@ -5287,16 +5139,12 @@ public: r->set_allocation_context(AllocationContext::system()); _hrm->insert_into_free_list(r); } else if (!_free_list_only) { - assert(!r->is_young(), "we should not come across young regions"); if (r->is_humongous()) { // We ignore humongous regions. We left the humongous set unchanged. } else { - // Objects that were compacted would have ended up on regions - // that were previously old or free. Archive regions (which are - // old) will not have been touched. - assert(r->is_free() || r->is_old(), "invariant"); - // We now consider them old, so register as such. Leave + assert(r->is_young() || r->is_free() || r->is_old(), "invariant"); + // We now consider all regions old, so register as such. Leave // archive regions set that way, however, while still adding // them to the old set. if (!r->is_archive()) { @@ -5319,7 +5167,8 @@ void G1CollectedHeap::rebuild_region_sets(bool free_list_only) { assert_at_safepoint(true /* should_be_vm_thread */); if (!free_list_only) { - _young_list->empty_list(); + _eden.clear(); + _survivor.clear(); } RebuildRegionSetsClosure cl(free_list_only, &_old_set, &_hrm); @@ -5353,14 +5202,14 @@ HeapRegion* G1CollectedHeap::new_mutator_alloc_region(size_t word_size, assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */); assert(!force || g1_policy()->can_expand_young_list(), "if force is true we should be able to expand the young list"); - bool young_list_full = g1_policy()->is_young_list_full(); - if (force || !young_list_full) { + bool should_allocate = g1_policy()->should_allocate_mutator_region(); + if (force || should_allocate) { HeapRegion* new_alloc_region = new_region(word_size, false /* is_old */, false /* do_expand */); if (new_alloc_region != NULL) { set_region_short_lived_locked(new_alloc_region); - _hr_printer.alloc(new_alloc_region, young_list_full); + _hr_printer.alloc(new_alloc_region, !should_allocate); _verifier->check_bitmaps("Mutator Region Allocation", new_alloc_region); return new_alloc_region; } @@ -5388,7 +5237,7 @@ bool G1CollectedHeap::has_more_regions(InCSetState dest) { if (dest.is_old()) { return true; } else { - return young_list()->survivor_length() < g1_policy()->max_survivor_regions(); + return survivor_regions_count() < g1_policy()->max_survivor_regions(); } } @@ -5411,7 +5260,7 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size, InCSetState d new_alloc_region->record_timestamp(); if (is_survivor) { new_alloc_region->set_survivor(); - young_list()->add_survivor_region(new_alloc_region); + _survivor.add(new_alloc_region); _verifier->check_bitmaps("Survivor Region Allocation", new_alloc_region); } else { new_alloc_region->set_old(); diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp index e98d57af7fb..66699651b6d 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp @@ -31,20 +31,23 @@ #include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1ConcurrentMark.hpp" +#include "gc/g1/g1EdenRegions.hpp" +#include "gc/g1/g1EvacFailure.hpp" +#include "gc/g1/g1EvacStats.hpp" +#include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1HRPrinter.hpp" #include "gc/g1/g1InCSetState.hpp" #include "gc/g1/g1MonitoringSupport.hpp" -#include "gc/g1/g1EvacFailure.hpp" -#include "gc/g1/g1EvacStats.hpp" #include "gc/g1/g1SATBCardTableModRefBS.hpp" +#include "gc/g1/g1SurvivorRegions.hpp" #include "gc/g1/g1YCTypes.hpp" #include "gc/g1/hSpaceCounters.hpp" #include "gc/g1/heapRegionManager.hpp" #include "gc/g1/heapRegionSet.hpp" -#include "gc/g1/youngList.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/plab.hpp" +#include "gc/shared/preservedMarks.hpp" #include "memory/memRegion.hpp" #include "utilities/stack.hpp" @@ -68,6 +71,8 @@ class CompactibleSpaceClosure; class Space; class G1CollectionSet; class G1CollectorPolicy; +class G1Policy; +class G1HotCardCache; class G1RemSet; class HeapRegionRemSetIterator; class G1ConcurrentMark; @@ -137,6 +142,7 @@ class G1CollectedHeap : public CollectedHeap { private: WorkGang* _workers; + G1CollectorPolicy* _collector_policy; static size_t _humongous_object_threshold_in_words; @@ -243,7 +249,7 @@ private: // If not, we can skip a few steps. bool _has_humongous_reclaim_candidates; - volatile unsigned _gc_time_stamp; + volatile uint _gc_time_stamp; G1HRPrinter _hr_printer; @@ -290,6 +296,8 @@ private: size_t size, size_t translation_factor); + static G1Policy* create_g1_policy(); + void trace_heap(GCWhen::Type when, const GCTracer* tracer); void process_weak_jni_handles(); @@ -357,10 +365,11 @@ private: protected: // The young region list. - YoungList* _young_list; + G1EdenRegions _eden; + G1SurvivorRegions _survivor; // The current policy object for the collector. - G1CollectorPolicy* _g1_policy; + G1Policy* _g1_policy; G1HeapSizingPolicy* _heap_sizing_policy; G1CollectionSet _collection_set; @@ -756,6 +765,9 @@ protected: // Update object copying statistics. void record_obj_copy_mem_stats(); + // The hot card cache for remembered set insertion optimization. + G1HotCardCache* _hot_card_cache; + // The g1 remembered set of the heap. G1RemSet* _g1_rem_set; @@ -793,16 +805,11 @@ protected: // forwarding pointers to themselves. Reset them. void remove_self_forwarding_pointers(); - // Restore the preserved mark words for objects with self-forwarding pointers. - void restore_preserved_marks(); - // Restore the objects in the regions in the collection set after an // evacuation failure. void restore_after_evac_failure(); - // Stores marks with the corresponding oop that we need to preserve during evacuation - // failure. - OopAndMarkOopStack* _preserved_objs; + PreservedMarksSet _preserved_marks_set; // Preserve the mark of "obj", if necessary, in preparation for its mark // word being overwritten with a self-forwarding-pointer. @@ -979,7 +986,7 @@ public: G1CollectorState* collector_state() { return &_collector_state; } // The current policy object for the collector. - G1CollectorPolicy* g1_policy() const { return _g1_policy; } + G1Policy* g1_policy() const { return _g1_policy; } const G1CollectionSet* collection_set() const { return &_collection_set; } G1CollectionSet* collection_set() { return &_collection_set; } @@ -995,7 +1002,7 @@ public: // Try to minimize the remembered set. void scrub_rem_set(); - unsigned get_gc_time_stamp() { + uint get_gc_time_stamp() { return _gc_time_stamp; } @@ -1165,10 +1172,6 @@ public: return barrier_set_cast(barrier_set()); } - // This resets the card table to all zeros. It is used after - // a collection pause which used the card table to claim cards. - void cleanUpCardTable(); - // Iteration functions. // Iterate over all objects, calling "cl.do_object" on each. @@ -1331,18 +1334,27 @@ public: void set_region_short_lived_locked(HeapRegion* hr); // add appropriate methods for any other surv rate groups - YoungList* young_list() const { return _young_list; } + const G1SurvivorRegions* survivor() const { return &_survivor; } + + uint survivor_regions_count() const { + return _survivor.length(); + } + + uint eden_regions_count() const { + return _eden.length(); + } + + uint young_regions_count() const { + return _eden.length() + _survivor.length(); + } uint old_regions_count() const { return _old_set.length(); } uint humongous_regions_count() const { return _humongous_set.length(); } - // debugging - bool check_young_list_well_formed() { - return _young_list->check_list_well_formed(); - } - - bool check_young_list_empty(bool check_heap); +#ifdef ASSERT + bool check_young_list_empty(); +#endif // *** Stuff related to concurrent marking. It's not clear to me that so // many of these need to be public. @@ -1394,16 +1406,6 @@ public: ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; } - // The dirty cards region list is used to record a subset of regions - // whose cards need clearing. The list if populated during the - // remembered set scanning and drained during the card table - // cleanup. Although the methods are reentrant, population/draining - // phases must not overlap. For synchronization purposes the last - // element on the list points to itself. - HeapRegion* _dirty_cards_region_list; - void push_dirty_cards_region(HeapRegion* hr); - HeapRegion* pop_dirty_cards_region(); - // Optimized nmethod scanning support routines // Register the given nmethod with the G1 heap. diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp index 040367b5be1..05b24e0bf52 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp @@ -26,7 +26,6 @@ #define SHARE_VM_GC_G1_G1COLLECTEDHEAP_INLINE_HPP #include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1SATBCardTableModRefBS.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1CollectedHeap_ext.cpp b/hotspot/src/share/vm/gc/g1/g1CollectedHeap_ext.cpp index a4a9617edb4..29766047edd 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap_ext.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap_ext.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" +#include "gc/g1/g1DefaultPolicy.hpp" #include "gc/g1/g1ParScanThreadState.hpp" #include "gc/g1/heapRegion.inline.hpp" @@ -38,3 +39,7 @@ HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index, MemRegion mr) { return new HeapRegion(hrs_index, bot(), mr); } + +G1Policy* G1CollectedHeap::create_g1_policy() { + return new G1DefaultPolicy(); +} diff --git a/hotspot/src/share/vm/gc/g1/g1CollectionSet.cpp b/hotspot/src/share/vm/gc/g1/g1CollectionSet.cpp index 720c828d1bc..1e41dfd89a7 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectionSet.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectionSet.cpp @@ -25,8 +25,8 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1CollectionSet.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1CollectorState.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "gc/g1/heapRegionSet.hpp" @@ -48,10 +48,9 @@ double G1CollectionSet::predict_region_elapsed_time_ms(HeapRegion* hr) { return _policy->predict_region_elapsed_time_ms(hr, collector_state()->gcs_are_young()); } - -G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h) : +G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) : _g1(g1h), - _policy(NULL), + _policy(policy), _cset_chooser(new CollectionSetChooser()), _eden_region_length(0), _survivor_region_length(0), @@ -68,7 +67,8 @@ G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h) : _inc_recorded_rs_lengths(0), _inc_recorded_rs_lengths_diffs(0), _inc_predicted_elapsed_time_ms(0.0), - _inc_predicted_elapsed_time_ms_diffs(0.0) {} + _inc_predicted_elapsed_time_ms_diffs(0.0), + _inc_region_length(0) {} G1CollectionSet::~G1CollectionSet() { delete _cset_chooser; @@ -78,6 +78,9 @@ void G1CollectionSet::init_region_lengths(uint eden_cset_region_length, uint survivor_cset_region_length) { _eden_region_length = eden_cset_region_length; _survivor_region_length = survivor_cset_region_length; + + assert(young_region_length() == _inc_region_length, "should match %u == %u", young_region_length(), _inc_region_length); + _old_region_length = 0; } @@ -107,6 +110,7 @@ void G1CollectionSet::start_incremental_building() { _inc_head = NULL; _inc_tail = NULL; _inc_bytes_used_before = 0; + _inc_region_length = 0; _inc_recorded_rs_lengths = 0; _inc_recorded_rs_lengths_diffs = 0; @@ -177,9 +181,11 @@ void G1CollectionSet::update_young_region_prediction(HeapRegion* hr, void G1CollectionSet::add_young_region_common(HeapRegion* hr) { assert(hr->is_young(), "invariant"); - assert(hr->young_index_in_cset() > -1, "should have already been set"); assert(_inc_build_state == Active, "Precondition"); + hr->set_young_index_in_cset(_inc_region_length); + _inc_region_length++; + // This routine is used when: // * adding survivor regions to the incremental cset at the end of an // evacuation pause or @@ -268,10 +274,9 @@ void G1CollectionSet::print(HeapRegion* list_head, outputStream* st) { } #endif // !PRODUCT -double G1CollectionSet::finalize_young_part(double target_pause_time_ms) { +double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors) { double young_start_time_sec = os::elapsedTime(); - YoungList* young_list = _g1->young_list(); finalize_incremental_building(); guarantee(target_pause_time_ms > 0.0, @@ -291,23 +296,14 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms) { // pause are appended to the RHS of the young list, i.e. // [Newly Young Regions ++ Survivors from last pause]. - uint survivor_region_length = young_list->survivor_length(); - uint eden_region_length = young_list->eden_length(); + uint survivor_region_length = survivors->length(); + uint eden_region_length = _g1->eden_regions_count(); init_region_lengths(eden_region_length, survivor_region_length); - HeapRegion* hr = young_list->first_survivor_region(); - while (hr != NULL) { - assert(hr->is_survivor(), "badly formed young list"); - // There is a convention that all the young regions in the CSet - // are tagged as "eden", so we do this for the survivors here. We - // use the special set_eden_pre_gc() as it doesn't check that the - // region is free (which is not the case here). - hr->set_eden_pre_gc(); - hr = hr->get_next_young_region(); - } + verify_young_cset_indices(); // Clear the fields that point to the survivor list - they are all young now. - young_list->clear_survivors(); + survivors->convert_to_eden(); _head = _inc_head; _bytes_used_before = _inc_bytes_used_before; @@ -424,3 +420,25 @@ void G1CollectionSet::finalize_old_part(double time_remaining_ms) { double non_young_end_time_sec = os::elapsedTime(); phase_times()->record_non_young_cset_choice_time_ms((non_young_end_time_sec - non_young_start_time_sec) * 1000.0); } + +#ifdef ASSERT +void G1CollectionSet::verify_young_cset_indices() const { + ResourceMark rm; + uint* heap_region_indices = NEW_RESOURCE_ARRAY(uint, young_region_length()); + for (uint i = 0; i < young_region_length(); ++i) { + heap_region_indices[i] = (uint)-1; + } + + for (HeapRegion* hr = _inc_head; hr != NULL; hr = hr->next_in_collection_set()) { + const int idx = hr->young_index_in_cset(); + assert(idx > -1, "must be set for all inc cset regions"); + assert((uint)idx < young_region_length(), "young cset index too large"); + + assert(heap_region_indices[idx] == (uint)-1, + "index %d used by multiple regions, first use by %u, second by %u", + idx, heap_region_indices[idx], hr->hrm_index()); + + heap_region_indices[idx] = hr->hrm_index(); + } +} +#endif diff --git a/hotspot/src/share/vm/gc/g1/g1CollectionSet.hpp b/hotspot/src/share/vm/gc/g1/g1CollectionSet.hpp index 75f93071624..bd6f41f7b95 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectionSet.hpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectionSet.hpp @@ -31,14 +31,15 @@ #include "utilities/globalDefinitions.hpp" class G1CollectedHeap; -class G1CollectorPolicy; class G1CollectorState; class G1GCPhaseTimes; +class G1Policy; +class G1SurvivorRegions; class HeapRegion; class G1CollectionSet VALUE_OBJ_CLASS_SPEC { G1CollectedHeap* _g1; - G1CollectorPolicy* _policy; + G1Policy* _policy; CollectionSetChooser* _cset_chooser; @@ -104,20 +105,18 @@ class G1CollectionSet VALUE_OBJ_CLASS_SPEC { // See the comment for _inc_recorded_rs_lengths_diffs. double _inc_predicted_elapsed_time_ms_diffs; + uint _inc_region_length; + G1CollectorState* collector_state(); G1GCPhaseTimes* phase_times(); double predict_region_elapsed_time_ms(HeapRegion* hr); + void verify_young_cset_indices() const NOT_DEBUG_RETURN; public: - G1CollectionSet(G1CollectedHeap* g1h); + G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy); ~G1CollectionSet(); - void set_policy(G1CollectorPolicy* g1p) { - assert(_policy == NULL, "should only initialize once"); - _policy = g1p; - } - CollectionSetChooser* cset_chooser(); void init_region_lengths(uint eden_cset_region_length, @@ -152,6 +151,7 @@ public: void clear_incremental() { _inc_head = NULL; _inc_tail = NULL; + _inc_region_length = 0; } // Stop adding regions to the incremental collection set @@ -176,7 +176,7 @@ public: // Choose a new collection set. Marks the chosen regions as being // "in_collection_set", and links them together. The head and number of // the collection set are available via access methods. - double finalize_young_part(double target_pause_time_ms); + double finalize_young_part(double target_pause_time_ms, G1SurvivorRegions* survivors); void finalize_old_part(double time_remaining_ms); // Add old region "hr" to the CSet. diff --git a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp index 75c75ded31c..c0288ed133b 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp @@ -23,43 +23,16 @@ */ #include "precompiled.hpp" -#include "gc/g1/concurrentG1Refine.hpp" -#include "gc/g1/concurrentMarkThread.inline.hpp" #include "gc/g1/g1Analytics.hpp" -#include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1CollectorPolicy.hpp" -#include "gc/g1/g1ConcurrentMark.hpp" -#include "gc/g1/g1IHOPControl.hpp" -#include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1YoungGenSizer.hpp" -#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "gc/shared/gcPolicyCounters.hpp" -#include "runtime/arguments.hpp" -#include "runtime/java.hpp" -#include "runtime/mutexLocker.hpp" +#include "runtime/globals.hpp" #include "utilities/debug.hpp" -#include "utilities/pair.hpp" -G1CollectorPolicy::G1CollectorPolicy() : - _predictor(G1ConfidencePercent / 100.0), - _analytics(new G1Analytics(&_predictor)), - _pause_time_target_ms((double) MaxGCPauseMillis), - _rs_lengths_prediction(0), - _max_survivor_regions(0), - _survivors_age_table(true), - - _bytes_allocated_in_old_since_last_gc(0), - _ihop_control(NULL), - _initial_mark_to_mixed() { - - // SurvRateGroups below must be initialized after the predictor because they - // indirectly use it through this object passed to their constructor. - _short_lived_surv_rate_group = - new SurvRateGroup(&_predictor, "Short Lived", G1YoungSurvRateNumRegionsSummary); - _survivor_surv_rate_group = - new SurvRateGroup(&_predictor, "Survivor", G1YoungSurvRateNumRegionsSummary); +G1CollectorPolicy::G1CollectorPolicy() { // Set up the region size and associated fields. Given that the // policy is created before the heap, we have to set this up here, @@ -74,64 +47,6 @@ G1CollectorPolicy::G1CollectorPolicy() : // unaligned values for the heap. HeapRegion::setup_heap_region_size(InitialHeapSize, MaxHeapSize); HeapRegionRemSet::setup_remset_size(); - - _phase_times = new G1GCPhaseTimes(ParallelGCThreads); - - // Below, we might need to calculate the pause time target based on - // the pause interval. When we do so we are going to give G1 maximum - // flexibility and allow it to do pauses when it needs to. So, we'll - // arrange that the pause interval to be pause time target + 1 to - // ensure that a) the pause time target is maximized with respect to - // the pause interval and b) we maintain the invariant that pause - // time target < pause interval. If the user does not want this - // maximum flexibility, they will have to set the pause interval - // explicitly. - - // First make sure that, if either parameter is set, its value is - // reasonable. - guarantee(MaxGCPauseMillis >= 1, "Range checking for MaxGCPauseMillis should guarantee that value is >= 1"); - - // Then, if the pause time target parameter was not set, set it to - // the default value. - if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) { - if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) { - // The default pause time target in G1 is 200ms - FLAG_SET_DEFAULT(MaxGCPauseMillis, 200); - } else { - // We do not allow the pause interval to be set without the - // pause time target - vm_exit_during_initialization("GCPauseIntervalMillis cannot be set " - "without setting MaxGCPauseMillis"); - } - } - - // Then, if the interval parameter was not set, set it according to - // the pause time target (this will also deal with the case when the - // pause time target is the default value). - if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) { - FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1); - } - guarantee(GCPauseIntervalMillis >= 1, "Constraint for GCPauseIntervalMillis should guarantee that value is >= 1"); - guarantee(GCPauseIntervalMillis > MaxGCPauseMillis, "Constraint for GCPauseIntervalMillis should guarantee that GCPauseIntervalMillis > MaxGCPauseMillis"); - - double max_gc_time = (double) MaxGCPauseMillis / 1000.0; - double time_slice = (double) GCPauseIntervalMillis / 1000.0; - _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time); - - _tenuring_threshold = MaxTenuringThreshold; - - - guarantee(G1ReservePercent <= 50, "Range checking should not allow values over 50."); - _reserve_factor = (double) G1ReservePercent / 100.0; - // This will be set when the heap is expanded - // for the first time during initialization. - _reserve_regions = 0; - - _ihop_control = create_ihop_control(); -} - -G1CollectorPolicy::~G1CollectorPolicy() { - delete _ihop_control; } void G1CollectorPolicy::initialize_alignments() { @@ -140,1133 +55,3 @@ void G1CollectorPolicy::initialize_alignments() { size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); _heap_alignment = MAX3(card_table_alignment, _space_alignment, page_size); } - -G1CollectorState* G1CollectorPolicy::collector_state() const { return _g1->collector_state(); } - -void G1CollectorPolicy::post_heap_initialize() { - uintx max_regions = G1CollectedHeap::heap()->max_regions(); - size_t max_young_size = (size_t)_young_gen_sizer->max_young_length(max_regions) * HeapRegion::GrainBytes; - if (max_young_size != MaxNewSize) { - FLAG_SET_ERGO(size_t, MaxNewSize, max_young_size); - } -} - -void G1CollectorPolicy::initialize_flags() { - if (G1HeapRegionSize != HeapRegion::GrainBytes) { - FLAG_SET_ERGO(size_t, G1HeapRegionSize, HeapRegion::GrainBytes); - } - - guarantee(SurvivorRatio >= 1, "Range checking for SurvivorRatio should guarantee that value is >= 1"); - - CollectorPolicy::initialize_flags(); - _young_gen_sizer = new G1YoungGenSizer(); // Must be after call to initialize_flags -} - - -void G1CollectorPolicy::init() { - // Set aside an initial future to_space. - _g1 = G1CollectedHeap::heap(); - _collection_set = _g1->collection_set(); - _collection_set->set_policy(this); - - assert(Heap_lock->owned_by_self(), "Locking discipline."); - - initialize_gc_policy_counters(); - - if (adaptive_young_list_length()) { - _young_list_fixed_length = 0; - } else { - _young_list_fixed_length = _young_gen_sizer->min_desired_young_length(); - } - _free_regions_at_end_of_collection = _g1->num_free_regions(); - - update_young_list_max_and_target_length(); - // We may immediately start allocating regions and placing them on the - // collection set list. Initialize the per-collection set info - _collection_set->start_incremental_building(); -} - -void G1CollectorPolicy::note_gc_start() { - phase_times()->note_gc_start(); -} - -// Create the jstat counters for the policy. -void G1CollectorPolicy::initialize_gc_policy_counters() { - _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 3); -} - -bool G1CollectorPolicy::predict_will_fit(uint young_length, - double base_time_ms, - uint base_free_regions, - double target_pause_time_ms) const { - if (young_length >= base_free_regions) { - // end condition 1: not enough space for the young regions - return false; - } - - double accum_surv_rate = accum_yg_surv_rate_pred((int) young_length - 1); - size_t bytes_to_copy = - (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes); - double copy_time_ms = _analytics->predict_object_copy_time_ms(bytes_to_copy, - collector_state()->during_concurrent_mark()); - double young_other_time_ms = _analytics->predict_young_other_time_ms(young_length); - double pause_time_ms = base_time_ms + copy_time_ms + young_other_time_ms; - if (pause_time_ms > target_pause_time_ms) { - // end condition 2: prediction is over the target pause time - return false; - } - - size_t free_bytes = (base_free_regions - young_length) * HeapRegion::GrainBytes; - - // When copying, we will likely need more bytes free than is live in the region. - // Add some safety margin to factor in the confidence of our guess, and the - // natural expected waste. - // (100.0 / G1ConfidencePercent) is a scale factor that expresses the uncertainty - // of the calculation: the lower the confidence, the more headroom. - // (100 + TargetPLABWastePct) represents the increase in expected bytes during - // copying due to anticipated waste in the PLABs. - double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0; - size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy); - - if (expected_bytes_to_copy > free_bytes) { - // end condition 3: out-of-space - return false; - } - - // success! - return true; -} - -void G1CollectorPolicy::record_new_heap_size(uint new_number_of_regions) { - // re-calculate the necessary reserve - double reserve_regions_d = (double) new_number_of_regions * _reserve_factor; - // We use ceiling so that if reserve_regions_d is > 0.0 (but - // smaller than 1.0) we'll get 1. - _reserve_regions = (uint) ceil(reserve_regions_d); - - _young_gen_sizer->heap_size_changed(new_number_of_regions); - - _ihop_control->update_target_occupancy(new_number_of_regions * HeapRegion::GrainBytes); -} - -uint G1CollectorPolicy::calculate_young_list_desired_min_length( - uint base_min_length) const { - uint desired_min_length = 0; - if (adaptive_young_list_length()) { - if (_analytics->num_alloc_rate_ms() > 3) { - double now_sec = os::elapsedTime(); - double when_ms = _mmu_tracker->when_max_gc_sec(now_sec) * 1000.0; - double alloc_rate_ms = _analytics->predict_alloc_rate_ms(); - desired_min_length = (uint) ceil(alloc_rate_ms * when_ms); - } else { - // otherwise we don't have enough info to make the prediction - } - } - desired_min_length += base_min_length; - // make sure we don't go below any user-defined minimum bound - return MAX2(_young_gen_sizer->min_desired_young_length(), desired_min_length); -} - -uint G1CollectorPolicy::calculate_young_list_desired_max_length() const { - // Here, we might want to also take into account any additional - // constraints (i.e., user-defined minimum bound). Currently, we - // effectively don't set this bound. - return _young_gen_sizer->max_desired_young_length(); -} - -uint G1CollectorPolicy::update_young_list_max_and_target_length() { - return update_young_list_max_and_target_length(_analytics->predict_rs_lengths()); -} - -uint G1CollectorPolicy::update_young_list_max_and_target_length(size_t rs_lengths) { - uint unbounded_target_length = update_young_list_target_length(rs_lengths); - update_max_gc_locker_expansion(); - return unbounded_target_length; -} - -uint G1CollectorPolicy::update_young_list_target_length(size_t rs_lengths) { - YoungTargetLengths young_lengths = young_list_target_lengths(rs_lengths); - _young_list_target_length = young_lengths.first; - return young_lengths.second; -} - -G1CollectorPolicy::YoungTargetLengths G1CollectorPolicy::young_list_target_lengths(size_t rs_lengths) const { - YoungTargetLengths result; - - // Calculate the absolute and desired min bounds first. - - // This is how many young regions we already have (currently: the survivors). - const uint base_min_length = _g1->young_list()->survivor_length(); - uint desired_min_length = calculate_young_list_desired_min_length(base_min_length); - // This is the absolute minimum young length. Ensure that we - // will at least have one eden region available for allocation. - uint absolute_min_length = base_min_length + MAX2(_g1->young_list()->eden_length(), (uint)1); - // If we shrank the young list target it should not shrink below the current size. - desired_min_length = MAX2(desired_min_length, absolute_min_length); - // Calculate the absolute and desired max bounds. - - uint desired_max_length = calculate_young_list_desired_max_length(); - - uint young_list_target_length = 0; - if (adaptive_young_list_length()) { - if (collector_state()->gcs_are_young()) { - young_list_target_length = - calculate_young_list_target_length(rs_lengths, - base_min_length, - desired_min_length, - desired_max_length); - } else { - // Don't calculate anything and let the code below bound it to - // the desired_min_length, i.e., do the next GC as soon as - // possible to maximize how many old regions we can add to it. - } - } else { - // The user asked for a fixed young gen so we'll fix the young gen - // whether the next GC is young or mixed. - young_list_target_length = _young_list_fixed_length; - } - - result.second = young_list_target_length; - - // We will try our best not to "eat" into the reserve. - uint absolute_max_length = 0; - if (_free_regions_at_end_of_collection > _reserve_regions) { - absolute_max_length = _free_regions_at_end_of_collection - _reserve_regions; - } - if (desired_max_length > absolute_max_length) { - desired_max_length = absolute_max_length; - } - - // Make sure we don't go over the desired max length, nor under the - // desired min length. In case they clash, desired_min_length wins - // which is why that test is second. - if (young_list_target_length > desired_max_length) { - young_list_target_length = desired_max_length; - } - if (young_list_target_length < desired_min_length) { - young_list_target_length = desired_min_length; - } - - assert(young_list_target_length > base_min_length, - "we should be able to allocate at least one eden region"); - assert(young_list_target_length >= absolute_min_length, "post-condition"); - - result.first = young_list_target_length; - return result; -} - -uint -G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths, - uint base_min_length, - uint desired_min_length, - uint desired_max_length) const { - assert(adaptive_young_list_length(), "pre-condition"); - assert(collector_state()->gcs_are_young(), "only call this for young GCs"); - - // In case some edge-condition makes the desired max length too small... - if (desired_max_length <= desired_min_length) { - return desired_min_length; - } - - // We'll adjust min_young_length and max_young_length not to include - // the already allocated young regions (i.e., so they reflect the - // min and max eden regions we'll allocate). The base_min_length - // will be reflected in the predictions by the - // survivor_regions_evac_time prediction. - assert(desired_min_length > base_min_length, "invariant"); - uint min_young_length = desired_min_length - base_min_length; - assert(desired_max_length > base_min_length, "invariant"); - uint max_young_length = desired_max_length - base_min_length; - - double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0; - double survivor_regions_evac_time = predict_survivor_regions_evac_time(); - size_t pending_cards = _analytics->predict_pending_cards(); - size_t adj_rs_lengths = rs_lengths + _analytics->predict_rs_length_diff(); - size_t scanned_cards = _analytics->predict_card_num(adj_rs_lengths, /* gcs_are_young */ true); - double base_time_ms = - predict_base_elapsed_time_ms(pending_cards, scanned_cards) + - survivor_regions_evac_time; - uint available_free_regions = _free_regions_at_end_of_collection; - uint base_free_regions = 0; - if (available_free_regions > _reserve_regions) { - base_free_regions = available_free_regions - _reserve_regions; - } - - // Here, we will make sure that the shortest young length that - // makes sense fits within the target pause time. - - if (predict_will_fit(min_young_length, base_time_ms, - base_free_regions, target_pause_time_ms)) { - // The shortest young length will fit into the target pause time; - // we'll now check whether the absolute maximum number of young - // regions will fit in the target pause time. If not, we'll do - // a binary search between min_young_length and max_young_length. - if (predict_will_fit(max_young_length, base_time_ms, - base_free_regions, target_pause_time_ms)) { - // The maximum young length will fit into the target pause time. - // We are done so set min young length to the maximum length (as - // the result is assumed to be returned in min_young_length). - min_young_length = max_young_length; - } else { - // The maximum possible number of young regions will not fit within - // the target pause time so we'll search for the optimal - // length. The loop invariants are: - // - // min_young_length < max_young_length - // min_young_length is known to fit into the target pause time - // max_young_length is known not to fit into the target pause time - // - // Going into the loop we know the above hold as we've just - // checked them. Every time around the loop we check whether - // the middle value between min_young_length and - // max_young_length fits into the target pause time. If it - // does, it becomes the new min. If it doesn't, it becomes - // the new max. This way we maintain the loop invariants. - - assert(min_young_length < max_young_length, "invariant"); - uint diff = (max_young_length - min_young_length) / 2; - while (diff > 0) { - uint young_length = min_young_length + diff; - if (predict_will_fit(young_length, base_time_ms, - base_free_regions, target_pause_time_ms)) { - min_young_length = young_length; - } else { - max_young_length = young_length; - } - assert(min_young_length < max_young_length, "invariant"); - diff = (max_young_length - min_young_length) / 2; - } - // The results is min_young_length which, according to the - // loop invariants, should fit within the target pause time. - - // These are the post-conditions of the binary search above: - assert(min_young_length < max_young_length, - "otherwise we should have discovered that max_young_length " - "fits into the pause target and not done the binary search"); - assert(predict_will_fit(min_young_length, base_time_ms, - base_free_regions, target_pause_time_ms), - "min_young_length, the result of the binary search, should " - "fit into the pause target"); - assert(!predict_will_fit(min_young_length + 1, base_time_ms, - base_free_regions, target_pause_time_ms), - "min_young_length, the result of the binary search, should be " - "optimal, so no larger length should fit into the pause target"); - } - } else { - // Even the minimum length doesn't fit into the pause time - // target, return it as the result nevertheless. - } - return base_min_length + min_young_length; -} - -double G1CollectorPolicy::predict_survivor_regions_evac_time() const { - double survivor_regions_evac_time = 0.0; - for (HeapRegion * r = _g1->young_list()->first_survivor_region(); - r != NULL && r != _g1->young_list()->last_survivor_region()->get_next_young_region(); - r = r->get_next_young_region()) { - survivor_regions_evac_time += predict_region_elapsed_time_ms(r, collector_state()->gcs_are_young()); - } - return survivor_regions_evac_time; -} - -void G1CollectorPolicy::revise_young_list_target_length_if_necessary(size_t rs_lengths) { - guarantee( adaptive_young_list_length(), "should not call this otherwise" ); - - if (rs_lengths > _rs_lengths_prediction) { - // add 10% to avoid having to recalculate often - size_t rs_lengths_prediction = rs_lengths * 1100 / 1000; - update_rs_lengths_prediction(rs_lengths_prediction); - - update_young_list_max_and_target_length(rs_lengths_prediction); - } -} - -void G1CollectorPolicy::update_rs_lengths_prediction() { - update_rs_lengths_prediction(_analytics->predict_rs_lengths()); -} - -void G1CollectorPolicy::update_rs_lengths_prediction(size_t prediction) { - if (collector_state()->gcs_are_young() && adaptive_young_list_length()) { - _rs_lengths_prediction = prediction; - } -} - -#ifndef PRODUCT -bool G1CollectorPolicy::verify_young_ages() { - HeapRegion* head = _g1->young_list()->first_region(); - return - verify_young_ages(head, _short_lived_surv_rate_group); - // also call verify_young_ages on any additional surv rate groups -} - -bool -G1CollectorPolicy::verify_young_ages(HeapRegion* head, - SurvRateGroup *surv_rate_group) { - guarantee( surv_rate_group != NULL, "pre-condition" ); - - const char* name = surv_rate_group->name(); - bool ret = true; - int prev_age = -1; - - for (HeapRegion* curr = head; - curr != NULL; - curr = curr->get_next_young_region()) { - SurvRateGroup* group = curr->surv_rate_group(); - if (group == NULL && !curr->is_survivor()) { - log_error(gc, verify)("## %s: encountered NULL surv_rate_group", name); - ret = false; - } - - if (surv_rate_group == group) { - int age = curr->age_in_surv_rate_group(); - - if (age < 0) { - log_error(gc, verify)("## %s: encountered negative age", name); - ret = false; - } - - if (age <= prev_age) { - log_error(gc, verify)("## %s: region ages are not strictly increasing (%d, %d)", name, age, prev_age); - ret = false; - } - prev_age = age; - } - } - - return ret; -} -#endif // PRODUCT - -void G1CollectorPolicy::record_full_collection_start() { - _full_collection_start_sec = os::elapsedTime(); - // Release the future to-space so that it is available for compaction into. - collector_state()->set_full_collection(true); -} - -void G1CollectorPolicy::record_full_collection_end() { - // Consider this like a collection pause for the purposes of allocation - // since last pause. - double end_sec = os::elapsedTime(); - double full_gc_time_sec = end_sec - _full_collection_start_sec; - double full_gc_time_ms = full_gc_time_sec * 1000.0; - - _analytics->update_recent_gc_times(end_sec, full_gc_time_ms); - - collector_state()->set_full_collection(false); - - // "Nuke" the heuristics that control the young/mixed GC - // transitions and make sure we start with young GCs after the Full GC. - collector_state()->set_gcs_are_young(true); - collector_state()->set_last_young_gc(false); - collector_state()->set_initiate_conc_mark_if_possible(need_to_start_conc_mark("end of Full GC", 0)); - collector_state()->set_during_initial_mark_pause(false); - collector_state()->set_in_marking_window(false); - collector_state()->set_in_marking_window_im(false); - - _short_lived_surv_rate_group->start_adding_regions(); - // also call this on any additional surv rate groups - - _free_regions_at_end_of_collection = _g1->num_free_regions(); - // Reset survivors SurvRateGroup. - _survivor_surv_rate_group->reset(); - update_young_list_max_and_target_length(); - update_rs_lengths_prediction(); - cset_chooser()->clear(); - - _bytes_allocated_in_old_since_last_gc = 0; - - record_pause(FullGC, _full_collection_start_sec, end_sec); -} - -void G1CollectorPolicy::record_collection_pause_start(double start_time_sec) { - // We only need to do this here as the policy will only be applied - // to the GC we're about to start. so, no point is calculating this - // every time we calculate / recalculate the target young length. - update_survivors_policy(); - - assert(_g1->used() == _g1->recalculate_used(), - "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT, - _g1->used(), _g1->recalculate_used()); - - phase_times()->record_cur_collection_start_sec(start_time_sec); - _pending_cards = _g1->pending_card_num(); - - _collection_set->reset_bytes_used_before(); - _bytes_copied_during_gc = 0; - - collector_state()->set_last_gc_was_young(false); - - // do that for any other surv rate groups - _short_lived_surv_rate_group->stop_adding_regions(); - _survivors_age_table.clear(); - - assert( verify_young_ages(), "region age verification" ); -} - -void G1CollectorPolicy::record_concurrent_mark_init_end(double - mark_init_elapsed_time_ms) { - collector_state()->set_during_marking(true); - assert(!collector_state()->initiate_conc_mark_if_possible(), "we should have cleared it by now"); - collector_state()->set_during_initial_mark_pause(false); -} - -void G1CollectorPolicy::record_concurrent_mark_remark_start() { - _mark_remark_start_sec = os::elapsedTime(); - collector_state()->set_during_marking(false); -} - -void G1CollectorPolicy::record_concurrent_mark_remark_end() { - double end_time_sec = os::elapsedTime(); - double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0; - _analytics->report_concurrent_mark_remark_times_ms(elapsed_time_ms); - _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms); - - record_pause(Remark, _mark_remark_start_sec, end_time_sec); -} - -void G1CollectorPolicy::record_concurrent_mark_cleanup_start() { - _mark_cleanup_start_sec = os::elapsedTime(); -} - -void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { - bool should_continue_with_reclaim = next_gc_should_be_mixed("request last young-only gc", - "skip last young-only gc"); - collector_state()->set_last_young_gc(should_continue_with_reclaim); - // We skip the marking phase. - if (!should_continue_with_reclaim) { - abort_time_to_mixed_tracking(); - } - collector_state()->set_in_marking_window(false); -} - -double G1CollectorPolicy::average_time_ms(G1GCPhaseTimes::GCParPhases phase) const { - return phase_times()->average_time_ms(phase); -} - -double G1CollectorPolicy::young_other_time_ms() const { - return phase_times()->young_cset_choice_time_ms() + - phase_times()->young_free_cset_time_ms(); -} - -double G1CollectorPolicy::non_young_other_time_ms() const { - return phase_times()->non_young_cset_choice_time_ms() + - phase_times()->non_young_free_cset_time_ms(); - -} - -double G1CollectorPolicy::other_time_ms(double pause_time_ms) const { - return pause_time_ms - - average_time_ms(G1GCPhaseTimes::UpdateRS) - - average_time_ms(G1GCPhaseTimes::ScanRS) - - average_time_ms(G1GCPhaseTimes::ObjCopy) - - average_time_ms(G1GCPhaseTimes::Termination); -} - -double G1CollectorPolicy::constant_other_time_ms(double pause_time_ms) const { - return other_time_ms(pause_time_ms) - young_other_time_ms() - non_young_other_time_ms(); -} - -CollectionSetChooser* G1CollectorPolicy::cset_chooser() const { - return _collection_set->cset_chooser(); -} - -bool G1CollectorPolicy::about_to_start_mixed_phase() const { - return _g1->concurrent_mark()->cmThread()->during_cycle() || collector_state()->last_young_gc(); -} - -bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) { - if (about_to_start_mixed_phase()) { - return false; - } - - size_t marking_initiating_used_threshold = _ihop_control->get_conc_mark_start_threshold(); - - size_t cur_used_bytes = _g1->non_young_capacity_bytes(); - size_t alloc_byte_size = alloc_word_size * HeapWordSize; - size_t marking_request_bytes = cur_used_bytes + alloc_byte_size; - - bool result = false; - if (marking_request_bytes > marking_initiating_used_threshold) { - result = collector_state()->gcs_are_young() && !collector_state()->last_young_gc(); - log_debug(gc, ergo, ihop)("%s occupancy: " SIZE_FORMAT "B allocation request: " SIZE_FORMAT "B threshold: " SIZE_FORMAT "B (%1.2f) source: %s", - result ? "Request concurrent cycle initiation (occupancy higher than threshold)" : "Do not request concurrent cycle initiation (still doing mixed collections)", - cur_used_bytes, alloc_byte_size, marking_initiating_used_threshold, (double) marking_initiating_used_threshold / _g1->capacity() * 100, source); - } - - return result; -} - -// Anything below that is considered to be zero -#define MIN_TIMER_GRANULARITY 0.0000001 - -void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, size_t cards_scanned, size_t heap_used_bytes_before_gc) { - double end_time_sec = os::elapsedTime(); - - size_t cur_used_bytes = _g1->used(); - assert(cur_used_bytes == _g1->recalculate_used(), "It should!"); - bool last_pause_included_initial_mark = false; - bool update_stats = !_g1->evacuation_failed(); - - NOT_PRODUCT(_short_lived_surv_rate_group->print()); - - record_pause(young_gc_pause_kind(), end_time_sec - pause_time_ms / 1000.0, end_time_sec); - - last_pause_included_initial_mark = collector_state()->during_initial_mark_pause(); - if (last_pause_included_initial_mark) { - record_concurrent_mark_init_end(0.0); - } else { - maybe_start_marking(); - } - - double app_time_ms = (phase_times()->cur_collection_start_sec() * 1000.0 - _analytics->prev_collection_pause_end_ms()); - if (app_time_ms < MIN_TIMER_GRANULARITY) { - // This usually happens due to the timer not having the required - // granularity. Some Linuxes are the usual culprits. - // We'll just set it to something (arbitrarily) small. - app_time_ms = 1.0; - } - - if (update_stats) { - // We maintain the invariant that all objects allocated by mutator - // threads will be allocated out of eden regions. So, we can use - // the eden region number allocated since the previous GC to - // calculate the application's allocate rate. The only exception - // to that is humongous objects that are allocated separately. But - // given that humongous object allocations do not really affect - // either the pause's duration nor when the next pause will take - // place we can safely ignore them here. - uint regions_allocated = _collection_set->eden_region_length(); - double alloc_rate_ms = (double) regions_allocated / app_time_ms; - _analytics->report_alloc_rate_ms(alloc_rate_ms); - - double interval_ms = - (end_time_sec - _analytics->last_known_gc_end_time_sec()) * 1000.0; - _analytics->update_recent_gc_times(end_time_sec, pause_time_ms); - _analytics->compute_pause_time_ratio(interval_ms, pause_time_ms); - } - - bool new_in_marking_window = collector_state()->in_marking_window(); - bool new_in_marking_window_im = false; - if (last_pause_included_initial_mark) { - new_in_marking_window = true; - new_in_marking_window_im = true; - } - - if (collector_state()->last_young_gc()) { - // This is supposed to to be the "last young GC" before we start - // doing mixed GCs. Here we decide whether to start mixed GCs or not. - assert(!last_pause_included_initial_mark, "The last young GC is not allowed to be an initial mark GC"); - - if (next_gc_should_be_mixed("start mixed GCs", - "do not start mixed GCs")) { - collector_state()->set_gcs_are_young(false); - } else { - // We aborted the mixed GC phase early. - abort_time_to_mixed_tracking(); - } - - collector_state()->set_last_young_gc(false); - } - - if (!collector_state()->last_gc_was_young()) { - // This is a mixed GC. Here we decide whether to continue doing - // mixed GCs or not. - if (!next_gc_should_be_mixed("continue mixed GCs", - "do not continue mixed GCs")) { - collector_state()->set_gcs_are_young(true); - - maybe_start_marking(); - } - } - - _short_lived_surv_rate_group->start_adding_regions(); - // Do that for any other surv rate groups - - double scan_hcc_time_ms = ConcurrentG1Refine::hot_card_cache_enabled() ? average_time_ms(G1GCPhaseTimes::ScanHCC) : 0.0; - - if (update_stats) { - double cost_per_card_ms = 0.0; - if (_pending_cards > 0) { - cost_per_card_ms = (average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms) / (double) _pending_cards; - _analytics->report_cost_per_card_ms(cost_per_card_ms); - } - _analytics->report_cost_scan_hcc(scan_hcc_time_ms); - - double cost_per_entry_ms = 0.0; - if (cards_scanned > 10) { - cost_per_entry_ms = average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned; - _analytics->report_cost_per_entry_ms(cost_per_entry_ms, collector_state()->last_gc_was_young()); - } - - if (_max_rs_lengths > 0) { - double cards_per_entry_ratio = - (double) cards_scanned / (double) _max_rs_lengths; - _analytics->report_cards_per_entry_ratio(cards_per_entry_ratio, collector_state()->last_gc_was_young()); - } - - // This is defensive. For a while _max_rs_lengths could get - // smaller than _recorded_rs_lengths which was causing - // rs_length_diff to get very large and mess up the RSet length - // predictions. The reason was unsafe concurrent updates to the - // _inc_cset_recorded_rs_lengths field which the code below guards - // against (see CR 7118202). This bug has now been fixed (see CR - // 7119027). However, I'm still worried that - // _inc_cset_recorded_rs_lengths might still end up somewhat - // inaccurate. The concurrent refinement thread calculates an - // RSet's length concurrently with other CR threads updating it - // which might cause it to calculate the length incorrectly (if, - // say, it's in mid-coarsening). So I'll leave in the defensive - // conditional below just in case. - size_t rs_length_diff = 0; - size_t recorded_rs_lengths = _collection_set->recorded_rs_lengths(); - if (_max_rs_lengths > recorded_rs_lengths) { - rs_length_diff = _max_rs_lengths - recorded_rs_lengths; - } - _analytics->report_rs_length_diff((double) rs_length_diff); - - size_t freed_bytes = heap_used_bytes_before_gc - cur_used_bytes; - size_t copied_bytes = _collection_set->bytes_used_before() - freed_bytes; - double cost_per_byte_ms = 0.0; - - if (copied_bytes > 0) { - cost_per_byte_ms = average_time_ms(G1GCPhaseTimes::ObjCopy) / (double) copied_bytes; - _analytics->report_cost_per_byte_ms(cost_per_byte_ms, collector_state()->in_marking_window()); - } - - if (_collection_set->young_region_length() > 0) { - _analytics->report_young_other_cost_per_region_ms(young_other_time_ms() / - _collection_set->young_region_length()); - } - - if (_collection_set->old_region_length() > 0) { - _analytics->report_non_young_other_cost_per_region_ms(non_young_other_time_ms() / - _collection_set->old_region_length()); - } - - _analytics->report_constant_other_time_ms(constant_other_time_ms(pause_time_ms)); - - _analytics->report_pending_cards((double) _pending_cards); - _analytics->report_rs_lengths((double) _max_rs_lengths); - } - - collector_state()->set_in_marking_window(new_in_marking_window); - collector_state()->set_in_marking_window_im(new_in_marking_window_im); - _free_regions_at_end_of_collection = _g1->num_free_regions(); - // IHOP control wants to know the expected young gen length if it were not - // restrained by the heap reserve. Using the actual length would make the - // prediction too small and the limit the young gen every time we get to the - // predicted target occupancy. - size_t last_unrestrained_young_length = update_young_list_max_and_target_length(); - update_rs_lengths_prediction(); - - update_ihop_prediction(app_time_ms / 1000.0, - _bytes_allocated_in_old_since_last_gc, - last_unrestrained_young_length * HeapRegion::GrainBytes); - _bytes_allocated_in_old_since_last_gc = 0; - - _ihop_control->send_trace_event(_g1->gc_tracer_stw()); - - // Note that _mmu_tracker->max_gc_time() returns the time in seconds. - double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; - - if (update_rs_time_goal_ms < scan_hcc_time_ms) { - log_debug(gc, ergo, refine)("Adjust concurrent refinement thresholds (scanning the HCC expected to take longer than Update RS time goal)." - "Update RS time goal: %1.2fms Scan HCC time: %1.2fms", - update_rs_time_goal_ms, scan_hcc_time_ms); - - update_rs_time_goal_ms = 0; - } else { - update_rs_time_goal_ms -= scan_hcc_time_ms; - } - _g1->concurrent_g1_refine()->adjust(average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms, - phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS), - update_rs_time_goal_ms); - - cset_chooser()->verify(); -} - -G1IHOPControl* G1CollectorPolicy::create_ihop_control() const { - if (G1UseAdaptiveIHOP) { - return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent, - &_predictor, - G1ReservePercent, - G1HeapWastePercent); - } else { - return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent); - } -} - -void G1CollectorPolicy::update_ihop_prediction(double mutator_time_s, - size_t mutator_alloc_bytes, - size_t young_gen_size) { - // Always try to update IHOP prediction. Even evacuation failures give information - // about e.g. whether to start IHOP earlier next time. - - // Avoid using really small application times that might create samples with - // very high or very low values. They may be caused by e.g. back-to-back gcs. - double const min_valid_time = 1e-6; - - bool report = false; - - double marking_to_mixed_time = -1.0; - if (!collector_state()->last_gc_was_young() && _initial_mark_to_mixed.has_result()) { - marking_to_mixed_time = _initial_mark_to_mixed.last_marking_time(); - assert(marking_to_mixed_time > 0.0, - "Initial mark to mixed time must be larger than zero but is %.3f", - marking_to_mixed_time); - if (marking_to_mixed_time > min_valid_time) { - _ihop_control->update_marking_length(marking_to_mixed_time); - report = true; - } - } - - // As an approximation for the young gc promotion rates during marking we use - // all of them. In many applications there are only a few if any young gcs during - // marking, which makes any prediction useless. This increases the accuracy of the - // prediction. - if (collector_state()->last_gc_was_young() && mutator_time_s > min_valid_time) { - _ihop_control->update_allocation_info(mutator_time_s, mutator_alloc_bytes, young_gen_size); - report = true; - } - - if (report) { - report_ihop_statistics(); - } -} - -void G1CollectorPolicy::report_ihop_statistics() { - _ihop_control->print(); -} - -void G1CollectorPolicy::print_phases() { - phase_times()->print(); -} - -double G1CollectorPolicy::predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const { - TruncatedSeq* seq = surv_rate_group->get_seq(age); - guarantee(seq->num() > 0, "There should be some young gen survivor samples available. Tried to access with age %d", age); - double pred = _predictor.get_new_prediction(seq); - if (pred > 1.0) { - pred = 1.0; - } - return pred; -} - -double G1CollectorPolicy::predict_yg_surv_rate(int age) const { - return predict_yg_surv_rate(age, _short_lived_surv_rate_group); -} - -double G1CollectorPolicy::accum_yg_surv_rate_pred(int age) const { - return _short_lived_surv_rate_group->accum_surv_rate_pred(age); -} - -double G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards, - size_t scanned_cards) const { - return - _analytics->predict_rs_update_time_ms(pending_cards) + - _analytics->predict_rs_scan_time_ms(scanned_cards, collector_state()->gcs_are_young()) + - _analytics->predict_constant_other_time_ms(); -} - -double G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) const { - size_t rs_length = _analytics->predict_rs_lengths() + _analytics->predict_rs_length_diff(); - size_t card_num = _analytics->predict_card_num(rs_length, collector_state()->gcs_are_young()); - return predict_base_elapsed_time_ms(pending_cards, card_num); -} - -size_t G1CollectorPolicy::predict_bytes_to_copy(HeapRegion* hr) const { - size_t bytes_to_copy; - if (hr->is_marked()) - bytes_to_copy = hr->max_live_bytes(); - else { - assert(hr->is_young() && hr->age_in_surv_rate_group() != -1, "invariant"); - int age = hr->age_in_surv_rate_group(); - double yg_surv_rate = predict_yg_surv_rate(age, hr->surv_rate_group()); - bytes_to_copy = (size_t) (hr->used() * yg_surv_rate); - } - return bytes_to_copy; -} - -double G1CollectorPolicy::predict_region_elapsed_time_ms(HeapRegion* hr, - bool for_young_gc) const { - size_t rs_length = hr->rem_set()->occupied(); - // Predicting the number of cards is based on which type of GC - // we're predicting for. - size_t card_num = _analytics->predict_card_num(rs_length, for_young_gc); - size_t bytes_to_copy = predict_bytes_to_copy(hr); - - double region_elapsed_time_ms = - _analytics->predict_rs_scan_time_ms(card_num, collector_state()->gcs_are_young()) + - _analytics->predict_object_copy_time_ms(bytes_to_copy, collector_state()->during_concurrent_mark()); - - // The prediction of the "other" time for this region is based - // upon the region type and NOT the GC type. - if (hr->is_young()) { - region_elapsed_time_ms += _analytics->predict_young_other_time_ms(1); - } else { - region_elapsed_time_ms += _analytics->predict_non_young_other_time_ms(1); - } - return region_elapsed_time_ms; -} - - -void G1CollectorPolicy::print_yg_surv_rate_info() const { -#ifndef PRODUCT - _short_lived_surv_rate_group->print_surv_rate_summary(); - // add this call for any other surv rate groups -#endif // PRODUCT -} - -bool G1CollectorPolicy::is_young_list_full() const { - uint young_list_length = _g1->young_list()->length(); - uint young_list_target_length = _young_list_target_length; - return young_list_length >= young_list_target_length; -} - -bool G1CollectorPolicy::can_expand_young_list() const { - uint young_list_length = _g1->young_list()->length(); - uint young_list_max_length = _young_list_max_length; - return young_list_length < young_list_max_length; -} - -bool G1CollectorPolicy::adaptive_young_list_length() const { - return _young_gen_sizer->adaptive_young_list_length(); -} - -void G1CollectorPolicy::update_max_gc_locker_expansion() { - uint expansion_region_num = 0; - if (GCLockerEdenExpansionPercent > 0) { - double perc = (double) GCLockerEdenExpansionPercent / 100.0; - double expansion_region_num_d = perc * (double) _young_list_target_length; - // We use ceiling so that if expansion_region_num_d is > 0.0 (but - // less than 1.0) we'll get 1. - expansion_region_num = (uint) ceil(expansion_region_num_d); - } else { - assert(expansion_region_num == 0, "sanity"); - } - _young_list_max_length = _young_list_target_length + expansion_region_num; - assert(_young_list_target_length <= _young_list_max_length, "post-condition"); -} - -// Calculates survivor space parameters. -void G1CollectorPolicy::update_survivors_policy() { - double max_survivor_regions_d = - (double) _young_list_target_length / (double) SurvivorRatio; - // We use ceiling so that if max_survivor_regions_d is > 0.0 (but - // smaller than 1.0) we'll get 1. - _max_survivor_regions = (uint) ceil(max_survivor_regions_d); - - _tenuring_threshold = _survivors_age_table.compute_tenuring_threshold( - HeapRegion::GrainWords * _max_survivor_regions, counters()); -} - -bool G1CollectorPolicy::force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause) { - // We actually check whether we are marking here and not if we are in a - // reclamation phase. This means that we will schedule a concurrent mark - // even while we are still in the process of reclaiming memory. - bool during_cycle = _g1->concurrent_mark()->cmThread()->during_cycle(); - if (!during_cycle) { - log_debug(gc, ergo)("Request concurrent cycle initiation (requested by GC cause). GC cause: %s", GCCause::to_string(gc_cause)); - collector_state()->set_initiate_conc_mark_if_possible(true); - return true; - } else { - log_debug(gc, ergo)("Do not request concurrent cycle initiation (concurrent cycle already in progress). GC cause: %s", GCCause::to_string(gc_cause)); - return false; - } -} - -void G1CollectorPolicy::initiate_conc_mark() { - collector_state()->set_during_initial_mark_pause(true); - collector_state()->set_initiate_conc_mark_if_possible(false); -} - -void G1CollectorPolicy::decide_on_conc_mark_initiation() { - // We are about to decide on whether this pause will be an - // initial-mark pause. - - // First, collector_state()->during_initial_mark_pause() should not be already set. We - // will set it here if we have to. However, it should be cleared by - // the end of the pause (it's only set for the duration of an - // initial-mark pause). - assert(!collector_state()->during_initial_mark_pause(), "pre-condition"); - - if (collector_state()->initiate_conc_mark_if_possible()) { - // We had noticed on a previous pause that the heap occupancy has - // gone over the initiating threshold and we should start a - // concurrent marking cycle. So we might initiate one. - - if (!about_to_start_mixed_phase() && collector_state()->gcs_are_young()) { - // Initiate a new initial mark if there is no marking or reclamation going on. - initiate_conc_mark(); - log_debug(gc, ergo)("Initiate concurrent cycle (concurrent cycle initiation requested)"); - } else if (_g1->is_user_requested_concurrent_full_gc(_g1->gc_cause())) { - // Initiate a user requested initial mark. An initial mark must be young only - // GC, so the collector state must be updated to reflect this. - collector_state()->set_gcs_are_young(true); - collector_state()->set_last_young_gc(false); - - abort_time_to_mixed_tracking(); - initiate_conc_mark(); - log_debug(gc, ergo)("Initiate concurrent cycle (user requested concurrent cycle)"); - } else { - // The concurrent marking thread is still finishing up the - // previous cycle. If we start one right now the two cycles - // overlap. In particular, the concurrent marking thread might - // be in the process of clearing the next marking bitmap (which - // we will use for the next cycle if we start one). Starting a - // cycle now will be bad given that parts of the marking - // information might get cleared by the marking thread. And we - // cannot wait for the marking thread to finish the cycle as it - // periodically yields while clearing the next marking bitmap - // and, if it's in a yield point, it's waiting for us to - // finish. So, at this point we will not start a cycle and we'll - // let the concurrent marking thread complete the last one. - log_debug(gc, ergo)("Do not initiate concurrent cycle (concurrent cycle already in progress)"); - } - } -} - -void G1CollectorPolicy::record_concurrent_mark_cleanup_end() { - cset_chooser()->rebuild(_g1->workers(), _g1->num_regions()); - - double end_sec = os::elapsedTime(); - double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0; - _analytics->report_concurrent_mark_cleanup_times_ms(elapsed_time_ms); - _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms); - - record_pause(Cleanup, _mark_cleanup_start_sec, end_sec); -} - -double G1CollectorPolicy::reclaimable_bytes_perc(size_t reclaimable_bytes) const { - // Returns the given amount of reclaimable bytes (that represents - // the amount of reclaimable space still to be collected) as a - // percentage of the current heap capacity. - size_t capacity_bytes = _g1->capacity(); - return (double) reclaimable_bytes * 100.0 / (double) capacity_bytes; -} - -void G1CollectorPolicy::maybe_start_marking() { - if (need_to_start_conc_mark("end of GC")) { - // Note: this might have already been set, if during the last - // pause we decided to start a cycle but at the beginning of - // this pause we decided to postpone it. That's OK. - collector_state()->set_initiate_conc_mark_if_possible(true); - } -} - -G1CollectorPolicy::PauseKind G1CollectorPolicy::young_gc_pause_kind() const { - assert(!collector_state()->full_collection(), "must be"); - if (collector_state()->during_initial_mark_pause()) { - assert(collector_state()->last_gc_was_young(), "must be"); - assert(!collector_state()->last_young_gc(), "must be"); - return InitialMarkGC; - } else if (collector_state()->last_young_gc()) { - assert(!collector_state()->during_initial_mark_pause(), "must be"); - assert(collector_state()->last_gc_was_young(), "must be"); - return LastYoungGC; - } else if (!collector_state()->last_gc_was_young()) { - assert(!collector_state()->during_initial_mark_pause(), "must be"); - assert(!collector_state()->last_young_gc(), "must be"); - return MixedGC; - } else { - assert(collector_state()->last_gc_was_young(), "must be"); - assert(!collector_state()->during_initial_mark_pause(), "must be"); - assert(!collector_state()->last_young_gc(), "must be"); - return YoungOnlyGC; - } -} - -void G1CollectorPolicy::record_pause(PauseKind kind, double start, double end) { - // Manage the MMU tracker. For some reason it ignores Full GCs. - if (kind != FullGC) { - _mmu_tracker->add_pause(start, end); - } - // Manage the mutator time tracking from initial mark to first mixed gc. - switch (kind) { - case FullGC: - abort_time_to_mixed_tracking(); - break; - case Cleanup: - case Remark: - case YoungOnlyGC: - case LastYoungGC: - _initial_mark_to_mixed.add_pause(end - start); - break; - case InitialMarkGC: - _initial_mark_to_mixed.record_initial_mark_end(end); - break; - case MixedGC: - _initial_mark_to_mixed.record_mixed_gc_start(start); - break; - default: - ShouldNotReachHere(); - } -} - -void G1CollectorPolicy::abort_time_to_mixed_tracking() { - _initial_mark_to_mixed.reset(); -} - -bool G1CollectorPolicy::next_gc_should_be_mixed(const char* true_action_str, - const char* false_action_str) const { - if (cset_chooser()->is_empty()) { - log_debug(gc, ergo)("%s (candidate old regions not available)", false_action_str); - return false; - } - - // Is the amount of uncollected reclaimable space above G1HeapWastePercent? - size_t reclaimable_bytes = cset_chooser()->remaining_reclaimable_bytes(); - double reclaimable_perc = reclaimable_bytes_perc(reclaimable_bytes); - double threshold = (double) G1HeapWastePercent; - if (reclaimable_perc <= threshold) { - log_debug(gc, ergo)("%s (reclaimable percentage not over threshold). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, - false_action_str, cset_chooser()->remaining_regions(), reclaimable_bytes, reclaimable_perc, G1HeapWastePercent); - return false; - } - log_debug(gc, ergo)("%s (candidate old regions available). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, - true_action_str, cset_chooser()->remaining_regions(), reclaimable_bytes, reclaimable_perc, G1HeapWastePercent); - return true; -} - -uint G1CollectorPolicy::calc_min_old_cset_length() const { - // The min old CSet region bound is based on the maximum desired - // number of mixed GCs after a cycle. I.e., even if some old regions - // look expensive, we should add them to the CSet anyway to make - // sure we go through the available old regions in no more than the - // maximum desired number of mixed GCs. - // - // The calculation is based on the number of marked regions we added - // to the CSet chooser in the first place, not how many remain, so - // that the result is the same during all mixed GCs that follow a cycle. - - const size_t region_num = (size_t) cset_chooser()->length(); - const size_t gc_num = (size_t) MAX2(G1MixedGCCountTarget, (uintx) 1); - size_t result = region_num / gc_num; - // emulate ceiling - if (result * gc_num < region_num) { - result += 1; - } - return (uint) result; -} - -uint G1CollectorPolicy::calc_max_old_cset_length() const { - // The max old CSet region bound is based on the threshold expressed - // as a percentage of the heap size. I.e., it should bound the - // number of old regions added to the CSet irrespective of how many - // of them are available. - - const G1CollectedHeap* g1h = G1CollectedHeap::heap(); - const size_t region_num = g1h->num_regions(); - const size_t perc = (size_t) G1OldCSetRegionThresholdPercent; - size_t result = region_num * perc / 100; - // emulate ceiling - if (100 * result < region_num * perc) { - result += 1; - } - return (uint) result; -} - -void G1CollectorPolicy::finalize_collection_set(double target_pause_time_ms) { - double time_remaining_ms = _collection_set->finalize_young_part(target_pause_time_ms); - _collection_set->finalize_old_part(time_remaining_ms); -} diff --git a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp index 01396394eb1..6e58448a342 100644 --- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp +++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp @@ -25,419 +25,19 @@ #ifndef SHARE_VM_GC_G1_G1COLLECTORPOLICY_HPP #define SHARE_VM_GC_G1_G1COLLECTORPOLICY_HPP -#include "gc/g1/g1CollectorState.hpp" -#include "gc/g1/g1GCPhaseTimes.hpp" -#include "gc/g1/g1InCSetState.hpp" -#include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp" -#include "gc/g1/g1MMUTracker.hpp" -#include "gc/g1/g1Predictions.hpp" #include "gc/shared/collectorPolicy.hpp" -#include "utilities/pair.hpp" -// A G1CollectorPolicy makes policy decisions that determine the -// characteristics of the collector. Examples include: -// * choice of collection set. -// * when to collect. +// G1CollectorPolicy is primarily used during initialization and to expose the +// functionality of the CollectorPolicy interface to the rest of the VM. -class HeapRegion; -class G1CollectionSet; -class CollectionSetChooser; -class G1IHOPControl; -class G1Analytics; class G1YoungGenSizer; class G1CollectorPolicy: public CollectorPolicy { - private: - G1IHOPControl* _ihop_control; - - G1IHOPControl* create_ihop_control() const; - // Update the IHOP control with necessary statistics. - void update_ihop_prediction(double mutator_time_s, - size_t mutator_alloc_bytes, - size_t young_gen_size); - void report_ihop_statistics(); - - G1Predictions _predictor; - G1Analytics* _analytics; - G1MMUTracker* _mmu_tracker; - - void initialize_alignments(); - void initialize_flags(); - - double _full_collection_start_sec; - - uint _young_list_target_length; - uint _young_list_fixed_length; - - // The max number of regions we can extend the eden by while the GC - // locker is active. This should be >= _young_list_target_length; - uint _young_list_max_length; - - SurvRateGroup* _short_lived_surv_rate_group; - SurvRateGroup* _survivor_surv_rate_group; - - double _reserve_factor; - uint _reserve_regions; - - G1YoungGenSizer* _young_gen_sizer; - - uint _free_regions_at_end_of_collection; - - size_t _max_rs_lengths; - - size_t _rs_lengths_prediction; - -#ifndef PRODUCT - bool verify_young_ages(HeapRegion* head, SurvRateGroup *surv_rate_group); -#endif // PRODUCT - - double _pause_time_target_ms; - - size_t _pending_cards; - - // The amount of allocated bytes in old gen during the last mutator and the following - // young GC phase. - size_t _bytes_allocated_in_old_since_last_gc; - - G1InitialMarkToMixedTimeTracker _initial_mark_to_mixed; -public: - const G1Predictions& predictor() const { return _predictor; } - const G1Analytics* analytics() const { return const_cast(_analytics); } - - // Add the given number of bytes to the total number of allocated bytes in the old gen. - void add_bytes_allocated_in_old_since_last_gc(size_t bytes) { _bytes_allocated_in_old_since_last_gc += bytes; } - - // Accessors - - void set_region_eden(HeapRegion* hr, int young_index_in_cset) { - hr->set_eden(); - hr->install_surv_rate_group(_short_lived_surv_rate_group); - hr->set_young_index_in_cset(young_index_in_cset); - } - - void set_region_survivor(HeapRegion* hr, int young_index_in_cset) { - assert(hr->is_survivor(), "pre-condition"); - hr->install_surv_rate_group(_survivor_surv_rate_group); - hr->set_young_index_in_cset(young_index_in_cset); - } - -#ifndef PRODUCT - bool verify_young_ages(); -#endif // PRODUCT - - void record_max_rs_lengths(size_t rs_lengths) { - _max_rs_lengths = rs_lengths; - } - - - double predict_base_elapsed_time_ms(size_t pending_cards) const; - double predict_base_elapsed_time_ms(size_t pending_cards, - size_t scanned_cards) const; - size_t predict_bytes_to_copy(HeapRegion* hr) const; - double predict_region_elapsed_time_ms(HeapRegion* hr, bool for_young_gc) const; - - double predict_survivor_regions_evac_time() const; - - bool should_update_surv_rate_group_predictors() { - return collector_state()->last_gc_was_young() && !collector_state()->in_marking_window(); - } - - void cset_regions_freed() { - bool update = should_update_surv_rate_group_predictors(); - - _short_lived_surv_rate_group->all_surviving_words_recorded(update); - _survivor_surv_rate_group->all_surviving_words_recorded(update); - } - - G1MMUTracker* mmu_tracker() { - return _mmu_tracker; - } - - const G1MMUTracker* mmu_tracker() const { - return _mmu_tracker; - } - - double max_pause_time_ms() const { - return _mmu_tracker->max_gc_time() * 1000.0; - } - - // Returns an estimate of the survival rate of the region at yg-age - // "yg_age". - double predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const; - - double predict_yg_surv_rate(int age) const; - - double accum_yg_surv_rate_pred(int age) const; - protected: - G1CollectionSet* _collection_set; - virtual double average_time_ms(G1GCPhaseTimes::GCParPhases phase) const; - virtual double other_time_ms(double pause_time_ms) const; - - double young_other_time_ms() const; - double non_young_other_time_ms() const; - double constant_other_time_ms(double pause_time_ms) const; - - CollectionSetChooser* cset_chooser() const; -private: - - // The number of bytes copied during the GC. - size_t _bytes_copied_during_gc; - - // Stash a pointer to the g1 heap. - G1CollectedHeap* _g1; - - G1GCPhaseTimes* _phase_times; - - // This set of variables tracks the collector efficiency, in order to - // determine whether we should initiate a new marking. - double _mark_remark_start_sec; - double _mark_cleanup_start_sec; - - // Updates the internal young list maximum and target lengths. Returns the - // unbounded young list target length. - uint update_young_list_max_and_target_length(); - uint update_young_list_max_and_target_length(size_t rs_lengths); - - // Update the young list target length either by setting it to the - // desired fixed value or by calculating it using G1's pause - // prediction model. If no rs_lengths parameter is passed, predict - // the RS lengths using the prediction model, otherwise use the - // given rs_lengths as the prediction. - // Returns the unbounded young list target length. - uint update_young_list_target_length(size_t rs_lengths); - - // Calculate and return the minimum desired young list target - // length. This is the minimum desired young list length according - // to the user's inputs. - uint calculate_young_list_desired_min_length(uint base_min_length) const; - - // Calculate and return the maximum desired young list target - // length. This is the maximum desired young list length according - // to the user's inputs. - uint calculate_young_list_desired_max_length() const; - - // Calculate and return the maximum young list target length that - // can fit into the pause time goal. The parameters are: rs_lengths - // represent the prediction of how large the young RSet lengths will - // be, base_min_length is the already existing number of regions in - // the young list, min_length and max_length are the desired min and - // max young list length according to the user's inputs. - uint calculate_young_list_target_length(size_t rs_lengths, - uint base_min_length, - uint desired_min_length, - uint desired_max_length) const; - - // Result of the bounded_young_list_target_length() method, containing both the - // bounded as well as the unbounded young list target lengths in this order. - typedef Pair YoungTargetLengths; - YoungTargetLengths young_list_target_lengths(size_t rs_lengths) const; - - void update_rs_lengths_prediction(); - void update_rs_lengths_prediction(size_t prediction); - - // Check whether a given young length (young_length) fits into the - // given target pause time and whether the prediction for the amount - // of objects to be copied for the given length will fit into the - // given free space (expressed by base_free_regions). It is used by - // calculate_young_list_target_length(). - bool predict_will_fit(uint young_length, double base_time_ms, - uint base_free_regions, double target_pause_time_ms) const; + void initialize_alignments(); public: - size_t pending_cards() const { return _pending_cards; } - - // Calculate the minimum number of old regions we'll add to the CSet - // during a mixed GC. - uint calc_min_old_cset_length() const; - - // Calculate the maximum number of old regions we'll add to the CSet - // during a mixed GC. - uint calc_max_old_cset_length() const; - - // Returns the given amount of uncollected reclaimable space - // as a percentage of the current heap capacity. - double reclaimable_bytes_perc(size_t reclaimable_bytes) const; - -private: - // Sets up marking if proper conditions are met. - void maybe_start_marking(); - - // The kind of STW pause. - enum PauseKind { - FullGC, - YoungOnlyGC, - MixedGC, - LastYoungGC, - InitialMarkGC, - Cleanup, - Remark - }; - - // Calculate PauseKind from internal state. - PauseKind young_gc_pause_kind() const; - // Record the given STW pause with the given start and end times (in s). - void record_pause(PauseKind kind, double start, double end); - // Indicate that we aborted marking before doing any mixed GCs. - void abort_time_to_mixed_tracking(); -public: - G1CollectorPolicy(); - - virtual ~G1CollectorPolicy(); - - virtual G1CollectorPolicy* as_g1_policy() { return this; } - - G1CollectorState* collector_state() const; - - G1GCPhaseTimes* phase_times() const { return _phase_times; } - - // Check the current value of the young list RSet lengths and - // compare it against the last prediction. If the current value is - // higher, recalculate the young list target length prediction. - void revise_young_list_target_length_if_necessary(size_t rs_lengths); - - // This should be called after the heap is resized. - void record_new_heap_size(uint new_number_of_regions); - - void init(); - - virtual void note_gc_start(); - - // Create jstat counters for the policy. - virtual void initialize_gc_policy_counters(); - - bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0); - - bool about_to_start_mixed_phase() const; - - // Record the start and end of an evacuation pause. - void record_collection_pause_start(double start_time_sec); - void record_collection_pause_end(double pause_time_ms, size_t cards_scanned, size_t heap_used_bytes_before_gc); - - // Record the start and end of a full collection. - void record_full_collection_start(); - void record_full_collection_end(); - - // Must currently be called while the world is stopped. - void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms); - - // Record start and end of remark. - void record_concurrent_mark_remark_start(); - void record_concurrent_mark_remark_end(); - - // Record start, end, and completion of cleanup. - void record_concurrent_mark_cleanup_start(); - void record_concurrent_mark_cleanup_end(); - void record_concurrent_mark_cleanup_completed(); - - virtual void print_phases(); - - // Record how much space we copied during a GC. This is typically - // called when a GC alloc region is being retired. - void record_bytes_copied_during_gc(size_t bytes) { - _bytes_copied_during_gc += bytes; - } - - // The amount of space we copied during a GC. - size_t bytes_copied_during_gc() const { - return _bytes_copied_during_gc; - } - - // Determine whether there are candidate regions so that the - // next GC should be mixed. The two action strings are used - // in the ergo output when the method returns true or false. - bool next_gc_should_be_mixed(const char* true_action_str, - const char* false_action_str) const; - - virtual void finalize_collection_set(double target_pause_time_ms); -private: - // Set the state to start a concurrent marking cycle and clear - // _initiate_conc_mark_if_possible because it has now been - // acted on. - void initiate_conc_mark(); - -public: - // This sets the initiate_conc_mark_if_possible() flag to start a - // new cycle, as long as we are not already in one. It's best if it - // is called during a safepoint when the test whether a cycle is in - // progress or not is stable. - bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause); - - // This is called at the very beginning of an evacuation pause (it - // has to be the first thing that the pause does). If - // initiate_conc_mark_if_possible() is true, and the concurrent - // marking thread has completed its work during the previous cycle, - // it will set during_initial_mark_pause() to so that the pause does - // the initial-mark work and start a marking cycle. - void decide_on_conc_mark_initiation(); - - // Print stats on young survival ratio - void print_yg_surv_rate_info() const; - - void finished_recalculating_age_indexes(bool is_survivors) { - if (is_survivors) { - _survivor_surv_rate_group->finished_recalculating_age_indexes(); - } else { - _short_lived_surv_rate_group->finished_recalculating_age_indexes(); - } - } - - size_t young_list_target_length() const { return _young_list_target_length; } - - bool is_young_list_full() const; - - bool can_expand_young_list() const; - - uint young_list_max_length() const { - return _young_list_max_length; - } - - bool adaptive_young_list_length() const; - - virtual bool should_process_references() const { - return true; - } - -private: - // - // Survivor regions policy. - // - - // Current tenuring threshold, set to 0 if the collector reaches the - // maximum amount of survivors regions. - uint _tenuring_threshold; - - // The limit on the number of regions allocated for survivors. - uint _max_survivor_regions; - - AgeTable _survivors_age_table; - -public: - uint tenuring_threshold() const { return _tenuring_threshold; } - - uint max_survivor_regions() { - return _max_survivor_regions; - } - - void note_start_adding_survivor_regions() { - _survivor_surv_rate_group->start_adding_regions(); - } - - void note_stop_adding_survivor_regions() { - _survivor_surv_rate_group->stop_adding_regions(); - } - - void record_age_table(AgeTable* age_table) { - _survivors_age_table.merge(age_table); - } - - void update_max_gc_locker_expansion(); - - // Calculates survivor space parameters. - void update_survivors_policy(); - - virtual void post_heap_initialize(); }; #endif // SHARE_VM_GC_G1_G1COLLECTORPOLICY_HPP diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp index b36583e9822..a409304b8cf 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.cpp @@ -28,12 +28,12 @@ #include "code/codeCache.hpp" #include "gc/g1/concurrentMarkThread.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1ConcurrentMark.inline.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1OopClosures.inline.hpp" #include "gc/g1/g1CardLiveData.inline.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" @@ -57,6 +57,7 @@ #include "runtime/java.hpp" #include "runtime/prefetch.inline.hpp" #include "services/memTracker.hpp" +#include "utilities/growableArray.hpp" // Concurrent marking bit map wrapper @@ -109,8 +110,7 @@ void G1CMBitMap::initialize(MemRegion heap, G1RegionToSpaceMapper* storage) { _bmStartWord = heap.start(); _bmWordSize = heap.word_size(); - _bm.set_map((BitMap::bm_word_t*) storage->reserved().start()); - _bm.set_size(_bmWordSize >> _shifter); + _bm = BitMapView((BitMap::bm_word_t*) storage->reserved().start(), _bmWordSize >> _shifter); storage->set_mapping_changed_listener(&_listener); } @@ -260,11 +260,11 @@ void G1CMMarkStack::note_end_of_gc() { } G1CMRootRegions::G1CMRootRegions() : - _young_list(NULL), _cm(NULL), _scan_in_progress(false), - _should_abort(false), _next_survivor(NULL) { } + _cm(NULL), _scan_in_progress(false), + _should_abort(false), _claimed_survivor_index(0) { } -void G1CMRootRegions::init(G1CollectedHeap* g1h, G1ConcurrentMark* cm) { - _young_list = g1h->young_list(); +void G1CMRootRegions::init(const G1SurvivorRegions* survivors, G1ConcurrentMark* cm) { + _survivors = survivors; _cm = cm; } @@ -272,9 +272,8 @@ void G1CMRootRegions::prepare_for_scan() { assert(!scan_in_progress(), "pre-condition"); // Currently, only survivors can be root regions. - assert(_next_survivor == NULL, "pre-condition"); - _next_survivor = _young_list->first_survivor_region(); - _scan_in_progress = (_next_survivor != NULL); + _claimed_survivor_index = 0; + _scan_in_progress = _survivors->regions()->is_nonempty(); _should_abort = false; } @@ -286,27 +285,17 @@ HeapRegion* G1CMRootRegions::claim_next() { } // Currently, only survivors can be root regions. - HeapRegion* res = _next_survivor; - if (res != NULL) { - MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag); - // Read it again in case it changed while we were waiting for the lock. - res = _next_survivor; - if (res != NULL) { - if (res == _young_list->last_survivor_region()) { - // We just claimed the last survivor so store NULL to indicate - // that we're done. - _next_survivor = NULL; - } else { - _next_survivor = res->get_next_young_region(); - } - } else { - // Someone else claimed the last survivor while we were trying - // to take the lock so nothing else to do. - } - } - assert(res == NULL || res->is_survivor(), "post-condition"); + const GrowableArray* survivor_regions = _survivors->regions(); - return res; + int claimed_index = Atomic::add(1, &_claimed_survivor_index) - 1; + if (claimed_index < survivor_regions->length()) { + return survivor_regions->at(claimed_index); + } + return NULL; +} + +uint G1CMRootRegions::num_root_regions() const { + return (uint)_survivors->regions()->length(); } void G1CMRootRegions::notify_scan_done() { @@ -324,9 +313,11 @@ void G1CMRootRegions::scan_finished() { // Currently, only survivors can be root regions. if (!_should_abort) { - assert(_next_survivor == NULL, "we should have claimed all survivors"); + assert(_claimed_survivor_index >= 0, "otherwise comparison is invalid: %d", _claimed_survivor_index); + assert((uint)_claimed_survivor_index >= _survivors->length(), + "we should have claimed all survivors, claimed index = %u, length = %u", + (uint)_claimed_survivor_index, _survivors->length()); } - _next_survivor = NULL; notify_scan_done(); } @@ -407,7 +398,7 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper* SATBMarkQueueSet& satb_qs = JavaThread::satb_mark_queue_set(); satb_qs.set_buffer_size(G1SATBBufferSize); - _root_regions.init(_g1h, this); + _root_regions.init(_g1h->survivor(), this); if (ConcGCThreads > ParallelGCThreads) { log_warning(gc)("Can't have more ConcGCThreads (%u) than ParallelGCThreads (%u).", @@ -609,6 +600,10 @@ G1ConcurrentMark::~G1ConcurrentMark() { } class G1ClearBitMapTask : public AbstractGangTask { +public: + static size_t chunk_size() { return M; } + +private: // Heap region closure used for clearing the given mark bitmap. class G1ClearBitmapHRClosure : public HeapRegionClosure { private: @@ -619,7 +614,7 @@ class G1ClearBitMapTask : public AbstractGangTask { } virtual bool doHeapRegion(HeapRegion* r) { - size_t const chunk_size_in_words = M / HeapWordSize; + size_t const chunk_size_in_words = G1ClearBitMapTask::chunk_size() / HeapWordSize; HeapWord* cur = r->bottom(); HeapWord* const end = r->end(); @@ -653,7 +648,7 @@ class G1ClearBitMapTask : public AbstractGangTask { public: G1ClearBitMapTask(G1CMBitMap* bitmap, G1ConcurrentMark* cm, uint n_workers, bool suspendible) : - AbstractGangTask("Parallel Clear Bitmap Task"), + AbstractGangTask("G1 Clear Bitmap"), _cl(bitmap, suspendible ? cm : NULL), _hr_claimer(n_workers), _suspendible(suspendible) @@ -672,9 +667,16 @@ public: void G1ConcurrentMark::clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield) { assert(may_yield || SafepointSynchronize::is_at_safepoint(), "Non-yielding bitmap clear only allowed at safepoint."); - G1ClearBitMapTask task(bitmap, this, workers->active_workers(), may_yield); - workers->run_task(&task); - guarantee(!may_yield || task.is_complete(), "Must have completed iteration when not yielding."); + size_t const num_bytes_to_clear = (HeapRegion::GrainBytes * _g1h->num_regions()) / G1CMBitMap::heap_map_factor(); + size_t const num_chunks = align_size_up(num_bytes_to_clear, G1ClearBitMapTask::chunk_size()) / G1ClearBitMapTask::chunk_size(); + + uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers()); + + G1ClearBitMapTask cl(bitmap, this, num_workers, may_yield); + + log_debug(gc, ergo)("Running %s with %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks); + workers->run_task(&cl, num_workers); + guarantee(!may_yield || cl.is_complete(), "Must have completed iteration when not yielding."); } void G1ConcurrentMark::cleanup_for_next_mark() { @@ -739,8 +741,8 @@ public: }; void G1ConcurrentMark::checkpointRootsInitialPre() { - G1CollectedHeap* g1h = G1CollectedHeap::heap(); - G1CollectorPolicy* g1p = g1h->g1_policy(); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + G1Policy* g1p = g1h->g1_policy(); _has_aborted = false; @@ -914,15 +916,16 @@ uint G1ConcurrentMark::calc_parallel_marking_threads() { n_conc_workers = max_parallel_marking_threads(); } else { n_conc_workers = - AdaptiveSizePolicy::calc_default_active_workers( - max_parallel_marking_threads(), - 1, /* Minimum workers */ - parallel_marking_threads(), - Threads::number_of_non_daemon_threads()); + AdaptiveSizePolicy::calc_default_active_workers(max_parallel_marking_threads(), + 1, /* Minimum workers */ + parallel_marking_threads(), + Threads::number_of_non_daemon_threads()); // Don't scale down "n_conc_workers" by scale_parallel_threads() because // that scaling has already gone into "_max_parallel_marking_threads". } - assert(n_conc_workers > 0, "Always need at least 1"); + assert(n_conc_workers > 0 && n_conc_workers <= max_parallel_marking_threads(), + "Calculated number of workers must be larger than zero and at most the maximum %u, but is %u", + max_parallel_marking_threads(), n_conc_workers); return n_conc_workers; } @@ -949,7 +952,7 @@ private: public: G1CMRootRegionScanTask(G1ConcurrentMark* cm) : - AbstractGangTask("Root Region Scan"), _cm(cm) { } + AbstractGangTask("G1 Root Region Scan"), _cm(cm) { } void work(uint worker_id) { assert(Thread::current()->is_ConcurrentGC_thread(), @@ -971,14 +974,17 @@ void G1ConcurrentMark::scan_root_regions() { if (root_regions()->scan_in_progress()) { assert(!has_aborted(), "Aborting before root region scanning is finished not supported."); - _parallel_marking_threads = calc_parallel_marking_threads(); + _parallel_marking_threads = MIN2(calc_parallel_marking_threads(), + // We distribute work on a per-region basis, so starting + // more threads than that is useless. + root_regions()->num_root_regions()); assert(parallel_marking_threads() <= max_parallel_marking_threads(), "Maximum number of marking threads exceeded"); - uint active_workers = MAX2(1U, parallel_marking_threads()); G1CMRootRegionScanTask task(this); - _parallel_workers->set_active_workers(active_workers); - _parallel_workers->run_task(&task); + log_debug(gc, ergo)("Running %s using %u workers for %u work units.", + task.name(), _parallel_marking_threads, root_regions()->num_root_regions()); + _parallel_workers->run_task(&task, _parallel_marking_threads); // It's possible that has_aborted() is true here without actually // aborting the survivor scan earlier. This is OK as it's @@ -1056,7 +1062,7 @@ void G1ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { } g1h->verifier()->check_bitmaps("Remark Start"); - G1CollectorPolicy* g1p = g1h->g1_policy(); + G1Policy* g1p = g1h->g1_policy(); g1p->record_concurrent_mark_remark_start(); double start = os::elapsedTime(); @@ -1144,8 +1150,6 @@ public: if (hr->is_archive()) { return false; } - // We use a claim value of zero here because all regions - // were claimed with value 1 in the FinalCount task. _g1->reset_gc_time_stamps(hr); hr->note_end_of_marking(); @@ -1240,7 +1244,7 @@ void G1ConcurrentMark::cleanup() { } g1h->verifier()->check_bitmaps("Cleanup Start"); - G1CollectorPolicy* g1p = g1h->g1_policy(); + G1Policy* g1p = g1h->g1_policy(); g1p->record_concurrent_mark_cleanup_start(); double start = os::elapsedTime(); @@ -2609,7 +2613,7 @@ void G1CMTask::do_marking_step(double time_target_ms, assert(time_target_ms >= 1.0, "minimum granularity is 1ms"); assert(concurrent() == _cm->concurrent(), "they should be the same"); - G1CollectorPolicy* g1_policy = _g1h->g1_policy(); + G1Policy* g1_policy = _g1h->g1_policy(); assert(_task_queues != NULL, "invariant"); assert(_task_queue != NULL, "invariant"); assert(_task_queues->queue(_worker_id) == _task_queue, "invariant"); diff --git a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp index 3b077d97a8a..03e33461b44 100644 --- a/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp +++ b/hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp @@ -36,6 +36,7 @@ class G1CMTask; class G1ConcurrentMark; class ConcurrentGCTimer; class G1OldTracer; +class G1SurvivorRegions; typedef GenericTaskQueue G1CMTaskQueue; typedef GenericTaskQueueSet G1CMTaskQueueSet; @@ -58,10 +59,10 @@ class G1CMIsAliveClosure: public BoolObjectClosure { class G1CMBitMapRO VALUE_OBJ_CLASS_SPEC { protected: - HeapWord* _bmStartWord; // base address of range covered by map - size_t _bmWordSize; // map size (in #HeapWords covered) - const int _shifter; // map to char or bit - BitMap _bm; // the bit map itself + HeapWord* _bmStartWord; // base address of range covered by map + size_t _bmWordSize; // map size (in #HeapWords covered) + const int _shifter; // map to char or bit + BitMapView _bm; // the bit map itself public: // constructor @@ -204,8 +205,6 @@ class G1CMMarkStack VALUE_OBJ_CLASS_SPEC { template void iterate(Fn fn); }; -class YoungList; - // Root Regions are regions that are not empty at the beginning of a // marking cycle and which we might collect during an evacuation pause // while the cycle is active. Given that, during evacuation pauses, we @@ -221,19 +220,19 @@ class YoungList; // regions populated during the initial-mark pause. class G1CMRootRegions VALUE_OBJ_CLASS_SPEC { private: - YoungList* _young_list; - G1ConcurrentMark* _cm; + const G1SurvivorRegions* _survivors; + G1ConcurrentMark* _cm; - volatile bool _scan_in_progress; - volatile bool _should_abort; - HeapRegion* volatile _next_survivor; + volatile bool _scan_in_progress; + volatile bool _should_abort; + volatile int _claimed_survivor_index; void notify_scan_done(); public: G1CMRootRegions(); // We actually do most of the initialization in this method. - void init(G1CollectedHeap* g1h, G1ConcurrentMark* cm); + void init(const G1SurvivorRegions* survivors, G1ConcurrentMark* cm); // Reset the claiming / scanning of the root regions. void prepare_for_scan(); @@ -249,6 +248,9 @@ public: // all have been claimed. HeapRegion* claim_next(); + // The number of root regions to scan. + uint num_root_regions() const; + void cancel_scan(); // Flag that we're done with root region scanning and notify anyone diff --git a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp new file mode 100644 index 00000000000..37d72134cfd --- /dev/null +++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.cpp @@ -0,0 +1,1171 @@ +/* + * Copyright (c) 2001, 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. + * + */ + +#include "precompiled.hpp" +#include "gc/g1/concurrentG1Refine.hpp" +#include "gc/g1/concurrentMarkThread.inline.hpp" +#include "gc/g1/g1Analytics.hpp" +#include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1CollectionSet.hpp" +#include "gc/g1/g1ConcurrentMark.hpp" +#include "gc/g1/g1DefaultPolicy.hpp" +#include "gc/g1/g1HotCardCache.hpp" +#include "gc/g1/g1IHOPControl.hpp" +#include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1Policy.hpp" +#include "gc/g1/g1SurvivorRegions.hpp" +#include "gc/g1/g1YoungGenSizer.hpp" +#include "gc/g1/heapRegion.inline.hpp" +#include "gc/g1/heapRegionRemSet.hpp" +#include "gc/shared/gcPolicyCounters.hpp" +#include "logging/logStream.hpp" +#include "runtime/arguments.hpp" +#include "runtime/java.hpp" +#include "runtime/mutexLocker.hpp" +#include "utilities/debug.hpp" +#include "utilities/growableArray.hpp" +#include "utilities/pair.hpp" + +G1DefaultPolicy::G1DefaultPolicy() : + _predictor(G1ConfidencePercent / 100.0), + _analytics(new G1Analytics(&_predictor)), + _mmu_tracker(new G1MMUTrackerQueue(GCPauseIntervalMillis / 1000.0, MaxGCPauseMillis / 1000.0)), + _ihop_control(create_ihop_control(&_predictor)), + _policy_counters(new GCPolicyCounters("GarbageFirst", 1, 3)), + _young_list_fixed_length(0), + _short_lived_surv_rate_group(new SurvRateGroup()), + _survivor_surv_rate_group(new SurvRateGroup()), + _reserve_factor((double) G1ReservePercent / 100.0), + _reserve_regions(0), + _rs_lengths_prediction(0), + _bytes_allocated_in_old_since_last_gc(0), + _initial_mark_to_mixed(), + _collection_set(NULL), + _g1(NULL), + _phase_times(new G1GCPhaseTimes(ParallelGCThreads)), + _tenuring_threshold(MaxTenuringThreshold), + _max_survivor_regions(0), + _survivors_age_table(true) { } + +G1DefaultPolicy::~G1DefaultPolicy() { + delete _ihop_control; +} + +G1CollectorState* G1DefaultPolicy::collector_state() const { return _g1->collector_state(); } + +void G1DefaultPolicy::init(G1CollectedHeap* g1h, G1CollectionSet* collection_set) { + _g1 = g1h; + _collection_set = collection_set; + + assert(Heap_lock->owned_by_self(), "Locking discipline."); + + if (!adaptive_young_list_length()) { + _young_list_fixed_length = _young_gen_sizer.min_desired_young_length(); + } + _young_gen_sizer.adjust_max_new_size(_g1->max_regions()); + + _free_regions_at_end_of_collection = _g1->num_free_regions(); + + update_young_list_max_and_target_length(); + // We may immediately start allocating regions and placing them on the + // collection set list. Initialize the per-collection set info + _collection_set->start_incremental_building(); +} + +void G1DefaultPolicy::note_gc_start() { + phase_times()->note_gc_start(); +} + +bool G1DefaultPolicy::predict_will_fit(uint young_length, + double base_time_ms, + uint base_free_regions, + double target_pause_time_ms) const { + if (young_length >= base_free_regions) { + // end condition 1: not enough space for the young regions + return false; + } + + double accum_surv_rate = accum_yg_surv_rate_pred((int) young_length - 1); + size_t bytes_to_copy = + (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes); + double copy_time_ms = _analytics->predict_object_copy_time_ms(bytes_to_copy, + collector_state()->during_concurrent_mark()); + double young_other_time_ms = _analytics->predict_young_other_time_ms(young_length); + double pause_time_ms = base_time_ms + copy_time_ms + young_other_time_ms; + if (pause_time_ms > target_pause_time_ms) { + // end condition 2: prediction is over the target pause time + return false; + } + + size_t free_bytes = (base_free_regions - young_length) * HeapRegion::GrainBytes; + + // When copying, we will likely need more bytes free than is live in the region. + // Add some safety margin to factor in the confidence of our guess, and the + // natural expected waste. + // (100.0 / G1ConfidencePercent) is a scale factor that expresses the uncertainty + // of the calculation: the lower the confidence, the more headroom. + // (100 + TargetPLABWastePct) represents the increase in expected bytes during + // copying due to anticipated waste in the PLABs. + double safety_factor = (100.0 / G1ConfidencePercent) * (100 + TargetPLABWastePct) / 100.0; + size_t expected_bytes_to_copy = (size_t)(safety_factor * bytes_to_copy); + + if (expected_bytes_to_copy > free_bytes) { + // end condition 3: out-of-space + return false; + } + + // success! + return true; +} + +void G1DefaultPolicy::record_new_heap_size(uint new_number_of_regions) { + // re-calculate the necessary reserve + double reserve_regions_d = (double) new_number_of_regions * _reserve_factor; + // We use ceiling so that if reserve_regions_d is > 0.0 (but + // smaller than 1.0) we'll get 1. + _reserve_regions = (uint) ceil(reserve_regions_d); + + _young_gen_sizer.heap_size_changed(new_number_of_regions); + + _ihop_control->update_target_occupancy(new_number_of_regions * HeapRegion::GrainBytes); +} + +uint G1DefaultPolicy::calculate_young_list_desired_min_length(uint base_min_length) const { + uint desired_min_length = 0; + if (adaptive_young_list_length()) { + if (_analytics->num_alloc_rate_ms() > 3) { + double now_sec = os::elapsedTime(); + double when_ms = _mmu_tracker->when_max_gc_sec(now_sec) * 1000.0; + double alloc_rate_ms = _analytics->predict_alloc_rate_ms(); + desired_min_length = (uint) ceil(alloc_rate_ms * when_ms); + } else { + // otherwise we don't have enough info to make the prediction + } + } + desired_min_length += base_min_length; + // make sure we don't go below any user-defined minimum bound + return MAX2(_young_gen_sizer.min_desired_young_length(), desired_min_length); +} + +uint G1DefaultPolicy::calculate_young_list_desired_max_length() const { + // Here, we might want to also take into account any additional + // constraints (i.e., user-defined minimum bound). Currently, we + // effectively don't set this bound. + return _young_gen_sizer.max_desired_young_length(); +} + +uint G1DefaultPolicy::update_young_list_max_and_target_length() { + return update_young_list_max_and_target_length(_analytics->predict_rs_lengths()); +} + +uint G1DefaultPolicy::update_young_list_max_and_target_length(size_t rs_lengths) { + uint unbounded_target_length = update_young_list_target_length(rs_lengths); + update_max_gc_locker_expansion(); + return unbounded_target_length; +} + +uint G1DefaultPolicy::update_young_list_target_length(size_t rs_lengths) { + YoungTargetLengths young_lengths = young_list_target_lengths(rs_lengths); + _young_list_target_length = young_lengths.first; + return young_lengths.second; +} + +G1DefaultPolicy::YoungTargetLengths G1DefaultPolicy::young_list_target_lengths(size_t rs_lengths) const { + YoungTargetLengths result; + + // Calculate the absolute and desired min bounds first. + + // This is how many young regions we already have (currently: the survivors). + const uint base_min_length = _g1->survivor_regions_count(); + uint desired_min_length = calculate_young_list_desired_min_length(base_min_length); + // This is the absolute minimum young length. Ensure that we + // will at least have one eden region available for allocation. + uint absolute_min_length = base_min_length + MAX2(_g1->eden_regions_count(), (uint)1); + // If we shrank the young list target it should not shrink below the current size. + desired_min_length = MAX2(desired_min_length, absolute_min_length); + // Calculate the absolute and desired max bounds. + + uint desired_max_length = calculate_young_list_desired_max_length(); + + uint young_list_target_length = 0; + if (adaptive_young_list_length()) { + if (collector_state()->gcs_are_young()) { + young_list_target_length = + calculate_young_list_target_length(rs_lengths, + base_min_length, + desired_min_length, + desired_max_length); + } else { + // Don't calculate anything and let the code below bound it to + // the desired_min_length, i.e., do the next GC as soon as + // possible to maximize how many old regions we can add to it. + } + } else { + // The user asked for a fixed young gen so we'll fix the young gen + // whether the next GC is young or mixed. + young_list_target_length = _young_list_fixed_length; + } + + result.second = young_list_target_length; + + // We will try our best not to "eat" into the reserve. + uint absolute_max_length = 0; + if (_free_regions_at_end_of_collection > _reserve_regions) { + absolute_max_length = _free_regions_at_end_of_collection - _reserve_regions; + } + if (desired_max_length > absolute_max_length) { + desired_max_length = absolute_max_length; + } + + // Make sure we don't go over the desired max length, nor under the + // desired min length. In case they clash, desired_min_length wins + // which is why that test is second. + if (young_list_target_length > desired_max_length) { + young_list_target_length = desired_max_length; + } + if (young_list_target_length < desired_min_length) { + young_list_target_length = desired_min_length; + } + + assert(young_list_target_length > base_min_length, + "we should be able to allocate at least one eden region"); + assert(young_list_target_length >= absolute_min_length, "post-condition"); + + result.first = young_list_target_length; + return result; +} + +uint +G1DefaultPolicy::calculate_young_list_target_length(size_t rs_lengths, + uint base_min_length, + uint desired_min_length, + uint desired_max_length) const { + assert(adaptive_young_list_length(), "pre-condition"); + assert(collector_state()->gcs_are_young(), "only call this for young GCs"); + + // In case some edge-condition makes the desired max length too small... + if (desired_max_length <= desired_min_length) { + return desired_min_length; + } + + // We'll adjust min_young_length and max_young_length not to include + // the already allocated young regions (i.e., so they reflect the + // min and max eden regions we'll allocate). The base_min_length + // will be reflected in the predictions by the + // survivor_regions_evac_time prediction. + assert(desired_min_length > base_min_length, "invariant"); + uint min_young_length = desired_min_length - base_min_length; + assert(desired_max_length > base_min_length, "invariant"); + uint max_young_length = desired_max_length - base_min_length; + + double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0; + double survivor_regions_evac_time = predict_survivor_regions_evac_time(); + size_t pending_cards = _analytics->predict_pending_cards(); + size_t adj_rs_lengths = rs_lengths + _analytics->predict_rs_length_diff(); + size_t scanned_cards = _analytics->predict_card_num(adj_rs_lengths, /* gcs_are_young */ true); + double base_time_ms = + predict_base_elapsed_time_ms(pending_cards, scanned_cards) + + survivor_regions_evac_time; + uint available_free_regions = _free_regions_at_end_of_collection; + uint base_free_regions = 0; + if (available_free_regions > _reserve_regions) { + base_free_regions = available_free_regions - _reserve_regions; + } + + // Here, we will make sure that the shortest young length that + // makes sense fits within the target pause time. + + if (predict_will_fit(min_young_length, base_time_ms, + base_free_regions, target_pause_time_ms)) { + // The shortest young length will fit into the target pause time; + // we'll now check whether the absolute maximum number of young + // regions will fit in the target pause time. If not, we'll do + // a binary search between min_young_length and max_young_length. + if (predict_will_fit(max_young_length, base_time_ms, + base_free_regions, target_pause_time_ms)) { + // The maximum young length will fit into the target pause time. + // We are done so set min young length to the maximum length (as + // the result is assumed to be returned in min_young_length). + min_young_length = max_young_length; + } else { + // The maximum possible number of young regions will not fit within + // the target pause time so we'll search for the optimal + // length. The loop invariants are: + // + // min_young_length < max_young_length + // min_young_length is known to fit into the target pause time + // max_young_length is known not to fit into the target pause time + // + // Going into the loop we know the above hold as we've just + // checked them. Every time around the loop we check whether + // the middle value between min_young_length and + // max_young_length fits into the target pause time. If it + // does, it becomes the new min. If it doesn't, it becomes + // the new max. This way we maintain the loop invariants. + + assert(min_young_length < max_young_length, "invariant"); + uint diff = (max_young_length - min_young_length) / 2; + while (diff > 0) { + uint young_length = min_young_length + diff; + if (predict_will_fit(young_length, base_time_ms, + base_free_regions, target_pause_time_ms)) { + min_young_length = young_length; + } else { + max_young_length = young_length; + } + assert(min_young_length < max_young_length, "invariant"); + diff = (max_young_length - min_young_length) / 2; + } + // The results is min_young_length which, according to the + // loop invariants, should fit within the target pause time. + + // These are the post-conditions of the binary search above: + assert(min_young_length < max_young_length, + "otherwise we should have discovered that max_young_length " + "fits into the pause target and not done the binary search"); + assert(predict_will_fit(min_young_length, base_time_ms, + base_free_regions, target_pause_time_ms), + "min_young_length, the result of the binary search, should " + "fit into the pause target"); + assert(!predict_will_fit(min_young_length + 1, base_time_ms, + base_free_regions, target_pause_time_ms), + "min_young_length, the result of the binary search, should be " + "optimal, so no larger length should fit into the pause target"); + } + } else { + // Even the minimum length doesn't fit into the pause time + // target, return it as the result nevertheless. + } + return base_min_length + min_young_length; +} + +double G1DefaultPolicy::predict_survivor_regions_evac_time() const { + double survivor_regions_evac_time = 0.0; + const GrowableArray* survivor_regions = _g1->survivor()->regions(); + + for (GrowableArrayIterator it = survivor_regions->begin(); + it != survivor_regions->end(); + ++it) { + survivor_regions_evac_time += predict_region_elapsed_time_ms(*it, collector_state()->gcs_are_young()); + } + return survivor_regions_evac_time; +} + +void G1DefaultPolicy::revise_young_list_target_length_if_necessary(size_t rs_lengths) { + guarantee( adaptive_young_list_length(), "should not call this otherwise" ); + + if (rs_lengths > _rs_lengths_prediction) { + // add 10% to avoid having to recalculate often + size_t rs_lengths_prediction = rs_lengths * 1100 / 1000; + update_rs_lengths_prediction(rs_lengths_prediction); + + update_young_list_max_and_target_length(rs_lengths_prediction); + } +} + +void G1DefaultPolicy::update_rs_lengths_prediction() { + update_rs_lengths_prediction(_analytics->predict_rs_lengths()); +} + +void G1DefaultPolicy::update_rs_lengths_prediction(size_t prediction) { + if (collector_state()->gcs_are_young() && adaptive_young_list_length()) { + _rs_lengths_prediction = prediction; + } +} + +#ifndef PRODUCT +bool G1DefaultPolicy::verify_young_ages() { + bool ret = true; + + for (HeapRegion* curr = _collection_set->inc_head(); + curr != NULL; + curr = curr->next_in_collection_set()) { + guarantee(curr->is_young(), "Region must be young"); + + SurvRateGroup* group = curr->surv_rate_group(); + + if (group == NULL) { + log_error(gc, verify)("## encountered NULL surv_rate_group in young region"); + ret = false; + } + + if (curr->age_in_surv_rate_group() < 0) { + log_error(gc, verify)("## encountered negative age in young region"); + ret = false; + } + } + + if (!ret) { + LogStreamHandle(Error, gc, verify) log; + _collection_set->print(_collection_set->inc_head(), &log); + } + + return ret; +} +#endif // PRODUCT + +void G1DefaultPolicy::record_full_collection_start() { + _full_collection_start_sec = os::elapsedTime(); + // Release the future to-space so that it is available for compaction into. + collector_state()->set_full_collection(true); +} + +void G1DefaultPolicy::record_full_collection_end() { + // Consider this like a collection pause for the purposes of allocation + // since last pause. + double end_sec = os::elapsedTime(); + double full_gc_time_sec = end_sec - _full_collection_start_sec; + double full_gc_time_ms = full_gc_time_sec * 1000.0; + + _analytics->update_recent_gc_times(end_sec, full_gc_time_ms); + + collector_state()->set_full_collection(false); + + // "Nuke" the heuristics that control the young/mixed GC + // transitions and make sure we start with young GCs after the Full GC. + collector_state()->set_gcs_are_young(true); + collector_state()->set_last_young_gc(false); + collector_state()->set_initiate_conc_mark_if_possible(need_to_start_conc_mark("end of Full GC", 0)); + collector_state()->set_during_initial_mark_pause(false); + collector_state()->set_in_marking_window(false); + collector_state()->set_in_marking_window_im(false); + + _short_lived_surv_rate_group->start_adding_regions(); + // also call this on any additional surv rate groups + + _free_regions_at_end_of_collection = _g1->num_free_regions(); + // Reset survivors SurvRateGroup. + _survivor_surv_rate_group->reset(); + update_young_list_max_and_target_length(); + update_rs_lengths_prediction(); + cset_chooser()->clear(); + + _bytes_allocated_in_old_since_last_gc = 0; + + record_pause(FullGC, _full_collection_start_sec, end_sec); +} + +void G1DefaultPolicy::record_collection_pause_start(double start_time_sec) { + // We only need to do this here as the policy will only be applied + // to the GC we're about to start. so, no point is calculating this + // every time we calculate / recalculate the target young length. + update_survivors_policy(); + + assert(_g1->used() == _g1->recalculate_used(), + "sanity, used: " SIZE_FORMAT " recalculate_used: " SIZE_FORMAT, + _g1->used(), _g1->recalculate_used()); + + phase_times()->record_cur_collection_start_sec(start_time_sec); + _pending_cards = _g1->pending_card_num(); + + _collection_set->reset_bytes_used_before(); + _bytes_copied_during_gc = 0; + + collector_state()->set_last_gc_was_young(false); + + // do that for any other surv rate groups + _short_lived_surv_rate_group->stop_adding_regions(); + _survivors_age_table.clear(); + + assert( verify_young_ages(), "region age verification" ); +} + +void G1DefaultPolicy::record_concurrent_mark_init_end(double mark_init_elapsed_time_ms) { + collector_state()->set_during_marking(true); + assert(!collector_state()->initiate_conc_mark_if_possible(), "we should have cleared it by now"); + collector_state()->set_during_initial_mark_pause(false); +} + +void G1DefaultPolicy::record_concurrent_mark_remark_start() { + _mark_remark_start_sec = os::elapsedTime(); + collector_state()->set_during_marking(false); +} + +void G1DefaultPolicy::record_concurrent_mark_remark_end() { + double end_time_sec = os::elapsedTime(); + double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0; + _analytics->report_concurrent_mark_remark_times_ms(elapsed_time_ms); + _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms); + + record_pause(Remark, _mark_remark_start_sec, end_time_sec); +} + +void G1DefaultPolicy::record_concurrent_mark_cleanup_start() { + _mark_cleanup_start_sec = os::elapsedTime(); +} + +void G1DefaultPolicy::record_concurrent_mark_cleanup_completed() { + bool should_continue_with_reclaim = next_gc_should_be_mixed("request last young-only gc", + "skip last young-only gc"); + collector_state()->set_last_young_gc(should_continue_with_reclaim); + // We skip the marking phase. + if (!should_continue_with_reclaim) { + abort_time_to_mixed_tracking(); + } + collector_state()->set_in_marking_window(false); +} + +double G1DefaultPolicy::average_time_ms(G1GCPhaseTimes::GCParPhases phase) const { + return phase_times()->average_time_ms(phase); +} + +double G1DefaultPolicy::young_other_time_ms() const { + return phase_times()->young_cset_choice_time_ms() + + phase_times()->young_free_cset_time_ms(); +} + +double G1DefaultPolicy::non_young_other_time_ms() const { + return phase_times()->non_young_cset_choice_time_ms() + + phase_times()->non_young_free_cset_time_ms(); + +} + +double G1DefaultPolicy::other_time_ms(double pause_time_ms) const { + return pause_time_ms - phase_times()->cur_collection_par_time_ms(); +} + +double G1DefaultPolicy::constant_other_time_ms(double pause_time_ms) const { + return other_time_ms(pause_time_ms) - young_other_time_ms() - non_young_other_time_ms(); +} + +CollectionSetChooser* G1DefaultPolicy::cset_chooser() const { + return _collection_set->cset_chooser(); +} + +bool G1DefaultPolicy::about_to_start_mixed_phase() const { + return _g1->concurrent_mark()->cmThread()->during_cycle() || collector_state()->last_young_gc(); +} + +bool G1DefaultPolicy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) { + if (about_to_start_mixed_phase()) { + return false; + } + + size_t marking_initiating_used_threshold = _ihop_control->get_conc_mark_start_threshold(); + + size_t cur_used_bytes = _g1->non_young_capacity_bytes(); + size_t alloc_byte_size = alloc_word_size * HeapWordSize; + size_t marking_request_bytes = cur_used_bytes + alloc_byte_size; + + bool result = false; + if (marking_request_bytes > marking_initiating_used_threshold) { + result = collector_state()->gcs_are_young() && !collector_state()->last_young_gc(); + log_debug(gc, ergo, ihop)("%s occupancy: " SIZE_FORMAT "B allocation request: " SIZE_FORMAT "B threshold: " SIZE_FORMAT "B (%1.2f) source: %s", + result ? "Request concurrent cycle initiation (occupancy higher than threshold)" : "Do not request concurrent cycle initiation (still doing mixed collections)", + cur_used_bytes, alloc_byte_size, marking_initiating_used_threshold, (double) marking_initiating_used_threshold / _g1->capacity() * 100, source); + } + + return result; +} + +// Anything below that is considered to be zero +#define MIN_TIMER_GRANULARITY 0.0000001 + +void G1DefaultPolicy::record_collection_pause_end(double pause_time_ms, size_t cards_scanned, size_t heap_used_bytes_before_gc) { + double end_time_sec = os::elapsedTime(); + + size_t cur_used_bytes = _g1->used(); + assert(cur_used_bytes == _g1->recalculate_used(), "It should!"); + bool last_pause_included_initial_mark = false; + bool update_stats = !_g1->evacuation_failed(); + + record_pause(young_gc_pause_kind(), end_time_sec - pause_time_ms / 1000.0, end_time_sec); + + last_pause_included_initial_mark = collector_state()->during_initial_mark_pause(); + if (last_pause_included_initial_mark) { + record_concurrent_mark_init_end(0.0); + } else { + maybe_start_marking(); + } + + double app_time_ms = (phase_times()->cur_collection_start_sec() * 1000.0 - _analytics->prev_collection_pause_end_ms()); + if (app_time_ms < MIN_TIMER_GRANULARITY) { + // This usually happens due to the timer not having the required + // granularity. Some Linuxes are the usual culprits. + // We'll just set it to something (arbitrarily) small. + app_time_ms = 1.0; + } + + if (update_stats) { + // We maintain the invariant that all objects allocated by mutator + // threads will be allocated out of eden regions. So, we can use + // the eden region number allocated since the previous GC to + // calculate the application's allocate rate. The only exception + // to that is humongous objects that are allocated separately. But + // given that humongous object allocations do not really affect + // either the pause's duration nor when the next pause will take + // place we can safely ignore them here. + uint regions_allocated = _collection_set->eden_region_length(); + double alloc_rate_ms = (double) regions_allocated / app_time_ms; + _analytics->report_alloc_rate_ms(alloc_rate_ms); + + double interval_ms = + (end_time_sec - _analytics->last_known_gc_end_time_sec()) * 1000.0; + _analytics->update_recent_gc_times(end_time_sec, pause_time_ms); + _analytics->compute_pause_time_ratio(interval_ms, pause_time_ms); + } + + bool new_in_marking_window = collector_state()->in_marking_window(); + bool new_in_marking_window_im = false; + if (last_pause_included_initial_mark) { + new_in_marking_window = true; + new_in_marking_window_im = true; + } + + if (collector_state()->last_young_gc()) { + // This is supposed to to be the "last young GC" before we start + // doing mixed GCs. Here we decide whether to start mixed GCs or not. + assert(!last_pause_included_initial_mark, "The last young GC is not allowed to be an initial mark GC"); + + if (next_gc_should_be_mixed("start mixed GCs", + "do not start mixed GCs")) { + collector_state()->set_gcs_are_young(false); + } else { + // We aborted the mixed GC phase early. + abort_time_to_mixed_tracking(); + } + + collector_state()->set_last_young_gc(false); + } + + if (!collector_state()->last_gc_was_young()) { + // This is a mixed GC. Here we decide whether to continue doing + // mixed GCs or not. + if (!next_gc_should_be_mixed("continue mixed GCs", + "do not continue mixed GCs")) { + collector_state()->set_gcs_are_young(true); + + maybe_start_marking(); + } + } + + _short_lived_surv_rate_group->start_adding_regions(); + // Do that for any other surv rate groups + + double scan_hcc_time_ms = G1HotCardCache::default_use_cache() ? average_time_ms(G1GCPhaseTimes::ScanHCC) : 0.0; + + if (update_stats) { + double cost_per_card_ms = 0.0; + if (_pending_cards > 0) { + cost_per_card_ms = (average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms) / (double) _pending_cards; + _analytics->report_cost_per_card_ms(cost_per_card_ms); + } + _analytics->report_cost_scan_hcc(scan_hcc_time_ms); + + double cost_per_entry_ms = 0.0; + if (cards_scanned > 10) { + cost_per_entry_ms = average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned; + _analytics->report_cost_per_entry_ms(cost_per_entry_ms, collector_state()->last_gc_was_young()); + } + + if (_max_rs_lengths > 0) { + double cards_per_entry_ratio = + (double) cards_scanned / (double) _max_rs_lengths; + _analytics->report_cards_per_entry_ratio(cards_per_entry_ratio, collector_state()->last_gc_was_young()); + } + + // This is defensive. For a while _max_rs_lengths could get + // smaller than _recorded_rs_lengths which was causing + // rs_length_diff to get very large and mess up the RSet length + // predictions. The reason was unsafe concurrent updates to the + // _inc_cset_recorded_rs_lengths field which the code below guards + // against (see CR 7118202). This bug has now been fixed (see CR + // 7119027). However, I'm still worried that + // _inc_cset_recorded_rs_lengths might still end up somewhat + // inaccurate. The concurrent refinement thread calculates an + // RSet's length concurrently with other CR threads updating it + // which might cause it to calculate the length incorrectly (if, + // say, it's in mid-coarsening). So I'll leave in the defensive + // conditional below just in case. + size_t rs_length_diff = 0; + size_t recorded_rs_lengths = _collection_set->recorded_rs_lengths(); + if (_max_rs_lengths > recorded_rs_lengths) { + rs_length_diff = _max_rs_lengths - recorded_rs_lengths; + } + _analytics->report_rs_length_diff((double) rs_length_diff); + + size_t freed_bytes = heap_used_bytes_before_gc - cur_used_bytes; + size_t copied_bytes = _collection_set->bytes_used_before() - freed_bytes; + double cost_per_byte_ms = 0.0; + + if (copied_bytes > 0) { + cost_per_byte_ms = average_time_ms(G1GCPhaseTimes::ObjCopy) / (double) copied_bytes; + _analytics->report_cost_per_byte_ms(cost_per_byte_ms, collector_state()->in_marking_window()); + } + + if (_collection_set->young_region_length() > 0) { + _analytics->report_young_other_cost_per_region_ms(young_other_time_ms() / + _collection_set->young_region_length()); + } + + if (_collection_set->old_region_length() > 0) { + _analytics->report_non_young_other_cost_per_region_ms(non_young_other_time_ms() / + _collection_set->old_region_length()); + } + + _analytics->report_constant_other_time_ms(constant_other_time_ms(pause_time_ms)); + + _analytics->report_pending_cards((double) _pending_cards); + _analytics->report_rs_lengths((double) _max_rs_lengths); + } + + collector_state()->set_in_marking_window(new_in_marking_window); + collector_state()->set_in_marking_window_im(new_in_marking_window_im); + _free_regions_at_end_of_collection = _g1->num_free_regions(); + // IHOP control wants to know the expected young gen length if it were not + // restrained by the heap reserve. Using the actual length would make the + // prediction too small and the limit the young gen every time we get to the + // predicted target occupancy. + size_t last_unrestrained_young_length = update_young_list_max_and_target_length(); + update_rs_lengths_prediction(); + + update_ihop_prediction(app_time_ms / 1000.0, + _bytes_allocated_in_old_since_last_gc, + last_unrestrained_young_length * HeapRegion::GrainBytes); + _bytes_allocated_in_old_since_last_gc = 0; + + _ihop_control->send_trace_event(_g1->gc_tracer_stw()); + + // Note that _mmu_tracker->max_gc_time() returns the time in seconds. + double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0; + + if (update_rs_time_goal_ms < scan_hcc_time_ms) { + log_debug(gc, ergo, refine)("Adjust concurrent refinement thresholds (scanning the HCC expected to take longer than Update RS time goal)." + "Update RS time goal: %1.2fms Scan HCC time: %1.2fms", + update_rs_time_goal_ms, scan_hcc_time_ms); + + update_rs_time_goal_ms = 0; + } else { + update_rs_time_goal_ms -= scan_hcc_time_ms; + } + _g1->concurrent_g1_refine()->adjust(average_time_ms(G1GCPhaseTimes::UpdateRS) - scan_hcc_time_ms, + phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS), + update_rs_time_goal_ms); + + cset_chooser()->verify(); +} + +G1IHOPControl* G1DefaultPolicy::create_ihop_control(const G1Predictions* predictor){ + if (G1UseAdaptiveIHOP) { + return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent, + predictor, + G1ReservePercent, + G1HeapWastePercent); + } else { + return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent); + } +} + +void G1DefaultPolicy::update_ihop_prediction(double mutator_time_s, + size_t mutator_alloc_bytes, + size_t young_gen_size) { + // Always try to update IHOP prediction. Even evacuation failures give information + // about e.g. whether to start IHOP earlier next time. + + // Avoid using really small application times that might create samples with + // very high or very low values. They may be caused by e.g. back-to-back gcs. + double const min_valid_time = 1e-6; + + bool report = false; + + double marking_to_mixed_time = -1.0; + if (!collector_state()->last_gc_was_young() && _initial_mark_to_mixed.has_result()) { + marking_to_mixed_time = _initial_mark_to_mixed.last_marking_time(); + assert(marking_to_mixed_time > 0.0, + "Initial mark to mixed time must be larger than zero but is %.3f", + marking_to_mixed_time); + if (marking_to_mixed_time > min_valid_time) { + _ihop_control->update_marking_length(marking_to_mixed_time); + report = true; + } + } + + // As an approximation for the young gc promotion rates during marking we use + // all of them. In many applications there are only a few if any young gcs during + // marking, which makes any prediction useless. This increases the accuracy of the + // prediction. + if (collector_state()->last_gc_was_young() && mutator_time_s > min_valid_time) { + _ihop_control->update_allocation_info(mutator_time_s, mutator_alloc_bytes, young_gen_size); + report = true; + } + + if (report) { + report_ihop_statistics(); + } +} + +void G1DefaultPolicy::report_ihop_statistics() { + _ihop_control->print(); +} + +void G1DefaultPolicy::print_phases() { + phase_times()->print(); +} + +double G1DefaultPolicy::predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const { + TruncatedSeq* seq = surv_rate_group->get_seq(age); + guarantee(seq->num() > 0, "There should be some young gen survivor samples available. Tried to access with age %d", age); + double pred = _predictor.get_new_prediction(seq); + if (pred > 1.0) { + pred = 1.0; + } + return pred; +} + +double G1DefaultPolicy::accum_yg_surv_rate_pred(int age) const { + return _short_lived_surv_rate_group->accum_surv_rate_pred(age); +} + +double G1DefaultPolicy::predict_base_elapsed_time_ms(size_t pending_cards, + size_t scanned_cards) const { + return + _analytics->predict_rs_update_time_ms(pending_cards) + + _analytics->predict_rs_scan_time_ms(scanned_cards, collector_state()->gcs_are_young()) + + _analytics->predict_constant_other_time_ms(); +} + +double G1DefaultPolicy::predict_base_elapsed_time_ms(size_t pending_cards) const { + size_t rs_length = _analytics->predict_rs_lengths() + _analytics->predict_rs_length_diff(); + size_t card_num = _analytics->predict_card_num(rs_length, collector_state()->gcs_are_young()); + return predict_base_elapsed_time_ms(pending_cards, card_num); +} + +size_t G1DefaultPolicy::predict_bytes_to_copy(HeapRegion* hr) const { + size_t bytes_to_copy; + if (hr->is_marked()) + bytes_to_copy = hr->max_live_bytes(); + else { + assert(hr->is_young() && hr->age_in_surv_rate_group() != -1, "invariant"); + int age = hr->age_in_surv_rate_group(); + double yg_surv_rate = predict_yg_surv_rate(age, hr->surv_rate_group()); + bytes_to_copy = (size_t) (hr->used() * yg_surv_rate); + } + return bytes_to_copy; +} + +double G1DefaultPolicy::predict_region_elapsed_time_ms(HeapRegion* hr, + bool for_young_gc) const { + size_t rs_length = hr->rem_set()->occupied(); + // Predicting the number of cards is based on which type of GC + // we're predicting for. + size_t card_num = _analytics->predict_card_num(rs_length, for_young_gc); + size_t bytes_to_copy = predict_bytes_to_copy(hr); + + double region_elapsed_time_ms = + _analytics->predict_rs_scan_time_ms(card_num, collector_state()->gcs_are_young()) + + _analytics->predict_object_copy_time_ms(bytes_to_copy, collector_state()->during_concurrent_mark()); + + // The prediction of the "other" time for this region is based + // upon the region type and NOT the GC type. + if (hr->is_young()) { + region_elapsed_time_ms += _analytics->predict_young_other_time_ms(1); + } else { + region_elapsed_time_ms += _analytics->predict_non_young_other_time_ms(1); + } + return region_elapsed_time_ms; +} + +bool G1DefaultPolicy::should_allocate_mutator_region() const { + uint young_list_length = _g1->young_regions_count(); + uint young_list_target_length = _young_list_target_length; + return young_list_length < young_list_target_length; +} + +bool G1DefaultPolicy::can_expand_young_list() const { + uint young_list_length = _g1->young_regions_count(); + uint young_list_max_length = _young_list_max_length; + return young_list_length < young_list_max_length; +} + +bool G1DefaultPolicy::adaptive_young_list_length() const { + return _young_gen_sizer.adaptive_young_list_length(); +} + +void G1DefaultPolicy::update_max_gc_locker_expansion() { + uint expansion_region_num = 0; + if (GCLockerEdenExpansionPercent > 0) { + double perc = (double) GCLockerEdenExpansionPercent / 100.0; + double expansion_region_num_d = perc * (double) _young_list_target_length; + // We use ceiling so that if expansion_region_num_d is > 0.0 (but + // less than 1.0) we'll get 1. + expansion_region_num = (uint) ceil(expansion_region_num_d); + } else { + assert(expansion_region_num == 0, "sanity"); + } + _young_list_max_length = _young_list_target_length + expansion_region_num; + assert(_young_list_target_length <= _young_list_max_length, "post-condition"); +} + +// Calculates survivor space parameters. +void G1DefaultPolicy::update_survivors_policy() { + double max_survivor_regions_d = + (double) _young_list_target_length / (double) SurvivorRatio; + // We use ceiling so that if max_survivor_regions_d is > 0.0 (but + // smaller than 1.0) we'll get 1. + _max_survivor_regions = (uint) ceil(max_survivor_regions_d); + + _tenuring_threshold = _survivors_age_table.compute_tenuring_threshold( + HeapRegion::GrainWords * _max_survivor_regions, _policy_counters); +} + +bool G1DefaultPolicy::force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause) { + // We actually check whether we are marking here and not if we are in a + // reclamation phase. This means that we will schedule a concurrent mark + // even while we are still in the process of reclaiming memory. + bool during_cycle = _g1->concurrent_mark()->cmThread()->during_cycle(); + if (!during_cycle) { + log_debug(gc, ergo)("Request concurrent cycle initiation (requested by GC cause). GC cause: %s", GCCause::to_string(gc_cause)); + collector_state()->set_initiate_conc_mark_if_possible(true); + return true; + } else { + log_debug(gc, ergo)("Do not request concurrent cycle initiation (concurrent cycle already in progress). GC cause: %s", GCCause::to_string(gc_cause)); + return false; + } +} + +void G1DefaultPolicy::initiate_conc_mark() { + collector_state()->set_during_initial_mark_pause(true); + collector_state()->set_initiate_conc_mark_if_possible(false); +} + +void G1DefaultPolicy::decide_on_conc_mark_initiation() { + // We are about to decide on whether this pause will be an + // initial-mark pause. + + // First, collector_state()->during_initial_mark_pause() should not be already set. We + // will set it here if we have to. However, it should be cleared by + // the end of the pause (it's only set for the duration of an + // initial-mark pause). + assert(!collector_state()->during_initial_mark_pause(), "pre-condition"); + + if (collector_state()->initiate_conc_mark_if_possible()) { + // We had noticed on a previous pause that the heap occupancy has + // gone over the initiating threshold and we should start a + // concurrent marking cycle. So we might initiate one. + + if (!about_to_start_mixed_phase() && collector_state()->gcs_are_young()) { + // Initiate a new initial mark if there is no marking or reclamation going on. + initiate_conc_mark(); + log_debug(gc, ergo)("Initiate concurrent cycle (concurrent cycle initiation requested)"); + } else if (_g1->is_user_requested_concurrent_full_gc(_g1->gc_cause())) { + // Initiate a user requested initial mark. An initial mark must be young only + // GC, so the collector state must be updated to reflect this. + collector_state()->set_gcs_are_young(true); + collector_state()->set_last_young_gc(false); + + abort_time_to_mixed_tracking(); + initiate_conc_mark(); + log_debug(gc, ergo)("Initiate concurrent cycle (user requested concurrent cycle)"); + } else { + // The concurrent marking thread is still finishing up the + // previous cycle. If we start one right now the two cycles + // overlap. In particular, the concurrent marking thread might + // be in the process of clearing the next marking bitmap (which + // we will use for the next cycle if we start one). Starting a + // cycle now will be bad given that parts of the marking + // information might get cleared by the marking thread. And we + // cannot wait for the marking thread to finish the cycle as it + // periodically yields while clearing the next marking bitmap + // and, if it's in a yield point, it's waiting for us to + // finish. So, at this point we will not start a cycle and we'll + // let the concurrent marking thread complete the last one. + log_debug(gc, ergo)("Do not initiate concurrent cycle (concurrent cycle already in progress)"); + } + } +} + +void G1DefaultPolicy::record_concurrent_mark_cleanup_end() { + cset_chooser()->rebuild(_g1->workers(), _g1->num_regions()); + + double end_sec = os::elapsedTime(); + double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0; + _analytics->report_concurrent_mark_cleanup_times_ms(elapsed_time_ms); + _analytics->append_prev_collection_pause_end_ms(elapsed_time_ms); + + record_pause(Cleanup, _mark_cleanup_start_sec, end_sec); +} + +double G1DefaultPolicy::reclaimable_bytes_perc(size_t reclaimable_bytes) const { + // Returns the given amount of reclaimable bytes (that represents + // the amount of reclaimable space still to be collected) as a + // percentage of the current heap capacity. + size_t capacity_bytes = _g1->capacity(); + return (double) reclaimable_bytes * 100.0 / (double) capacity_bytes; +} + +void G1DefaultPolicy::maybe_start_marking() { + if (need_to_start_conc_mark("end of GC")) { + // Note: this might have already been set, if during the last + // pause we decided to start a cycle but at the beginning of + // this pause we decided to postpone it. That's OK. + collector_state()->set_initiate_conc_mark_if_possible(true); + } +} + +G1DefaultPolicy::PauseKind G1DefaultPolicy::young_gc_pause_kind() const { + assert(!collector_state()->full_collection(), "must be"); + if (collector_state()->during_initial_mark_pause()) { + assert(collector_state()->last_gc_was_young(), "must be"); + assert(!collector_state()->last_young_gc(), "must be"); + return InitialMarkGC; + } else if (collector_state()->last_young_gc()) { + assert(!collector_state()->during_initial_mark_pause(), "must be"); + assert(collector_state()->last_gc_was_young(), "must be"); + return LastYoungGC; + } else if (!collector_state()->last_gc_was_young()) { + assert(!collector_state()->during_initial_mark_pause(), "must be"); + assert(!collector_state()->last_young_gc(), "must be"); + return MixedGC; + } else { + assert(collector_state()->last_gc_was_young(), "must be"); + assert(!collector_state()->during_initial_mark_pause(), "must be"); + assert(!collector_state()->last_young_gc(), "must be"); + return YoungOnlyGC; + } +} + +void G1DefaultPolicy::record_pause(PauseKind kind, double start, double end) { + // Manage the MMU tracker. For some reason it ignores Full GCs. + if (kind != FullGC) { + _mmu_tracker->add_pause(start, end); + } + // Manage the mutator time tracking from initial mark to first mixed gc. + switch (kind) { + case FullGC: + abort_time_to_mixed_tracking(); + break; + case Cleanup: + case Remark: + case YoungOnlyGC: + case LastYoungGC: + _initial_mark_to_mixed.add_pause(end - start); + break; + case InitialMarkGC: + _initial_mark_to_mixed.record_initial_mark_end(end); + break; + case MixedGC: + _initial_mark_to_mixed.record_mixed_gc_start(start); + break; + default: + ShouldNotReachHere(); + } +} + +void G1DefaultPolicy::abort_time_to_mixed_tracking() { + _initial_mark_to_mixed.reset(); +} + +bool G1DefaultPolicy::next_gc_should_be_mixed(const char* true_action_str, + const char* false_action_str) const { + if (cset_chooser()->is_empty()) { + log_debug(gc, ergo)("%s (candidate old regions not available)", false_action_str); + return false; + } + + // Is the amount of uncollected reclaimable space above G1HeapWastePercent? + size_t reclaimable_bytes = cset_chooser()->remaining_reclaimable_bytes(); + double reclaimable_perc = reclaimable_bytes_perc(reclaimable_bytes); + double threshold = (double) G1HeapWastePercent; + if (reclaimable_perc <= threshold) { + log_debug(gc, ergo)("%s (reclaimable percentage not over threshold). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, + false_action_str, cset_chooser()->remaining_regions(), reclaimable_bytes, reclaimable_perc, G1HeapWastePercent); + return false; + } + log_debug(gc, ergo)("%s (candidate old regions available). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, + true_action_str, cset_chooser()->remaining_regions(), reclaimable_bytes, reclaimable_perc, G1HeapWastePercent); + return true; +} + +uint G1DefaultPolicy::calc_min_old_cset_length() const { + // The min old CSet region bound is based on the maximum desired + // number of mixed GCs after a cycle. I.e., even if some old regions + // look expensive, we should add them to the CSet anyway to make + // sure we go through the available old regions in no more than the + // maximum desired number of mixed GCs. + // + // The calculation is based on the number of marked regions we added + // to the CSet chooser in the first place, not how many remain, so + // that the result is the same during all mixed GCs that follow a cycle. + + const size_t region_num = (size_t) cset_chooser()->length(); + const size_t gc_num = (size_t) MAX2(G1MixedGCCountTarget, (uintx) 1); + size_t result = region_num / gc_num; + // emulate ceiling + if (result * gc_num < region_num) { + result += 1; + } + return (uint) result; +} + +uint G1DefaultPolicy::calc_max_old_cset_length() const { + // The max old CSet region bound is based on the threshold expressed + // as a percentage of the heap size. I.e., it should bound the + // number of old regions added to the CSet irrespective of how many + // of them are available. + + const G1CollectedHeap* g1h = G1CollectedHeap::heap(); + const size_t region_num = g1h->num_regions(); + const size_t perc = (size_t) G1OldCSetRegionThresholdPercent; + size_t result = region_num * perc / 100; + // emulate ceiling + if (100 * result < region_num * perc) { + result += 1; + } + return (uint) result; +} + +void G1DefaultPolicy::finalize_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor) { + double time_remaining_ms = _collection_set->finalize_young_part(target_pause_time_ms, survivor); + _collection_set->finalize_old_part(time_remaining_ms); +} + +void G1DefaultPolicy::transfer_survivors_to_cset(const G1SurvivorRegions* survivors) { + + // Add survivor regions to SurvRateGroup. + note_start_adding_survivor_regions(); + finished_recalculating_age_indexes(true /* is_survivors */); + + HeapRegion* last = NULL; + for (GrowableArrayIterator it = survivors->regions()->begin(); + it != survivors->regions()->end(); + ++it) { + HeapRegion* curr = *it; + set_region_survivor(curr); + + // The region is a non-empty survivor so let's add it to + // the incremental collection set for the next evacuation + // pause. + _collection_set->add_survivor_regions(curr); + + last = curr; + } + note_stop_adding_survivor_regions(); + + // Don't clear the survivor list handles until the start of + // the next evacuation pause - we need it in order to re-tag + // the survivor regions from this evacuation pause as 'young' + // at the start of the next. + + finished_recalculating_age_indexes(false /* is_survivors */); +} diff --git a/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp new file mode 100644 index 00000000000..2627dc4517d --- /dev/null +++ b/hotspot/src/share/vm/gc/g1/g1DefaultPolicy.hpp @@ -0,0 +1,438 @@ +/* + * 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. + * + */ + +#ifndef SHARE_VM_GC_G1_G1DEFAULTPOLICY_HPP +#define SHARE_VM_GC_G1_G1DEFAULTPOLICY_HPP + +#include "gc/g1/g1CollectorState.hpp" +#include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1InCSetState.hpp" +#include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp" +#include "gc/g1/g1MMUTracker.hpp" +#include "gc/g1/g1Predictions.hpp" +#include "gc/g1/g1Policy.hpp" +#include "gc/g1/g1YoungGenSizer.hpp" +#include "gc/shared/gcCause.hpp" +#include "utilities/pair.hpp" + +// A G1Policy makes policy decisions that determine the +// characteristics of the collector. Examples include: +// * choice of collection set. +// * when to collect. + +class HeapRegion; +class G1CollectionSet; +class CollectionSetChooser; +class G1IHOPControl; +class G1Analytics; +class G1SurvivorRegions; +class G1YoungGenSizer; +class GCPolicyCounters; + +class G1DefaultPolicy: public G1Policy { + private: + + static G1IHOPControl* create_ihop_control(const G1Predictions* predictor); + // Update the IHOP control with necessary statistics. + void update_ihop_prediction(double mutator_time_s, + size_t mutator_alloc_bytes, + size_t young_gen_size); + void report_ihop_statistics(); + + G1Predictions _predictor; + G1Analytics* _analytics; + G1MMUTracker* _mmu_tracker; + G1IHOPControl* _ihop_control; + + GCPolicyCounters* _policy_counters; + + double _full_collection_start_sec; + + uint _young_list_target_length; + uint _young_list_fixed_length; + + // The max number of regions we can extend the eden by while the GC + // locker is active. This should be >= _young_list_target_length; + uint _young_list_max_length; + + // SurvRateGroups below must be initialized after the predictor because they + // indirectly use it through this object passed to their constructor. + SurvRateGroup* _short_lived_surv_rate_group; + SurvRateGroup* _survivor_surv_rate_group; + + double _reserve_factor; + // This will be set when the heap is expanded + // for the first time during initialization. + uint _reserve_regions; + + G1YoungGenSizer _young_gen_sizer; + + uint _free_regions_at_end_of_collection; + + size_t _max_rs_lengths; + + size_t _rs_lengths_prediction; + +#ifndef PRODUCT + bool verify_young_ages(HeapRegion* head, SurvRateGroup *surv_rate_group); +#endif // PRODUCT + + size_t _pending_cards; + + // The amount of allocated bytes in old gen during the last mutator and the following + // young GC phase. + size_t _bytes_allocated_in_old_since_last_gc; + + G1InitialMarkToMixedTimeTracker _initial_mark_to_mixed; +public: + const G1Predictions& predictor() const { return _predictor; } + const G1Analytics* analytics() const { return const_cast(_analytics); } + + // Add the given number of bytes to the total number of allocated bytes in the old gen. + void add_bytes_allocated_in_old_since_last_gc(size_t bytes) { _bytes_allocated_in_old_since_last_gc += bytes; } + + // Accessors + + void set_region_eden(HeapRegion* hr) { + hr->set_eden(); + hr->install_surv_rate_group(_short_lived_surv_rate_group); + } + + void set_region_survivor(HeapRegion* hr) { + assert(hr->is_survivor(), "pre-condition"); + hr->install_surv_rate_group(_survivor_surv_rate_group); + } + +#ifndef PRODUCT + bool verify_young_ages(); +#endif // PRODUCT + + void record_max_rs_lengths(size_t rs_lengths) { + _max_rs_lengths = rs_lengths; + } + + + double predict_base_elapsed_time_ms(size_t pending_cards) const; + double predict_base_elapsed_time_ms(size_t pending_cards, + size_t scanned_cards) const; + size_t predict_bytes_to_copy(HeapRegion* hr) const; + double predict_region_elapsed_time_ms(HeapRegion* hr, bool for_young_gc) const; + + double predict_survivor_regions_evac_time() const; + + bool should_update_surv_rate_group_predictors() { + return collector_state()->last_gc_was_young() && !collector_state()->in_marking_window(); + } + + void cset_regions_freed() { + bool update = should_update_surv_rate_group_predictors(); + + _short_lived_surv_rate_group->all_surviving_words_recorded(predictor(), update); + _survivor_surv_rate_group->all_surviving_words_recorded(predictor(), update); + } + + G1MMUTracker* mmu_tracker() { + return _mmu_tracker; + } + + const G1MMUTracker* mmu_tracker() const { + return _mmu_tracker; + } + + double max_pause_time_ms() const { + return _mmu_tracker->max_gc_time() * 1000.0; + } + + // Returns an estimate of the survival rate of the region at yg-age + // "yg_age". + double predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) const; + + double predict_yg_surv_rate(int age) const; + + double accum_yg_surv_rate_pred(int age) const; + +protected: + G1CollectionSet* _collection_set; + virtual double average_time_ms(G1GCPhaseTimes::GCParPhases phase) const; + virtual double other_time_ms(double pause_time_ms) const; + + double young_other_time_ms() const; + double non_young_other_time_ms() const; + double constant_other_time_ms(double pause_time_ms) const; + + CollectionSetChooser* cset_chooser() const; +private: + + // The number of bytes copied during the GC. + size_t _bytes_copied_during_gc; + + // Stash a pointer to the g1 heap. + G1CollectedHeap* _g1; + + G1GCPhaseTimes* _phase_times; + + // This set of variables tracks the collector efficiency, in order to + // determine whether we should initiate a new marking. + double _mark_remark_start_sec; + double _mark_cleanup_start_sec; + + // Updates the internal young list maximum and target lengths. Returns the + // unbounded young list target length. + uint update_young_list_max_and_target_length(); + uint update_young_list_max_and_target_length(size_t rs_lengths); + + // Update the young list target length either by setting it to the + // desired fixed value or by calculating it using G1's pause + // prediction model. If no rs_lengths parameter is passed, predict + // the RS lengths using the prediction model, otherwise use the + // given rs_lengths as the prediction. + // Returns the unbounded young list target length. + uint update_young_list_target_length(size_t rs_lengths); + + // Calculate and return the minimum desired young list target + // length. This is the minimum desired young list length according + // to the user's inputs. + uint calculate_young_list_desired_min_length(uint base_min_length) const; + + // Calculate and return the maximum desired young list target + // length. This is the maximum desired young list length according + // to the user's inputs. + uint calculate_young_list_desired_max_length() const; + + // Calculate and return the maximum young list target length that + // can fit into the pause time goal. The parameters are: rs_lengths + // represent the prediction of how large the young RSet lengths will + // be, base_min_length is the already existing number of regions in + // the young list, min_length and max_length are the desired min and + // max young list length according to the user's inputs. + uint calculate_young_list_target_length(size_t rs_lengths, + uint base_min_length, + uint desired_min_length, + uint desired_max_length) const; + + // Result of the bounded_young_list_target_length() method, containing both the + // bounded as well as the unbounded young list target lengths in this order. + typedef Pair YoungTargetLengths; + YoungTargetLengths young_list_target_lengths(size_t rs_lengths) const; + + void update_rs_lengths_prediction(); + void update_rs_lengths_prediction(size_t prediction); + + // Check whether a given young length (young_length) fits into the + // given target pause time and whether the prediction for the amount + // of objects to be copied for the given length will fit into the + // given free space (expressed by base_free_regions). It is used by + // calculate_young_list_target_length(). + bool predict_will_fit(uint young_length, double base_time_ms, + uint base_free_regions, double target_pause_time_ms) const; + +public: + size_t pending_cards() const { return _pending_cards; } + + // Calculate the minimum number of old regions we'll add to the CSet + // during a mixed GC. + uint calc_min_old_cset_length() const; + + // Calculate the maximum number of old regions we'll add to the CSet + // during a mixed GC. + uint calc_max_old_cset_length() const; + + // Returns the given amount of uncollected reclaimable space + // as a percentage of the current heap capacity. + double reclaimable_bytes_perc(size_t reclaimable_bytes) const; + +private: + // Sets up marking if proper conditions are met. + void maybe_start_marking(); + + // The kind of STW pause. + enum PauseKind { + FullGC, + YoungOnlyGC, + MixedGC, + LastYoungGC, + InitialMarkGC, + Cleanup, + Remark + }; + + // Calculate PauseKind from internal state. + PauseKind young_gc_pause_kind() const; + // Record the given STW pause with the given start and end times (in s). + void record_pause(PauseKind kind, double start, double end); + // Indicate that we aborted marking before doing any mixed GCs. + void abort_time_to_mixed_tracking(); +public: + + G1DefaultPolicy(); + + virtual ~G1DefaultPolicy(); + + G1CollectorState* collector_state() const; + + G1GCPhaseTimes* phase_times() const { return _phase_times; } + + // Check the current value of the young list RSet lengths and + // compare it against the last prediction. If the current value is + // higher, recalculate the young list target length prediction. + void revise_young_list_target_length_if_necessary(size_t rs_lengths); + + // This should be called after the heap is resized. + void record_new_heap_size(uint new_number_of_regions); + + void init(G1CollectedHeap* g1h, G1CollectionSet* collection_set); + + virtual void note_gc_start(); + + bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0); + + bool about_to_start_mixed_phase() const; + + // Record the start and end of an evacuation pause. + void record_collection_pause_start(double start_time_sec); + void record_collection_pause_end(double pause_time_ms, size_t cards_scanned, size_t heap_used_bytes_before_gc); + + // Record the start and end of a full collection. + void record_full_collection_start(); + void record_full_collection_end(); + + // Must currently be called while the world is stopped. + void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms); + + // Record start and end of remark. + void record_concurrent_mark_remark_start(); + void record_concurrent_mark_remark_end(); + + // Record start, end, and completion of cleanup. + void record_concurrent_mark_cleanup_start(); + void record_concurrent_mark_cleanup_end(); + void record_concurrent_mark_cleanup_completed(); + + virtual void print_phases(); + + // Record how much space we copied during a GC. This is typically + // called when a GC alloc region is being retired. + void record_bytes_copied_during_gc(size_t bytes) { + _bytes_copied_during_gc += bytes; + } + + // The amount of space we copied during a GC. + size_t bytes_copied_during_gc() const { + return _bytes_copied_during_gc; + } + + // Determine whether there are candidate regions so that the + // next GC should be mixed. The two action strings are used + // in the ergo output when the method returns true or false. + bool next_gc_should_be_mixed(const char* true_action_str, + const char* false_action_str) const; + + virtual void finalize_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor); +private: + // Set the state to start a concurrent marking cycle and clear + // _initiate_conc_mark_if_possible because it has now been + // acted on. + void initiate_conc_mark(); + +public: + // This sets the initiate_conc_mark_if_possible() flag to start a + // new cycle, as long as we are not already in one. It's best if it + // is called during a safepoint when the test whether a cycle is in + // progress or not is stable. + bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause); + + // This is called at the very beginning of an evacuation pause (it + // has to be the first thing that the pause does). If + // initiate_conc_mark_if_possible() is true, and the concurrent + // marking thread has completed its work during the previous cycle, + // it will set during_initial_mark_pause() to so that the pause does + // the initial-mark work and start a marking cycle. + void decide_on_conc_mark_initiation(); + + void finished_recalculating_age_indexes(bool is_survivors) { + if (is_survivors) { + _survivor_surv_rate_group->finished_recalculating_age_indexes(); + } else { + _short_lived_surv_rate_group->finished_recalculating_age_indexes(); + } + } + + size_t young_list_target_length() const { return _young_list_target_length; } + + bool should_allocate_mutator_region() const; + + bool can_expand_young_list() const; + + uint young_list_max_length() const { + return _young_list_max_length; + } + + bool adaptive_young_list_length() const; + + virtual bool should_process_references() const { + return true; + } + + void transfer_survivors_to_cset(const G1SurvivorRegions* survivors); + +private: + // + // Survivor regions policy. + // + + // Current tenuring threshold, set to 0 if the collector reaches the + // maximum amount of survivors regions. + uint _tenuring_threshold; + + // The limit on the number of regions allocated for survivors. + uint _max_survivor_regions; + + AgeTable _survivors_age_table; + +public: + uint tenuring_threshold() const { return _tenuring_threshold; } + + uint max_survivor_regions() { + return _max_survivor_regions; + } + + void note_start_adding_survivor_regions() { + _survivor_surv_rate_group->start_adding_regions(); + } + + void note_stop_adding_survivor_regions() { + _survivor_surv_rate_group->stop_adding_regions(); + } + + void record_age_table(AgeTable* age_table) { + _survivors_age_table.merge(age_table); + } + + void update_max_gc_locker_expansion(); + + // Calculates survivor space parameters. + void update_survivors_policy(); +}; + +#endif // SHARE_VM_GC_G1_G1DEFAULTPOLICY_HPP diff --git a/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageBlendTable.h b/hotspot/src/share/vm/gc/g1/g1EdenRegions.hpp similarity index 58% rename from jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageBlendTable.h rename to hotspot/src/share/vm/gc/g1/g1EdenRegions.hpp index 2e95d502478..c83261b27b3 100644 --- a/jdk/src/java.desktop/share/native/libmlib_image/mlib_c_ImageBlendTable.h +++ b/hotspot/src/share/vm/gc/g1/g1EdenRegions.hpp @@ -1,12 +1,10 @@ /* - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -21,21 +19,32 @@ * 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. + * */ -/* - * These tables are used by C versions of the - * mlib_ImageBlend_... functions. - */ +#ifndef SHARE_VM_GC_G1_G1EDENREGIONS_HPP +#define SHARE_VM_GC_G1_G1EDENREGIONS_HPP -#ifndef MLIB_C_IMAGE_BLEND_TABLE_H -#define MLIB_C_IMAGE_BLEND_TABLE_H +#include "gc/g1/heapRegion.hpp" +#include "memory/allocation.hpp" +#include "runtime/globals.hpp" +#include "utilities/debug.hpp" -#include "mlib_image.h" +class G1EdenRegions VALUE_OBJ_CLASS_SPEC { +private: + int _length; -extern const mlib_f32 mlib_c_blend_u8[]; -extern const mlib_f32 mlib_U82F32[]; -extern const mlib_f32 mlib_c_blend_Q8[]; -extern const mlib_f32 mlib_c_blend_u8_sat[]; +public: + G1EdenRegions() : _length(0) {} -#endif /* MLIB_C_IMAGEF_BLEND_TABLE_H */ + void add(HeapRegion* hr) { + assert(!hr->is_eden(), "should not already be set"); + _length++; + } + + void clear() { _length = 0; } + + uint length() const { return _length; } +}; + +#endif // SHARE_VM_GC_G1_G1EDENREGIONS_HPP diff --git a/hotspot/src/share/vm/gc/g1/g1EvacFailure.cpp b/hotspot/src/share/vm/gc/g1/g1EvacFailure.cpp index 82d655ed232..f6c7371de6e 100644 --- a/hotspot/src/share/vm/gc/g1/g1EvacFailure.cpp +++ b/hotspot/src/share/vm/gc/g1/g1EvacFailure.cpp @@ -33,6 +33,7 @@ #include "gc/g1/g1_globals.hpp" #include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegionRemSet.hpp" +#include "gc/shared/preservedMarks.inline.hpp" class UpdateRSetDeferred : public OopsInHeapRegionClosure { private: @@ -122,7 +123,7 @@ public: size_t obj_size = obj->size(); _marked_bytes += (obj_size * HeapWordSize); - obj->set_mark(markOopDesc::prototype()); + PreservedMarks::init_forwarded_mark(obj); // While we were processing RSet buffers during the collection, // we actually didn't scan any cards on the collection set, @@ -227,15 +228,6 @@ public: during_conc_mark); _g1h->verifier()->check_bitmaps("Self-Forwarding Ptr Removal", hr); - // In the common case (i.e. when there is no evacuation - // failure) we make sure that the following is done when - // the region is freed so that it is "ready-to-go" when it's - // re-allocated. However, when evacuation failure happens, a - // region will remain in the heap and might ultimately be added - // to a CSet in the future. So we have to be careful here and - // make sure the region's RSet is ready for parallel iteration - // whenever this might be required in the future. - hr->rem_set()->reset_for_par_iteration(); hr->reset_bot(); size_t live_bytes = remove_self_forward_ptr_by_walking_hr(hr, during_initial_mark); @@ -262,16 +254,3 @@ void G1ParRemoveSelfForwardPtrsTask::work(uint worker_id) { HeapRegion* hr = _g1h->start_cset_region_for_worker(worker_id); _g1h->collection_set_iterate_from(hr, &rsfp_cl); } - -G1RestorePreservedMarksTask::G1RestorePreservedMarksTask(OopAndMarkOopStack* preserved_objs) : - AbstractGangTask("G1 Restore Preserved Marks"), - _preserved_objs(preserved_objs) {} - -void G1RestorePreservedMarksTask::work(uint worker_id) { - OopAndMarkOopStack& cur = _preserved_objs[worker_id]; - while (!cur.is_empty()) { - OopAndMarkOop elem = cur.pop(); - elem.set_mark(); - } - cur.clear(true); -} diff --git a/hotspot/src/share/vm/gc/g1/g1EvacFailure.hpp b/hotspot/src/share/vm/gc/g1/g1EvacFailure.hpp index eff37e8ae44..9e1945efdd9 100644 --- a/hotspot/src/share/vm/gc/g1/g1EvacFailure.hpp +++ b/hotspot/src/share/vm/gc/g1/g1EvacFailure.hpp @@ -27,7 +27,6 @@ #include "gc/g1/g1OopClosures.hpp" #include "gc/g1/heapRegionManager.hpp" - #include "gc/shared/preservedMarks.hpp" #include "gc/shared/workgroup.hpp" #include "utilities/globalDefinitions.hpp" @@ -46,12 +45,4 @@ public: void work(uint worker_id); }; -class G1RestorePreservedMarksTask : public AbstractGangTask { - OopAndMarkOopStack* _preserved_objs; - public: - G1RestorePreservedMarksTask(OopAndMarkOopStack* preserved_objs); - - void work(uint worker_id); -}; - #endif // SHARE_VM_GC_G1_G1EVACFAILURE_HPP diff --git a/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp b/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp index 0a66488f71d..2b6c3917800 100644 --- a/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp +++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "memory/allocation.inline.hpp" +#include "gc/g1/g1_globals.hpp" #include "gc/g1/g1EvacStats.hpp" #include "gc/shared/gcId.hpp" #include "logging/log.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp index bc7b17cef76..f7e8b1db586 100644 --- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp +++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp @@ -23,9 +23,9 @@ */ #include "precompiled.hpp" -#include "gc/g1/concurrentG1Refine.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1HotCardCache.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/g1/workerDataArray.inline.hpp" #include "memory/resourceArea.hpp" @@ -60,7 +60,7 @@ G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) : _gc_par_phases[SATBFiltering] = new WorkerDataArray(max_gc_threads, "SATB Filtering (ms):"); _gc_par_phases[UpdateRS] = new WorkerDataArray(max_gc_threads, "Update RS (ms):"); - if (ConcurrentG1Refine::hot_card_cache_enabled()) { + if (G1HotCardCache::default_use_cache()) { _gc_par_phases[ScanHCC] = new WorkerDataArray(max_gc_threads, "Scan HCC (ms):"); } else { _gc_par_phases[ScanHCC] = NULL; @@ -255,7 +255,7 @@ void G1GCPhaseTimes::print() { trace_phase(_gc_par_phases[i]); } debug_phase(_gc_par_phases[UpdateRS]); - if (ConcurrentG1Refine::hot_card_cache_enabled()) { + if (G1HotCardCache::default_use_cache()) { trace_phase(_gc_par_phases[ScanHCC]); } debug_phase(_gc_par_phases[ScanRS]); diff --git a/hotspot/src/share/vm/gc/g1/g1HeapSizingPolicy_ext.cpp b/hotspot/src/share/vm/gc/g1/g1HeapSizingPolicy_ext.cpp index 48432568cc0..ec597f7a2cd 100644 --- a/hotspot/src/share/vm/gc/g1/g1HeapSizingPolicy_ext.cpp +++ b/hotspot/src/share/vm/gc/g1/g1HeapSizingPolicy_ext.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc/g1/g1HeapSizingPolicy.hpp" +#include "memory/allocation.inline.hpp" G1HeapSizingPolicy* G1HeapSizingPolicy::create(const G1CollectedHeap* g1, const G1Analytics* analytics) { return new G1HeapSizingPolicy(g1, analytics); diff --git a/hotspot/src/share/vm/gc/g1/g1HeapTransition.cpp b/hotspot/src/share/vm/gc/g1/g1HeapTransition.cpp index 2d1562ea05a..2250863b2b9 100644 --- a/hotspot/src/share/vm/gc/g1/g1HeapTransition.cpp +++ b/hotspot/src/share/vm/gc/g1/g1HeapTransition.cpp @@ -24,15 +24,14 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1HeapTransition.hpp" +#include "gc/g1/g1Policy.hpp" #include "logging/log.hpp" #include "memory/metaspace.hpp" G1HeapTransition::Data::Data(G1CollectedHeap* g1_heap) { - YoungList* young_list = g1_heap->young_list(); - _eden_length = young_list->eden_length(); - _survivor_length = young_list->survivor_length(); + _eden_length = g1_heap->eden_regions_count(); + _survivor_length = g1_heap->survivor_regions_count(); _old_length = g1_heap->old_regions_count(); _humongous_length = g1_heap->humongous_regions_count(); _metaspace_used_bytes = MetaspaceAux::used_bytes(); diff --git a/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp b/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp index ddbdfad5f14..b8093e4fb94 100644 --- a/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp +++ b/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp @@ -29,13 +29,13 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1MarkSweep.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1RootProcessor.hpp" #include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "gc/g1/g1StringDedup.hpp" -#include "gc/g1/youngList.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" @@ -582,13 +582,13 @@ void G1HeapVerifier::verify_dirty_region(HeapRegion* hr) { void G1HeapVerifier::verify_dirty_young_list(HeapRegion* head) { G1SATBCardTableModRefBS* ct_bs = _g1h->g1_barrier_set(); - for (HeapRegion* hr = head; hr != NULL; hr = hr->get_next_young_region()) { + for (HeapRegion* hr = head; hr != NULL; hr = hr->next_in_collection_set()) { verify_dirty_region(hr); } } void G1HeapVerifier::verify_dirty_young_regions() { - verify_dirty_young_list(_g1h->young_list()->first_region()); + verify_dirty_young_list(_g1h->collection_set()->inc_head()); } bool G1HeapVerifier::verify_no_bits_over_tams(const char* bitmap_name, G1CMBitMapRO* bitmap, diff --git a/hotspot/src/share/vm/gc/g1/g1MMUTracker.cpp b/hotspot/src/share/vm/gc/g1/g1MMUTracker.cpp index e8c7a4e9f9b..fdb99afe7b7 100644 --- a/hotspot/src/share/vm/gc/g1/g1MMUTracker.cpp +++ b/hotspot/src/share/vm/gc/g1/g1MMUTracker.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/g1MMUTracker.hpp" #include "gc/shared/gcTrace.hpp" +#include "logging/log.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/ostream.hpp" @@ -107,6 +108,10 @@ void G1MMUTrackerQueue::add_pause(double start, double end) { // Current entry needs to be added before calculating the value double slice_time = calculate_gc_time(end); G1MMUTracer::report_mmu(_time_slice, slice_time, _max_gc_time); + + if (slice_time >= _max_gc_time) { + log_info(gc, mmu)("MMU target violated: %.1lfms (%.1lfms/%.1lfms)", slice_time * 1000.0, _max_gc_time * 1000.0, _time_slice * 1000); + } } // basically the _internal call does not remove expired entries diff --git a/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp b/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp index 1dcbcc24c36..a0cf7c2c3cf 100644 --- a/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp +++ b/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1MonitoringSupport.hpp" +#include "gc/g1/g1Policy.hpp" G1GenerationCounters::G1GenerationCounters(G1MonitoringSupport* g1mm, const char* name, @@ -177,8 +177,8 @@ void G1MonitoringSupport::recalculate_sizes() { // values we read here are possible (i.e., at a STW phase at the end // of a GC). - uint young_list_length = g1->young_list()->length(); - uint survivor_list_length = g1->young_list()->survivor_length(); + uint young_list_length = g1->young_regions_count(); + uint survivor_list_length = g1->survivor_regions_count(); assert(young_list_length >= survivor_list_length, "invariant"); uint eden_list_length = young_list_length - survivor_list_length; // Max length includes any potential extensions to the young gen @@ -237,7 +237,7 @@ void G1MonitoringSupport::recalculate_eden_size() { // When a new eden region is allocated, only the eden_used size is // affected (since we have recalculated everything else at the last GC). - uint young_region_num = g1h()->young_list()->length(); + uint young_region_num = g1h()->young_regions_count(); if (young_region_num > _young_region_num) { uint diff = young_region_num - _young_region_num; _eden_used += (size_t) diff * HeapRegion::GrainBytes; diff --git a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp index 0a42184f3ca..46cd63fb576 100644 --- a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp +++ b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp @@ -75,19 +75,15 @@ void G1PageBasedVirtualSpace::initialize_with_page_size(ReservedSpace rs, size_t vmassert(_committed.size() == 0, "virtual space initialized more than once"); BitMap::idx_t size_in_pages = rs.size() / page_size; - _committed.resize(size_in_pages, /* in_resource_area */ false); + _committed.initialize(size_in_pages); if (_special) { - _dirty.resize(size_in_pages, /* in_resource_area */ false); + _dirty.initialize(size_in_pages); } _tail_size = used_size % _page_size; } G1PageBasedVirtualSpace::~G1PageBasedVirtualSpace() { - release(); -} - -void G1PageBasedVirtualSpace::release() { // This does not release memory it never reserved. // Caller must release via rs.release(); _low_boundary = NULL; @@ -96,8 +92,6 @@ void G1PageBasedVirtualSpace::release() { _executable = false; _page_size = 0; _tail_size = 0; - _committed.resize(0, false); - _dirty.resize(0, false); } size_t G1PageBasedVirtualSpace::committed_size() const { diff --git a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.hpp b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.hpp index 23a7d53d85f..ed16fac9553 100644 --- a/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.hpp +++ b/hotspot/src/share/vm/gc/g1/g1PageBasedVirtualSpace.hpp @@ -57,13 +57,13 @@ class G1PageBasedVirtualSpace VALUE_OBJ_CLASS_SPEC { size_t _page_size; // Bitmap used for verification of commit/uncommit operations. - BitMap _committed; + CHeapBitMap _committed; // Bitmap used to keep track of which pages are dirty or not for _special // spaces. This is needed because for those spaces the underlying memory // will only be zero filled the first time it is committed. Calls to commit // will use this bitmap and return whether or not the memory is zero filled. - BitMap _dirty; + CHeapBitMap _dirty; // Indicates that the entire space has been committed and pinned in memory, // os::commit_memory() or os::uncommit_memory() have no function. @@ -139,8 +139,6 @@ class G1PageBasedVirtualSpace VALUE_OBJ_CLASS_SPEC { return x; } - void release(); - void check_for_contiguity() PRODUCT_RETURN; // Debugging diff --git a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp index 6accb48c1de..6b399ae975c 100644 --- a/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp +++ b/hotspot/src/share/vm/gc/g1/g1ParScanThreadState.hpp @@ -27,8 +27,8 @@ #include "gc/g1/dirtyCardQueue.hpp" #include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1OopClosures.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1SATBCardTableModRefBS.hpp" #include "gc/shared/ageTable.hpp" diff --git a/hotspot/src/share/vm/gc/g1/g1Policy.hpp b/hotspot/src/share/vm/gc/g1/g1Policy.hpp new file mode 100644 index 00000000000..78240032d2d --- /dev/null +++ b/hotspot/src/share/vm/gc/g1/g1Policy.hpp @@ -0,0 +1,186 @@ +/* + * 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. + * + */ + +#ifndef SHARE_VM_GC_G1_G1POLICY_HPP +#define SHARE_VM_GC_G1_G1POLICY_HPP + +#include "gc/g1/g1CollectorState.hpp" +#include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1InCSetState.hpp" +#include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp" +#include "gc/g1/g1MMUTracker.hpp" +#include "gc/g1/g1Predictions.hpp" +#include "gc/g1/g1YoungGenSizer.hpp" +#include "gc/shared/gcCause.hpp" +#include "utilities/pair.hpp" + +// A G1Policy makes policy decisions that determine the +// characteristics of the collector. Examples include: +// * choice of collection set. +// * when to collect. + +class HeapRegion; +class G1CollectionSet; +class CollectionSetChooser; +class G1IHOPControl; +class G1Analytics; +class G1SurvivorRegions; +class G1YoungGenSizer; + +class G1Policy: public CHeapObj { +public: + virtual const G1Predictions& predictor() const = 0; + virtual const G1Analytics* analytics() const = 0; + + // Add the given number of bytes to the total number of allocated bytes in the old gen. + virtual void add_bytes_allocated_in_old_since_last_gc(size_t bytes) = 0; + + // Accessors + + virtual void set_region_eden(HeapRegion* hr) = 0; + virtual void set_region_survivor(HeapRegion* hr) = 0; + + virtual void record_max_rs_lengths(size_t rs_lengths) = 0; + + virtual double predict_base_elapsed_time_ms(size_t pending_cards) const = 0; + virtual double predict_base_elapsed_time_ms(size_t pending_cards, + size_t scanned_cards) const = 0; + + virtual double predict_region_elapsed_time_ms(HeapRegion* hr, bool for_young_gc) const = 0; + + virtual void cset_regions_freed() = 0; + + virtual G1MMUTracker* mmu_tracker() = 0; + + virtual const G1MMUTracker* mmu_tracker() const = 0; + + virtual double max_pause_time_ms() const = 0; + + virtual size_t pending_cards() const = 0; + + // Calculate the minimum number of old regions we'll add to the CSet + // during a mixed GC. + virtual uint calc_min_old_cset_length() const = 0; + + // Calculate the maximum number of old regions we'll add to the CSet + // during a mixed GC. + virtual uint calc_max_old_cset_length() const = 0; + + // Returns the given amount of uncollected reclaimable space + // as a percentage of the current heap capacity. + virtual double reclaimable_bytes_perc(size_t reclaimable_bytes) const = 0; + + virtual ~G1Policy() {} + + virtual G1CollectorState* collector_state() const = 0; + + virtual G1GCPhaseTimes* phase_times() const = 0; + + // Check the current value of the young list RSet lengths and + // compare it against the last prediction. If the current value is + // higher, recalculate the young list target length prediction. + virtual void revise_young_list_target_length_if_necessary(size_t rs_lengths) = 0; + + // This should be called after the heap is resized. + virtual void record_new_heap_size(uint new_number_of_regions) = 0; + + virtual void init(G1CollectedHeap* g1h, G1CollectionSet* collection_set) = 0; + + virtual void note_gc_start() = 0; + + virtual bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0) = 0; + + // Record the start and end of an evacuation pause. + virtual void record_collection_pause_start(double start_time_sec) = 0; + virtual void record_collection_pause_end(double pause_time_ms, size_t cards_scanned, size_t heap_used_bytes_before_gc) = 0; + + // Record the start and end of a full collection. + virtual void record_full_collection_start() = 0; + virtual void record_full_collection_end() = 0; + + // Must currently be called while the world is stopped. + virtual void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms) = 0; + + // Record start and end of remark. + virtual void record_concurrent_mark_remark_start() = 0; + virtual void record_concurrent_mark_remark_end() = 0; + + // Record start, end, and completion of cleanup. + virtual void record_concurrent_mark_cleanup_start() = 0; + virtual void record_concurrent_mark_cleanup_end() = 0; + virtual void record_concurrent_mark_cleanup_completed() = 0; + + virtual void print_phases() = 0; + + // Record how much space we copied during a GC. This is typically + // called when a GC alloc region is being retired. + virtual void record_bytes_copied_during_gc(size_t bytes) = 0; + + // The amount of space we copied during a GC. + virtual size_t bytes_copied_during_gc() const = 0; + + virtual void finalize_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor) = 0; + + // This sets the initiate_conc_mark_if_possible() flag to start a + // new cycle, as long as we are not already in one. It's best if it + // is called during a safepoint when the test whether a cycle is in + // progress or not is stable. + virtual bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause) = 0; + + // This is called at the very beginning of an evacuation pause (it + // has to be the first thing that the pause does). If + // initiate_conc_mark_if_possible() is true, and the concurrent + // marking thread has completed its work during the previous cycle, + // it will set during_initial_mark_pause() to so that the pause does + // the initial-mark work and start a marking cycle. + virtual void decide_on_conc_mark_initiation() = 0; + + + virtual void finished_recalculating_age_indexes(bool is_survivors) = 0; + + virtual void transfer_survivors_to_cset(const G1SurvivorRegions* survivors) = 0; + + virtual size_t young_list_target_length() const = 0; + + virtual bool should_allocate_mutator_region() const = 0; + + virtual bool can_expand_young_list() const = 0; + + virtual uint young_list_max_length() const = 0; + + virtual bool adaptive_young_list_length() const = 0; + + virtual bool should_process_references() const = 0; + + virtual uint tenuring_threshold() const = 0; + virtual uint max_survivor_regions() = 0; + + virtual void note_start_adding_survivor_regions() = 0; + + virtual void note_stop_adding_survivor_regions() = 0; + + virtual void record_age_table(AgeTable* age_table) = 0; +}; + +#endif // SHARE_VM_GC_G1_G1POLICY_HPP diff --git a/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp b/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp index cfac671de88..80b794153ed 100644 --- a/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp +++ b/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.cpp @@ -34,11 +34,12 @@ G1RegionToSpaceMapper::G1RegionToSpaceMapper(ReservedSpace rs, size_t used_size, size_t page_size, size_t region_granularity, + size_t commit_factor, MemoryType type) : _storage(rs, used_size, page_size), _region_granularity(region_granularity), _listener(NULL), - _commit_map() { + _commit_map(rs.size() * commit_factor / region_granularity) { guarantee(is_power_of_2(page_size), "must be"); guarantee(is_power_of_2(region_granularity), "must be"); @@ -59,11 +60,10 @@ class G1RegionsLargerThanCommitSizeMapper : public G1RegionToSpaceMapper { size_t alloc_granularity, size_t commit_factor, MemoryType type) : - G1RegionToSpaceMapper(rs, actual_size, page_size, alloc_granularity, type), + G1RegionToSpaceMapper(rs, actual_size, page_size, alloc_granularity, commit_factor, type), _pages_per_region(alloc_granularity / (page_size * commit_factor)) { guarantee(alloc_granularity >= page_size, "allocation granularity smaller than commit granularity"); - _commit_map.resize(rs.size() * commit_factor / alloc_granularity, /* in_resource_area */ false); } virtual void commit_regions(uint start_idx, size_t num_regions) { @@ -103,12 +103,11 @@ class G1RegionsSmallerThanCommitSizeMapper : public G1RegionToSpaceMapper { size_t alloc_granularity, size_t commit_factor, MemoryType type) : - G1RegionToSpaceMapper(rs, actual_size, page_size, alloc_granularity, type), + G1RegionToSpaceMapper(rs, actual_size, page_size, alloc_granularity, commit_factor, type), _regions_per_page((page_size * commit_factor) / alloc_granularity), _refcounts() { guarantee((page_size * commit_factor) >= alloc_granularity, "allocation granularity smaller than commit granularity"); _refcounts.initialize((HeapWord*)rs.base(), (HeapWord*)(rs.base() + align_size_up(rs.size(), page_size)), page_size); - _commit_map.resize(rs.size() * commit_factor / alloc_granularity, /* in_resource_area */ false); } virtual void commit_regions(uint start_idx, size_t num_regions) { diff --git a/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.hpp b/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.hpp index a6d085e0b8e..218ae1550ae 100644 --- a/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.hpp +++ b/hotspot/src/share/vm/gc/g1/g1RegionToSpaceMapper.hpp @@ -49,9 +49,9 @@ class G1RegionToSpaceMapper : public CHeapObj { size_t _region_granularity; // Mapping management - BitMap _commit_map; + CHeapBitMap _commit_map; - G1RegionToSpaceMapper(ReservedSpace rs, size_t used_size, size_t page_size, size_t region_granularity, MemoryType type); + G1RegionToSpaceMapper(ReservedSpace rs, size_t used_size, size_t page_size, size_t region_granularity, size_t commit_factor, MemoryType type); void fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled); public: @@ -62,9 +62,7 @@ class G1RegionToSpaceMapper : public CHeapObj { void set_mapping_changed_listener(G1MappingChangedListener* listener) { _listener = listener; } - virtual ~G1RegionToSpaceMapper() { - _commit_map.resize(0, /* in_resource_area */ false); - } + virtual ~G1RegionToSpaceMapper() {} bool is_committed(uintptr_t idx) const { return _commit_map.at(idx); diff --git a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp index 12ed0506d94..9871a7ce962 100644 --- a/hotspot/src/share/vm/gc/g1/g1RemSet.cpp +++ b/hotspot/src/share/vm/gc/g1/g1RemSet.cpp @@ -24,11 +24,9 @@ #include "precompiled.hpp" #include "gc/g1/concurrentG1Refine.hpp" -#include "gc/g1/concurrentG1RefineThread.hpp" #include "gc/g1/dirtyCardQueue.hpp" #include "gc/g1/g1BlockOffsetTable.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1FromCardCache.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" #include "gc/g1/g1HotCardCache.hpp" @@ -46,20 +44,213 @@ #include "utilities/intHisto.hpp" #include "utilities/stack.inline.hpp" -G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) : +// Collects information about the overall remembered set scan progress during an evacuation. +class G1RemSetScanState : public CHeapObj { +private: + class G1ClearCardTableTask : public AbstractGangTask { + G1CollectedHeap* _g1h; + uint* _dirty_region_list; + size_t _num_dirty_regions; + size_t _chunk_length; + + size_t volatile _cur_dirty_regions; + public: + G1ClearCardTableTask(G1CollectedHeap* g1h, + uint* dirty_region_list, + size_t num_dirty_regions, + size_t chunk_length) : + AbstractGangTask("G1 Clear Card Table Task"), + _g1h(g1h), + _dirty_region_list(dirty_region_list), + _num_dirty_regions(num_dirty_regions), + _chunk_length(chunk_length), + _cur_dirty_regions(0) { + + assert(chunk_length > 0, "must be"); + } + + static size_t chunk_size() { return M; } + + void work(uint worker_id) { + G1SATBCardTableModRefBS* ct_bs = _g1h->g1_barrier_set(); + + while (_cur_dirty_regions < _num_dirty_regions) { + size_t next = Atomic::add(_chunk_length, &_cur_dirty_regions) - _chunk_length; + size_t max = MIN2(next + _chunk_length, _num_dirty_regions); + + for (size_t i = next; i < max; i++) { + HeapRegion* r = _g1h->region_at(_dirty_region_list[i]); + if (!r->is_survivor()) { + ct_bs->clear(MemRegion(r->bottom(), r->end())); + } + } + } + } + }; + + size_t _max_regions; + + // Scan progress for the remembered set of a single region. Transitions from + // Unclaimed -> Claimed -> Complete. + // At each of the transitions the thread that does the transition needs to perform + // some special action once. This is the reason for the extra "Claimed" state. + typedef jint G1RemsetIterState; + + static const G1RemsetIterState Unclaimed = 0; // The remembered set has not been scanned yet. + static const G1RemsetIterState Claimed = 1; // The remembered set is currently being scanned. + static const G1RemsetIterState Complete = 2; // The remembered set has been completely scanned. + + G1RemsetIterState volatile* _iter_states; + // The current location where the next thread should continue scanning in a region's + // remembered set. + size_t volatile* _iter_claims; + + // Temporary buffer holding the regions we used to store remembered set scan duplicate + // information. These are also called "dirty". Valid entries are from [0.._cur_dirty_region) + uint* _dirty_region_buffer; + + typedef jbyte IsDirtyRegionState; + static const IsDirtyRegionState Clean = 0; + static const IsDirtyRegionState Dirty = 1; + // Holds a flag for every region whether it is in the _dirty_region_buffer already + // to avoid duplicates. Uses jbyte since there are no atomic instructions for bools. + IsDirtyRegionState* _in_dirty_region_buffer; + size_t _cur_dirty_region; +public: + G1RemSetScanState() : + _max_regions(0), + _iter_states(NULL), + _iter_claims(NULL), + _dirty_region_buffer(NULL), + _in_dirty_region_buffer(NULL), + _cur_dirty_region(0) { + + } + + ~G1RemSetScanState() { + if (_iter_states != NULL) { + FREE_C_HEAP_ARRAY(G1RemsetIterState, _iter_states); + } + if (_iter_claims != NULL) { + FREE_C_HEAP_ARRAY(size_t, _iter_claims); + } + if (_dirty_region_buffer != NULL) { + FREE_C_HEAP_ARRAY(uint, _dirty_region_buffer); + } + if (_in_dirty_region_buffer != NULL) { + FREE_C_HEAP_ARRAY(IsDirtyRegionState, _in_dirty_region_buffer); + } + } + + void initialize(uint max_regions) { + assert(_iter_states == NULL, "Must not be initialized twice"); + assert(_iter_claims == NULL, "Must not be initialized twice"); + _max_regions = max_regions; + _iter_states = NEW_C_HEAP_ARRAY(G1RemsetIterState, max_regions, mtGC); + _iter_claims = NEW_C_HEAP_ARRAY(size_t, max_regions, mtGC); + _dirty_region_buffer = NEW_C_HEAP_ARRAY(uint, max_regions, mtGC); + _in_dirty_region_buffer = NEW_C_HEAP_ARRAY(IsDirtyRegionState, max_regions, mtGC); + } + + void reset() { + for (uint i = 0; i < _max_regions; i++) { + _iter_states[i] = Unclaimed; + } + memset((void*)_iter_claims, 0, _max_regions * sizeof(size_t)); + memset(_in_dirty_region_buffer, Clean, _max_regions * sizeof(IsDirtyRegionState)); + _cur_dirty_region = 0; + } + + // Attempt to claim the remembered set of the region for iteration. Returns true + // if this call caused the transition from Unclaimed to Claimed. + inline bool claim_iter(uint region) { + assert(region < _max_regions, "Tried to access invalid region %u", region); + if (_iter_states[region] != Unclaimed) { + return false; + } + jint res = Atomic::cmpxchg(Claimed, (jint*)(&_iter_states[region]), Unclaimed); + return (res == Unclaimed); + } + + // Try to atomically sets the iteration state to "complete". Returns true for the + // thread that caused the transition. + inline bool set_iter_complete(uint region) { + if (iter_is_complete(region)) { + return false; + } + jint res = Atomic::cmpxchg(Complete, (jint*)(&_iter_states[region]), Claimed); + return (res == Claimed); + } + + // Returns true if the region's iteration is complete. + inline bool iter_is_complete(uint region) const { + assert(region < _max_regions, "Tried to access invalid region %u", region); + return _iter_states[region] == Complete; + } + + // The current position within the remembered set of the given region. + inline size_t iter_claimed(uint region) const { + assert(region < _max_regions, "Tried to access invalid region %u", region); + return _iter_claims[region]; + } + + // Claim the next block of cards within the remembered set of the region with + // step size. + inline size_t iter_claimed_next(uint region, size_t step) { + return Atomic::add(step, &_iter_claims[region]) - step; + } + + void add_dirty_region(uint region) { + if (_in_dirty_region_buffer[region] == Dirty) { + return; + } + + bool marked_as_dirty = Atomic::cmpxchg(Dirty, &_in_dirty_region_buffer[region], Clean) == Clean; + if (marked_as_dirty) { + size_t allocated = Atomic::add(1, &_cur_dirty_region) - 1; + _dirty_region_buffer[allocated] = region; + } + } + + // Clear the card table of "dirty" regions. + void clear_card_table(WorkGang* workers) { + if (_cur_dirty_region == 0) { + return; + } + + size_t const num_chunks = align_size_up(_cur_dirty_region * HeapRegion::CardsPerRegion, G1ClearCardTableTask::chunk_size()) / G1ClearCardTableTask::chunk_size(); + uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers()); + size_t const chunk_length = G1ClearCardTableTask::chunk_size() / HeapRegion::CardsPerRegion; + + // Iterate over the dirty cards region list. + G1ClearCardTableTask cl(G1CollectedHeap::heap(), _dirty_region_buffer, _cur_dirty_region, chunk_length); + + log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " " + "units of work for " SIZE_FORMAT " regions.", + cl.name(), num_workers, num_chunks, _cur_dirty_region); + workers->run_task(&cl, num_workers); + +#ifndef PRODUCT + // Need to synchronize with concurrent cleanup since it needs to + // finish its card table clearing before we can verify. + G1CollectedHeap::heap()->wait_while_free_regions_coming(); + G1CollectedHeap::heap()->verifier()->verify_card_table_cleanup(); +#endif + } +}; + +G1RemSet::G1RemSet(G1CollectedHeap* g1, + CardTableModRefBS* ct_bs, + G1HotCardCache* hot_card_cache) : _g1(g1), + _scan_state(new G1RemSetScanState()), _conc_refine_cards(0), _ct_bs(ct_bs), _g1p(_g1->g1_policy()), - _cg1r(g1->concurrent_g1_refine()), - _cset_rs_update_cl(NULL), + _hot_card_cache(hot_card_cache), _prev_period_summary(), _into_cset_dirty_card_queue_set(false) { - _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC); - for (uint i = 0; i < n_workers(); i++) { - _cset_rs_update_cl[i] = NULL; - } if (log_is_enabled(Trace, gc, remset)) { _prev_period_summary.initialize(this); } @@ -75,10 +266,9 @@ G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) : } G1RemSet::~G1RemSet() { - for (uint i = 0; i < n_workers(); i++) { - assert(_cset_rs_update_cl[i] == NULL, "it should be"); + if (_scan_state != NULL) { + delete _scan_state; } - FREE_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, _cset_rs_update_cl); } uint G1RemSet::num_par_rem_sets() { @@ -87,6 +277,7 @@ uint G1RemSet::num_par_rem_sets() { void G1RemSet::initialize(size_t capacity, uint max_regions) { G1FromCardCache::initialize(num_par_rem_sets(), max_regions); + _scan_state->initialize(max_regions); { GCTraceTime(Debug, gc, marking)("Initialize Card Live Data"); _card_live_data.initialize(capacity, max_regions); @@ -97,29 +288,29 @@ void G1RemSet::initialize(size_t capacity, uint max_regions) { } } -ScanRSClosure::ScanRSClosure(G1ParPushHeapRSClosure* oc, - CodeBlobClosure* code_root_cl, - uint worker_i) : - _oc(oc), +G1ScanRSClosure::G1ScanRSClosure(G1RemSetScanState* scan_state, + G1ParPushHeapRSClosure* push_heap_cl, + CodeBlobClosure* code_root_cl, + uint worker_i) : + _scan_state(scan_state), + _push_heap_cl(push_heap_cl), _code_root_cl(code_root_cl), _strong_code_root_scan_time_sec(0.0), _cards(0), _cards_done(0), - _worker_i(worker_i), - _try_claimed(false) { + _worker_i(worker_i) { _g1h = G1CollectedHeap::heap(); _bot = _g1h->bot(); _ct_bs = _g1h->g1_barrier_set(); _block_size = MAX2(G1RSetScanBlockSize, 1); } -void ScanRSClosure::scanCard(size_t index, HeapRegion *r) { +void G1ScanRSClosure::scan_card(size_t index, HeapRegion *r) { // Stack allocate the DirtyCardToOopClosure instance - HeapRegionDCTOC cl(_g1h, r, _oc, - CardTableModRefBS::Precise); + HeapRegionDCTOC cl(_g1h, r, _push_heap_cl, CardTableModRefBS::Precise); // Set the "from" region in the closure. - _oc->set_region(r); + _push_heap_cl->set_region(r); MemRegion card_region(_bot->address_for_index(index), BOTConstants::N_words); MemRegion pre_gc_allocated(r->bottom(), r->scan_top()); MemRegion mr = pre_gc_allocated.intersection(card_region); @@ -133,81 +324,76 @@ void ScanRSClosure::scanCard(size_t index, HeapRegion *r) { } } -void ScanRSClosure::scan_strong_code_roots(HeapRegion* r) { +void G1ScanRSClosure::scan_strong_code_roots(HeapRegion* r) { double scan_start = os::elapsedTime(); r->strong_code_roots_do(_code_root_cl); _strong_code_root_scan_time_sec += (os::elapsedTime() - scan_start); } -bool ScanRSClosure::doHeapRegion(HeapRegion* r) { +bool G1ScanRSClosure::doHeapRegion(HeapRegion* r) { assert(r->in_collection_set(), "should only be called on elements of CS."); - HeapRegionRemSet* hrrs = r->rem_set(); - if (hrrs->iter_is_complete()) return false; // All done. - if (!_try_claimed && !hrrs->claim_iter()) return false; - // If we ever free the collection set concurrently, we should also - // clear the card table concurrently therefore we won't need to - // add regions of the collection set to the dirty cards region. - _g1h->push_dirty_cards_region(r); - // If we didn't return above, then - // _try_claimed || r->claim_iter() - // is true: either we're supposed to work on claimed-but-not-complete - // regions, or we successfully claimed the region. + uint region_idx = r->hrm_index(); - HeapRegionRemSetIterator iter(hrrs); + if (_scan_state->iter_is_complete(region_idx)) { + return false; + } + if (_scan_state->claim_iter(region_idx)) { + // If we ever free the collection set concurrently, we should also + // clear the card table concurrently therefore we won't need to + // add regions of the collection set to the dirty cards region. + _scan_state->add_dirty_region(region_idx); + } + + HeapRegionRemSetIterator iter(r->rem_set()); size_t card_index; // We claim cards in block so as to reduce the contention. The block size is determined by // the G1RSetScanBlockSize parameter. - size_t jump_to_card = hrrs->iter_claimed_next(_block_size); + size_t claimed_card_block = _scan_state->iter_claimed_next(region_idx, _block_size); for (size_t current_card = 0; iter.has_next(card_index); current_card++) { - if (current_card >= jump_to_card + _block_size) { - jump_to_card = hrrs->iter_claimed_next(_block_size); + if (current_card >= claimed_card_block + _block_size) { + claimed_card_block = _scan_state->iter_claimed_next(region_idx, _block_size); + } + if (current_card < claimed_card_block) { + continue; } - if (current_card < jump_to_card) continue; HeapWord* card_start = _g1h->bot()->address_for_index(card_index); HeapRegion* card_region = _g1h->heap_region_containing(card_start); _cards++; - if (!card_region->is_on_dirty_cards_region_list()) { - _g1h->push_dirty_cards_region(card_region); - } + _scan_state->add_dirty_region(card_region->hrm_index()); // If the card is dirty, then we will scan it during updateRS. if (!card_region->in_collection_set() && !_ct_bs->is_card_dirty(card_index)) { - scanCard(card_index, card_region); + scan_card(card_index, card_region); } } - if (!_try_claimed) { + if (_scan_state->set_iter_complete(region_idx)) { // Scan the strong code root list attached to the current region scan_strong_code_roots(r); - - hrrs->set_iter_complete(); } return false; } -size_t G1RemSet::scanRS(G1ParPushHeapRSClosure* oc, - CodeBlobClosure* heap_region_codeblobs, - uint worker_i) { +size_t G1RemSet::scan_rem_set(G1ParPushHeapRSClosure* oops_in_heap_closure, + CodeBlobClosure* heap_region_codeblobs, + uint worker_i) { double rs_time_start = os::elapsedTime(); HeapRegion *startRegion = _g1->start_cset_region_for_worker(worker_i); - ScanRSClosure scanRScl(oc, heap_region_codeblobs, worker_i); + G1ScanRSClosure cl(_scan_state, oops_in_heap_closure, heap_region_codeblobs, worker_i); + _g1->collection_set_iterate_from(startRegion, &cl); - _g1->collection_set_iterate_from(startRegion, &scanRScl); - scanRScl.set_try_claimed(); - _g1->collection_set_iterate_from(startRegion, &scanRScl); - - double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) - - scanRScl.strong_code_root_scan_time_sec(); + double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) - + cl.strong_code_root_scan_time_sec(); _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec); - _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec()); + _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, cl.strong_code_root_scan_time_sec()); - return scanRScl.cards_done(); + return cl.cards_done(); } // Closure used for updating RSets and recording references that @@ -217,10 +403,12 @@ size_t G1RemSet::scanRS(G1ParPushHeapRSClosure* oc, class RefineRecordRefsIntoCSCardTableEntryClosure: public CardTableEntryClosure { G1RemSet* _g1rs; DirtyCardQueue* _into_cset_dcq; + G1ParPushHeapRSClosure* _cl; public: RefineRecordRefsIntoCSCardTableEntryClosure(G1CollectedHeap* g1h, - DirtyCardQueue* into_cset_dcq) : - _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq) + DirtyCardQueue* into_cset_dcq, + G1ParPushHeapRSClosure* cl) : + _g1rs(g1h->g1_rem_set()), _into_cset_dcq(into_cset_dcq), _cl(cl) {} bool do_card_ptr(jbyte* card_ptr, uint worker_i) { @@ -231,7 +419,7 @@ public: assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); assert(worker_i < ParallelGCThreads, "should be a GC worker"); - if (_g1rs->refine_card(card_ptr, worker_i, true)) { + if (_g1rs->refine_card(card_ptr, worker_i, _cl)) { // 'card_ptr' contains references that point into the collection // set. We need to record the card in the DCQS // (_into_cset_dirty_card_queue_set) @@ -244,11 +432,13 @@ public: } }; -void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) { - RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq); +void G1RemSet::update_rem_set(DirtyCardQueue* into_cset_dcq, + G1ParPushHeapRSClosure* oops_in_heap_closure, + uint worker_i) { + RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq, oops_in_heap_closure); G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i); - if (ConcurrentG1Refine::hot_card_cache_enabled()) { + if (G1HotCardCache::default_use_cache()) { // Apply the closure to the entries of the hot card cache. G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i); _g1->iterate_hcc_closure(&into_cset_update_rs_cl, worker_i); @@ -261,14 +451,9 @@ void G1RemSet::cleanupHRRS() { HeapRegionRemSet::cleanup(); } -size_t G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc, +size_t G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* cl, CodeBlobClosure* heap_region_codeblobs, uint worker_i) { - // We cache the value of 'oc' closure into the appropriate slot in the - // _cset_rs_update_cl for this worker - assert(worker_i < n_workers(), "sanity"); - _cset_rs_update_cl[worker_i] = oc; - // A DirtyCardQueue that is used to hold cards containing references // that point into the collection set. This DCQ is associated with a // special DirtyCardQueueSet (see g1CollectedHeap.hpp). Under normal @@ -280,25 +465,27 @@ size_t G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc, // DirtyCardQueueSet that is used to manage RSet updates DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set); - updateRS(&into_cset_dcq, worker_i); - size_t cards_scanned = scanRS(oc, heap_region_codeblobs, worker_i); - - // We now clear the cached values of _cset_rs_update_cl for this worker - _cset_rs_update_cl[worker_i] = NULL; - return cards_scanned; + update_rem_set(&into_cset_dcq, cl, worker_i); + return scan_rem_set(cl, heap_region_codeblobs, worker_i);; } void G1RemSet::prepare_for_oops_into_collection_set_do() { _g1->set_refine_cte_cl_concurrency(false); DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); dcqs.concatenate_logs(); + + _scan_state->reset(); } void G1RemSet::cleanup_after_oops_into_collection_set_do() { + G1GCPhaseTimes* phase_times = _g1->g1_policy()->phase_times(); // Cleanup after copy _g1->set_refine_cte_cl_concurrency(true); + // Set all cards back to clean. - _g1->cleanUpCardTable(); + double start = os::elapsedTime(); + _scan_state->clear_card_table(_g1->workers()); + phase_times->record_clear_ct_time((os::elapsedTime() - start) * 1000.0); DirtyCardQueueSet& into_cset_dcqs = _into_cset_dirty_card_queue_set; @@ -310,7 +497,7 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() { // used to hold cards that contain references that point into the collection set // to the DCQS used to hold the deferred RS updates. _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs); - _g1->g1_policy()->phase_times()->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0); + phase_times->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0); } // Free any completed buffers in the DirtyCardQueueSet used to hold cards @@ -366,8 +553,9 @@ G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, // into the collection set, if we're checking for such references; // false otherwise. -bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, - bool check_for_refs_into_cset) { +bool G1RemSet::refine_card(jbyte* card_ptr, + uint worker_i, + G1ParPushHeapRSClosure* oops_in_heap_closure) { assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)), "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", p2i(card_ptr), @@ -375,6 +563,8 @@ bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, p2i(_ct_bs->addr_for(card_ptr)), _g1->addr_to_region(_ct_bs->addr_for(card_ptr))); + bool check_for_refs_into_cset = oops_in_heap_closure != NULL; + // If the card is no longer dirty, nothing to do. if (*card_ptr != CardTableModRefBS::dirty_card_val()) { // No need to return that this card contains refs that point @@ -425,12 +615,11 @@ bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, // * a pointer to a "hot" card that was evicted from the "hot" cache. // - G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); - if (hot_card_cache->use_cache()) { + if (_hot_card_cache->use_cache()) { assert(!check_for_refs_into_cset, "sanity"); assert(!SafepointSynchronize::is_at_safepoint(), "sanity"); - card_ptr = hot_card_cache->insert(card_ptr); + card_ptr = _hot_card_cache->insert(card_ptr); if (card_ptr == NULL) { // There was no eviction. Nothing to do. return false; @@ -451,15 +640,6 @@ bool G1RemSet::refine_card(jbyte* card_ptr, uint worker_i, HeapWord* end = start + CardTableModRefBS::card_size_in_words; MemRegion dirtyRegion(start, end); - G1ParPushHeapRSClosure* oops_in_heap_closure = NULL; - if (check_for_refs_into_cset) { - // ConcurrentG1RefineThreads have worker numbers larger than what - // _cset_rs_update_cl[] is set up to handle. But those threads should - // only be active outside of a collection which means that when they - // reach here they should have check_for_refs_into_cset == false. - assert((size_t)worker_i < n_workers(), "index of worker larger than _cset_rs_update_cl[].length"); - oops_in_heap_closure = _cset_rs_update_cl[worker_i]; - } G1UpdateRSOrPushRefOopClosure update_rs_oop_cl(_g1, _g1->g1_rem_set(), oops_in_heap_closure, @@ -574,15 +754,14 @@ void G1RemSet::prepare_for_verify() { dcqs.concatenate_logs(); } - G1HotCardCache* hot_card_cache = _cg1r->hot_card_cache(); - bool use_hot_card_cache = hot_card_cache->use_cache(); - hot_card_cache->set_use_cache(false); + bool use_hot_card_cache = _hot_card_cache->use_cache(); + _hot_card_cache->set_use_cache(false); DirtyCardQueue into_cset_dcq(&_into_cset_dirty_card_queue_set); - updateRS(&into_cset_dcq, 0); + update_rem_set(&into_cset_dcq, NULL, 0); _into_cset_dirty_card_queue_set.clear(); - hot_card_cache->set_use_cache(use_hot_card_cache); + _hot_card_cache->set_use_cache(use_hot_card_cache); assert(JavaThread::dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed"); } } diff --git a/hotspot/src/share/vm/gc/g1/g1RemSet.hpp b/hotspot/src/share/vm/gc/g1/g1RemSet.hpp index 381d5fd8f72..561b3cfe072 100644 --- a/hotspot/src/share/vm/gc/g1/g1RemSet.hpp +++ b/hotspot/src/share/vm/gc/g1/g1RemSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -38,11 +38,12 @@ class BitMap; class CardTableModRefBS; class G1BlockOffsetTable; -class ConcurrentG1Refine; class CodeBlobClosure; class G1CollectedHeap; -class G1CollectorPolicy; +class G1HotCardCache; class G1ParPushHeapRSClosure; +class G1RemSetScanState; +class G1Policy; class G1SATBCardTableModRefBS; class HeapRegionClaimer; @@ -51,6 +52,7 @@ class HeapRegionClaimer; // so that they can be used to update the individual region remsets. class G1RemSet: public CHeapObj { private: + G1RemSetScanState* _scan_state; G1CardLiveData _card_live_data; G1RemSetSummary _prev_period_summary; @@ -68,13 +70,8 @@ protected: protected: CardTableModRefBS* _ct_bs; - G1CollectorPolicy* _g1p; - - ConcurrentG1Refine* _cg1r; - - // Used for caching the closure that is responsible for scanning - // references into the collection set. - G1ParPushHeapRSClosure** _cset_rs_update_cl; + G1Policy* _g1p; + G1HotCardCache* _hot_card_cache; public: // Gives an approximation on how many threads can be expected to add records to @@ -92,12 +89,14 @@ public: // scanned. void cleanupHRRS(); - G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs); + G1RemSet(G1CollectedHeap* g1, + CardTableModRefBS* ct_bs, + G1HotCardCache* hot_card_cache); ~G1RemSet(); - // Invoke "blk->do_oop" on all pointers into the collection set + // Invoke "cl->do_oop" on all pointers into the collection set // from objects in regions outside the collection set (having - // invoked "blk->set_region" to set the "from" region correctly + // invoked "cl->set_region" to set the "from" region correctly // beforehand.) // // Apply non_heap_roots on the oops of the unmarked nmethods @@ -112,7 +111,7 @@ public: // // Returns the number of cards scanned while looking for pointers // into the collection set. - size_t oops_into_collection_set_do(G1ParPushHeapRSClosure* blk, + size_t oops_into_collection_set_do(G1ParPushHeapRSClosure* cl, CodeBlobClosure* heap_region_codeblobs, uint worker_i); @@ -124,13 +123,15 @@ public: void prepare_for_oops_into_collection_set_do(); void cleanup_after_oops_into_collection_set_do(); - size_t scanRS(G1ParPushHeapRSClosure* oc, - CodeBlobClosure* heap_region_codeblobs, - uint worker_i); + size_t scan_rem_set(G1ParPushHeapRSClosure* oops_in_heap_closure, + CodeBlobClosure* heap_region_codeblobs, + uint worker_i); - void updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i); + G1RemSetScanState* scan_state() const { return _scan_state; } - CardTableModRefBS* ct_bs() { return _ct_bs; } + // Flush remaining refinement buffers into the remembered set, + // applying oops_in_heap_closure on the references found. + void update_rem_set(DirtyCardQueue* into_cset_dcq, G1ParPushHeapRSClosure* oops_in_heap_closure, uint worker_i); // Record, if necessary, the fact that *p (where "p" is in region "from", // which is required to be non-NULL) has changed to a new non-NULL value. @@ -145,12 +146,12 @@ public: void scrub(uint worker_num, HeapRegionClaimer* hrclaimer); // Refine the card corresponding to "card_ptr". - // If check_for_refs_into_cset is true, a true result is returned + // If oops_in_heap_closure is not NULL, a true result is returned // if the given card contains oops that have references into the // current collection set. virtual bool refine_card(jbyte* card_ptr, uint worker_i, - bool check_for_refs_into_cset); + G1ParPushHeapRSClosure* oops_in_heap_closure); // Print accumulated summary info from the start of the VM. virtual void print_summary_info(); @@ -179,11 +180,14 @@ public: #endif }; -class ScanRSClosure : public HeapRegionClosure { - size_t _cards_done, _cards; +class G1ScanRSClosure : public HeapRegionClosure { + G1RemSetScanState* _scan_state; + + size_t _cards_done; + size_t _cards; G1CollectedHeap* _g1h; - G1ParPushHeapRSClosure* _oc; + G1ParPushHeapRSClosure* _push_heap_cl; CodeBlobClosure* _code_root_cl; G1BlockOffsetTable* _bot; @@ -192,26 +196,23 @@ class ScanRSClosure : public HeapRegionClosure { double _strong_code_root_scan_time_sec; uint _worker_i; size_t _block_size; - bool _try_claimed; + void scan_card(size_t index, HeapRegion *r); + void scan_strong_code_roots(HeapRegion* r); public: - ScanRSClosure(G1ParPushHeapRSClosure* oc, - CodeBlobClosure* code_root_cl, - uint worker_i); + G1ScanRSClosure(G1RemSetScanState* scan_state, + G1ParPushHeapRSClosure* push_heap_cl, + CodeBlobClosure* code_root_cl, + uint worker_i); bool doHeapRegion(HeapRegion* r); double strong_code_root_scan_time_sec() { return _strong_code_root_scan_time_sec; } + size_t cards_done() { return _cards_done;} size_t cards_looked_up() { return _cards;} - void set_try_claimed() { _try_claimed = true; } -private: - void scanCard(size_t index, HeapRegion *r); - void printCard(HeapRegion* card_region, size_t card_index, - HeapWord* card_start); - void scan_strong_code_roots(HeapRegion* r); }; class UpdateRSOopClosure: public ExtendedOopClosure { diff --git a/hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp b/hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp index 5b226d1d5a4..53fe119389b 100644 --- a/hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp +++ b/hotspot/src/share/vm/gc/g1/g1RemSetSummary.cpp @@ -28,6 +28,7 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1RemSet.inline.hpp" #include "gc/g1/g1RemSetSummary.hpp" +#include "gc/g1/g1YoungRemSetSamplingThread.hpp" #include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "memory/allocation.inline.hpp" @@ -143,10 +144,6 @@ void G1RemSetSummary::subtract_from(G1RemSetSummary* other) { _sampling_thread_vtime = other->sampling_thread_vtime() - _sampling_thread_vtime; } -static size_t round_to_K(size_t value) { - return value / K; -} - class RegionTypeCounter VALUE_OBJ_CLASS_SPEC { private: const char* _name; @@ -197,8 +194,10 @@ public: size_t code_root_elems() const { return _code_root_elems; } void print_rs_mem_info_on(outputStream * out, size_t total) { - out->print_cr(" " SIZE_FORMAT_W(8) "K (%5.1f%%) by " SIZE_FORMAT " %s regions", - round_to_K(rs_mem_size()), rs_mem_size_percent_of(total), amount(), _name); + out->print_cr(" " SIZE_FORMAT_W(8) "%s (%5.1f%%) by " SIZE_FORMAT " %s regions", + byte_size_in_proper_unit(rs_mem_size()), + proper_unit_for_byte_size(rs_mem_size()), + rs_mem_size_percent_of(total), amount(), _name); } void print_cards_occupied_info_on(outputStream * out, size_t total) { @@ -207,8 +206,10 @@ public: } void print_code_root_mem_info_on(outputStream * out, size_t total) { - out->print_cr(" " SIZE_FORMAT_W(8) "K (%5.1f%%) by " SIZE_FORMAT " %s regions", - round_to_K(code_root_mem_size()), code_root_mem_size_percent_of(total), amount(), _name); + out->print_cr(" " SIZE_FORMAT_W(8) "%s (%5.1f%%) by " SIZE_FORMAT " %s regions", + byte_size_in_proper_unit(code_root_mem_size()), + proper_unit_for_byte_size(code_root_mem_size()), + code_root_mem_size_percent_of(total), amount(), _name); } void print_code_root_elems_info_on(outputStream * out, size_t total) { @@ -290,17 +291,22 @@ public: RegionTypeCounter* counters[] = { &_young, &_humongous, &_free, &_old, NULL }; out->print_cr(" Current rem set statistics"); - out->print_cr(" Total per region rem sets sizes = " SIZE_FORMAT "K." - " Max = " SIZE_FORMAT "K.", - round_to_K(total_rs_mem_sz()), round_to_K(max_rs_mem_sz())); + out->print_cr(" Total per region rem sets sizes = " SIZE_FORMAT "%s." + " Max = " SIZE_FORMAT "%s.", + byte_size_in_proper_unit(total_rs_mem_sz()), + proper_unit_for_byte_size(total_rs_mem_sz()), + byte_size_in_proper_unit(max_rs_mem_sz()), + proper_unit_for_byte_size(max_rs_mem_sz())); for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) { (*current)->print_rs_mem_info_on(out, total_rs_mem_sz()); } - out->print_cr(" Static structures = " SIZE_FORMAT "K," - " free_lists = " SIZE_FORMAT "K.", - round_to_K(HeapRegionRemSet::static_mem_size()), - round_to_K(HeapRegionRemSet::fl_mem_size())); + out->print_cr(" Static structures = " SIZE_FORMAT "%s," + " free_lists = " SIZE_FORMAT "%s.", + byte_size_in_proper_unit(HeapRegionRemSet::static_mem_size()), + proper_unit_for_byte_size(HeapRegionRemSet::static_mem_size()), + byte_size_in_proper_unit(HeapRegionRemSet::fl_mem_size()), + proper_unit_for_byte_size(HeapRegionRemSet::fl_mem_size())); out->print_cr(" " SIZE_FORMAT " occupied cards represented.", total_cards_occupied()); @@ -311,17 +317,20 @@ public: // Largest sized rem set region statistics HeapRegionRemSet* rem_set = max_rs_mem_sz_region()->rem_set(); out->print_cr(" Region with largest rem set = " HR_FORMAT ", " - "size = " SIZE_FORMAT "K, occupied = " SIZE_FORMAT "K.", + "size = " SIZE_FORMAT "%s, occupied = " SIZE_FORMAT "%s.", HR_FORMAT_PARAMS(max_rs_mem_sz_region()), - round_to_K(rem_set->mem_size()), - round_to_K(rem_set->occupied())); - + byte_size_in_proper_unit(rem_set->mem_size()), + proper_unit_for_byte_size(rem_set->mem_size()), + byte_size_in_proper_unit(rem_set->occupied()), + proper_unit_for_byte_size(rem_set->occupied())); // Strong code root statistics HeapRegionRemSet* max_code_root_rem_set = max_code_root_mem_sz_region()->rem_set(); - out->print_cr(" Total heap region code root sets sizes = " SIZE_FORMAT "K." - " Max = " SIZE_FORMAT "K.", - round_to_K(total_code_root_mem_sz()), - round_to_K(max_code_root_rem_set->strong_code_roots_mem_size())); + out->print_cr(" Total heap region code root sets sizes = " SIZE_FORMAT "%s." + " Max = " SIZE_FORMAT "%s.", + byte_size_in_proper_unit(total_code_root_mem_sz()), + proper_unit_for_byte_size(total_code_root_mem_sz()), + byte_size_in_proper_unit(max_code_root_rem_set->strong_code_roots_mem_size()), + proper_unit_for_byte_size(max_code_root_rem_set->strong_code_roots_mem_size())); for (RegionTypeCounter** current = &counters[0]; *current != NULL; current++) { (*current)->print_code_root_mem_info_on(out, total_code_root_mem_sz()); } @@ -333,10 +342,11 @@ public: } out->print_cr(" Region with largest amount of code roots = " HR_FORMAT ", " - "size = " SIZE_FORMAT "K, num_elems = " SIZE_FORMAT ".", + "size = " SIZE_FORMAT "%s, num_elems = " SIZE_FORMAT ".", HR_FORMAT_PARAMS(max_code_root_mem_sz_region()), - round_to_K(max_code_root_rem_set->strong_code_roots_mem_size()), - round_to_K(max_code_root_rem_set->strong_code_roots_list_length())); + byte_size_in_proper_unit(max_code_root_rem_set->strong_code_roots_mem_size()), + proper_unit_for_byte_size(max_code_root_rem_set->strong_code_roots_mem_size()), + max_code_root_rem_set->strong_code_roots_list_length()); } }; diff --git a/hotspot/src/share/vm/gc/g1/g1RootClosures.cpp b/hotspot/src/share/vm/gc/g1/g1RootClosures.cpp index 4e54a68c73a..5ecdade929a 100644 --- a/hotspot/src/share/vm/gc/g1/g1RootClosures.cpp +++ b/hotspot/src/share/vm/gc/g1/g1RootClosures.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -42,7 +42,6 @@ public: CLDClosure* weak_clds() { return &_closures._clds; } CLDClosure* strong_clds() { return &_closures._clds; } - CLDClosure* thread_root_clds() { return NULL; } CLDClosure* second_pass_weak_clds() { return NULL; } CodeBlobClosure* strong_codeblobs() { return &_closures._codeblobs; } @@ -89,7 +88,6 @@ public: // If MarkWeak is G1MarkFromRoot then all CLDs are processed by the weak and strong variants // return a NULL closure for the following specialized versions in that case. - CLDClosure* thread_root_clds() { return null_if(&_strong._clds); } CLDClosure* second_pass_weak_clds() { return null_if(&_weak._clds); } CodeBlobClosure* strong_codeblobs() { return &_strong._codeblobs; } diff --git a/hotspot/src/share/vm/gc/g1/g1RootClosures.hpp b/hotspot/src/share/vm/gc/g1/g1RootClosures.hpp index 34e58f0f411..571a263a197 100644 --- a/hotspot/src/share/vm/gc/g1/g1RootClosures.hpp +++ b/hotspot/src/share/vm/gc/g1/g1RootClosures.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -41,9 +41,6 @@ public: virtual CLDClosure* weak_clds() = 0; virtual CLDClosure* strong_clds() = 0; - // Applied to the CLDs reachable from the thread stacks. - virtual CLDClosure* thread_root_clds() = 0; - // Applied to code blobs reachable as strong roots. virtual CodeBlobClosure* strong_codeblobs() = 0; }; diff --git a/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp b/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp index 14b175320b3..f8526e778e9 100644 --- a/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp +++ b/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -30,9 +30,9 @@ #include "gc/g1/bufferingOopClosure.hpp" #include "gc/g1/g1CodeBlobClosure.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1CollectorState.hpp" #include "gc/g1/g1GCPhaseTimes.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RootClosures.hpp" #include "gc/g1/g1RootProcessor.hpp" #include "gc/g1/heapRegion.inline.hpp" @@ -152,7 +152,6 @@ public: CLDClosure* weak_clds() { return NULL; } CLDClosure* strong_clds() { return _clds; } - CLDClosure* thread_root_clds() { return _clds; } CodeBlobClosure* strong_codeblobs() { return _blobs; } }; @@ -184,9 +183,6 @@ public: // system. CLDClosure* weak_clds() { return _clds; } CLDClosure* strong_clds() { return _clds; } - // We don't want to visit CLDs more than once, so we return NULL for the - // thread root CLDs. - CLDClosure* thread_root_clds() { return NULL; } // We don't want to visit code blobs more than once, so we return NULL for the // strong case and walk the entire code cache as a separate step. @@ -211,7 +207,6 @@ void G1RootProcessor::process_all_roots(OopClosure* oops, void G1RootProcessor::process_java_roots(G1RootClosures* closures, G1GCPhaseTimes* phase_times, uint worker_i) { - assert(closures->thread_root_clds() == NULL || closures->weak_clds() == NULL, "There is overlap between those, only one may be set"); // Iterating over the CLDG and the Threads are done early to allow us to // first process the strong CLDs and nmethods and then, after a barrier, // let the thread process the weak CLDs and nmethods. @@ -227,7 +222,6 @@ void G1RootProcessor::process_java_roots(G1RootClosures* closures, bool is_par = n_workers() > 1; Threads::possibly_parallel_oops_do(is_par, closures->strong_oops(), - closures->thread_root_clds(), closures->strong_codeblobs()); } } diff --git a/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.cpp b/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.cpp new file mode 100644 index 00000000000..ec49aea984d --- /dev/null +++ b/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2015, 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. + * + */ + +#include "precompiled.hpp" +#include "gc/g1/g1SurvivorRegions.hpp" +#include "gc/g1/heapRegion.hpp" +#include "utilities/growableArray.hpp" +#include "utilities/debug.hpp" + +G1SurvivorRegions::G1SurvivorRegions() : _regions(new (ResourceObj::C_HEAP, mtGC) GrowableArray(8, true, mtGC)) {} + +void G1SurvivorRegions::add(HeapRegion* hr) { + assert(hr->is_survivor(), "should be flagged as survivor region"); + _regions->append(hr); +} + +uint G1SurvivorRegions::length() const { + return (uint)_regions->length(); +} + +void G1SurvivorRegions::convert_to_eden() { + for (GrowableArrayIterator it = _regions->begin(); + it != _regions->end(); + ++it) { + HeapRegion* hr = *it; + hr->set_eden_pre_gc(); + } + clear(); +} + +void G1SurvivorRegions::clear() { + _regions->clear(); +} + diff --git a/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.hpp b/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.hpp new file mode 100644 index 00000000000..9a8333782d7 --- /dev/null +++ b/hotspot/src/share/vm/gc/g1/g1SurvivorRegions.hpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_G1_G1SURVIVORREGIONS_HPP +#define SHARE_VM_GC_G1_G1SURVIVORREGIONS_HPP + +#include "memory/allocation.hpp" +#include "runtime/globals.hpp" + +template +class GrowableArray; +class HeapRegion; + +class G1SurvivorRegions VALUE_OBJ_CLASS_SPEC { +private: + GrowableArray* _regions; + +public: + G1SurvivorRegions(); + + void add(HeapRegion* hr); + + void convert_to_eden(); + + void clear(); + + uint length() const; + + const GrowableArray* regions() const { + return _regions; + } +}; + +#endif // SHARE_VM_GC_G1_G1SURVIVORREGIONS_HPP diff --git a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp index e049f4da639..c5058739df5 100644 --- a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp +++ b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.cpp @@ -108,13 +108,18 @@ void G1YoungGenSizer::recalculate_min_max_young_length(uint number_of_heap_regio assert(*min_young_length <= *max_young_length, "Invalid min/max young gen size values"); } -uint G1YoungGenSizer::max_young_length(uint number_of_heap_regions) { +void G1YoungGenSizer::adjust_max_new_size(uint number_of_heap_regions) { + // We need to pass the desired values because recalculation may not update these // values in some cases. uint temp = _min_desired_young_length; uint result = _max_desired_young_length; recalculate_min_max_young_length(number_of_heap_regions, &temp, &result); - return result; + + size_t max_young_size = result * HeapRegion::GrainBytes; + if (max_young_size != MaxNewSize) { + FLAG_SET_ERGO(size_t, MaxNewSize, max_young_size); + } } void G1YoungGenSizer::heap_size_changed(uint new_number_of_heap_regions) { diff --git a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.hpp b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.hpp index 1d5421b2802..895cf6eb227 100644 --- a/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.hpp +++ b/hotspot/src/share/vm/gc/g1/g1YoungGenSizer.hpp @@ -22,6 +22,9 @@ * */ +#ifndef SHARE_VM_GC_G1_G1YOUNGGENSIZER_HPP +#define SHARE_VM_GC_G1_G1YOUNGGENSIZER_HPP + #include "memory/allocation.hpp" // There are three command line options related to the young gen size: @@ -60,7 +63,7 @@ // // NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is // combined with either NewSize or MaxNewSize. (A warning message is printed.) -class G1YoungGenSizer : public CHeapObj { +class G1YoungGenSizer VALUE_OBJ_CLASS_SPEC { private: enum SizerKind { SizerDefaults, @@ -84,13 +87,13 @@ public: G1YoungGenSizer(); // Calculate the maximum length of the young gen given the number of regions // depending on the sizing algorithm. - uint max_young_length(uint number_of_heap_regions); + void adjust_max_new_size(uint number_of_heap_regions); void heap_size_changed(uint new_number_of_heap_regions); - uint min_desired_young_length() { + uint min_desired_young_length() const { return _min_desired_young_length; } - uint max_desired_young_length() { + uint max_desired_young_length() const { return _max_desired_young_length; } @@ -99,3 +102,4 @@ public: } }; +#endif // SHARE_VM_GC_G1_G1YOUNGGENSIZER_HPP diff --git a/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp b/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp index b435c052cad..5e57885d8ed 100644 --- a/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp +++ b/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.cpp @@ -24,8 +24,8 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/g1CollectionSet.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/g1/g1YoungRemSetSamplingThread.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" @@ -74,23 +74,19 @@ void G1YoungRemSetSamplingThread::stop_service() { void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() { SuspendibleThreadSetJoiner sts; G1CollectedHeap* g1h = G1CollectedHeap::heap(); - G1CollectorPolicy* g1p = g1h->g1_policy(); + G1Policy* g1p = g1h->g1_policy(); + G1CollectionSet* g1cs = g1h->collection_set(); if (g1p->adaptive_young_list_length()) { int regions_visited = 0; - HeapRegion* hr = g1h->young_list()->first_region(); + HeapRegion* hr = g1cs->inc_head(); size_t sampled_rs_lengths = 0; while (hr != NULL) { size_t rs_length = hr->rem_set()->occupied(); sampled_rs_lengths += rs_length; - // The current region may not yet have been added to the - // incremental collection set (it gets added when it is - // retired as the current allocation region). - if (hr->in_collection_set()) { - // Update the collection set policy information for this region - g1h->collection_set()->update_young_region_prediction(hr, rs_length); - } + // Update the collection set policy information for this region + g1cs->update_young_region_prediction(hr, rs_length); ++regions_visited; @@ -99,12 +95,13 @@ void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() { if (sts.should_yield()) { sts.yield(); // A gc may have occurred and our sampling data is stale and further - // traversal of the young list is unsafe + // traversal of the collection set is unsafe return; } regions_visited = 0; } - hr = hr->get_next_young_region(); + assert(hr == g1cs->inc_tail() || hr->next_in_collection_set() != NULL, "next should only be null at tail of icset"); + hr = hr->next_in_collection_set(); } g1p->revise_young_list_target_length_if_necessary(sampled_rs_lengths); } diff --git a/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.hpp b/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.hpp index 31cf79ed500..b5215efbd19 100644 --- a/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.hpp +++ b/hotspot/src/share/vm/gc/g1/g1YoungRemSetSamplingThread.hpp @@ -37,7 +37,7 @@ // The assumption is that a significant part of the GC is spent on scanning // the remembered sets (and many other components), so this thread constantly // reevaluates the prediction for the remembered set scanning costs, and potentially -// G1CollectorPolicy resizes the young gen. This may do a premature GC or even +// G1Policy resizes the young gen. This may do a premature GC or even // increase the young gen size to keep pause time length goal. class G1YoungRemSetSamplingThread: public ConcurrentGCThread { private: diff --git a/hotspot/src/share/vm/gc/g1/g1_globals.cpp b/hotspot/src/share/vm/gc/g1/g1_globals.cpp index c1bf99eca40..0b25b03f2b2 100644 --- a/hotspot/src/share/vm/gc/g1/g1_globals.cpp +++ b/hotspot/src/share/vm/gc/g1/g1_globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -35,4 +35,5 @@ G1_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_MANAGEABLE_FLAG, \ MATERIALIZE_PRODUCT_RW_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) diff --git a/hotspot/src/share/vm/gc/g1/g1_globals.hpp b/hotspot/src/share/vm/gc/g1/g1_globals.hpp index ce8d96ea3ec..3abcba4df9e 100644 --- a/hotspot/src/share/vm/gc/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc/g1/g1_globals.hpp @@ -31,7 +31,18 @@ // Defines all globals flags used by the garbage-first compiler. // -#define G1_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, manageable, product_rw, range, constraint) \ +#define G1_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + experimental, \ + notproduct, \ + manageable, \ + product_rw, \ + range, \ + constraint, \ + writeable) \ \ product(bool, G1UseAdaptiveIHOP, true, \ "Adaptively adjust the initiating heap occupancy from the " \ @@ -179,12 +190,6 @@ develop(bool, G1ScrubRemSets, true, \ "When true, do RS scrubbing after cleanup.") \ \ - develop(intx, G1YoungSurvRateNumRegionsSummary, 0, \ - "the number of regions for which we'll print a surv rate " \ - "summary.") \ - range(0, max_intx) \ - constraint(G1YoungSurvRateNumRegionsSummaryConstraintFunc,AfterErgo)\ - \ product(uintx, G1ReservePercent, 10, \ "It determines the minimum reserve we should have in the heap " \ "to minimize the probability of promotion failure.") \ @@ -323,6 +328,7 @@ G1_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_MANAGEABLE_FLAG, \ DECLARE_PRODUCT_RW_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // SHARE_VM_GC_G1_G1_GLOBALS_HPP diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.cpp b/hotspot/src/share/vm/gc/g1/heapRegion.cpp index b88145da9c1..44ef49423b4 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp @@ -153,6 +153,10 @@ void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_hea guarantee(CardsPerRegion == 0, "we should only set it once"); CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift; + + if (G1HeapRegionSize != GrainBytes) { + FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes); + } } void HeapRegion::reset_after_compaction() { @@ -187,6 +191,7 @@ void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { zero_marked_bytes(); init_top_at_mark_start(); + _gc_time_stamp = G1CollectedHeap::heap()->get_gc_time_stamp(); if (clear_space) clear(SpaceDecorator::Mangle); } @@ -204,7 +209,7 @@ void HeapRegion::calc_gc_efficiency() { // GC efficiency is the ratio of how much space would be // reclaimed over how long we predict it would take to reclaim it. G1CollectedHeap* g1h = G1CollectedHeap::heap(); - G1CollectorPolicy* g1p = g1h->g1_policy(); + G1Policy* g1p = g1h->g1_policy(); // Retrieve a prediction of the elapsed time for this region for // a mixed gc because the region will only be evacuated during a @@ -282,8 +287,7 @@ HeapRegion::HeapRegion(uint hrm_index, _next_in_special_set(NULL), _evacuation_failed(false), _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0), - _next_young_region(NULL), - _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL), + _next(NULL), _prev(NULL), #ifdef ASSERT _containing_set(NULL), #endif // ASSERT @@ -1044,7 +1048,7 @@ HeapWord* G1ContiguousSpace::scan_top() const { void G1ContiguousSpace::record_timestamp() { G1CollectedHeap* g1h = G1CollectedHeap::heap(); - unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp(); + uint curr_gc_time_stamp = g1h->get_gc_time_stamp(); if (_gc_time_stamp < curr_gc_time_stamp) { // Setting the time stamp here tells concurrent readers to look at diff --git a/hotspot/src/share/vm/gc/g1/heapRegion.hpp b/hotspot/src/share/vm/gc/g1/heapRegion.hpp index 88d83cb2be3..10d1cc59d3e 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc/g1/heapRegion.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -124,7 +124,7 @@ class G1ContiguousSpace: public CompactibleSpace { protected: G1BlockOffsetTablePart _bot_part; Mutex _par_alloc_lock; - volatile unsigned _gc_time_stamp; + volatile uint _gc_time_stamp; // When we need to retire an allocation region, while other threads // are also concurrently trying to allocate into it, we typically // allocate a dummy object at the end of the region to ensure that @@ -174,7 +174,7 @@ class G1ContiguousSpace: public CompactibleSpace { HeapWord* scan_top() const; void record_timestamp(); void reset_gc_time_stamp() { _gc_time_stamp = 0; } - unsigned get_gc_time_stamp() { return _gc_time_stamp; } + uint get_gc_time_stamp() { return _gc_time_stamp; } void record_retained_region(); // See the comment above in the declaration of _pre_dummy_top for an @@ -267,12 +267,6 @@ class HeapRegion: public G1ContiguousSpace { // The collection set. HeapRegion* _next_in_special_set; - // next region in the young "generation" region set - HeapRegion* _next_young_region; - - // Next region whose cards need cleaning - HeapRegion* _next_dirty_cards_region; - // Fields used by the HeapRegionSetBase class and subclasses. HeapRegion* _next; HeapRegion* _prev; @@ -526,15 +520,6 @@ class HeapRegion: public G1ContiguousSpace { // to provide a dummy version of it. #endif // ASSERT - HeapRegion* get_next_young_region() { return _next_young_region; } - void set_next_young_region(HeapRegion* hr) { - _next_young_region = hr; - } - - HeapRegion* get_next_dirty_cards_region() const { return _next_dirty_cards_region; } - HeapRegion** next_dirty_cards_region_addr() { return &_next_dirty_cards_region; } - void set_next_dirty_cards_region(HeapRegion* hr) { _next_dirty_cards_region = hr; } - bool is_on_dirty_cards_region_list() const { return get_next_dirty_cards_region() != NULL; } // Reset HR stuff to default values. void hr_clear(bool par, bool clear_space, bool locked = false); diff --git a/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp index b5e01a00243..06b04eeefea 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.cpp @@ -51,8 +51,7 @@ void HeapRegionManager::initialize(G1RegionToSpaceMapper* heap_storage, MemRegion reserved = heap_storage->reserved(); _regions.initialize(reserved.start(), reserved.end(), HeapRegion::GrainBytes); - _available_map.resize(_regions.length(), false); - _available_map.clear(); + _available_map.initialize(_regions.length()); } bool HeapRegionManager::is_available(uint region) const { diff --git a/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp b/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp index 03bc3ed53b4..8644d3e56e6 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp +++ b/hotspot/src/share/vm/gc/g1/heapRegionManager.hpp @@ -83,7 +83,7 @@ class HeapRegionManager: public CHeapObj { // Each bit in this bitmap indicates that the corresponding region is available // for allocation. - BitMap _available_map; + CHeapBitMap _available_map; // The number of regions committed in the heap. uint _num_committed; diff --git a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp index 4fee9c4ecfc..ad4821ae4fd 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp @@ -43,7 +43,7 @@ class PerRegionTable: public CHeapObj { friend class HeapRegionRemSetIterator; HeapRegion* _hr; - BitMap _bm; + CHeapBitMap _bm; jint _occupied; // next pointer for free/allocated 'all' list @@ -69,7 +69,7 @@ protected: PerRegionTable(HeapRegion* hr) : _hr(hr), _occupied(0), - _bm(HeapRegion::CardsPerRegion, false /* in-resource-area */), + _bm(HeapRegion::CardsPerRegion), _collision_list_next(NULL), _next(NULL), _prev(NULL) {} @@ -103,7 +103,7 @@ protected: CardIdx_t from_card = (CardIdx_t) hw_offset >> (CardTableModRefBS::card_shift - LogHeapWordSize); - assert(0 <= from_card && (size_t)from_card < HeapRegion::CardsPerRegion, + assert((size_t)from_card < HeapRegion::CardsPerRegion, "Must be in range."); add_card_work(from_card, par); } @@ -259,8 +259,7 @@ size_t OtherRegionsTable::_fine_eviction_sample_size = 0; OtherRegionsTable::OtherRegionsTable(HeapRegion* hr, Mutex* m) : _g1h(G1CollectedHeap::heap()), _hr(hr), _m(m), - _coarse_map(G1CollectedHeap::heap()->max_regions(), - false /* in-resource-area */), + _coarse_map(G1CollectedHeap::heap()->max_regions()), _fine_grain_regions(NULL), _first_all_fine_prts(NULL), _last_all_fine_prts(NULL), _n_fine_entries(0), _n_coarse_entries(0), @@ -387,7 +386,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) { uintptr_t(from_hr->bottom()) >> CardTableModRefBS::card_shift; CardIdx_t card_index = from_card - from_hr_bot_card_index; - assert(0 <= card_index && (size_t)card_index < HeapRegion::CardsPerRegion, + assert((size_t)card_index < HeapRegion::CardsPerRegion, "Must be in range."); if (G1HRRSUseSparseTable && _sparse_table.add_card(from_hrm_ind, card_index)) { @@ -422,11 +421,9 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) { // Transfer from sparse to fine-grain. SparsePRTEntry *sprt_entry = _sparse_table.get_entry(from_hrm_ind); assert(sprt_entry != NULL, "There should have been an entry"); - for (int i = 0; i < SparsePRTEntry::cards_num(); i++) { + for (int i = 0; i < sprt_entry->num_valid_cards(); i++) { CardIdx_t c = sprt_entry->card(i); - if (c != SparsePRTEntry::NullEntry) { - prt->add_card(c); - } + prt->add_card(c); } // Now we can delete the sparse entry. bool res = _sparse_table.delete_entry(from_hrm_ind); @@ -519,8 +516,10 @@ void OtherRegionsTable::scrub(G1CardLiveData* live_data) { log_develop_trace(gc, remset, scrub)("Scrubbing region %u:", _hr->hrm_index()); log_develop_trace(gc, remset, scrub)(" Coarse map: before = " SIZE_FORMAT "...", _n_coarse_entries); - live_data->remove_nonlive_regions(&_coarse_map); - _n_coarse_entries = _coarse_map.count_one_bits(); + if (_n_coarse_entries > 0) { + live_data->remove_nonlive_regions(&_coarse_map); + _n_coarse_entries = _coarse_map.count_one_bits(); + } log_develop_trace(gc, remset, scrub)(" after = " SIZE_FORMAT ".", _n_coarse_entries); // Now do the fine-grained maps. @@ -646,7 +645,9 @@ void OtherRegionsTable::clear() { _first_all_fine_prts = _last_all_fine_prts = NULL; _sparse_table.clear(); - _coarse_map.clear(); + if (_n_coarse_entries > 0) { + _coarse_map.clear(); + } _n_fine_entries = 0; _n_coarse_entries = 0; @@ -677,7 +678,7 @@ bool OtherRegionsTable::contains_reference_locked(OopOrNarrowOopStar from) const uintptr_t(hr->bottom()) >> CardTableModRefBS::card_shift; assert(from_card >= hr_bot_card_index, "Inv"); CardIdx_t card_index = from_card - hr_bot_card_index; - assert(0 <= card_index && (size_t)card_index < HeapRegion::CardsPerRegion, + assert((size_t)card_index < HeapRegion::CardsPerRegion, "Must be in range."); return _sparse_table.contains_card(hr_ind, card_index); } @@ -692,8 +693,8 @@ HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetTable* bot, HeapRegion* hr) : _bot(bot), _m(Mutex::leaf, FormatBuffer<128>("HeapRegionRemSet lock #%u", hr->hrm_index()), true, Monitor::_safepoint_check_never), - _code_roots(), _other_regions(hr, &_m), _iter_state(Unclaimed), _iter_claimed(0) { - reset_for_par_iteration(); + _code_roots(), + _other_regions(hr, &_m) { } void HeapRegionRemSet::setup_remset_size() { @@ -710,20 +711,6 @@ void HeapRegionRemSet::setup_remset_size() { guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity"); } -bool HeapRegionRemSet::claim_iter() { - if (_iter_state != Unclaimed) return false; - jint res = Atomic::cmpxchg(Claimed, (jint*)(&_iter_state), Unclaimed); - return (res == Unclaimed); -} - -void HeapRegionRemSet::set_iter_complete() { - _iter_state = Complete; -} - -bool HeapRegionRemSet::iter_is_complete() { - return _iter_state == Complete; -} - #ifndef PRODUCT void HeapRegionRemSet::print() { HeapRegionRemSetIterator iter(this); @@ -760,14 +747,6 @@ void HeapRegionRemSet::clear_locked() { _code_roots.clear(); _other_regions.clear(); assert(occupied_locked() == 0, "Should be clear."); - reset_for_par_iteration(); -} - -void HeapRegionRemSet::reset_for_par_iteration() { - _iter_state = Unclaimed; - _iter_claimed = 0; - // It's good to check this to make sure that the two methods are in sync. - assert(verify_ready_for_par_iteration(), "post-condition"); } void HeapRegionRemSet::scrub(G1CardLiveData* live_data) { diff --git a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp index c884dab2484..7f740b692c8 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp +++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -79,7 +79,7 @@ class OtherRegionsTable VALUE_OBJ_CLASS_SPEC { HeapRegion* _hr; // These are protected by "_m". - BitMap _coarse_map; + CHeapBitMap _coarse_map; size_t _n_coarse_entries; static jint _n_coarsenings; @@ -185,10 +185,6 @@ private: OtherRegionsTable _other_regions; - enum ParIterState { Unclaimed, Claimed, Complete }; - volatile ParIterState _iter_state; - volatile size_t _iter_claimed; - public: HeapRegionRemSet(G1BlockOffsetTable* bot, HeapRegion* hr); @@ -240,27 +236,6 @@ public: void clear(); void clear_locked(); - // Attempt to claim the region. Returns true iff this call caused an - // atomic transition from Unclaimed to Claimed. - bool claim_iter(); - // Sets the iteration state to "complete". - void set_iter_complete(); - // Returns "true" iff the region's iteration is complete. - bool iter_is_complete(); - - // Support for claiming blocks of cards during iteration - size_t iter_claimed() const { return _iter_claimed; } - // Claim the next block of cards - size_t iter_claimed_next(size_t step) { - return Atomic::add(step, &_iter_claimed) - step; - } - - void reset_for_par_iteration(); - - bool verify_ready_for_par_iteration() { - return (_iter_state == Unclaimed) && (_iter_claimed == 0); - } - // The actual # of bytes this hr_remset takes up. // Note also includes the strong code root set. size_t mem_size() { diff --git a/hotspot/src/share/vm/gc/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc/g1/heapRegionSet.cpp index 89b5a7f044f..83bbc71bc4c 100644 --- a/hotspot/src/share/vm/gc/g1/heapRegionSet.cpp +++ b/hotspot/src/share/vm/gc/g1/heapRegionSet.cpp @@ -38,7 +38,6 @@ void HeapRegionSetBase::verify_region(HeapRegion* hr) { assert(!hr->is_free() || hr->is_empty(), "Free region %u is not empty for set %s", hr->hrm_index(), name()); assert(!hr->is_empty() || hr->is_free() || hr->is_archive(), "Empty region %u is not free or archive for set %s", hr->hrm_index(), name()); - assert(hr->rem_set()->verify_ready_for_par_iteration(), "Wrong iteration state %u", hr->hrm_index()); } #endif diff --git a/hotspot/src/share/vm/gc/g1/sparsePRT.cpp b/hotspot/src/share/vm/gc/g1/sparsePRT.cpp index f282ae922d0..cab39b36e91 100644 --- a/hotspot/src/share/vm/gc/g1/sparsePRT.cpp +++ b/hotspot/src/share/vm/gc/g1/sparsePRT.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc/g1/heapRegion.hpp" +#include "gc/g1/heapRegionBounds.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "gc/g1/sparsePRT.hpp" #include "gc/shared/cardTableModRefBS.hpp" @@ -32,57 +33,69 @@ #include "runtime/atomic.inline.hpp" #include "runtime/mutexLocker.hpp" -void SparsePRTEntry::init(RegionIdx_t region_ind) { - _region_ind = region_ind; - _next_index = NullEntry; +// Check that the size of the SparsePRTEntry is evenly divisible by the maximum +// member type to avoid SIGBUS when accessing them. +STATIC_ASSERT(sizeof(SparsePRTEntry) % sizeof(int) == 0); - for (int i = 0; i < cards_num(); i++) { - _cards[i] = NullEntry; - } +void SparsePRTEntry::init(RegionIdx_t region_ind) { + // Check that the card array element type can represent all cards in the region. + // Choose a large SparsePRTEntry::card_elem_t (e.g. CardIdx_t) if required. + assert(((size_t)1 << (sizeof(SparsePRTEntry::card_elem_t) * BitsPerByte)) * + G1SATBCardTableModRefBS::card_size >= HeapRegionBounds::max_size(), "precondition"); + assert(G1RSetSparseRegionEntries > 0, "precondition"); + _region_ind = region_ind; + _next_index = RSHashTable::NullEntry; + _next_null = 0; } bool SparsePRTEntry::contains_card(CardIdx_t card_index) const { - for (int i = 0; i < cards_num(); i++) { - if (_cards[i] == card_index) return true; + for (int i = 0; i < num_valid_cards(); i++) { + if (card(i) == card_index) { + return true; + } } return false; } -int SparsePRTEntry::num_valid_cards() const { - int sum = 0; - for (int i = 0; i < cards_num(); i++) { - sum += (_cards[i] != NullEntry); - } - return sum; -} - SparsePRTEntry::AddCardResult SparsePRTEntry::add_card(CardIdx_t card_index) { - for (int i = 0; i < cards_num(); i++) { - CardIdx_t c = _cards[i]; - if (c == card_index) return found; - if (c == NullEntry) { _cards[i] = card_index; return added; } + for (int i = 0; i < num_valid_cards(); i++) { + if (card(i) == card_index) { + return found; + } } + if (num_valid_cards() < cards_num() - 1) { + _cards[_next_null] = (card_elem_t)card_index; + _next_null++; + return added; + } // Otherwise, we're full. return overflow; } -void SparsePRTEntry::copy_cards(CardIdx_t* cards) const { - memcpy(cards, _cards, cards_num() * sizeof(CardIdx_t)); +void SparsePRTEntry::copy_cards(card_elem_t* cards) const { + memcpy(cards, _cards, cards_num() * sizeof(card_elem_t)); } void SparsePRTEntry::copy_cards(SparsePRTEntry* e) const { - copy_cards(&e->_cards[0]); + copy_cards(e->_cards); + assert(_next_null >= 0, "invariant"); + assert(_next_null <= cards_num(), "invariant"); + e->_next_null = _next_null; } // ---------------------------------------------------------------------- +float RSHashTable::TableOccupancyFactor = 0.5f; + RSHashTable::RSHashTable(size_t capacity) : _capacity(capacity), _capacity_mask(capacity-1), _occupied_entries(0), _occupied_cards(0), - _entries((SparsePRTEntry*)NEW_C_HEAP_ARRAY(char, SparsePRTEntry::size() * capacity, mtGC)), + _entries(NULL), _buckets(NEW_C_HEAP_ARRAY(int, capacity, mtGC)), _free_list(NullEntry), _free_region(0) { + _num_entries = (capacity * TableOccupancyFactor) + 1; + _entries = (SparsePRTEntry*)NEW_C_HEAP_ARRAY(char, _num_entries * SparsePRTEntry::size(), mtGC); clear(); } @@ -107,7 +120,7 @@ void RSHashTable::clear() { "_capacity too large"); // This will put -1 == NullEntry in the key field of all entries. - memset(_entries, NullEntry, _capacity * SparsePRTEntry::size()); + memset(_entries, NullEntry, _num_entries * SparsePRTEntry::size()); memset(_buckets, NullEntry, _capacity * sizeof(int)); _free_list = NullEntry; _free_region = 0; @@ -123,16 +136,6 @@ bool RSHashTable::add_card(RegionIdx_t region_ind, CardIdx_t card_index) { return res != SparsePRTEntry::overflow; } -bool RSHashTable::get_cards(RegionIdx_t region_ind, CardIdx_t* cards) { - SparsePRTEntry* entry = get_entry(region_ind); - if (entry == NULL) { - return false; - } - // Otherwise... - entry->copy_cards(cards); - return true; -} - SparsePRTEntry* RSHashTable::get_entry(RegionIdx_t region_ind) const { int ind = (int) (region_ind & capacity_mask()); int cur_ind = _buckets[ind]; @@ -174,7 +177,6 @@ RSHashTable::entry_for_region_ind_create(RegionIdx_t region_ind) { SparsePRTEntry* res = get_entry(region_ind); if (res == NULL) { int new_ind = alloc_entry(); - assert(0 <= new_ind && (size_t)new_ind < capacity(), "There should be room."); res = entry(new_ind); res->init(region_ind); // Insert at front. @@ -192,7 +194,7 @@ int RSHashTable::alloc_entry() { res = _free_list; _free_list = entry(res)->next_index(); return res; - } else if ((size_t) _free_region+1 < capacity()) { + } else if ((size_t)_free_region < _num_entries) { res = _free_region; _free_region++; return res; @@ -215,17 +217,16 @@ void RSHashTable::add_entry(SparsePRTEntry* e) { } CardIdx_t RSHashTableIter::find_first_card_in_list() { - CardIdx_t res; while (_bl_ind != RSHashTable::NullEntry) { - res = _rsht->entry(_bl_ind)->card(0); - if (res != SparsePRTEntry::NullEntry) { - return res; + SparsePRTEntry* sparse_entry = _rsht->entry(_bl_ind); + if (sparse_entry->num_valid_cards() > 0) { + return sparse_entry->card(0); } else { - _bl_ind = _rsht->entry(_bl_ind)->next_index(); + _bl_ind = sparse_entry->next_index(); } } // Otherwise, none found: - return SparsePRTEntry::NullEntry; + return NoCardFound; } size_t RSHashTableIter::compute_card_ind(CardIdx_t ci) { @@ -234,20 +235,22 @@ size_t RSHashTableIter::compute_card_ind(CardIdx_t ci) { bool RSHashTableIter::has_next(size_t& card_index) { _card_ind++; - CardIdx_t ci; - if (_card_ind < SparsePRTEntry::cards_num() && - ((ci = _rsht->entry(_bl_ind)->card(_card_ind)) != - SparsePRTEntry::NullEntry)) { - card_index = compute_card_ind(ci); - return true; + if (_bl_ind >= 0) { + SparsePRTEntry* e = _rsht->entry(_bl_ind); + if (_card_ind < e->num_valid_cards()) { + CardIdx_t ci = e->card(_card_ind); + card_index = compute_card_ind(ci); + return true; + } } + // Otherwise, must find the next valid entry. _card_ind = 0; if (_bl_ind != RSHashTable::NullEntry) { _bl_ind = _rsht->entry(_bl_ind)->next_index(); - ci = find_first_card_in_list(); - if (ci != SparsePRTEntry::NullEntry) { + CardIdx_t ci = find_first_card_in_list(); + if (ci != NoCardFound) { card_index = compute_card_ind(ci); return true; } @@ -256,8 +259,8 @@ bool RSHashTableIter::has_next(size_t& card_index) { _tbl_ind++; while ((size_t)_tbl_ind < _rsht->capacity()) { _bl_ind = _rsht->_buckets[_tbl_ind]; - ci = find_first_card_in_list(); - if (ci != SparsePRTEntry::NullEntry) { + CardIdx_t ci = find_first_card_in_list(); + if (ci != NoCardFound) { card_index = compute_card_ind(ci); return true; } @@ -275,7 +278,7 @@ bool RSHashTable::contains_card(RegionIdx_t region_index, CardIdx_t card_index) size_t RSHashTable::mem_size() const { return sizeof(RSHashTable) + - capacity() * (SparsePRTEntry::size() + sizeof(int)); + _num_entries * (SparsePRTEntry::size() + sizeof(int)); } // ---------------------------------------------------------------------- @@ -380,16 +383,12 @@ size_t SparsePRT::mem_size() const { } bool SparsePRT::add_card(RegionIdx_t region_id, CardIdx_t card_index) { - if (_next->occupied_entries() * 2 > _next->capacity()) { + if (_next->should_expand()) { expand(); } return _next->add_card(region_id, card_index); } -bool SparsePRT::get_cards(RegionIdx_t region_id, CardIdx_t* cards) { - return _next->get_cards(region_id, cards); -} - SparsePRTEntry* SparsePRT::get_entry(RegionIdx_t region_id) { return _next->get_entry(region_id); } @@ -427,7 +426,7 @@ void SparsePRT::cleanup() { void SparsePRT::expand() { RSHashTable* last = _next; _next = new RSHashTable(last->capacity() * 2); - for (size_t i = 0; i < last->capacity(); i++) { + for (size_t i = 0; i < last->num_entries(); i++) { SparsePRTEntry* e = last->entry((int)i); if (e->valid_entry()) { _next->add_entry(e); diff --git a/hotspot/src/share/vm/gc/g1/sparsePRT.hpp b/hotspot/src/share/vm/gc/g1/sparsePRT.hpp index b5ea3cde9a9..5ea825ced8c 100644 --- a/hotspot/src/share/vm/gc/g1/sparsePRT.hpp +++ b/hotspot/src/share/vm/gc/g1/sparsePRT.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -43,26 +43,32 @@ // old versions synchronously. class SparsePRTEntry: public CHeapObj { -public: - enum SomePublicConstants { - NullEntry = -1, - UnrollFactor = 4 - }; private: + // The type of a card entry. + typedef uint16_t card_elem_t; + + // We need to make sizeof(SparsePRTEntry) an even multiple of maximum member size, + // in order to force correct alignment that could otherwise cause SIGBUS errors + // when reading the member variables. This calculates the minimum number of card + // array elements required to get that alignment. + static const size_t card_array_alignment = sizeof(int) / sizeof(card_elem_t); + RegionIdx_t _region_ind; int _next_index; - CardIdx_t _cards[1]; + int _next_null; + // The actual cards stored in this array. // WARNING: Don't put any data members beyond this line. Card array has, in fact, variable length. // It should always be the last data member. + card_elem_t _cards[card_array_alignment]; + + // Copy the current entry's cards into "cards". + inline void copy_cards(card_elem_t* cards) const; public: // Returns the size of the entry, used for entry allocation. - static size_t size() { return sizeof(SparsePRTEntry) + sizeof(CardIdx_t) * (cards_num() - 1); } + static size_t size() { return sizeof(SparsePRTEntry) + sizeof(card_elem_t) * (cards_num() - card_array_alignment); } // Returns the size of the card array. static int cards_num() { - // The number of cards should be a multiple of 4, because that's our current - // unrolling factor. - static const int s = MAX2(G1RSetSparseRegionEntries & ~(UnrollFactor - 1), UnrollFactor); - return s; + return align_size_up(G1RSetSparseRegionEntries, card_array_alignment); } // Set the region_ind to the given value, and delete all cards. @@ -80,7 +86,7 @@ public: inline bool contains_card(CardIdx_t card_index) const; // Returns the number of non-NULL card entries. - inline int num_valid_cards() const; + inline int num_valid_cards() const { return _next_null; } // Requires that the entry not contain the given card index. If there is // space available, add the given card index to the entry and return @@ -92,22 +98,25 @@ public: }; inline AddCardResult add_card(CardIdx_t card_index); - // Copy the current entry's cards into "cards". - inline void copy_cards(CardIdx_t* cards) const; // Copy the current entry's cards into the "_card" array of "e." inline void copy_cards(SparsePRTEntry* e) const; - inline CardIdx_t card(int i) const { return _cards[i]; } + inline CardIdx_t card(int i) const { + assert(i >= 0, "must be nonnegative"); + assert(i < cards_num(), "range checking"); + return (CardIdx_t)_cards[i]; + } }; - class RSHashTable : public CHeapObj { friend class RSHashTableIter; - enum SomePrivateConstants { - NullEntry = -1 - }; + + // Inverse maximum hash table occupancy used. + static float TableOccupancyFactor; + + size_t _num_entries; size_t _capacity; size_t _capacity_mask; @@ -136,6 +145,10 @@ public: RSHashTable(size_t capacity); ~RSHashTable(); + static const int NullEntry = -1; + + bool should_expand() const { return _occupied_entries == _num_entries; } + // Attempts to ensure that the given card_index in the given region is in // the sparse table. If successful (because the card was already // present, or because it was successfully added) returns "true". @@ -156,27 +169,35 @@ public: void clear(); - size_t capacity() const { return _capacity; } + size_t capacity() const { return _capacity; } size_t capacity_mask() const { return _capacity_mask; } size_t occupied_entries() const { return _occupied_entries; } - size_t occupied_cards() const { return _occupied_cards; } + size_t occupied_cards() const { return _occupied_cards; } size_t mem_size() const; + // The number of SparsePRTEntry instances available. + size_t num_entries() const { return _num_entries; } - SparsePRTEntry* entry(int i) const { return (SparsePRTEntry*)((char*)_entries + SparsePRTEntry::size() * i); } + SparsePRTEntry* entry(int i) const { + assert(i >= 0 && (size_t)i < _num_entries, "precondition"); + return (SparsePRTEntry*)((char*)_entries + SparsePRTEntry::size() * i); + } void print(); }; // ValueObj because will be embedded in HRRS iterator. class RSHashTableIter VALUE_OBJ_CLASS_SPEC { + // Return value indicating "invalid/no card". + static const int NoCardFound = -1; + int _tbl_ind; // [-1, 0.._rsht->_capacity) int _bl_ind; // [-1, 0.._rsht->_capacity) short _card_ind; // [0..SparsePRTEntry::cards_num()) RSHashTable* _rsht; // If the bucket list pointed to by _bl_ind contains a card, sets - // _bl_ind to the index of that entry, and returns the card. - // Otherwise, returns SparseEntry::NullEntry. + // _bl_ind to the index of that entry, + // Returns the card found if there is, otherwise returns InvalidCard. CardIdx_t find_first_card_in_list(); // Computes the proper card index for the card whose offset in the @@ -247,12 +268,6 @@ public: // entries to a larger-capacity representation. bool add_card(RegionIdx_t region_id, CardIdx_t card_index); - // If the table hold an entry for "region_ind", Copies its - // cards into "cards", which must be an array of length at least - // "SparePRTEntry::cards_num()", and returns "true"; otherwise, - // returns "false". - bool get_cards(RegionIdx_t region_ind, CardIdx_t* cards); - // Return the pointer to the entry associated with the given region. SparsePRTEntry* get_entry(RegionIdx_t region_ind); diff --git a/hotspot/src/share/vm/gc/g1/survRateGroup.cpp b/hotspot/src/share/vm/gc/g1/survRateGroup.cpp index e201d259491..b59a7268379 100644 --- a/hotspot/src/share/vm/gc/g1/survRateGroup.cpp +++ b/hotspot/src/share/vm/gc/g1/survRateGroup.cpp @@ -30,33 +30,14 @@ #include "logging/log.hpp" #include "memory/allocation.hpp" -SurvRateGroup::SurvRateGroup(G1Predictions* predictor, - const char* name, - size_t summary_surv_rates_len) : - _predictor(predictor), _name(name), - _summary_surv_rates_len(summary_surv_rates_len), - _summary_surv_rates_max_len(0), - _summary_surv_rates(NULL), - _surv_rate(NULL), +SurvRateGroup::SurvRateGroup() : _accum_surv_rate_pred(NULL), _surv_rate_pred(NULL), _stats_arrays_length(0) { reset(); - if (summary_surv_rates_len > 0) { - size_t length = summary_surv_rates_len; - _summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length, mtGC); - for (size_t i = 0; i < length; ++i) { - _summary_surv_rates[i] = new NumberSeq(); - } - } - start_adding_regions(); } -double SurvRateGroup::get_new_prediction(TruncatedSeq const* seq) const { - return _predictor->get_new_prediction(seq); -} - void SurvRateGroup::reset() { _all_regions_allocated = 0; _setup_seq_num = 0; @@ -73,10 +54,14 @@ void SurvRateGroup::reset() { _stats_arrays_length = 0; stop_adding_regions(); + + // Seed initial _surv_rate_pred and _accum_surv_rate_pred values guarantee( _stats_arrays_length == 1, "invariant" ); guarantee( _surv_rate_pred[0] != NULL, "invariant" ); - _surv_rate_pred[0]->add(0.4); - all_surviving_words_recorded(false); + const double initial_surv_rate = 0.4; + _surv_rate_pred[0]->add(initial_surv_rate); + _last_pred = _accum_surv_rate_pred[0] = initial_surv_rate; + _region_num = 0; } @@ -87,131 +72,49 @@ void SurvRateGroup::start_adding_regions() { void SurvRateGroup::stop_adding_regions() { if (_region_num > _stats_arrays_length) { - double* old_surv_rate = _surv_rate; - double* old_accum_surv_rate_pred = _accum_surv_rate_pred; - TruncatedSeq** old_surv_rate_pred = _surv_rate_pred; + _accum_surv_rate_pred = REALLOC_C_HEAP_ARRAY(double, _accum_surv_rate_pred, _region_num, mtGC); + _surv_rate_pred = REALLOC_C_HEAP_ARRAY(TruncatedSeq*, _surv_rate_pred, _region_num, mtGC); - _surv_rate = NEW_C_HEAP_ARRAY(double, _region_num, mtGC); - _accum_surv_rate_pred = NEW_C_HEAP_ARRAY(double, _region_num, mtGC); - _surv_rate_pred = NEW_C_HEAP_ARRAY(TruncatedSeq*, _region_num, mtGC); - - for (size_t i = 0; i < _stats_arrays_length; ++i) { - _surv_rate_pred[i] = old_surv_rate_pred[i]; - } for (size_t i = _stats_arrays_length; i < _region_num; ++i) { _surv_rate_pred[i] = new TruncatedSeq(10); } _stats_arrays_length = _region_num; - - if (old_surv_rate != NULL) { - FREE_C_HEAP_ARRAY(double, old_surv_rate); - } - if (old_accum_surv_rate_pred != NULL) { - FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred); - } - if (old_surv_rate_pred != NULL) { - FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred); - } } - - for (size_t i = 0; i < _stats_arrays_length; ++i) { - _surv_rate[i] = 0.0; - } -} - -int SurvRateGroup::next_age_index() { - ++_region_num; - return (int) ++_all_regions_allocated; } void SurvRateGroup::record_surviving_words(int age_in_group, size_t surv_words) { guarantee( 0 <= age_in_group && (size_t) age_in_group < _region_num, "pre-condition" ); - guarantee( _surv_rate[age_in_group] <= 0.00001, - "should only update each slot once" ); double surv_rate = (double) surv_words / (double) HeapRegion::GrainWords; - _surv_rate[age_in_group] = surv_rate; _surv_rate_pred[age_in_group]->add(surv_rate); - if ((size_t)age_in_group < _summary_surv_rates_len) { - _summary_surv_rates[age_in_group]->add(surv_rate); - if ((size_t)(age_in_group+1) > _summary_surv_rates_max_len) - _summary_surv_rates_max_len = age_in_group+1; - } } -void SurvRateGroup::all_surviving_words_recorded(bool update_predictors) { - if (update_predictors && _region_num > 0) { // conservative +void SurvRateGroup::all_surviving_words_recorded(const G1Predictions& predictor, bool update_predictors) { + if (update_predictors) { + fill_in_last_surv_rates(); + } + finalize_predictions(predictor); +} + +void SurvRateGroup::fill_in_last_surv_rates() { + if (_region_num > 0) { // conservative double surv_rate = _surv_rate_pred[_region_num-1]->last(); for (size_t i = _region_num; i < _stats_arrays_length; ++i) { - guarantee( _surv_rate[i] <= 0.00001, - "the slot should not have been updated" ); _surv_rate_pred[i]->add(surv_rate); } } +} +void SurvRateGroup::finalize_predictions(const G1Predictions& predictor) { double accum = 0.0; double pred = 0.0; for (size_t i = 0; i < _stats_arrays_length; ++i) { - pred = get_new_prediction(_surv_rate_pred[i]); + pred = predictor.get_new_prediction(_surv_rate_pred[i]); if (pred > 1.0) pred = 1.0; accum += pred; _accum_surv_rate_pred[i] = accum; } _last_pred = pred; } - -#ifndef PRODUCT -void SurvRateGroup::print() { - log_develop_trace(gc, survivor)("Surv Rate Group: %s (" SIZE_FORMAT " entries)", _name, _region_num); - for (size_t i = 0; i < _region_num; ++i) { - log_develop_trace(gc, survivor)(" age " SIZE_FORMAT_W(4) " surv rate %6.2lf %% pred %6.2lf %%", - i, _surv_rate[i] * 100.0, - _predictor->get_new_prediction(_surv_rate_pred[i]) * 100.0); - } -} - -void -SurvRateGroup::print_surv_rate_summary() { - size_t length = _summary_surv_rates_max_len; - if (length == 0) - return; - - log_trace(gc, survivor)("%s Rate Summary (for up to age " SIZE_FORMAT ")", _name, length-1); - log_trace(gc, survivor)(" age range survival rate (avg) samples (avg)"); - log_trace(gc, survivor)(" ---------------------------------------------------------"); - - size_t index = 0; - size_t limit = MIN2((int) length, 10); - while (index < limit) { - log_trace(gc, survivor)(" " SIZE_FORMAT_W(4) " %6.2lf%% %6.2lf", - index, _summary_surv_rates[index]->avg() * 100.0, - (double) _summary_surv_rates[index]->num()); - ++index; - } - - log_trace(gc, survivor)(" ---------------------------------------------------------"); - - int num = 0; - double sum = 0.0; - int samples = 0; - while (index < length) { - ++num; - sum += _summary_surv_rates[index]->avg() * 100.0; - samples += _summary_surv_rates[index]->num(); - ++index; - - if (index == length || num % 10 == 0) { - log_trace(gc, survivor)(" " SIZE_FORMAT_W(4) " .. " SIZE_FORMAT_W(4) " %6.2lf%% %6.2lf", - (index-1) / 10 * 10, index-1, sum / (double) num, - (double) samples / (double) num); - sum = 0.0; - num = 0; - samples = 0; - } - } - - log_trace(gc, survivor)(" ---------------------------------------------------------"); -} -#endif // PRODUCT diff --git a/hotspot/src/share/vm/gc/g1/survRateGroup.hpp b/hotspot/src/share/vm/gc/g1/survRateGroup.hpp index a4fbe3bf690..58f458c79be 100644 --- a/hotspot/src/share/vm/gc/g1/survRateGroup.hpp +++ b/hotspot/src/share/vm/gc/g1/survRateGroup.hpp @@ -31,37 +31,27 @@ class G1Predictions; class SurvRateGroup : public CHeapObj { private: - G1Predictions* _predictor; - - double get_new_prediction(TruncatedSeq const* seq) const; - - const char* _name; - size_t _stats_arrays_length; - double* _surv_rate; double* _accum_surv_rate_pred; double _last_pred; TruncatedSeq** _surv_rate_pred; - NumberSeq** _summary_surv_rates; - size_t _summary_surv_rates_len; - size_t _summary_surv_rates_max_len; int _all_regions_allocated; size_t _region_num; size_t _setup_seq_num; + void fill_in_last_surv_rates(); + void finalize_predictions(const G1Predictions& predictor); public: - SurvRateGroup(G1Predictions* predictor, - const char* name, - size_t summary_surv_rates_len); + SurvRateGroup(); void reset(); void start_adding_regions(); void stop_adding_regions(); void record_surviving_words(int age_in_group, size_t surv_words); - void all_surviving_words_recorded(bool update_predictors); - const char* name() { return _name; } + void all_surviving_words_recorded(const G1Predictions& predictor, bool update_predictors); + + size_t region_num() const { return _region_num; } - size_t region_num() { return _region_num; } double accum_surv_rate_pred(int age) const { assert(age >= 0, "must be"); if ((size_t)age < _stats_arrays_length) @@ -82,8 +72,12 @@ public: return seq; } - int next_age_index(); - int age_in_group(int age_index) { + int next_age_index() { + ++_region_num; + return (int) ++_all_regions_allocated; + } + + int age_in_group(int age_index) const { int ret = (int) (_all_regions_allocated - age_index); assert( ret >= 0, "invariant" ); return ret; @@ -92,10 +86,6 @@ public: _all_regions_allocated = 0; } -#ifndef PRODUCT - void print(); - void print_surv_rate_summary(); -#endif // PRODUCT }; #endif // SHARE_VM_GC_G1_SURVRATEGROUP_HPP diff --git a/hotspot/src/share/vm/gc/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc/g1/vm_operations_g1.cpp index 62d610d966b..333499a0a97 100644 --- a/hotspot/src/share/vm/gc/g1/vm_operations_g1.cpp +++ b/hotspot/src/share/vm/gc/g1/vm_operations_g1.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/concurrentMarkThread.inline.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" +#include "gc/g1/g1Policy.hpp" #include "gc/shared/gcId.hpp" #include "gc/g1/vm_operations_g1.hpp" #include "gc/shared/gcTimer.hpp" diff --git a/hotspot/src/share/vm/gc/g1/youngList.cpp b/hotspot/src/share/vm/gc/g1/youngList.cpp deleted file mode 100644 index 5d57d5cb2f1..00000000000 --- a/hotspot/src/share/vm/gc/g1/youngList.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2015, 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. - * - */ - -#include "precompiled.hpp" -#include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/g1CollectionSet.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" -#include "gc/g1/heapRegion.hpp" -#include "gc/g1/heapRegion.inline.hpp" -#include "gc/g1/heapRegionRemSet.hpp" -#include "gc/g1/youngList.hpp" -#include "logging/log.hpp" -#include "utilities/ostream.hpp" - -YoungList::YoungList(G1CollectedHeap* g1h) : - _g1h(g1h), _head(NULL), _length(0), - _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) { - guarantee(check_list_empty(), "just making sure..."); -} - -void YoungList::push_region(HeapRegion *hr) { - assert(!hr->is_young(), "should not already be young"); - assert(hr->get_next_young_region() == NULL, "cause it should!"); - - hr->set_next_young_region(_head); - _head = hr; - - _g1h->g1_policy()->set_region_eden(hr, (int) _length); - ++_length; -} - -void YoungList::add_survivor_region(HeapRegion* hr) { - assert(hr->is_survivor(), "should be flagged as survivor region"); - assert(hr->get_next_young_region() == NULL, "cause it should!"); - - hr->set_next_young_region(_survivor_head); - if (_survivor_head == NULL) { - _survivor_tail = hr; - } - _survivor_head = hr; - ++_survivor_length; -} - -void YoungList::empty_list(HeapRegion* list) { - while (list != NULL) { - HeapRegion* next = list->get_next_young_region(); - list->set_next_young_region(NULL); - list->uninstall_surv_rate_group(); - // This is called before a Full GC and all the non-empty / - // non-humongous regions at the end of the Full GC will end up as - // old anyway. - list->set_old(); - list = next; - } -} - -void YoungList::empty_list() { - assert(check_list_well_formed(), "young list should be well formed"); - - empty_list(_head); - _head = NULL; - _length = 0; - - empty_list(_survivor_head); - _survivor_head = NULL; - _survivor_tail = NULL; - _survivor_length = 0; - - assert(check_list_empty(), "just making sure..."); -} - -bool YoungList::check_list_well_formed() { - bool ret = true; - - uint length = 0; - HeapRegion* curr = _head; - HeapRegion* last = NULL; - while (curr != NULL) { - if (!curr->is_young()) { - log_error(gc, verify)("### YOUNG REGION " PTR_FORMAT "-" PTR_FORMAT " " - "incorrectly tagged (y: %d, surv: %d)", - p2i(curr->bottom()), p2i(curr->end()), - curr->is_young(), curr->is_survivor()); - ret = false; - } - ++length; - last = curr; - curr = curr->get_next_young_region(); - } - ret = ret && (length == _length); - - if (!ret) { - log_error(gc, verify)("### YOUNG LIST seems not well formed!"); - log_error(gc, verify)("### list has %u entries, _length is %u", length, _length); - } - - return ret; -} - -bool YoungList::check_list_empty() { - bool ret = true; - - if (_length != 0) { - log_error(gc, verify)("### YOUNG LIST should have 0 length, not %u", _length); - ret = false; - } - if (_head != NULL) { - log_error(gc, verify)("### YOUNG LIST does not have a NULL head"); - ret = false; - } - if (!ret) { - log_error(gc, verify)("### YOUNG LIST does not seem empty"); - } - - return ret; -} - -void -YoungList::reset_auxilary_lists() { - guarantee( is_empty(), "young list should be empty" ); - assert(check_list_well_formed(), "young list should be well formed"); - - // Add survivor regions to SurvRateGroup. - _g1h->g1_policy()->note_start_adding_survivor_regions(); - _g1h->g1_policy()->finished_recalculating_age_indexes(true /* is_survivors */); - - int young_index_in_cset = 0; - for (HeapRegion* curr = _survivor_head; - curr != NULL; - curr = curr->get_next_young_region()) { - _g1h->g1_policy()->set_region_survivor(curr, young_index_in_cset); - - // The region is a non-empty survivor so let's add it to - // the incremental collection set for the next evacuation - // pause. - _g1h->collection_set()->add_survivor_regions(curr); - young_index_in_cset += 1; - } - assert((uint) young_index_in_cset == _survivor_length, "post-condition"); - _g1h->g1_policy()->note_stop_adding_survivor_regions(); - - _head = _survivor_head; - _length = _survivor_length; - if (_survivor_head != NULL) { - assert(_survivor_tail != NULL, "cause it shouldn't be"); - assert(_survivor_length > 0, "invariant"); - _survivor_tail->set_next_young_region(NULL); - } - - // Don't clear the survivor list handles until the start of - // the next evacuation pause - we need it in order to re-tag - // the survivor regions from this evacuation pause as 'young' - // at the start of the next. - - _g1h->g1_policy()->finished_recalculating_age_indexes(false /* is_survivors */); - - assert(check_list_well_formed(), "young list should be well formed"); -} - -void YoungList::print() { - HeapRegion* lists[] = {_head, _survivor_head}; - const char* names[] = {"YOUNG", "SURVIVOR"}; - - for (uint list = 0; list < ARRAY_SIZE(lists); ++list) { - tty->print_cr("%s LIST CONTENTS", names[list]); - HeapRegion *curr = lists[list]; - if (curr == NULL) { - tty->print_cr(" empty"); - } - while (curr != NULL) { - tty->print_cr(" " HR_FORMAT ", P: " PTR_FORMAT ", N: " PTR_FORMAT ", age: %4d", - HR_FORMAT_PARAMS(curr), - p2i(curr->prev_top_at_mark_start()), - p2i(curr->next_top_at_mark_start()), - curr->age_in_surv_rate_group_cond()); - curr = curr->get_next_young_region(); - } - } - - tty->cr(); -} diff --git a/hotspot/src/share/vm/gc/g1/youngList.hpp b/hotspot/src/share/vm/gc/g1/youngList.hpp deleted file mode 100644 index 1030b3f9c1c..00000000000 --- a/hotspot/src/share/vm/gc/g1/youngList.hpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_VM_GC_G1_YOUNGLIST_HPP -#define SHARE_VM_GC_G1_YOUNGLIST_HPP - -#include "memory/allocation.hpp" -#include "runtime/globals.hpp" - -class YoungList : public CHeapObj { -private: - G1CollectedHeap* _g1h; - - HeapRegion* _head; - - HeapRegion* _survivor_head; - HeapRegion* _survivor_tail; - - uint _length; - uint _survivor_length; - - void empty_list(HeapRegion* list); - -public: - YoungList(G1CollectedHeap* g1h); - - void push_region(HeapRegion* hr); - void add_survivor_region(HeapRegion* hr); - - void empty_list(); - bool is_empty() { return _length == 0; } - uint length() { return _length; } - uint eden_length() { return length() - survivor_length(); } - uint survivor_length() { return _survivor_length; } - - // Currently we do not keep track of the used byte sum for the - // young list and the survivors and it'd be quite a lot of work to - // do so. When we'll eventually replace the young list with - // instances of HeapRegionLinkedList we'll get that for free. So, - // we'll report the more accurate information then. - size_t eden_used_bytes() { - assert(length() >= survivor_length(), "invariant"); - return (size_t) eden_length() * HeapRegion::GrainBytes; - } - size_t survivor_used_bytes() { - return (size_t) survivor_length() * HeapRegion::GrainBytes; - } - - // for development purposes - void reset_auxilary_lists(); - void clear() { _head = NULL; _length = 0; } - - void clear_survivors() { - _survivor_head = NULL; - _survivor_tail = NULL; - _survivor_length = 0; - } - - HeapRegion* first_region() { return _head; } - HeapRegion* first_survivor_region() { return _survivor_head; } - HeapRegion* last_survivor_region() { return _survivor_tail; } - - // debugging - bool check_list_well_formed(); - bool check_list_empty(); - void print(); -}; - -#endif // SHARE_VM_GC_G1_YOUNGLIST_HPP diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp index 57e91b6d16c..2ec5d190293 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include "precompiled.hpp" #include "gc/parallel/gcTaskManager.hpp" #include "gc/parallel/gcTaskThread.hpp" -#include "gc/shared/adaptiveSizePolicy.hpp" #include "gc/shared/gcId.hpp" +#include "gc/shared/workerManager.hpp" #include "logging/log.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" @@ -34,6 +34,7 @@ #include "runtime/mutex.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/orderAccess.inline.hpp" +#include "runtime/os.hpp" // // GCTask @@ -372,10 +373,28 @@ SynchronizedGCTaskQueue::~SynchronizedGCTaskQueue() { GCTaskManager::GCTaskManager(uint workers) : _workers(workers), _active_workers(0), - _idle_workers(0) { + _idle_workers(0), + _created_workers(0) { initialize(); } +GCTaskThread* GCTaskManager::install_worker(uint t) { + GCTaskThread* new_worker = GCTaskThread::create(this, t, _processor_assignment[t]); + set_thread(t, new_worker); + return new_worker; +} + +void GCTaskManager::add_workers(bool initializing) { + os::ThreadType worker_type = os::pgc_thread; + _created_workers = WorkerManager::add_workers(this, + _active_workers, + (uint) _workers, + _created_workers, + worker_type, + initializing); + _active_workers = MIN2(_created_workers, _active_workers); +} + void GCTaskManager::initialize() { if (TraceGCTaskManager) { tty->print_cr("GCTaskManager::initialize: workers: %u", workers()); @@ -394,28 +413,30 @@ void GCTaskManager::initialize() { // Set up worker threads. // Distribute the workers among the available processors, // unless we were told not to, or if the os doesn't want to. - uint* processor_assignment = NEW_C_HEAP_ARRAY(uint, workers(), mtGC); + _processor_assignment = NEW_C_HEAP_ARRAY(uint, workers(), mtGC); if (!BindGCTaskThreadsToCPUs || - !os::distribute_processes(workers(), processor_assignment)) { + !os::distribute_processes(workers(), _processor_assignment)) { for (uint a = 0; a < workers(); a += 1) { - processor_assignment[a] = sentinel_worker(); + _processor_assignment[a] = sentinel_worker(); } } + _thread = NEW_C_HEAP_ARRAY(GCTaskThread*, workers(), mtGC); - for (uint t = 0; t < workers(); t += 1) { - set_thread(t, GCTaskThread::create(this, t, processor_assignment[t])); + _active_workers = ParallelGCThreads; + if (UseDynamicNumberOfGCThreads && !FLAG_IS_CMDLINE(ParallelGCThreads)) { + _active_workers = 1U; } + Log(gc, task, thread) log; if (log.is_trace()) { ResourceMark rm; outputStream* out = log.trace_stream(); out->print("GCTaskManager::initialize: distribution:"); for (uint t = 0; t < workers(); t += 1) { - out->print(" %u", processor_assignment[t]); + out->print(" %u", _processor_assignment[t]); } out->cr(); } - FREE_C_HEAP_ARRAY(uint, processor_assignment); } reset_busy_workers(); set_unblocked(); @@ -426,9 +447,8 @@ void GCTaskManager::initialize() { reset_completed_tasks(); reset_barriers(); reset_emptied_queue(); - for (uint s = 0; s < workers(); s += 1) { - thread(s)->start(); - } + + add_workers(true); } GCTaskManager::~GCTaskManager() { @@ -437,13 +457,17 @@ GCTaskManager::~GCTaskManager() { NoopGCTask::destroy(_noop_task); _noop_task = NULL; if (_thread != NULL) { - for (uint i = 0; i < workers(); i += 1) { + for (uint i = 0; i < created_workers(); i += 1) { GCTaskThread::destroy(thread(i)); set_thread(i, NULL); } FREE_C_HEAP_ARRAY(GCTaskThread*, _thread); _thread = NULL; } + if (_processor_assignment != NULL) { + FREE_C_HEAP_ARRAY(uint, _processor_assignment); + _processor_assignment = NULL; + } if (_resource_flag != NULL) { FREE_C_HEAP_ARRAY(bool, _resource_flag); _resource_flag = NULL; @@ -470,6 +494,9 @@ void GCTaskManager::set_active_gang() { "all_workers_active() is incorrect: " "active %d ParallelGCThreads %u", active_workers(), ParallelGCThreads); + _active_workers = MIN2(_active_workers, _workers); + // "add_workers" does not guarantee any additional workers + add_workers(false); log_trace(gc, task)("GCTaskManager::set_active_gang(): " "all_workers_active() %d workers %d " "active %d ParallelGCThreads %u", @@ -499,7 +526,7 @@ void GCTaskManager::task_idle_workers() { // is starting). Try later to release enough idle_workers // to allow the desired number of active_workers. more_inactive_workers = - workers() - active_workers() - idle_workers(); + created_workers() - active_workers() - idle_workers(); if (more_inactive_workers < 0) { int reduced_active_workers = active_workers() + more_inactive_workers; set_active_workers(reduced_active_workers); @@ -507,7 +534,7 @@ void GCTaskManager::task_idle_workers() { } log_trace(gc, task)("JT: %d workers %d active %d idle %d more %d", Threads::number_of_non_daemon_threads(), - workers(), + created_workers(), active_workers(), idle_workers(), more_inactive_workers); @@ -517,7 +544,7 @@ void GCTaskManager::task_idle_workers() { q->enqueue(IdleGCTask::create_on_c_heap()); increment_idle_workers(); } - assert(workers() == active_workers() + idle_workers(), + assert(created_workers() == active_workers() + idle_workers(), "total workers should equal active + inactive"); add_list(q); // GCTaskQueue* q was created in a ResourceArea so a @@ -539,14 +566,15 @@ void GCTaskManager::print_task_time_stamps() { if (!log_is_enabled(Debug, gc, task, time)) { return; } - for(uint i=0; iprint_task_time_stamps(); } } void GCTaskManager::print_threads_on(outputStream* st) { - uint num_thr = workers(); + uint num_thr = created_workers(); for (uint i = 0; i < num_thr; i++) { thread(i)->print_on(st); st->cr(); @@ -555,19 +583,20 @@ void GCTaskManager::print_threads_on(outputStream* st) { void GCTaskManager::threads_do(ThreadClosure* tc) { assert(tc != NULL, "Null ThreadClosure"); - uint num_thr = workers(); + uint num_thr = created_workers(); for (uint i = 0; i < num_thr; i++) { tc->do_thread(thread(i)); } } GCTaskThread* GCTaskManager::thread(uint which) { - assert(which < workers(), "index out of bounds"); + assert(which < created_workers(), "index out of bounds"); assert(_thread[which] != NULL, "shouldn't have null thread"); return _thread[which]; } void GCTaskManager::set_thread(uint which, GCTaskThread* value) { + // "_created_workers" may not have been updated yet so use workers() assert(which < workers(), "index out of bounds"); assert(value != NULL, "shouldn't have null thread"); _thread[which] = value; @@ -728,7 +757,7 @@ uint GCTaskManager::decrement_busy_workers() { void GCTaskManager::release_all_resources() { // If you want this to be done atomically, do it in a WaitForBarrierGCTask. - for (uint i = 0; i < workers(); i += 1) { + for (uint i = 0; i < created_workers(); i += 1) { set_resource_flag(i, true); } } diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp index 9d462039ad7..70ac6b2d226 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskManager.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -370,6 +370,7 @@ private: Monitor* _monitor; // Notification of changes. SynchronizedGCTaskQueue* _queue; // Queue of tasks. GCTaskThread** _thread; // Array of worker threads. + uint _created_workers; // Number of workers created. uint _active_workers; // Number of active workers. uint _busy_workers; // Number of busy workers. uint _blocking_worker; // The worker that's blocking. @@ -381,6 +382,8 @@ private: NoopGCTask* _noop_task; // The NoopGCTask instance. WaitHelper _wait_helper; // Used by inactive worker volatile uint _idle_workers; // Number of idled workers + uint* _processor_assignment; // Worker to cpu mappings. May + // be used lazily public: // Factory create and destroy methods. static GCTaskManager* create(uint workers) { @@ -546,6 +549,13 @@ protected: uint active_workers() const { return _active_workers; } + uint created_workers() const { + return _created_workers; + } + // Create a GC worker and install into GCTaskManager + GCTaskThread* install_worker(uint worker_id); + // Add GC workers as needed. + void add_workers(bool initializing); }; // diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp index d81db6900e1..f6fd1a38a6f 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp @@ -44,9 +44,6 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager, _time_stamps(NULL), _time_stamp_index(0) { - if (!os::create_thread(this, os::pgc_thread)) - vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GC thread. Out of system resources."); - set_id(which); set_name("ParGC Thread#%d", which); } @@ -57,10 +54,6 @@ GCTaskThread::~GCTaskThread() { } } -void GCTaskThread::start() { - os::start_thread(this); -} - GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) { guarantee(index < GCTaskTimeStampEntries, "increase GCTaskTimeStampEntries"); if (_time_stamps == NULL) { diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp index 49f9bd07fbf..aa10a69531a 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,13 +48,13 @@ private: bool _is_working; // True if participating in GC tasks - public: // Factory create and destroy methods. static GCTaskThread* create(GCTaskManager* manager, uint which, uint processor_id) { return new GCTaskThread(manager, which, processor_id); } + public: static void destroy(GCTaskThread* manager) { if (manager != NULL) { delete manager; @@ -65,8 +65,6 @@ private: return true; } virtual void run(); - // Methods. - void start(); void print_task_time_stamps(); diff --git a/hotspot/src/share/vm/gc/parallel/generationSizer.hpp b/hotspot/src/share/vm/gc/parallel/generationSizer.hpp index 539629b1c96..558476049b7 100644 --- a/hotspot/src/share/vm/gc/parallel/generationSizer.hpp +++ b/hotspot/src/share/vm/gc/parallel/generationSizer.hpp @@ -41,5 +41,11 @@ class GenerationSizer : public GenCollectorPolicy { void initialize_alignments(); void initialize_flags(); void initialize_size_info(); + + public: + // We don't have associated counters and complain if this is invoked. + void initialize_gc_policy_counters() { + ShouldNotReachHere(); + } }; #endif // SHARE_VM_GC_PARALLEL_GENERATIONSIZER_HPP diff --git a/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp b/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp index 76241d92692..39b63acb016 100644 --- a/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp +++ b/hotspot/src/share/vm/gc/parallel/parMarkBitMap.cpp @@ -59,10 +59,8 @@ ParMarkBitMap::initialize(MemRegion covered_region) _region_start = covered_region.start(); _region_size = covered_region.word_size(); BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr(); - _beg_bits.set_map(map); - _beg_bits.set_size(bits / 2); - _end_bits.set_map(map + words / 2); - _end_bits.set_size(bits / 2); + _beg_bits = BitMapView(map, bits / 2); + _end_bits = BitMapView(map + words / 2, bits / 2); return true; } diff --git a/hotspot/src/share/vm/gc/parallel/parMarkBitMap.hpp b/hotspot/src/share/vm/gc/parallel/parMarkBitMap.hpp index 3f29f94fc97..9457d3e6e98 100644 --- a/hotspot/src/share/vm/gc/parallel/parMarkBitMap.hpp +++ b/hotspot/src/share/vm/gc/parallel/parMarkBitMap.hpp @@ -182,8 +182,8 @@ private: HeapWord* _region_start; size_t _region_size; - BitMap _beg_bits; - BitMap _end_bits; + BitMapView _beg_bits; + BitMapView _end_bits; PSVirtualSpace* _virtual_space; size_t _reserved_byte_size; }; diff --git a/hotspot/src/share/vm/gc/parallel/pcTasks.cpp b/hotspot/src/share/vm/gc/parallel/pcTasks.cpp index bc58a0dbaec..05efac3e3b7 100644 --- a/hotspot/src/share/vm/gc/parallel/pcTasks.cpp +++ b/hotspot/src/share/vm/gc/parallel/pcTasks.cpp @@ -58,19 +58,16 @@ void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) { ParCompactionManager::gc_thread_compaction_manager(which); ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm); - CLDToOopClosure mark_and_push_from_clds(&mark_and_push_closure, true); MarkingCodeBlobClosure mark_and_push_in_blobs(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations); if (_java_thread != NULL) _java_thread->oops_do( &mark_and_push_closure, - &mark_and_push_from_clds, &mark_and_push_in_blobs); if (_vm_thread != NULL) _vm_thread->oops_do( &mark_and_push_closure, - &mark_and_push_from_clds, &mark_and_push_in_blobs); // Do the real work @@ -99,8 +96,7 @@ void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) { { ResourceMark rm; MarkingCodeBlobClosure each_active_code_blob(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations); - CLDToOopClosure mark_and_push_from_cld(&mark_and_push_closure); - Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob); + Threads::oops_do(&mark_and_push_closure, &each_active_code_blob); } break; @@ -224,48 +220,28 @@ void StealMarkingTask::do_it(GCTaskManager* manager, uint which) { } // -// StealRegionCompactionTask +// CompactionWithStealingTask // -StealRegionCompactionTask::StealRegionCompactionTask(ParallelTaskTerminator* t): +CompactionWithStealingTask::CompactionWithStealingTask(ParallelTaskTerminator* t): _terminator(t) {} -void StealRegionCompactionTask::do_it(GCTaskManager* manager, uint which) { +void CompactionWithStealingTask::do_it(GCTaskManager* manager, uint which) { assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(which); - - // If not all threads are active, get a draining stack - // from the list. Else, just use this threads draining stack. - uint which_stack_index; - bool use_all_workers = manager->all_workers_active(); - if (use_all_workers) { - which_stack_index = which; - assert(manager->active_workers() == ParallelGCThreads, - "all_workers_active has been incorrectly set: " - " active %d ParallelGCThreads %u", manager->active_workers(), - ParallelGCThreads); - } else { - which_stack_index = ParCompactionManager::pop_recycled_stack_index(); - } - - cm->set_region_stack_index(which_stack_index); - cm->set_region_stack(ParCompactionManager::region_list(which_stack_index)); - - // Has to drain stacks first because there may be regions on - // preloaded onto the stack and this thread may never have - // done a draining task. Are the draining tasks needed? + // Drain the stacks that have been preloaded with regions + // that are ready to fill. cm->drain_region_stacks(); + guarantee(cm->region_stack()->is_empty(), "Not empty"); + size_t region_index = 0; int random_seed = 17; - // If we're the termination task, try 10 rounds of stealing before - // setting the termination flag - while(true) { if (ParCompactionManager::steal(which, &random_seed, region_index)) { PSParallelCompact::fill_and_update_region(cm, region_index); @@ -297,42 +273,3 @@ void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { _region_index_start, _region_index_end); } - -void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { - assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); - - ParCompactionManager* cm = - ParCompactionManager::gc_thread_compaction_manager(which); - - uint which_stack_index; - bool use_all_workers = manager->all_workers_active(); - if (use_all_workers) { - which_stack_index = which; - assert(manager->active_workers() == ParallelGCThreads, - "all_workers_active has been incorrectly set: " - " active %d ParallelGCThreads %u", manager->active_workers(), - ParallelGCThreads); - } else { - which_stack_index = stack_index(); - } - - cm->set_region_stack(ParCompactionManager::region_list(which_stack_index)); - - cm->set_region_stack_index(which_stack_index); - - // Process any regions already in the compaction managers stacks. - cm->drain_region_stacks(); - - assert(cm->region_stack()->is_empty(), "Not empty"); - - if (!use_all_workers) { - // Always give up the region stack. - assert(cm->region_stack() == - ParCompactionManager::region_list(cm->region_stack_index()), - "region_stack and region_stack_index are inconsistent"); - ParCompactionManager::push_recycled_stack_index(cm->region_stack_index()); - - cm->set_region_stack(NULL); - cm->set_region_stack_index((uint)max_uintx); - } -} diff --git a/hotspot/src/share/vm/gc/parallel/pcTasks.hpp b/hotspot/src/share/vm/gc/parallel/pcTasks.hpp index 40a2009a2c5..08bad720f3c 100644 --- a/hotspot/src/share/vm/gc/parallel/pcTasks.hpp +++ b/hotspot/src/share/vm/gc/parallel/pcTasks.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -195,16 +195,16 @@ class StealMarkingTask : public GCTask { }; // -// StealRegionCompactionTask +// CompactionWithStealingTask // // This task is used to distribute work to idle threads. // -class StealRegionCompactionTask : public GCTask { +class CompactionWithStealingTask : public GCTask { private: ParallelTaskTerminator* const _terminator; public: - StealRegionCompactionTask(ParallelTaskTerminator* t); + CompactionWithStealingTask(ParallelTaskTerminator* t); char* name() { return (char *)"steal-region-task"; } ParallelTaskTerminator* terminator() { return _terminator; } @@ -234,27 +234,4 @@ class UpdateDensePrefixTask : public GCTask { virtual void do_it(GCTaskManager* manager, uint which); }; - -// -// DrainStacksCompactionTask -// -// This task processes regions that have been added to the stacks of each -// compaction manager. -// -// Trying to use one draining thread does not work because there are no -// guarantees about which task will be picked up by which thread. For example, -// if thread A gets all the preloaded regions, thread A may not get a draining -// task (they may all be done by other threads). -// - -class DrainStacksCompactionTask : public GCTask { - uint _stack_index; - uint stack_index() { return _stack_index; } - public: - DrainStacksCompactionTask(uint stack_index) : GCTask(), - _stack_index(stack_index) {}; - char* name() { return (char *)"drain-region-task"; } - virtual void do_it(GCTaskManager* manager, uint which); -}; - #endif // SHARE_VM_GC_PARALLEL_PCTASKS_HPP diff --git a/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp b/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp index 433b4dc2a06..2884b4c7df6 100644 --- a/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp +++ b/hotspot/src/share/vm/gc/parallel/psCompactionManager.cpp @@ -43,8 +43,6 @@ PSOldGen* ParCompactionManager::_old_gen = NULL; ParCompactionManager** ParCompactionManager::_manager_array = NULL; -RegionTaskQueue** ParCompactionManager::_region_list = NULL; - OopTaskQueueSet* ParCompactionManager::_stack_array = NULL; ParCompactionManager::ObjArrayTaskQueueSet* ParCompactionManager::_objarray_queues = NULL; @@ -52,14 +50,8 @@ ObjectStartArray* ParCompactionManager::_start_array = NULL; ParMarkBitMap* ParCompactionManager::_mark_bitmap = NULL; RegionTaskQueueSet* ParCompactionManager::_region_array = NULL; -uint* ParCompactionManager::_recycled_stack_index = NULL; -int ParCompactionManager::_recycled_top = -1; -int ParCompactionManager::_recycled_bottom = -1; - ParCompactionManager::ParCompactionManager() : - _action(CopyAndUpdate), - _region_stack(NULL), - _region_stack_index((uint)max_uintx) { + _action(CopyAndUpdate) { ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); @@ -68,14 +60,11 @@ ParCompactionManager::ParCompactionManager() : marking_stack()->initialize(); _objarray_stack.initialize(); + _region_stack.initialize(); reset_bitmap_query_cache(); } -ParCompactionManager::~ParCompactionManager() { - delete _recycled_stack_index; -} - void ParCompactionManager::initialize(ParMarkBitMap* mbm) { assert(PSParallelCompact::gc_task_manager() != NULL, "Needed for initialization"); @@ -88,19 +77,6 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { _manager_array = NEW_C_HEAP_ARRAY(ParCompactionManager*, parallel_gc_threads+1, mtGC); guarantee(_manager_array != NULL, "Could not allocate manager_array"); - _region_list = NEW_C_HEAP_ARRAY(RegionTaskQueue*, - parallel_gc_threads+1, mtGC); - guarantee(_region_list != NULL, "Could not initialize promotion manager"); - - _recycled_stack_index = NEW_C_HEAP_ARRAY(uint, parallel_gc_threads, mtGC); - - // parallel_gc-threads + 1 to be consistent with the number of - // compaction managers. - for(uint i=0; iinitialize(); - } - _stack_array = new OopTaskQueueSet(parallel_gc_threads); guarantee(_stack_array != NULL, "Could not allocate stack_array"); _objarray_queues = new ObjArrayTaskQueueSet(parallel_gc_threads); @@ -114,7 +90,7 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { guarantee(_manager_array[i] != NULL, "Could not create ParCompactionManager"); stack_array()->register_queue(i, _manager_array[i]->marking_stack()); _objarray_queues->register_queue(i, &_manager_array[i]->_objarray_stack); - region_array()->register_queue(i, region_list(i)); + region_array()->register_queue(i, _manager_array[i]->region_stack()); } // The VMThread gets its own ParCompactionManager, which is not available @@ -133,29 +109,6 @@ void ParCompactionManager::reset_all_bitmap_query_caches() { } } -int ParCompactionManager::pop_recycled_stack_index() { - assert(_recycled_bottom <= _recycled_top, "list is empty"); - // Get the next available index - if (_recycled_bottom < _recycled_top) { - uint cur, next, last; - do { - cur = _recycled_bottom; - next = cur + 1; - last = Atomic::cmpxchg(next, &_recycled_bottom, cur); - } while (cur != last); - return _recycled_stack_index[next]; - } else { - return -1; - } -} - -void ParCompactionManager::push_recycled_stack_index(uint v) { - // Get the next available index - int cur = Atomic::add(1, &_recycled_top); - _recycled_stack_index[cur] = v; - assert(_recycled_bottom <= _recycled_top, "list top and bottom are wrong"); -} - bool ParCompactionManager::should_update() { assert(action() != NotValid, "Action is not set"); return (action() == ParCompactionManager::Update) || @@ -170,15 +123,6 @@ bool ParCompactionManager::should_copy() { (action() == ParCompactionManager::UpdateAndCopy); } -void ParCompactionManager::region_list_push(uint list_index, - size_t region_index) { - region_list(list_index)->push(region_index); -} - -void ParCompactionManager::verify_region_list_empty(uint list_index) { - assert(region_list(list_index)->is_empty(), "Not empty"); -} - ParCompactionManager* ParCompactionManager::gc_thread_compaction_manager(uint index) { assert(index < ParallelGCThreads, "index out of range"); diff --git a/hotspot/src/share/vm/gc/parallel/psCompactionManager.hpp b/hotspot/src/share/vm/gc/parallel/psCompactionManager.hpp index 9e35ff29d9e..9eb8bceff57 100644 --- a/hotspot/src/share/vm/gc/parallel/psCompactionManager.hpp +++ b/hotspot/src/share/vm/gc/parallel/psCompactionManager.hpp @@ -40,7 +40,7 @@ class ParCompactionManager : public CHeapObj { friend class ParallelTaskTerminator; friend class ParMarkBitMap; friend class PSParallelCompact; - friend class StealRegionCompactionTask; + friend class CompactionWithStealingTask; friend class UpdateAndFillClosure; friend class RefProcTaskExecutor; friend class IdleGCTask; @@ -79,31 +79,7 @@ private: // Is there a way to reuse the _marking_stack for the // saving empty regions? For now just create a different // type of TaskQueue. - RegionTaskQueue* _region_stack; - - static RegionTaskQueue** _region_list; - // Index in _region_list for current _region_stack. - uint _region_stack_index; - - // Indexes of recycled region stacks/overflow stacks - // Stacks of regions to be compacted are embedded in the tasks doing - // the compaction. A thread that executes the task extracts the - // region stack and drains it. These threads keep these region - // stacks for use during compaction task stealing. If a thread - // gets a second draining task, it pushed its current region stack - // index into the array _recycled_stack_index and gets a new - // region stack from the task. A thread that is executing a - // compaction stealing task without ever having executing a - // draining task, will get a region stack from _recycled_stack_index. - // - // Array of indexes into the array of region stacks. - static uint* _recycled_stack_index; - // The index into _recycled_stack_index of the last region stack index - // pushed. If -1, there are no entries into _recycled_stack_index. - static int _recycled_top; - // The index into _recycled_stack_index of the last region stack index - // popped. If -1, there has not been any entry popped. - static int _recycled_bottom; + RegionTaskQueue _region_stack; static ParMarkBitMap* _mark_bitmap; @@ -151,32 +127,15 @@ private: static void reset_all_bitmap_query_caches(); - RegionTaskQueue* region_stack() { return _region_stack; } - void set_region_stack(RegionTaskQueue* v) { _region_stack = v; } + RegionTaskQueue* region_stack() { return &_region_stack; } inline static ParCompactionManager* manager_array(uint index); - inline static RegionTaskQueue* region_list(int index) { - return _region_list[index]; - } - - uint region_stack_index() { return _region_stack_index; } - void set_region_stack_index(uint v) { _region_stack_index = v; } - - // Pop and push unique reusable stack index - static int pop_recycled_stack_index(); - static void push_recycled_stack_index(uint v); - static void reset_recycled_stack_index() { - _recycled_bottom = _recycled_top = -1; - } - ParCompactionManager(); - ~ParCompactionManager(); // Pushes onto the region stack at the given index. If the // region stack is full, // pushes onto the region overflow stack. - static void region_list_push(uint stack_index, size_t region_index); static void verify_region_list_empty(uint stack_index); ParMarkBitMap* mark_bitmap() { return _mark_bitmap; } diff --git a/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp b/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp index e2084e9c190..9fa97309099 100644 --- a/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp @@ -505,9 +505,8 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { ParallelScavengeHeap::ParStrongRootsScope psrs; Universe::oops_do(mark_and_push_closure()); JNIHandles::oops_do(mark_and_push_closure()); // Global (strong) JNI handles - CLDToOopClosure mark_and_push_from_cld(mark_and_push_closure()); MarkingCodeBlobClosure each_active_code_blob(mark_and_push_closure(), !CodeBlobToOopClosure::FixRelocations); - Threads::oops_do(mark_and_push_closure(), &mark_and_push_from_cld, &each_active_code_blob); + Threads::oops_do(mark_and_push_closure(), &each_active_code_blob); ObjectSynchronizer::oops_do(mark_and_push_closure()); FlatProfiler::oops_do(mark_and_push_closure()); Management::oops_do(mark_and_push_closure()); @@ -597,8 +596,7 @@ void PSMarkSweep::mark_sweep_phase3() { // General strong roots. Universe::oops_do(adjust_pointer_closure()); JNIHandles::oops_do(adjust_pointer_closure()); // Global (strong) JNI handles - CLDToOopClosure adjust_from_cld(adjust_pointer_closure()); - Threads::oops_do(adjust_pointer_closure(), &adjust_from_cld, NULL); + Threads::oops_do(adjust_pointer_closure(), NULL); ObjectSynchronizer::oops_do(adjust_pointer_closure()); FlatProfiler::oops_do(adjust_pointer_closure()); Management::oops_do(adjust_pointer_closure()); diff --git a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp index 6b145d17c00..d16e510a5f5 100644 --- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp @@ -249,7 +249,7 @@ print_generic_summary_data(ParallelCompactData& summary_data, const size_t last = summary_data.addr_to_region_idx(end_addr); HeapWord* pdest = 0; - while (i <= last) { + while (i < last) { ParallelCompactData::RegionData* c = summary_data.region(i); if (c->data_size() != 0 || c->destination() != pdest) { print_generic_summary_region(i, c); @@ -377,6 +377,26 @@ print_initial_summary_data(ParallelCompactData& summary_data, print_generic_summary_data(summary_data, space->bottom(), space->top()); } while (++id < PSParallelCompact::last_space_id); } + +void ParallelCompact_test() { + if (!UseParallelOldGC) { + return; + } + // Check that print_generic_summary_data() does not print the + // end region by placing a bad value in the destination of the + // end region. The end region should not be printed because it + // corresponds to the space after the end of the heap. + ParallelScavengeHeap* heap = ParallelScavengeHeap::heap(); + ParCompactionManager* const vmthread_cm = + ParCompactionManager::manager_array(ParallelGCThreads); + HeapWord* begin_heap = + (HeapWord*) heap->old_gen()->virtual_space()->low_boundary(); + HeapWord* end_heap = + (HeapWord*) heap->young_gen()->virtual_space()->high_boundary(); + + print_generic_summary_data(PSParallelCompact::summary_data(), + begin_heap, end_heap); +} #endif // #ifndef PRODUCT #ifdef ASSERT @@ -1902,7 +1922,7 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { ParCompactionManager* const cm = ParCompactionManager::manager_array(int(i)); assert(cm->marking_stack()->is_empty(), "should be empty"); - assert(ParCompactionManager::region_list(int(i))->is_empty(), "should be empty"); + assert(cm->region_stack()->is_empty(), "Region stack " SIZE_FORMAT " is not empty", i); } #endif // ASSERT @@ -2148,8 +2168,7 @@ void PSParallelCompact::adjust_roots(ParCompactionManager* cm) { // General strong roots. Universe::oops_do(&oop_closure); JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles - CLDToOopClosure adjust_from_cld(&oop_closure); - Threads::oops_do(&oop_closure, &adjust_from_cld, NULL); + Threads::oops_do(&oop_closure, NULL); ObjectSynchronizer::oops_do(&oop_closure); FlatProfiler::oops_do(&oop_closure); Management::oops_do(&oop_closure); @@ -2212,7 +2231,7 @@ public: } }; -void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, +void PSParallelCompact::prepare_region_draining_tasks(GCTaskQueue* q, uint parallel_gc_threads) { GCTraceTime(Trace, gc, phases) tm("Drain Task Setup", &_gc_timer); @@ -2220,29 +2239,12 @@ void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, // Find the threads that are active unsigned int which = 0; - const uint task_count = MAX2(parallel_gc_threads, 1U); - for (uint j = 0; j < task_count; j++) { - q->enqueue(new DrainStacksCompactionTask(j)); - ParCompactionManager::verify_region_list_empty(j); - // Set the region stacks variables to "no" region stack values - // so that they will be recognized and needing a region stack - // in the stealing tasks if they do not get one by executing - // a draining stack. - ParCompactionManager* cm = ParCompactionManager::manager_array(j); - cm->set_region_stack(NULL); - cm->set_region_stack_index((uint)max_uintx); - } - ParCompactionManager::reset_recycled_stack_index(); - // Find all regions that are available (can be filled immediately) and // distribute them to the thread stacks. The iteration is done in reverse // order (high to low) so the regions will be removed in ascending order. const ParallelCompactData& sd = PSParallelCompact::summary_data(); - // A region index which corresponds to the tasks created above. - // "which" must be 0 <= which < task_count - which = 0; // id + 1 is used to test termination so unsigned can // be used with an old_space_id == 0. @@ -2258,12 +2260,11 @@ void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, for (size_t cur = end_region - 1; cur + 1 > beg_region; --cur) { if (sd.region(cur)->claim_unsafe()) { - ParCompactionManager::region_list_push(which, cur); + ParCompactionManager* cm = ParCompactionManager::manager_array(which); + cm->region_stack()->push(cur); region_logger.handle(cur); // Assign regions to tasks in round-robin fashion. - if (++which == task_count) { - assert(which <= parallel_gc_threads, - "Inconsistent number of workers"); + if (++which == parallel_gc_threads) { which = 0; } } @@ -2362,10 +2363,8 @@ void PSParallelCompact::enqueue_region_stealing_tasks( // Once a thread has drained it's stack, it should try to steal regions from // other threads. - if (parallel_gc_threads > 1) { - for (uint j = 0; j < parallel_gc_threads; j++) { - q->enqueue(new StealRegionCompactionTask(terminator_ptr)); - } + for (uint j = 0; j < parallel_gc_threads; j++) { + q->enqueue(new CompactionWithStealingTask(terminator_ptr)); } } @@ -2422,7 +2421,7 @@ void PSParallelCompact::compact() { ParallelTaskTerminator terminator(active_gc_threads, qset); GCTaskQueue* q = GCTaskQueue::create(); - enqueue_region_draining_tasks(q, active_gc_threads); + prepare_region_draining_tasks(q, active_gc_threads); enqueue_dense_prefix_tasks(q, active_gc_threads); enqueue_region_stealing_tasks(q, &terminator, active_gc_threads); diff --git a/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp b/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp index ce0beda2ba8..50b7bfb23f5 100644 --- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.hpp @@ -631,8 +631,8 @@ ParallelCompactData::region_offset(const HeapWord* addr) const inline size_t ParallelCompactData::addr_to_region_idx(const HeapWord* addr) const { - assert(addr >= _region_start, "bad addr"); - assert(addr <= _region_end, "bad addr"); + assert(addr >= _region_start, "bad addr " PTR_FORMAT " _region_start " PTR_FORMAT, p2i(addr), p2i(_region_start)); + assert(addr <= _region_end, "bad addr " PTR_FORMAT " _region_end " PTR_FORMAT, p2i(addr), p2i(_region_end)); return pointer_delta(addr, _region_start) >> Log2RegionSize; } @@ -1079,7 +1079,7 @@ class PSParallelCompact : AllStatic { static void compact(); // Add available regions to the stack and draining tasks to the task queue. - static void enqueue_region_draining_tasks(GCTaskQueue* q, + static void prepare_region_draining_tasks(GCTaskQueue* q, uint parallel_gc_threads); // Add dense prefix update tasks to the task queue. diff --git a/hotspot/src/share/vm/gc/parallel/psPromotionManager.cpp b/hotspot/src/share/vm/gc/parallel/psPromotionManager.cpp index a5bf57903d4..bdd965bd5b6 100644 --- a/hotspot/src/share/vm/gc/parallel/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc/parallel/psPromotionManager.cpp @@ -237,6 +237,10 @@ void PSPromotionManager::register_preserved_marks(PreservedMarks* preserved_mark _preserved_marks = preserved_marks; } +void PSPromotionManager::restore_preserved_marks() { + _preserved_marks_set->restore(PSScavenge::gc_task_manager()); +} + void PSPromotionManager::drain_stacks_depth(bool totally_drain) { totally_drain = totally_drain || _totally_drain; diff --git a/hotspot/src/share/vm/gc/parallel/psPromotionManager.hpp b/hotspot/src/share/vm/gc/parallel/psPromotionManager.hpp index 32159e6a48c..0946f10d664 100644 --- a/hotspot/src/share/vm/gc/parallel/psPromotionManager.hpp +++ b/hotspot/src/share/vm/gc/parallel/psPromotionManager.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -180,7 +180,7 @@ class PSPromotionManager VALUE_OBJ_CLASS_SPEC { void reset(); void register_preserved_marks(PreservedMarks* preserved_marks); - static void restore_preserved_marks() { _preserved_marks_set->restore(); } + static void restore_preserved_marks(); void flush_labs(); void drain_stacks(bool totally_drain) { diff --git a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp index b027d68fa70..82caad39008 100644 --- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp +++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp @@ -443,7 +443,7 @@ bool PSScavenge::invoke_no_policy() { promotion_failure_occurred = PSPromotionManager::post_scavenge(_gc_tracer); if (promotion_failure_occurred) { clean_up_failed_promotion(); - log_info(gc)("Promotion failed"); + log_info(gc, promotion)("Promotion failed"); } _gc_tracer.report_tenuring_threshold(tenuring_threshold()); diff --git a/hotspot/src/share/vm/gc/parallel/psScavenge.inline.hpp b/hotspot/src/share/vm/gc/parallel/psScavenge.inline.hpp index f7e98688277..a944277d00f 100644 --- a/hotspot/src/share/vm/gc/parallel/psScavenge.inline.hpp +++ b/hotspot/src/share/vm/gc/parallel/psScavenge.inline.hpp @@ -140,12 +140,6 @@ class PSScavengeKlassClosure: public KlassClosure { // If the klass has not been dirtied we know that there's // no references into the young gen and we can skip it. - NOT_PRODUCT(ResourceMark rm); - log_develop_trace(gc, scavenge)("PSScavengeKlassClosure::do_klass " PTR_FORMAT ", %s, dirty: %s", - p2i(klass), - klass->external_name(), - klass->has_modified_oops() ? "true" : "false"); - if (klass->has_modified_oops()) { // Clean the klass since we're going to scavenge all the metadata. klass->clear_modified_oops(); diff --git a/hotspot/src/share/vm/gc/parallel/psTasks.cpp b/hotspot/src/share/vm/gc/parallel/psTasks.cpp index 4f372f9f0b0..9e95868b507 100644 --- a/hotspot/src/share/vm/gc/parallel/psTasks.cpp +++ b/hotspot/src/share/vm/gc/parallel/psTasks.cpp @@ -65,8 +65,7 @@ void ScavengeRootsTask::do_it(GCTaskManager* manager, uint which) { case threads: { ResourceMark rm; - CLDClosure* cld_closure = NULL; // Not needed. All CLDs are already visited. - Threads::oops_do(&roots_closure, cld_closure, NULL); + Threads::oops_do(&roots_closure, NULL); } break; @@ -122,14 +121,13 @@ void ThreadRootsTask::do_it(GCTaskManager* manager, uint which) { PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which); PSScavengeRootsClosure roots_closure(pm); - CLDClosure* roots_from_clds = NULL; // Not needed. All CLDs are already visited. MarkingCodeBlobClosure roots_in_blobs(&roots_closure, CodeBlobToOopClosure::FixRelocations); if (_java_thread != NULL) - _java_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs); + _java_thread->oops_do(&roots_closure, &roots_in_blobs); if (_vm_thread != NULL) - _vm_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs); + _vm_thread->oops_do(&roots_closure, &roots_in_blobs); // Do the real work pm->drain_stacks(false); diff --git a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp index 247c7e3e49a..c8d3e0f3894 100644 --- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp +++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp @@ -564,7 +564,7 @@ HeapWord* DefNewGeneration::expand_and_allocate(size_t size, void DefNewGeneration::adjust_desired_tenuring_threshold() { // Set the desired survivor size to half the real survivor space - GCPolicyCounters* gc_counters = GenCollectedHeap::heap()->collector_policy()->counters(); + GCPolicyCounters* gc_counters = GenCollectedHeap::heap()->gen_policy()->counters(); _tenuring_threshold = age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize, gc_counters); } @@ -945,7 +945,7 @@ void DefNewGeneration::gc_epilogue(bool full) { // update the generation and space performance counters update_counters(); - gch->collector_policy()->counters()->update_counters(); + gch->gen_policy()->counters()->update_counters(); } void DefNewGeneration::record_spaces_top() { diff --git a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp index 8365c62766f..9aa3f79c08d 100644 --- a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp +++ b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -130,10 +130,7 @@ uint AdaptiveSizePolicy::calc_default_active_workers(uintx total_workers, uintx max_active_workers = MAX2(active_workers_by_JT, active_workers_by_heap_size); - // Limit the number of workers to the the number created, - // (workers()). - new_active_workers = MIN2(max_active_workers, - (uintx) total_workers); + new_active_workers = MIN2(max_active_workers, (uintx) total_workers); // Increase GC workers instantly but decrease them more // slowly. @@ -167,7 +164,7 @@ uint AdaptiveSizePolicy::calc_default_active_workers(uintx total_workers, "Jiggled active workers too much"); } - log_trace(gc, task)("GCTaskManager::calc_default_active_workers() : " + log_trace(gc, task)("GCTaskManager::calc_default_active_workers() : " "active_workers(): " UINTX_FORMAT " new_active_workers: " UINTX_FORMAT " " "prev_active_workers: " UINTX_FORMAT "\n" " active_workers_by_JT: " UINTX_FORMAT " active_workers_by_heap_size: " UINTX_FORMAT, diff --git a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp index eb483623d20..27bc4f307a0 100644 --- a/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp +++ b/hotspot/src/share/vm/gc/shared/adaptiveSizePolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 diff --git a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp index cfd55ad3dc7..e40326066fe 100644 --- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp +++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp @@ -510,10 +510,6 @@ void CollectedHeap::fill_with_objects(HeapWord* start, size_t words, bool zap) fill_with_object_impl(start, words, zap); } -void CollectedHeap::post_initialize() { - collector_policy()->post_heap_initialize(); -} - HeapWord* CollectedHeap::allocate_new_tlab(size_t size) { guarantee(false, "thread-local allocation buffers not supported"); return NULL; diff --git a/hotspot/src/share/vm/gc/shared/collectedHeap.hpp b/hotspot/src/share/vm/gc/shared/collectedHeap.hpp index 4c0e8d9cb1b..2b2fe90598d 100644 --- a/hotspot/src/share/vm/gc/shared/collectedHeap.hpp +++ b/hotspot/src/share/vm/gc/shared/collectedHeap.hpp @@ -209,7 +209,7 @@ class CollectedHeap : public CHeapObj { // In many heaps, there will be a need to perform some initialization activities // after the Universe is fully formed, but before general heap allocation is allowed. // This is the correct place to place such initialization methods. - virtual void post_initialize(); + virtual void post_initialize() = 0; // Stop any onging concurrent work and prepare for exit. virtual void stop() {} diff --git a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp index 82ac817d70b..8c9b65e4848 100644 --- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp +++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp @@ -58,8 +58,6 @@ class MarkSweepPolicy; class CollectorPolicy : public CHeapObj { protected: - GCPolicyCounters* _gc_policy_counters; - virtual void initialize_alignments() = 0; virtual void initialize_flags(); virtual void initialize_size_info(); @@ -129,17 +127,14 @@ class CollectorPolicy : public CHeapObj { virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; } #if INCLUDE_ALL_GCS virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; } - virtual G1CollectorPolicy* as_g1_policy() { return NULL; } #endif // INCLUDE_ALL_GCS // Note that these are not virtual. bool is_generation_policy() { return as_generation_policy() != NULL; } bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; } #if INCLUDE_ALL_GCS bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; } - bool is_g1_policy() { return as_g1_policy() != NULL; } #else // INCLUDE_ALL_GCS bool is_concurrent_mark_sweep_policy() { return false; } - bool is_g1_policy() { return false; } #endif // INCLUDE_ALL_GCS @@ -148,19 +143,6 @@ class CollectorPolicy : public CHeapObj { MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, size_t size, Metaspace::MetadataType mdtype); - - // Performance Counter support - GCPolicyCounters* counters() { return _gc_policy_counters; } - - // Create the jstat counters for the GC policy. By default, policy's - // don't have associated counters, and we complain if this is invoked. - virtual void initialize_gc_policy_counters() { - ShouldNotReachHere(); - } - - // Do any updates required to global flags that are due to heap initialization - // changes - virtual void post_heap_initialize() = 0; }; class ClearedAllSoftRefs : public StackObj { @@ -197,6 +179,8 @@ class GenCollectorPolicy : public CollectorPolicy { GenerationSpec* _young_gen_spec; GenerationSpec* _old_gen_spec; + GCPolicyCounters* _gc_policy_counters; + // Return true if an allocation should be attempted in the older generation // if it fails in the younger generation. Return false, otherwise. virtual bool should_try_older_generation_allocation(size_t word_size) const; @@ -243,6 +227,12 @@ class GenCollectorPolicy : public CollectorPolicy { return _old_gen_spec; } + // Performance Counter support + GCPolicyCounters* counters() { return _gc_policy_counters; } + + // Create the jstat counters for the GC policy. + virtual void initialize_gc_policy_counters() = 0; + virtual GenCollectorPolicy* as_generation_policy() { return this; } virtual void initialize_generations() { }; @@ -266,10 +256,6 @@ class GenCollectorPolicy : public CollectorPolicy { virtual void initialize_size_policy(size_t init_eden_size, size_t init_promo_size, size_t init_survivor_size); - - virtual void post_heap_initialize() { - assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info"); - } }; class MarkSweepPolicy : public GenCollectorPolicy { diff --git a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp index c60e3a02092..049b675bd51 100644 --- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp @@ -179,7 +179,6 @@ char* GenCollectedHeap::allocate(size_t alignment, } void GenCollectedHeap::post_initialize() { - CollectedHeap::post_initialize(); ref_processing_init(); assert((_young_gen->kind() == Generation::DefNew) || (_young_gen->kind() == Generation::ParNew), @@ -583,14 +582,11 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope, ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure); } - // Some CLDs contained in the thread frames should be considered strong. - // Don't process them if they will be processed during the ClassLoaderDataGraph phase. - CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL; // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots; bool is_par = scope->n_threads() > 1; - Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_clds_p, roots_from_code_p); + Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_code_p); if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) { Universe::oops_do(strong_roots); diff --git a/hotspot/src/share/vm/gc/shared/preservedMarks.cpp b/hotspot/src/share/vm/gc/shared/preservedMarks.cpp index 96d124e2259..9312c198483 100644 --- a/hotspot/src/share/vm/gc/shared/preservedMarks.cpp +++ b/hotspot/src/share/vm/gc/shared/preservedMarks.cpp @@ -26,6 +26,11 @@ #include "gc/shared/preservedMarks.inline.hpp" #include "gc/shared/workgroup.hpp" #include "memory/allocation.inline.hpp" +#include "memory/resourceArea.hpp" +#include "utilities/macros.hpp" +#if INCLUDE_ALL_GCS +#include "gc/parallel/gcTaskManager.hpp" +#endif void PreservedMarks::restore() { while (!_stack.is_empty()) { @@ -106,10 +111,46 @@ void PreservedMarksSet::restore_internal(WorkGang* workers, workers->run_task(&task); } -// temporary, used by PS -void PreservedMarksSet::restore() { - restore(NULL); +#if INCLUDE_ALL_GCS +class ParRestoreGCTask : public GCTask { +private: + const uint _id; + PreservedMarksSet* const _preserved_marks_set; + volatile size_t* const _total_size_addr; + +public: + virtual char* name() { return (char*) "preserved mark restoration task"; } + + virtual void do_it(GCTaskManager* manager, uint which) { + PreservedMarks* const preserved_marks = _preserved_marks_set->get(_id); + const size_t size = preserved_marks->size(); + preserved_marks->restore(); + // Only do the atomic add if the size is > 0. + if (size > 0) { + Atomic::add(size, _total_size_addr); + } + } + + ParRestoreGCTask(uint id, + PreservedMarksSet* preserved_marks_set, + volatile size_t* total_size_addr) + : _id(id), + _preserved_marks_set(preserved_marks_set), + _total_size_addr(total_size_addr) { } +}; + +void PreservedMarksSet::restore_internal(GCTaskManager* gc_task_manager, + volatile size_t* total_size_addr) { + // GCTask / GCTaskQueue are ResourceObjs + ResourceMark rm; + + GCTaskQueue* q = GCTaskQueue::create(); + for (uint i = 0; i < num(); i += 1) { + q->enqueue(new ParRestoreGCTask(i, this, total_size_addr)); + } + gc_task_manager->execute_and_wait(q); } +#endif void PreservedMarksSet::reclaim() { assert_empty(); diff --git a/hotspot/src/share/vm/gc/shared/preservedMarks.hpp b/hotspot/src/share/vm/gc/shared/preservedMarks.hpp index 6ab52ba0fb4..3c8ebd87cab 100644 --- a/hotspot/src/share/vm/gc/shared/preservedMarks.hpp +++ b/hotspot/src/share/vm/gc/shared/preservedMarks.hpp @@ -30,24 +30,25 @@ #include "oops/oop.hpp" #include "utilities/stack.hpp" -class OopAndMarkOop { -private: - oop _o; - markOop _m; - -public: - OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) { } - - void set_mark() const { - _o->set_mark(_m); - } -}; -typedef Stack OopAndMarkOopStack; - +class GCTaskManager; class WorkGang; class PreservedMarks VALUE_OBJ_CLASS_SPEC { private: + class OopAndMarkOop { + private: + oop _o; + markOop _m; + + public: + OopAndMarkOop(oop obj, markOop m) : _o(obj), _m(m) { } + + void set_mark() const { + _o->set_mark(_m); + } + }; + typedef Stack OopAndMarkOopStack; + OopAndMarkOopStack _stack; inline bool should_preserve_mark(oop obj, markOop m) const; @@ -93,6 +94,10 @@ private: // Internal version of restore() that uses a WorkGang for parallelism. void restore_internal(WorkGang* workers, volatile size_t* total_size_addr); + // Internal version of restore() that uses a GCTaskManager for parallelism. + void restore_internal(GCTaskManager* gc_task_manager, + volatile size_t* total_size_addr); + public: uint num() const { return _num; } @@ -110,14 +115,11 @@ public: // the memory taken up by the stack segments. If the executor is // NULL, restoration will be done serially. If the executor is not // NULL, restoration could be done in parallel (when it makes - // sense). Supported executors: WorkGang (Serial, CMS, G1) + // sense). Supported executors: WorkGang (Serial, CMS, G1), + // GCTaskManager (PS). template inline void restore(E* executor); - // Do the restoration serially. Temporary, to be used by PS until we - // can support GCTaskManager in restore(E*). - void restore(); - // Reclaim stack array. void reclaim(); diff --git a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp index 0c975d1e269..a9fb53f48bb 100644 --- a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp +++ b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.cpp @@ -36,6 +36,7 @@ // static member initialization size_t ThreadLocalAllocBuffer::_max_size = 0; +int ThreadLocalAllocBuffer::_reserve_for_allocation_prefetch = 0; unsigned ThreadLocalAllocBuffer::_target_refills = 0; GlobalTLABStats* ThreadLocalAllocBuffer::_global_stats = NULL; @@ -215,6 +216,23 @@ void ThreadLocalAllocBuffer::startup_initialization() { _global_stats = new GlobalTLABStats(); + // Need extra space at the end of TLAB, otherwise prefetching + // instructions will fault (due to accessing memory outside of heap). + // The amount of space is the max of the number of lines to + // prefetch for array and for instance allocations. (Extra space must be + // reserved to accommodate both types of allocations.) + // + // Only SPARC-specific BIS instructions are known to fault. (Those + // instructions are generated if AllocatePrefetchStyle==3 and + // AllocatePrefetchInstr==1). To be on the safe side, however, + // extra space is reserved for all combinations of + // AllocatePrefetchStyle and AllocatePrefetchInstr. + + // +1 for rounding up to next cache line, +1 to be safe + int lines = MAX2(AllocatePrefetchLines, AllocateInstancePrefetchLines) + 2; + _reserve_for_allocation_prefetch = (AllocatePrefetchDistance + AllocatePrefetchStepSize * lines) / + (int)HeapWordSize; + // During jvm startup, the main (primordial) thread is initialized // before the heap is initialized. So reinitialize it now. guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread"); diff --git a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp index 2af19576191..6a5ab498bf6 100644 --- a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp +++ b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp @@ -49,8 +49,9 @@ private: size_t _refill_waste_limit; // hold onto tlab if free() is larger than this size_t _allocated_before_last_gc; // total bytes allocated up until the last gc - static size_t _max_size; // maximum size of any TLAB - static unsigned _target_refills; // expected number of refills between GCs + static size_t _max_size; // maximum size of any TLAB + static int _reserve_for_allocation_prefetch; // Reserve at the end of the TLAB + static unsigned _target_refills; // expected number of refills between GCs unsigned _number_of_refills; unsigned _fast_refill_waste; @@ -129,7 +130,7 @@ public: // Reserve space at the end of TLAB static size_t end_reserve() { int reserve_size = typeArrayOopDesc::header_size(T_INT); - return MAX2(reserve_size, VM_Version::reserve_for_allocation_prefetch()); + return MAX2(reserve_size, _reserve_for_allocation_prefetch); } static size_t alignment_reserve() { return align_object_size(end_reserve()); } static size_t alignment_reserve_in_bytes() { return alignment_reserve() * HeapWordSize; } diff --git a/hotspot/src/share/vm/gc/shared/vmGCOperations.cpp b/hotspot/src/share/vm/gc/shared/vmGCOperations.cpp index 004a5f4f285..9ac7d42e0a0 100644 --- a/hotspot/src/share/vm/gc/shared/vmGCOperations.cpp +++ b/hotspot/src/share/vm/gc/shared/vmGCOperations.cpp @@ -40,6 +40,7 @@ #include "utilities/preserveException.hpp" #if INCLUDE_ALL_GCS #include "gc/g1/g1CollectedHeap.inline.hpp" +#include "gc/g1/g1Policy.hpp" #endif // INCLUDE_ALL_GCS VM_GC_Operation::~VM_GC_Operation() { diff --git a/hotspot/src/share/vm/gc/shared/workerManager.hpp b/hotspot/src/share/vm/gc/shared/workerManager.hpp new file mode 100644 index 00000000000..9dfa7d745bc --- /dev/null +++ b/hotspot/src/share/vm/gc/shared/workerManager.hpp @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_VM_GC_SHARED_WORKERMANAGER_HPP +#define SHARE_VM_GC_SHARED_WORKERMANAGER_HPP + +#include "gc/shared/adaptiveSizePolicy.hpp" + +class WorkerManager : public AllStatic { + public: + // Create additional workers as needed. + // active_workers - number of workers being requested for an upcoming + // parallel task. + // total_workers - total number of workers. This is the maximum + // number possible. + // created_workers - number of workers already created. This maybe + // less than, equal to, or greater than active workers. If greater than + // or equal to active_workers, nothing is done. + // worker_type - type of thread. + // initializing - true if this is called to get the initial number of + // GC workers. + // If initializing is true, do a vm exit if the workers cannot be created. + // The initializing = true case is for JVM start up and failing to + // create all the worker at start should considered a problem so exit. + // If initializing = false, there are already some number of worker + // threads and a failure would not be optimal but should not be fatal. + template + static uint add_workers (WorkerType* holder, + uint active_workers, + uint total_workers, + uint created_workers, + os::ThreadType worker_type, + bool initializing) { + uint start = created_workers; + uint end = MIN2(active_workers, total_workers); + for (uint worker_id = start; worker_id < end; worker_id += 1) { + WorkerThread* new_worker = holder->install_worker(worker_id); + assert(new_worker != NULL, "Failed to allocate GangWorker"); + if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) { + if(initializing) { + vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, + "Cannot create worker GC thread. Out of system resources."); + } + } + created_workers++; + os::start_thread(new_worker); + } + + log_trace(gc, task)("AdaptiveSizePolicy::add_workers() : " + "active_workers: %u created_workers: %u", + active_workers, created_workers); + + return created_workers; + } +}; +#endif // SHARE_VM_GC_SHARED_WORKERMANAGER_HPP diff --git a/hotspot/src/share/vm/gc/shared/workgroup.cpp b/hotspot/src/share/vm/gc/shared/workgroup.cpp index a8da10db4cc..0dfffcd82e8 100644 --- a/hotspot/src/share/vm/gc/shared/workgroup.cpp +++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "gc/shared/gcId.hpp" #include "gc/shared/workgroup.hpp" +#include "gc/shared/workerManager.hpp" #include "memory/allocation.hpp" #include "memory/allocation.inline.hpp" #include "runtime/atomic.inline.hpp" @@ -35,37 +36,45 @@ // Definitions of WorkGang methods. // The current implementation will exit if the allocation -// of any worker fails. Still, return a boolean so that -// a future implementation can possibly do a partial -// initialization of the workers and report such to the -// caller. -bool AbstractWorkGang::initialize_workers() { +// of any worker fails. +void AbstractWorkGang::initialize_workers() { log_develop_trace(gc, workgang)("Constructing work gang %s with %u threads", name(), total_workers()); _workers = NEW_C_HEAP_ARRAY(AbstractGangWorker*, total_workers(), mtInternal); if (_workers == NULL) { vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array."); - return false; } + + _active_workers = ParallelGCThreads; + if (UseDynamicNumberOfGCThreads && !FLAG_IS_CMDLINE(ParallelGCThreads)) { + _active_workers = 1U; + } + + add_workers(true); +} + + +AbstractGangWorker* AbstractWorkGang::install_worker(uint worker_id) { + AbstractGangWorker* new_worker = allocate_worker(worker_id); + set_thread(worker_id, new_worker); + return new_worker; +} + +void AbstractWorkGang::add_workers(bool initializing) { + os::ThreadType worker_type; if (are_ConcurrentGC_threads()) { worker_type = os::cgc_thread; } else { worker_type = os::pgc_thread; } - for (uint worker = 0; worker < total_workers(); worker += 1) { - AbstractGangWorker* new_worker = allocate_worker(worker); - assert(new_worker != NULL, "Failed to allocate GangWorker"); - _workers[worker] = new_worker; - if (new_worker == NULL || !os::create_thread(new_worker, worker_type)) { - vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, - "Cannot create worker GC thread. Out of system resources."); - return false; - } - if (!DisableStartThread) { - os::start_thread(new_worker); - } - } - return true; + + _created_workers = WorkerManager::add_workers(this, + _active_workers, + _total_workers, + _created_workers, + worker_type, + initializing); + _active_workers = MIN2(_created_workers, _active_workers); } AbstractGangWorker* AbstractWorkGang::worker(uint i) const { @@ -79,7 +88,7 @@ AbstractGangWorker* AbstractWorkGang::worker(uint i) const { } void AbstractWorkGang::print_worker_threads_on(outputStream* st) const { - uint workers = total_workers(); + uint workers = created_workers(); for (uint i = 0; i < workers; i++) { worker(i)->print_on(st); st->cr(); @@ -88,7 +97,7 @@ void AbstractWorkGang::print_worker_threads_on(outputStream* st) const { void AbstractWorkGang::threads_do(ThreadClosure* tc) const { assert(tc != NULL, "Null ThreadClosure"); - uint workers = total_workers(); + uint workers = created_workers(); for (uint i = 0; i < workers; i++) { tc->do_thread(worker(i)); } @@ -255,7 +264,15 @@ AbstractGangWorker* WorkGang::allocate_worker(uint worker_id) { } void WorkGang::run_task(AbstractGangTask* task) { - _dispatcher->coordinator_execute_on_workers(task, active_workers()); + run_task(task, active_workers()); +} + +void WorkGang::run_task(AbstractGangTask* task, uint num_workers) { + guarantee(num_workers <= active_workers(), + "Trying to execute task %s with %u workers which is more than the amount of active workers %u.", + task->name(), num_workers, active_workers()); + guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name()); + _dispatcher->coordinator_execute_on_workers(task, num_workers); } AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) { diff --git a/hotspot/src/share/vm/gc/shared/workgroup.hpp b/hotspot/src/share/vm/gc/shared/workgroup.hpp index ee6b7be4c14..388909168be 100644 --- a/hotspot/src/share/vm/gc/shared/workgroup.hpp +++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp @@ -112,6 +112,8 @@ class AbstractWorkGang : public CHeapObj { uint _total_workers; // The currently active workers in this gang. uint _active_workers; + // The count of created workers in the gang. + uint _created_workers; // Printing support. const char* _name; @@ -120,23 +122,32 @@ class AbstractWorkGang : public CHeapObj { const bool _are_GC_task_threads; const bool _are_ConcurrentGC_threads; + void set_thread(uint worker_id, AbstractGangWorker* worker) { + _workers[worker_id] = worker; + } + public: AbstractWorkGang(const char* name, uint workers, bool are_GC_task_threads, bool are_ConcurrentGC_threads) : _name(name), _total_workers(workers), _active_workers(UseDynamicNumberOfGCThreads ? 1U : workers), + _created_workers(0), _are_GC_task_threads(are_GC_task_threads), _are_ConcurrentGC_threads(are_ConcurrentGC_threads) { } // Initialize workers in the gang. Return true if initialization succeeded. - bool initialize_workers(); + void initialize_workers(); bool are_GC_task_threads() const { return _are_GC_task_threads; } bool are_ConcurrentGC_threads() const { return _are_ConcurrentGC_threads; } uint total_workers() const { return _total_workers; } + uint created_workers() const { + return _created_workers; + } + virtual uint active_workers() const { assert(_active_workers <= _total_workers, "_active_workers: %u > _total_workers: %u", _active_workers, _total_workers); @@ -144,22 +155,29 @@ class AbstractWorkGang : public CHeapObj { "Unless dynamic should use total workers"); return _active_workers; } + void set_active_workers(uint v) { assert(v <= _total_workers, "Trying to set more workers active than there are"); _active_workers = MIN2(v, _total_workers); + add_workers(false /* exit_on_failure */); assert(v != 0, "Trying to set active workers to 0"); - _active_workers = MAX2(1U, _active_workers); assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers, "Unless dynamic should use total workers"); log_info(gc, task)("GC Workers: using %d out of %d", _active_workers, _total_workers); } + // Add GC workers as needed. + void add_workers(bool initializing); + // Return the Ith worker. AbstractGangWorker* worker(uint i) const; void threads_do(ThreadClosure* tc) const; + // Create a GC worker and install it into the work gang. + virtual AbstractGangWorker* install_worker(uint which); + // Debugging. const char* name() const { return _name; } @@ -192,8 +210,12 @@ public: bool are_GC_task_threads, bool are_ConcurrentGC_threads); - // Run a task, returns when the task is done. + // Run a task using the current active number of workers, returns when the task is done. virtual void run_task(AbstractGangTask* task); + // Run a task with the given number of workers, returns + // when the task is done. The number of workers must be at most the number of + // active workers. + void run_task(AbstractGangTask* task, uint num_workers); protected: virtual AbstractGangWorker* allocate_worker(uint which); diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp index 2b42fab10b9..179940d7e22 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp @@ -578,8 +578,9 @@ BytecodeInterpreter::run(interpreterState istate) { /* 0xDC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, /* 0xE0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, -/* 0xE4 */ &&opc_default, &&opc_fast_aldc, &&opc_fast_aldc_w, &&opc_return_register_finalizer, -/* 0xE8 */ &&opc_invokehandle,&&opc_default, &&opc_default, &&opc_default, +/* 0xE4 */ &&opc_default, &&opc_default, &&opc_fast_aldc, &&opc_fast_aldc_w, +/* 0xE8 */ &&opc_return_register_finalizer, + &&opc_invokehandle, &&opc_default, &&opc_default, /* 0xEC */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, /* 0xF0 */ &&opc_default, &&opc_default, &&opc_default, &&opc_default, diff --git a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp index f7121d0309b..5adbe465271 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -110,6 +110,7 @@ private: intptr_t* _locals; // local variable pointer ConstantPoolCache* _constants; // constant pool cache Method* _method; // method being executed + oop _mirror; // mirror to klass containing method DataLayout* _mdx; // compiler profiling data for current bytecode intptr_t* _stack; // expression stack messages _msg; // frame manager <-> interpreter message diff --git a/hotspot/src/share/vm/interpreter/linkResolver.cpp b/hotspot/src/share/vm/interpreter/linkResolver.cpp index eb29da892a6..0544e1ca476 100644 --- a/hotspot/src/share/vm/interpreter/linkResolver.cpp +++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp @@ -127,30 +127,7 @@ void CallInfo::set_common(KlassHandle resolved_klass, _resolved_appendix = Handle(); DEBUG_ONLY(verify()); // verify before making side effects - if (CompilationPolicy::must_be_compiled(selected_method)) { - // This path is unusual, mostly used by the '-Xcomp' stress test mode. - - // Note: with several active threads, the must_be_compiled may be true - // while can_be_compiled is false; remove assert - // assert(CompilationPolicy::can_be_compiled(selected_method), "cannot compile"); - if (!THREAD->can_call_java()) { - // don't force compilation, resolve was on behalf of compiler - return; - } - if (selected_method->method_holder()->is_not_initialized()) { - // 'is_not_initialized' means not only '!is_initialized', but also that - // initialization has not been started yet ('!being_initialized') - // Do not force compilation of methods in uninitialized classes. - // Note that doing this would throw an assert later, - // in CompileBroker::compile_method. - // We sometimes use the link resolver to do reflective lookups - // even before classes are initialized. - return; - } - CompileBroker::compile_method(selected_method, InvocationEntryBci, - CompilationPolicy::policy()->initial_compile_level(), - methodHandle(), 0, "must_be_compiled", CHECK); - } + CompilationPolicy::compile_if_required(selected_method, THREAD); } // utility query for unreflecting a method @@ -612,14 +589,13 @@ methodHandle LinkResolver::resolve_method_statically(Bytecodes::Code code, } if (code == Bytecodes::_invokeinterface) { - return resolve_interface_method(link_info, true, THREAD); + return resolve_interface_method(link_info, code, THREAD); } else if (code == Bytecodes::_invokevirtual) { return resolve_method(link_info, /*require_methodref*/true, THREAD); } else if (!resolved_klass->is_interface()) { return resolve_method(link_info, /*require_methodref*/false, THREAD); } else { - bool nostatics = (code == Bytecodes::_invokestatic) ? false : true; - return resolve_interface_method(link_info, nostatics, THREAD); + return resolve_interface_method(link_info, code, THREAD); } } @@ -777,8 +753,8 @@ static void trace_method_resolution(const char* prefix, #endif // PRODUCT } -methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, - bool nostatics, TRAPS) { +// Do linktime resolution of a method in the interface within the context of the specied bytecode. +methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, Bytecodes::Code code, TRAPS) { KlassHandle resolved_klass = link_info.resolved_klass(); @@ -824,7 +800,7 @@ methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, check_method_loader_constraints(link_info, resolved_method, "interface method", CHECK_NULL); } - if (nostatics && resolved_method->is_static()) { + if (code != Bytecodes::_invokestatic && resolved_method->is_static()) { ResourceMark rm(THREAD); char buf[200]; jio_snprintf(buf, sizeof(buf), "Expected instance not static method %s", @@ -833,6 +809,19 @@ methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); } + if (code == Bytecodes::_invokeinterface && resolved_method->is_private()) { + ResourceMark rm(THREAD); + char buf[200]; + + KlassHandle current_klass = link_info.current_klass(); + jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokeinterface: method %s, caller-class:%s", + Method::name_and_sig_as_C_string(resolved_klass(), + resolved_method->name(), + resolved_method->signature()), + (current_klass.is_null() ? "" : current_klass->internal_name())); + THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); + } + if (log_develop_is_enabled(Trace, itables)) { trace_method_resolution("invokeinterface resolved method: caller-class", link_info.current_klass(), resolved_klass, @@ -984,7 +973,7 @@ methodHandle LinkResolver::linktime_resolve_static_method(const LinkInfo& link_i if (!resolved_klass->is_interface()) { resolved_method = resolve_method(link_info, /*require_methodref*/false, CHECK_NULL); } else { - resolved_method = resolve_interface_method(link_info, /*nostatics*/false, CHECK_NULL); + resolved_method = resolve_interface_method(link_info, Bytecodes::_invokestatic, CHECK_NULL); } assert(resolved_method->name() != vmSymbols::class_initializer_name(), "should have been checked in verifier"); @@ -1027,7 +1016,7 @@ methodHandle LinkResolver::linktime_resolve_special_method(const LinkInfo& link_ if (!resolved_klass->is_interface()) { resolved_method = resolve_method(link_info, /*require_methodref*/false, CHECK_NULL); } else { - resolved_method = resolve_interface_method(link_info, /*nostatics*/true, CHECK_NULL); + resolved_method = resolve_interface_method(link_info, Bytecodes::_invokespecial, CHECK_NULL); } // check if method name is , that it is found in same klass as static type @@ -1302,7 +1291,7 @@ void LinkResolver::resolve_interface_call(CallInfo& result, Handle recv, KlassHa methodHandle LinkResolver::linktime_resolve_interface_method(const LinkInfo& link_info, TRAPS) { // normal interface method resolution - methodHandle resolved_method = resolve_interface_method(link_info, true, CHECK_NULL); + methodHandle resolved_method = resolve_interface_method(link_info, Bytecodes::_invokeinterface, CHECK_NULL); assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier"); assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier"); @@ -1321,17 +1310,6 @@ void LinkResolver::runtime_resolve_interface_method(CallInfo& result, THROW(vmSymbols::java_lang_NullPointerException()); } - // check if private interface method - if (resolved_klass->is_interface() && resolved_method->is_private()) { - ResourceMark rm(THREAD); - char buf[200]; - jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokeinterface: method %s", - Method::name_and_sig_as_C_string(resolved_klass(), - resolved_method->name(), - resolved_method->signature())); - THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); - } - // check if receiver klass implements the resolved interface if (!recv_klass->is_subtype_of(resolved_klass())) { ResourceMark rm(THREAD); diff --git a/hotspot/src/share/vm/interpreter/linkResolver.hpp b/hotspot/src/share/vm/interpreter/linkResolver.hpp index 4dae8111e18..b319be9b3b6 100644 --- a/hotspot/src/share/vm/interpreter/linkResolver.hpp +++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp @@ -191,7 +191,7 @@ class LinkResolver: AllStatic { KlassHandle current_klass, KlassHandle sel_klass, TRAPS); - static methodHandle resolve_interface_method(const LinkInfo& link_info, bool nostatics, TRAPS); + static methodHandle resolve_interface_method(const LinkInfo& link_info, Bytecodes::Code code, TRAPS); static methodHandle resolve_method (const LinkInfo& link_info, bool require_methodref, TRAPS); static methodHandle linktime_resolve_static_method (const LinkInfo& link_info, TRAPS); diff --git a/hotspot/src/share/vm/interpreter/oopMapCache.cpp b/hotspot/src/share/vm/interpreter/oopMapCache.cpp index 7dcf024532e..a32949ad340 100644 --- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp +++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp @@ -24,10 +24,10 @@ #include "precompiled.hpp" #include "interpreter/oopMapCache.hpp" +#include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/handles.inline.hpp" #include "runtime/signature.hpp" @@ -469,10 +469,12 @@ void OopMapCache::flush_obsolete_entries() { if (!_array[i].is_empty() && _array[i].method()->is_old()) { // Cache entry is occupied by an old redefined method and we don't want // to pin it down so flush the entry. - RC_TRACE(0x08000000, ("flush: %s(%s): cached entry @%d", - _array[i].method()->name()->as_C_string(), - _array[i].method()->signature()->as_C_string(), i)); - + if (log_is_enabled(Debug, redefine, class, oopmap)) { + ResourceMark rm; + log_debug(redefine, class, oopmap) + ("flush: %s(%s): cached entry @%d", + _array[i].method()->name()->as_C_string(), _array[i].method()->signature()->as_C_string(), i); + } _array[i].flush(); } } diff --git a/hotspot/src/share/vm/interpreter/rewriter.cpp b/hotspot/src/share/vm/interpreter/rewriter.cpp index 41e29a6ee53..7680fbf4b50 100644 --- a/hotspot/src/share/vm/interpreter/rewriter.cpp +++ b/hotspot/src/share/vm/interpreter/rewriter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,11 +65,12 @@ void Rewriter::compute_index_maps() { // Record limits of resolved reference map for constant pool cache indices record_map_limits(); - guarantee((int)_cp_cache_map.length()-1 <= (int)((u2)-1), + guarantee((int) _cp_cache_map.length() - 1 <= (int) ((u2)-1), "all cp cache indexes fit in a u2"); - if (saw_mh_symbol) - _method_handle_invokers.initialize(length, (int)0); + if (saw_mh_symbol) { + _method_handle_invokers.at_grow(length, 0); + } } // Unrewrite the bytecodes if an error occurs. @@ -193,7 +194,7 @@ void Rewriter::maybe_rewrite_invokehandle(address opc, int cp_index, int cache_i assert(_pool->tag_at(cp_index).is_method(), "wrong index"); // Determine whether this is a signature-polymorphic method. if (cp_index >= _method_handle_invokers.length()) return; - int status = _method_handle_invokers[cp_index]; + int status = _method_handle_invokers.at(cp_index); assert(status >= -1 && status <= 1, "oob tri-state"); if (status == 0) { if (_pool->klass_ref_at_noresolve(cp_index) == vmSymbols::java_lang_invoke_MethodHandle() && @@ -211,7 +212,7 @@ void Rewriter::maybe_rewrite_invokehandle(address opc, int cp_index, int cache_i } else { status = -1; } - _method_handle_invokers[cp_index] = status; + _method_handle_invokers.at(cp_index) = status; } // We use a special internal bytecode for such methods (if non-static). // The basic reason for this is that such methods need an extra "appendix" argument @@ -287,7 +288,7 @@ void Rewriter::patch_invokedynamic_bytecodes() { // add delta to each. int resolved_index = _patch_invokedynamic_refs->at(i); for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { - assert(_invokedynamic_references_map[resolved_index+entry] == cache_index, + assert(_invokedynamic_references_map.at(resolved_index + entry) == cache_index, "should be the same index"); _invokedynamic_references_map.at_put(resolved_index+entry, cache_index + delta); @@ -520,7 +521,14 @@ void Rewriter::rewrite(instanceKlassHandle klass, TRAPS) { Rewriter::Rewriter(instanceKlassHandle klass, const constantPoolHandle& cpool, Array* methods, TRAPS) : _klass(klass), _pool(cpool), - _methods(methods) + _methods(methods), + _cp_map(cpool->length()), + _cp_cache_map(cpool->length() / 2), + _reference_map(cpool->length()), + _resolved_references_map(cpool->length() / 2), + _invokedynamic_references_map(cpool->length() / 2), + _method_handle_invokers(cpool->length()), + _invokedynamic_cp_cache_map(cpool->length() / 4) { // Rewrite bytecodes - exception here exits. diff --git a/hotspot/src/share/vm/interpreter/rewriter.hpp b/hotspot/src/share/vm/interpreter/rewriter.hpp index de25b101e84..68658537b4e 100644 --- a/hotspot/src/share/vm/interpreter/rewriter.hpp +++ b/hotspot/src/share/vm/interpreter/rewriter.hpp @@ -37,13 +37,13 @@ class Rewriter: public StackObj { instanceKlassHandle _klass; constantPoolHandle _pool; Array* _methods; - intArray _cp_map; - intStack _cp_cache_map; // for Methodref, Fieldref, - // InterfaceMethodref and InvokeDynamic - intArray _reference_map; // maps from cp index to resolved_refs index (or -1) - intStack _resolved_references_map; // for strings, methodHandle, methodType - intStack _invokedynamic_references_map; // for invokedynamic resolved refs - intArray _method_handle_invokers; + GrowableArray _cp_map; + GrowableArray _cp_cache_map; // for Methodref, Fieldref, + // InterfaceMethodref and InvokeDynamic + GrowableArray _reference_map; // maps from cp index to resolved_refs index (or -1) + GrowableArray _resolved_references_map; // for strings, methodHandle, methodType + GrowableArray _invokedynamic_references_map; // for invokedynamic resolved refs + GrowableArray _method_handle_invokers; int _resolved_reference_limit; // For mapping invokedynamic bytecodes, which are discovered during method @@ -51,28 +51,31 @@ class Rewriter: public StackObj { // If there are any invokespecial/InterfaceMethodref special case bytecodes, // these entries are added before invokedynamic entries so that the // invokespecial bytecode 16 bit index doesn't overflow. - intStack _invokedynamic_cp_cache_map; + GrowableArray _invokedynamic_cp_cache_map; // For patching. GrowableArray
* _patch_invokedynamic_bcps; GrowableArray* _patch_invokedynamic_refs; void init_maps(int length) { - _cp_map.initialize(length, -1); - // Choose an initial value large enough that we don't get frequent - // calls to grow(). - _cp_cache_map.initialize(length/2); + _cp_map.trunc_to(0); + _cp_map.at_grow(length, -1); + + _cp_cache_map.trunc_to(0); // Also cache resolved objects, in another different cache. - _reference_map.initialize(length, -1); - _resolved_references_map.initialize(length/2); - _invokedynamic_references_map.initialize(length/2); + _reference_map.trunc_to(0); + _reference_map.at_grow(length, -1); + + _method_handle_invokers.trunc_to(0); + _resolved_references_map.trunc_to(0); + _invokedynamic_references_map.trunc_to(0); _resolved_reference_limit = -1; _first_iteration_cp_cache_limit = -1; // invokedynamic specific fields - _invokedynamic_cp_cache_map.initialize(length/4); - _patch_invokedynamic_bcps = new GrowableArray
(length/4); - _patch_invokedynamic_refs = new GrowableArray(length/4); + _invokedynamic_cp_cache_map.trunc_to(0); + _patch_invokedynamic_bcps = new GrowableArray
(length / 4); + _patch_invokedynamic_refs = new GrowableArray(length / 4); } int _first_iteration_cp_cache_limit; @@ -90,10 +93,10 @@ class Rewriter: public StackObj { return _cp_cache_map.length() - _first_iteration_cp_cache_limit; } - int cp_entry_to_cp_cache(int i) { assert(has_cp_cache(i), "oob"); return _cp_map[i]; } - bool has_cp_cache(int i) { return (uint)i < (uint)_cp_map.length() && _cp_map[i] >= 0; } + int cp_entry_to_cp_cache(int i) { assert(has_cp_cache(i), "oob"); return _cp_map.at(i); } + bool has_cp_cache(int i) { return (uint) i < (uint) _cp_map.length() && _cp_map.at(i) >= 0; } - int add_map_entry(int cp_index, intArray* cp_map, intStack* cp_cache_map) { + int add_map_entry(int cp_index, GrowableArray* cp_map, GrowableArray* cp_cache_map) { assert(cp_map->at(cp_index) == -1, "not twice on same cp_index"); int cache_index = cp_cache_map->append(cp_index); cp_map->at_put(cp_index, cache_index); @@ -121,7 +124,7 @@ class Rewriter: public StackObj { } int invokedynamic_cp_cache_entry_pool_index(int cache_index) { - int cp_index = _invokedynamic_cp_cache_map[cache_index]; + int cp_index = _invokedynamic_cp_cache_map.at(cache_index); return cp_index; } @@ -131,9 +134,9 @@ class Rewriter: public StackObj { assert(_first_iteration_cp_cache_limit >= 0, "add these special cache entries after first iteration"); // Don't add InterfaceMethodref if it already exists at the end. for (int i = _first_iteration_cp_cache_limit; i < _cp_cache_map.length(); i++) { - if (cp_cache_entry_pool_index(i) == cp_index) { - return i; - } + if (cp_cache_entry_pool_index(i) == cp_index) { + return i; + } } int cache_index = _cp_cache_map.append(cp_index); assert(cache_index >= _first_iteration_cp_cache_limit, ""); @@ -144,10 +147,10 @@ class Rewriter: public StackObj { int cp_entry_to_resolved_references(int cp_index) const { assert(has_entry_in_resolved_references(cp_index), "oob"); - return _reference_map[cp_index]; + return _reference_map.at(cp_index); } bool has_entry_in_resolved_references(int cp_index) const { - return (uint)cp_index < (uint)_reference_map.length() && _reference_map[cp_index] >= 0; + return (uint) cp_index < (uint) _reference_map.length() && _reference_map.at(cp_index) >= 0; } // add a new entry to the resolved_references map @@ -174,13 +177,13 @@ class Rewriter: public StackObj { } int resolved_references_entry_to_pool_index(int ref_index) { - int cp_index = _resolved_references_map[ref_index]; + int cp_index = _resolved_references_map.at(ref_index); return cp_index; } // Access the contents of _cp_cache_map to determine CP cache layout. int cp_cache_entry_pool_index(int cache_index) { - int cp_index = _cp_cache_map[cache_index]; + int cp_index = _cp_cache_map.at(cache_index); return cp_index; } diff --git a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp index 3e948e3533c..8b34d14e589 100644 --- a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp @@ -85,7 +85,7 @@ void JVMCICompiler::bootstrap() { if (!mh->is_native() && !mh->is_static() && !mh->is_initializer()) { ResourceMark rm; int hot_count = 10; // TODO: what's the appropriate value? - CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, "bootstrap", THREAD); + CompileBroker::compile_method(mh, InvocationEntryBci, CompLevel_full_optimization, mh, hot_count, CompileTask::Reason_Bootstrap, THREAD); } } diff --git a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp index 6ff1897124a..94108e6c75c 100644 --- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp @@ -154,6 +154,14 @@ int CompilerToVM::Data::cardtable_shift; int CompilerToVM::Data::vm_page_size; +address CompilerToVM::Data::dsin; +address CompilerToVM::Data::dcos; +address CompilerToVM::Data::dtan; +address CompilerToVM::Data::dexp; +address CompilerToVM::Data::dlog; +address CompilerToVM::Data::dlog10; +address CompilerToVM::Data::dpow; + void CompilerToVM::Data::initialize() { Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset()); Klass_vtable_length_offset = in_bytes(Klass::vtable_length_offset()); @@ -205,6 +213,23 @@ void CompilerToVM::Data::initialize() { } vm_page_size = os::vm_page_size(); + +#define SET_TRIGFUNC(name) \ + if (StubRoutines::name() != NULL) { \ + name = StubRoutines::name(); \ + } else { \ + name = CAST_FROM_FN_PTR(address, SharedRuntime::name); \ + } + + SET_TRIGFUNC(dsin); + SET_TRIGFUNC(dcos); + SET_TRIGFUNC(dtan); + SET_TRIGFUNC(dexp); + SET_TRIGFUNC(dlog10); + SET_TRIGFUNC(dlog); + SET_TRIGFUNC(dpow); + +#undef SET_TRIGFUNC } /** @@ -628,65 +653,35 @@ C2V_VMENTRY(jint, getVtableIndexForInterfaceMethod, (JNIEnv *, jobject, jobject C2V_END C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type)) - Klass* recv_klass = CompilerToVM::asKlass(receiver_jvmci_type); - Klass* caller_klass = CompilerToVM::asKlass(caller_jvmci_type); - Method* method = CompilerToVM::asMethod(jvmci_method); + KlassHandle recv_klass = CompilerToVM::asKlass(receiver_jvmci_type); + KlassHandle caller_klass = CompilerToVM::asKlass(caller_jvmci_type); + methodHandle method = CompilerToVM::asMethod(jvmci_method); - if (recv_klass->is_array_klass() || (InstanceKlass::cast(recv_klass)->is_linked())) { - Klass* holder_klass = method->method_holder(); - Symbol* method_name = method->name(); - Symbol* method_signature = method->signature(); + KlassHandle h_resolved (THREAD, method->method_holder()); + Symbol* h_name = method->name(); + Symbol* h_signature = method->signature(); - if (holder_klass->is_interface()) { - // do link-time resolution to check all access rules. - LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true); - methodHandle resolved_method = LinkResolver::linktime_resolve_interface_method_or_null(link_info); - if (resolved_method.is_null() || resolved_method->is_private()) { - return NULL; - } - assert(recv_klass->is_subtype_of(holder_klass), ""); - // do actual lookup - methodHandle sel_method = LinkResolver::lookup_instance_method_in_klasses(recv_klass, resolved_method->name(), resolved_method->signature(), CHECK_AND_CLEAR_0); - oop result = CompilerToVM::get_jvmci_method(sel_method, CHECK_NULL); - return JNIHandles::make_local(THREAD, result); + bool check_access = true; + LinkInfo link_info(h_resolved, h_name, h_signature, caller_klass, check_access); + methodHandle m; + // Only do exact lookup if receiver klass has been linked. Otherwise, + // the vtable has not been setup, and the LinkResolver will fail. + if (recv_klass->is_array_klass() || + InstanceKlass::cast(recv_klass())->is_linked() && !recv_klass->is_interface()) { + if (h_resolved->is_interface()) { + m = LinkResolver::resolve_interface_call_or_null(recv_klass, link_info); } else { - // do link-time resolution to check all access rules. - LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true); - methodHandle resolved_method = LinkResolver::linktime_resolve_virtual_method_or_null(link_info); - if (resolved_method.is_null()) { - return NULL; - } - // do actual lookup (see LinkResolver::runtime_resolve_virtual_method) - int vtable_index = Method::invalid_vtable_index; - Method* selected_method; - - if (resolved_method->method_holder()->is_interface()) { // miranda method - vtable_index = LinkResolver::vtable_index_of_interface_method(holder_klass, resolved_method); - assert(vtable_index >= 0 , "we should have valid vtable index at this point"); - - selected_method = recv_klass->method_at_vtable(vtable_index); - } else { - // at this point we are sure that resolved_method is virtual and not - // a miranda method; therefore, it must have a valid vtable index. - assert(!resolved_method->has_itable_index(), ""); - vtable_index = resolved_method->vtable_index(); - // We could get a negative vtable_index for final methods, - // because as an optimization they are they are never put in the vtable, - // unless they override an existing method. - // If we do get a negative, it means the resolved method is the the selected - // method, and it can never be changed by an override. - if (vtable_index == Method::nonvirtual_vtable_index) { - assert(resolved_method->can_be_statically_bound(), "cannot override this method"); - selected_method = resolved_method(); - } else { - selected_method = recv_klass->method_at_vtable(vtable_index); - } - } - oop result = CompilerToVM::get_jvmci_method(selected_method, CHECK_NULL); - return JNIHandles::make_local(THREAD, result); + m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info); } } - return NULL; + + if (m.is_null()) { + // Return NULL only if there was a problem with lookup (uninitialized class, etc.) + return NULL; + } + + oop result = CompilerToVM::get_jvmci_method(m, CHECK_NULL); + return JNIHandles::make_local(THREAD, result); C2V_END C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jobject jvmci_type)) @@ -992,7 +987,7 @@ C2V_VMENTRY(void, reprofile, (JNIEnv*, jobject, jobject jvmci_method)) } NOT_PRODUCT(method->set_compiled_invocation_count(0)); - nmethod* code = method->code(); + CompiledMethod* code = method->code(); if (code != NULL) { code->make_not_entrant(); } diff --git a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp index 9ec78fd7358..f6790375d64 100644 --- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp +++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp @@ -65,6 +65,14 @@ class CompilerToVM { static int vm_page_size; + static address dsin; + static address dcos; + static address dtan; + static address dexp; + static address dlog; + static address dlog10; + static address dpow; + public: static void initialize(); }; diff --git a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp index eb39c2764c3..502b2f7c011 100644 --- a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp @@ -546,7 +546,7 @@ JVMCIEnv::CodeInstallResult JVMCIEnv::register_method( if (entry_bci == InvocationEntryBci) { if (TieredCompilation) { // If there is an old version we're done with it - nmethod* old = method->code(); + CompiledMethod* old = method->code(); if (TraceMethodReplacement && old != NULL) { ResourceMark rm; char *method_name = method->name_and_sig_as_C_string(); diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp index 76545ebc7b1..219ad61d9f4 100644 --- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp +++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp @@ -220,15 +220,15 @@ extern void vm_exit(int code); // been deoptimized. If that is the case we return the deopt blob // unpack_with_exception entry instead. This makes life for the exception blob easier // because making that same check and diverting is painful from assembly language. -JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm)) +JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, CompiledMethod*& cm)) // Reset method handle flag. thread->set_is_method_handle_return(false); Handle exception(thread, ex); - nm = CodeCache::find_nmethod(pc); - assert(nm != NULL, "this is not a compiled method"); + cm = CodeCache::find_compiled(pc); + assert(cm != NULL, "this is not a compiled method"); // Adjust the pc as needed/ - if (nm->is_deopt_pc(pc)) { + if (cm->is_deopt_pc(pc)) { RegisterMap map(thread, false); frame exception_frame = thread->last_frame().sender(&map); // if the frame isn't deopted then pc must not correspond to the caller of last_frame @@ -275,10 +275,10 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions if (guard_pages_enabled) { - address fast_continuation = nm->handler_for_exception_and_pc(exception, pc); + address fast_continuation = cm->handler_for_exception_and_pc(exception, pc); if (fast_continuation != NULL) { // Set flag if return address is a method handle call site. - thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); + thread->set_is_method_handle_return(cm->is_method_handle_return(pc)); return fast_continuation; } } @@ -299,7 +299,7 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t stringStream tempst; tempst.print("compiled method <%s>\n" " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, - nm->method()->print_value_string(), p2i(pc), p2i(thread)); + cm->method()->print_value_string(), p2i(pc), p2i(thread)); Exceptions::log_exception(exception, tempst); } // for AbortVMOnException flag @@ -311,19 +311,19 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t // normal bytecode execution. thread->clear_exception_oop_and_pc(); - continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); + continuation = SharedRuntime::compute_compiled_exc_handler(cm, pc, exception, false, false); // If an exception was thrown during exception dispatch, the exception oop may have changed thread->set_exception_oop(exception()); thread->set_exception_pc(pc); // the exception cache is used only by non-implicit exceptions if (continuation != NULL && !SharedRuntime::deopt_blob()->contains(continuation)) { - nm->add_handler_for_exception_and_pc(exception, pc, continuation); + cm->add_handler_for_exception_and_pc(exception, pc, continuation); } } // Set flag if return address is a method handle call site. - thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); + thread->set_is_method_handle_return(cm->is_method_handle_return(pc)); if (log_is_enabled(Info, exceptions)) { ResourceMark rm; @@ -345,18 +345,18 @@ address JVMCIRuntime::exception_handler_for_pc(JavaThread* thread) { address pc = thread->exception_pc(); // Still in Java mode DEBUG_ONLY(ResetNoHandleMark rnhm); - nmethod* nm = NULL; + CompiledMethod* cm = NULL; address continuation = NULL; { // Enter VM mode by calling the helper ResetNoHandleMark rnhm; - continuation = exception_handler_for_pc_helper(thread, exception, pc, nm); + continuation = exception_handler_for_pc_helper(thread, exception, pc, cm); } // Back in JAVA, use no oops DON'T safepoint // Now check to see if the compiled method we were called from is now deoptimized. // If so we must return to the deopt blob and deoptimize the nmethod - if (nm != NULL && caller_is_deopted()) { + if (cm != NULL && caller_is_deopted()) { continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); } @@ -425,19 +425,22 @@ JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, Basic } JRT_END -JRT_ENTRY(void, JVMCIRuntime::throw_and_post_jvmti_exception(JavaThread* thread, Symbol* name, const char* message)) - SharedRuntime::throw_and_post_jvmti_exception(thread, name, message); +JRT_ENTRY(void, JVMCIRuntime::throw_and_post_jvmti_exception(JavaThread* thread, const char* exception, const char* message)) + TempNewSymbol symbol = SymbolTable::new_symbol(exception, CHECK); + SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message); JRT_END -JRT_ENTRY(void, JVMCIRuntime::throw_klass_external_name_exception(JavaThread* thread, Symbol* exception, Klass* klass)) +JRT_ENTRY(void, JVMCIRuntime::throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass)) ResourceMark rm(thread); - SharedRuntime::throw_and_post_jvmti_exception(thread, exception, klass->external_name()); + TempNewSymbol symbol = SymbolTable::new_symbol(exception, CHECK); + SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, klass->external_name()); JRT_END -JRT_ENTRY(void, JVMCIRuntime::throw_class_cast_exception(JavaThread* thread, Symbol* exception, Klass* caster_klass, Klass* target_klass)) +JRT_ENTRY(void, JVMCIRuntime::throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass)) ResourceMark rm(thread); const char* message = SharedRuntime::generate_class_cast_message(caster_klass, target_klass); - SharedRuntime::throw_and_post_jvmti_exception(thread, exception, message); + TempNewSymbol symbol = SymbolTable::new_symbol(exception, CHECK); + SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message); JRT_END JRT_LEAF(void, JVMCIRuntime::log_object(JavaThread* thread, oopDesc* obj, bool as_string, bool newline)) diff --git a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp index 256872aee4d..d3deb1d8ff5 100644 --- a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp +++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp @@ -156,10 +156,10 @@ class JVMCIRuntime: public AllStatic { static void new_store_pre_barrier(JavaThread* thread); // used to throw exceptions from compiled JVMCI code - static void throw_and_post_jvmti_exception(JavaThread* thread, Symbol* exception, const char* message); + static void throw_and_post_jvmti_exception(JavaThread* thread, const char* exception, const char* message); // helper methods to throw exception with complex messages - static void throw_klass_external_name_exception(JavaThread* thread, Symbol* exception, Klass* klass); - static void throw_class_cast_exception(JavaThread* thread, Symbol* exception, Klass* caster_klass, Klass* target_klass); + static void throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass); + static void throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass); // Test only function static int test_deoptimize_call_int(JavaThread* thread, int value); diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp index 992746975f4..2b2155a969a 100644 --- a/hotspot/src/share/vm/jvmci/jvmci_globals.cpp +++ b/hotspot/src/share/vm/jvmci/jvmci_globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -35,7 +35,8 @@ JVMCI_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_EXPERIMENTAL_FLAG, \ MATERIALIZE_NOTPRODUCT_FLAG, IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #define JVMCI_IGNORE_FLAG_FOUR_PARAM(type, name, value, doc) #define JVMCI_IGNORE_FLAG_THREE_PARAM(type, name, doc) @@ -91,7 +92,8 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() { JVMCI_IGNORE_FLAG_FOUR_PARAM, \ JVMCI_IGNORE_FLAG_FOUR_PARAM, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) } // Check consistency of experimental flags if UnlockExperimentalVMOptions is @@ -105,7 +107,8 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() { JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE, \ JVMCI_IGNORE_FLAG_FOUR_PARAM, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) } #ifndef PRODUCT @@ -129,7 +132,8 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() { JVMCI_IGNORE_FLAG_FOUR_PARAM, \ JVMCI_NOTPRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #undef EMIT_FLAG_VALUE_CHANGED_CHECK_CODE #undef JVMCI_DEVELOP_FLAG_VALUE_CHANGED_CHECK_CODE @@ -167,7 +171,8 @@ void JVMCIGlobals::print_jvmci_args_inconsistency_error_message() { JVMCI_IGNORE_FLAG_FOUR_PARAM, \ JVMCI_IGNORE_FLAG_FOUR_PARAM, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) } if (UnlockExperimentalVMOptions || !FLAG_IS_DEFAULT(UnlockExperimentalVMOptions)) { @@ -179,7 +184,8 @@ void JVMCIGlobals::print_jvmci_args_inconsistency_error_message() { JVMCI_EXPERIMENTAL_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ JVMCI_IGNORE_FLAG_FOUR_PARAM, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) } #ifndef PRODUCT @@ -203,7 +209,8 @@ void JVMCIGlobals::print_jvmci_args_inconsistency_error_message() { JVMCI_IGNORE_FLAG_FOUR_PARAM, \ JVMCI_NOTPRODUCT_FLAG_CHECK_PRINT_ERR_MSG_CODE, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #undef EMIT_CHECK_PRINT_ERR_MSG_CODE #undef JVMCI_DEVELOP_FLAG_CHECK_PRINT_ERR_MSG_CODE diff --git a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp index 03285e3bdfc..d42e09cc0b1 100644 --- a/hotspot/src/share/vm/jvmci/jvmci_globals.hpp +++ b/hotspot/src/share/vm/jvmci/jvmci_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -32,7 +32,16 @@ // to be accessible to the JVMCI C++ code should be defined here. All other // JVMCI flags should be defined in JVMCIOptions.java. // -#define JVMCI_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, range, constraint) \ +#define JVMCI_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ experimental(bool, EnableJVMCI, false, \ "Enable JVMCI") \ @@ -96,7 +105,8 @@ JVMCI_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_EXPERIMENTAL_FLAG, \ DECLARE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) class JVMCIGlobals { public: diff --git a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp index b668737d709..a40a3e11867 100644 --- a/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp +++ b/hotspot/src/share/vm/jvmci/vmStructs_jvmci.cpp @@ -76,6 +76,14 @@ \ static_field(CompilerToVM::Data, vm_page_size, int) \ \ + static_field(CompilerToVM::Data, dsin, address) \ + static_field(CompilerToVM::Data, dcos, address) \ + static_field(CompilerToVM::Data, dtan, address) \ + static_field(CompilerToVM::Data, dexp, address) \ + static_field(CompilerToVM::Data, dlog, address) \ + static_field(CompilerToVM::Data, dlog10, address) \ + static_field(CompilerToVM::Data, dpow, address) \ + \ static_field(Abstract_VM_Version, _features, uint64_t) \ \ nonstatic_field(Array, _length, int) \ @@ -186,7 +194,7 @@ nonstatic_field(Method, _vtable_index, int) \ nonstatic_field(Method, _intrinsic_id, u2) \ nonstatic_field(Method, _flags, u2) \ - volatile_nonstatic_field(Method, _code, nmethod*) \ + volatile_nonstatic_field(Method, _code, CompiledMethod*) \ volatile_nonstatic_field(Method, _from_compiled_entry, address) \ \ nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \ @@ -309,6 +317,7 @@ declare_constant(JVM_ACC_MONITOR_MATCH) \ declare_constant(JVM_ACC_HAS_MONITOR_BYTECODES) \ declare_constant(JVM_ACC_HAS_FINALIZER) \ + declare_constant(JVM_ACC_IS_CLONEABLE_FAST) \ declare_constant(JVM_ACC_FIELD_INTERNAL) \ declare_constant(JVM_ACC_FIELD_STABLE) \ declare_constant(JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE) \ @@ -523,13 +532,6 @@ declare_function(SharedRuntime::exception_handler_for_return_address) \ declare_function(SharedRuntime::OSR_migration_end) \ declare_function(SharedRuntime::enable_stack_reserved_zone) \ - declare_function(SharedRuntime::dsin) \ - declare_function(SharedRuntime::dcos) \ - declare_function(SharedRuntime::dtan) \ - declare_function(SharedRuntime::dexp) \ - declare_function(SharedRuntime::dlog) \ - declare_function(SharedRuntime::dlog10) \ - declare_function(SharedRuntime::dpow) \ \ declare_function(os::dll_load) \ declare_function(os::dll_lookup) \ diff --git a/hotspot/src/share/vm/libadt/vectset.cpp b/hotspot/src/share/vm/libadt/vectset.cpp index 256b0a9a1a9..2db14514f3e 100644 --- a/hotspot/src/share/vm/libadt/vectset.cpp +++ b/hotspot/src/share/vm/libadt/vectset.cpp @@ -31,7 +31,7 @@ // BitsInByte is a lookup table which tells the number of bits that // are in the looked-up number. It is very useful in VectorSet_Size. -uint8_t bitsInByte[256] = { +uint8_t bitsInByte[BITS_IN_BYTE_ARRAY_SIZE] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, diff --git a/hotspot/src/share/vm/libadt/vectset.hpp b/hotspot/src/share/vm/libadt/vectset.hpp index d94ce44d35f..887329de1ee 100644 --- a/hotspot/src/share/vm/libadt/vectset.hpp +++ b/hotspot/src/share/vm/libadt/vectset.hpp @@ -27,6 +27,8 @@ #include "libadt/set.hpp" +#define BITS_IN_BYTE_ARRAY_SIZE 256 + // Vector Sets - An Abstract Data Type //INTERFACE diff --git a/hotspot/src/share/vm/logging/log.cpp b/hotspot/src/share/vm/logging/log.cpp index cdef6d8a7ab..59de3ef3289 100644 --- a/hotspot/src/share/vm/logging/log.cpp +++ b/hotspot/src/share/vm/logging/log.cpp @@ -32,9 +32,12 @@ #include "logging/log.hpp" #include "logging/logConfiguration.hpp" #include "logging/logFileOutput.hpp" +#include "logging/logMessage.hpp" +#include "logging/logMessageBuffer.hpp" #include "logging/logOutput.hpp" #include "logging/logTagLevelExpression.hpp" #include "logging/logTagSet.hpp" +#include "logging/logTagSetDescriptions.hpp" #include "logging/logStream.inline.hpp" #include "memory/resourceArea.hpp" @@ -54,6 +57,102 @@ void Test_log_tag_combinations_limit() { LogTagLevelExpression::MaxCombinations, LogTagSet::ntagsets()); } +// Read a complete line from fp and return it as a resource allocated string. +// Returns NULL on EOF. +static char* read_line(FILE* fp) { + assert(fp != NULL, "bad fp"); + int buflen = 512; + char* buf = NEW_RESOURCE_ARRAY(char, buflen); + long pos = ftell(fp); + + char* ret = fgets(buf, buflen, fp); + while (ret != NULL && buf[strlen(buf) - 1] != '\n' && !feof(fp)) { + // retry with a larger buffer + buf = REALLOC_RESOURCE_ARRAY(char, buf, buflen, buflen * 2); + buflen *= 2; + // rewind to beginning of line + fseek(fp, pos, SEEK_SET); + // retry read with new buffer + ret = fgets(buf, buflen, fp); + } + return ret; +} + +static bool file_contains_substrings_in_order(const char* filename, const char* substrs[]) { + FILE* fp = fopen(filename, "r"); + assert(fp != NULL, "error opening file %s: %s", filename, strerror(errno)); + + size_t idx = 0; + while (substrs[idx] != NULL) { + ResourceMark rm; + char* line = read_line(fp); + if (line == NULL) { + break; + } + for (char* match = strstr(line, substrs[idx]); match != NULL;) { + size_t match_len = strlen(substrs[idx]); + idx++; + if (substrs[idx] == NULL) { + break; + } + match = strstr(match + match_len, substrs[idx]); + } + } + + fclose(fp); + return substrs[idx] == NULL; +} + +static bool file_contains_substring(const char* filename, const char* substr) { + const char* strs[] = {substr, NULL}; + return file_contains_substrings_in_order(filename, strs); +} + +static size_t number_of_lines_with_substring_in_file(const char* filename, + const char* substr) { + FILE* fp = fopen(filename, "r"); + assert(fp != NULL, "error opening file %s: %s", filename, strerror(errno)); + + size_t ret = 0; + for (;;) { + ResourceMark rm; + char* line = read_line(fp); + if (line == NULL) { + break; + } + if (strstr(line, substr) != NULL) { + ret++; + } + } + + fclose(fp); + return ret; +} + +static bool file_exists(const char* filename) { + struct stat st; + return os::stat(filename, &st) == 0; +} + +static void delete_file(const char* filename) { + if (!file_exists(filename)) { + return; + } + int ret = remove(filename); + assert(ret == 0, "failed to remove file '%s': %s", filename, strerror(errno)); +} + +static void create_directory(const char* name) { + assert(!file_exists(name), "can't create directory: %s already exists", name); + bool failed; +#ifdef _WINDOWS + failed = !CreateDirectory(name, NULL); +#else + failed = mkdir(name, 0777); +#endif + assert(!failed, "failed to create directory %s", name); +} + class TestLogFile { private: char file_name[256]; @@ -139,60 +238,6 @@ void Test_configure_stdout() { assert_str_eq("all=off", stdoutput->config_string()); } -static size_t number_of_lines_with_substring_in_file(const char* filename, - const char* substr) { - ResourceMark rm; - size_t ret = 0; - FILE* fp = fopen(filename, "r"); - assert(fp != NULL, "error opening file %s: %s", filename, strerror(errno)); - - int buflen = 512; - char* buf = NEW_RESOURCE_ARRAY(char, buflen); - long pos = 0; - - while (fgets(buf, buflen, fp) != NULL) { - if (buf[strlen(buf) - 1] != '\n' && !feof(fp)) { - // retry with a larger buffer - buf = REALLOC_RESOURCE_ARRAY(char, buf, buflen, buflen * 2); - buflen *= 2; - // rewind to beginning of line - fseek(fp, pos, SEEK_SET); - continue; - } - pos = ftell(fp); - if (strstr(buf, substr) != NULL) { - ret++; - } - } - - fclose(fp); - return ret; -} - -static bool file_exists(const char* filename) { - struct stat st; - return os::stat(filename, &st) == 0; -} - -static void delete_file(const char* filename) { - if (!file_exists(filename)) { - return; - } - int ret = remove(filename); - assert(ret == 0, "failed to remove file '%s': %s", filename, strerror(errno)); -} - -static void create_directory(const char* name) { - assert(!file_exists(name), "can't create directory: %s already exists", name); - bool failed; -#ifdef _WINDOWS - failed = !CreateDirectory(name, NULL); -#else - failed = mkdir(name, 0777); -#endif - assert(!failed, "failed to create directory %s", name); -} - static const char* ExpectedLine = "a (hopefully) unique log line for testing"; static void init_file(const char* filename, const char* options = "") { @@ -264,6 +309,253 @@ void Test_log_file_startup_truncation() { delete_file(archived_filename); } +class LogMessageTest { + private: + static Log(logging) _log; + static const char* _level_filename[]; + + static void test_level_inclusion(); + static void test_long_message(); + static void test_message_with_many_lines(); + static void test_line_order(); + static void test_prefixing(); + static void test_scoped_messages(); + static void test_scoped_flushing(); + static void test_scoped_reset(); + + public: + static void test(); +}; + +const char* LogMessageTest::_level_filename[] = { + NULL, // LogLevel::Off +#define LOG_LEVEL(name, printname) "multiline-" #printname ".log", + LOG_LEVEL_LIST +#undef LOG_LEVEL +}; + +void Test_multiline_logging() { + LogMessageTest::test(); +} + +void LogMessageTest::test() { + ResourceMark rm; + + for (int i = 0; i < LogLevel::Count; i++) { + char buf[32]; + // Attempt to remove possibly pre-existing log files + remove(_level_filename[i]); + + jio_snprintf(buf, sizeof(buf), "logging=%s", LogLevel::name(static_cast(i))); + bool success = LogConfiguration::parse_log_arguments(_level_filename[i], buf, + NULL, NULL, _log.error_stream()); + assert(success, "unable to configure logging to file '%s'", _level_filename[i]); + } + + test_level_inclusion(); + test_line_order(); + test_long_message(); + test_message_with_many_lines(); + test_prefixing(); + test_scoped_messages(); + test_scoped_flushing(); + test_scoped_reset(); + + // Stop logging to the files and remove them. + for (int i = 0; i < LogLevel::Count; i++) { + LogConfiguration::parse_log_arguments(_level_filename[i], "all=off", NULL, NULL, _log.error_stream()); + remove(_level_filename[i]); + } +} + +// Verify that messages with multiple levels are written +// to outputs configured for all the corresponding levels +void LogMessageTest::test_level_inclusion() { + const size_t message_count = 10; + LogMessageBuffer msg[message_count]; + + struct { + int message_number; + LogLevelType level; + } lines[] = { + { 0, LogLevel::Error }, + { 1, LogLevel::Info }, + { 2, LogLevel::Info }, { 2, LogLevel::Debug }, + { 3, LogLevel::Info }, { 3, LogLevel::Warning }, + { 4, LogLevel::Debug }, { 4, LogLevel::Warning }, + { 5, LogLevel::Trace }, { 5, LogLevel::Debug }, + { 6, LogLevel::Warning }, { 6, LogLevel::Error }, + { 7, LogLevel::Trace }, { 7, LogLevel::Info }, { 7, LogLevel::Debug }, + { 8, LogLevel::Trace }, { 8, LogLevel::Debug }, { 8, LogLevel::Info }, + { 8, LogLevel::Warning }, { 8, LogLevel::Error}, + { 9, LogLevel::Trace } + }; + + // Fill in messages with the above lines + for (size_t i = 0; i < ARRAY_SIZE(lines); i++) { + switch (lines[i].level) { +#define LOG_LEVEL(name, printname) \ + case LogLevel::name: \ + msg[lines[i].message_number].printname("msg[%d]: " #printname, lines[i].message_number); \ + break; +LOG_LEVEL_LIST +#undef LOG_LEVEL + } + } + + for (size_t i = 0; i < message_count; i++) { + _log.write(msg[i]); + } + + // Verify that lines are written to the expected log files + for (size_t i = 0; i < ARRAY_SIZE(lines); i++) { + char expected[256]; + jio_snprintf(expected, sizeof(expected), "msg[%d]: %s", + lines[i].message_number, LogLevel::name(lines[i].level)); + for (int level = lines[i].level; level > 0; level--) { + assert(file_contains_substring(_level_filename[level], expected), + "line #" SIZE_FORMAT " missing from log file '%s'", i, _level_filename[level]); + } + for (int level = lines[i].level + 1; level < LogLevel::Count; level++) { + assert(!file_contains_substring(_level_filename[level], expected), + "line #" SIZE_FORMAT " erroneously included in log file '%s'", i, _level_filename[level]); + } + } +} + +// Verify that messages are logged in the order they are added to the log message +void LogMessageTest::test_line_order() { + LogMessageBuffer msg; + msg.info("info line").error("error line").trace("trace line") + .error("another error").warning("warning line").debug("debug line"); + _log.write(msg); + + const char* expected[] = { "info line", "error line", "trace line", + "another error", "warning line", "debug line", NULL }; + assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected), + "output missing or in incorrect order"); +} + +void LogMessageTest::test_long_message() { + // Write 10K bytes worth of log data + LogMessageBuffer msg; + const size_t size = 10 * K; + const char* start_marker = "#start#"; + const char* end_marker = "#the end#"; + char* data = NEW_C_HEAP_ARRAY(char, size, mtLogging); + + // fill buffer with start_marker...some data...end_marker + sprintf(data, "%s", start_marker); + for (size_t i = strlen(start_marker); i < size; i++) { + data[i] = '0' + (i % 10); + } + sprintf(data + size - strlen(end_marker) - 1, "%s", end_marker); + + msg.trace("%s", data); // Adds a newline, making the message exactly 10K in length. + _log.write(msg); + + const char* expected[] = { start_marker, "0123456789", end_marker, NULL }; + assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected), + "unable to print long line"); + FREE_C_HEAP_ARRAY(char, data); +} + +void LogMessageTest::test_message_with_many_lines() { + const size_t lines = 100; + const size_t line_length = 16; + + LogMessageBuffer msg; + for (size_t i = 0; i < lines; i++) { + msg.info("Line #" SIZE_FORMAT, i); + } + _log.write(msg); + + char expected_lines_data[lines][line_length]; + const char* expected_lines[lines + 1]; + for (size_t i = 0; i < lines; i++) { + jio_snprintf(&expected_lines_data[i][0], line_length, "Line #" SIZE_FORMAT, i); + expected_lines[i] = expected_lines_data[i]; + } + expected_lines[lines] = NULL; + + assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected_lines), + "couldn't find all lines in multiline message"); +} + +static size_t dummy_prefixer(char* buf, size_t len) { + static int i = 0; + const char* prefix = "some prefix: "; + const size_t prefix_len = strlen(prefix); + if (len < prefix_len) { + return prefix_len; + } + jio_snprintf(buf, len, "%s", prefix); + return prefix_len; +} + +void LogMessageTest::test_prefixing() { + LogMessageBuffer msg; + msg.set_prefix(dummy_prefixer); + for (int i = 0; i < 3; i++) { + msg.info("test %d", i); + } + msg.set_prefix(NULL); + msg.info("test 3"); + _log.write(msg); + + const char* expected[] = { + "] some prefix: test 0", + "] some prefix: test 1", + "] some prefix: test 2", + "] test 3", + NULL + }; + assert(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected), "error in prefixed output"); +} + +void LogMessageTest::test_scoped_messages() { + { + LogMessage(logging) msg; + msg.info("scoped info"); + msg.warning("scoped warn"); + assert(!file_contains_substring(_level_filename[LogLevel::Info], "scoped info"), + "scoped log message written prematurely"); + } + assert(file_contains_substring(_level_filename[LogLevel::Info], "scoped info"), + "missing output from scoped log message"); + assert(file_contains_substring(_level_filename[LogLevel::Warning], "scoped warn"), + "missing output from scoped log message"); +} + +void LogMessageTest::test_scoped_flushing() { + { + LogMessage(logging) msg; + msg.info("manual flush info"); + msg.flush(); + assert(file_contains_substring(_level_filename[LogLevel::Info], "manual flush info"), + "missing output from manually flushed scoped log message"); + } + const char* tmp[] = {"manual flush info", "manual flush info", NULL}; + assert(!file_contains_substrings_in_order(_level_filename[LogLevel::Info], tmp), + "log file contains duplicate lines from single scoped log message"); +} + +void LogMessageTest::test_scoped_reset() { + { + LogMessage(logging) msg, partial; + msg.info("%s", "info reset msg"); + msg.reset(); + partial.info("%s", "info reset msg"); + partial.reset(); + partial.trace("%s", "trace reset msg"); + } + assert(!file_contains_substring(_level_filename[LogLevel::Info], "info reset msg"), + "reset message written anyway"); + assert(file_contains_substring(_level_filename[LogLevel::Trace], "trace reset msg"), + "missing message from partially reset scoped log message"); +} + + static int Test_logconfiguration_subscribe_triggered = 0; static void Test_logconfiguration_subscribe_helper() { @@ -883,4 +1175,28 @@ void Test_invalid_log_file() { remove(target_name); } +// Ensure -Xlog:help and LogConfiguration::describe contain tagset descriptions +void Test_logtagset_descriptions() { + for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) { + char expected[1024]; + d->tagset->label(expected, sizeof(expected), "+"); + jio_snprintf(expected + strlen(expected), + sizeof(expected) - strlen(expected), + ": %s", d->descr); + + ResourceMark rm; + stringStream ss; + LogConfiguration::describe(&ss); + assert(strstr(ss.as_string(), expected) != NULL, + "missing log tag set descriptions in LogConfiguration::describe"); + + TestLogFile file("log_tagset_descriptions"); + FILE* fp = fopen(file.name(), "w+"); + assert(fp != NULL, "File open error"); + LogConfiguration::print_command_line_help(fp); + fclose(fp); + assert(number_of_lines_with_substring_in_file(file.name(), expected) > 0, + "missing log tag set descriptions in -Xlog:help output"); + } +} #endif // PRODUCT diff --git a/hotspot/src/share/vm/logging/log.hpp b/hotspot/src/share/vm/logging/log.hpp index 64664a52366..5d36a6b4fe9 100644 --- a/hotspot/src/share/vm/logging/log.hpp +++ b/hotspot/src/share/vm/logging/log.hpp @@ -32,6 +32,8 @@ #include "runtime/os.hpp" #include "utilities/debug.hpp" +class LogMessageBuffer; + // // Logging macros // @@ -138,6 +140,10 @@ class LogImpl VALUE_OBJ_CLASS_SPEC { va_end(args); } + static void write(const LogMessageBuffer& msg) { + LogTagSetMapping::tagset().log(msg); + }; + template ATTRIBUTE_PRINTF(1, 2) static void write(const char* fmt, ...) { diff --git a/hotspot/src/share/vm/logging/logConfiguration.cpp b/hotspot/src/share/vm/logging/logConfiguration.cpp index 6f9f7bb2a27..f09b3b56596 100644 --- a/hotspot/src/share/vm/logging/logConfiguration.cpp +++ b/hotspot/src/share/vm/logging/logConfiguration.cpp @@ -29,6 +29,7 @@ #include "logging/logDiagnosticCommand.hpp" #include "logging/logFileOutput.hpp" #include "logging/logOutput.hpp" +#include "logging/logStream.hpp" #include "logging/logTagLevelExpression.hpp" #include "logging/logTagSet.hpp" #include "memory/allocation.inline.hpp" @@ -75,11 +76,17 @@ bool ConfigurationLock::current_thread_has_lock() { void LogConfiguration::post_initialize() { LogDiagnosticCommand::registerCommand(); Log(logging) log; - log.info("Log configuration fully initialized."); - log_develop_info(logging)("Develop logging is available."); - if (log.is_trace()) { - ResourceMark rm; - describe(log.trace_stream()); + if (log.is_info()) { + log.info("Log configuration fully initialized."); + log_develop_info(logging)("Develop logging is available."); + if (log.is_debug()) { + LogStream debug_stream(log.debug()); + describe(&debug_stream); + if (log.is_trace()) { + LogStream trace_stream(log.trace()); + LogTagSet::list_all_tagsets(&trace_stream); + } + } } } @@ -382,7 +389,7 @@ bool LogConfiguration::parse_log_arguments(const char* outputstr, return true; } -void LogConfiguration::describe(outputStream* out) { +void LogConfiguration::describe_available(outputStream* out){ out->print("Available log levels:"); for (size_t i = 0; i < LogLevel::Count; i++) { out->print("%s %s", (i == 0 ? "" : ","), LogLevel::name(static_cast(i))); @@ -402,20 +409,31 @@ void LogConfiguration::describe(outputStream* out) { } out->cr(); - ConfigurationLock cl; + LogTagSet::describe_tagsets(out); +} + +void LogConfiguration::describe_current_configuration(outputStream* out){ out->print_cr("Log output configuration:"); for (size_t i = 0; i < _n_outputs; i++) { out->print("#" SIZE_FORMAT ": %s %s ", i, _outputs[i]->name(), _outputs[i]->config_string()); + char delimiter[2] = {0}; for (size_t d = 0; d < LogDecorators::Count; d++) { LogDecorators::Decorator decorator = static_cast(d); if (_outputs[i]->decorators().is_decorator(decorator)) { - out->print("%s,", LogDecorators::name(decorator)); + out->print("%s%s", delimiter, LogDecorators::name(decorator)); + *delimiter = ','; } } out->cr(); } } +void LogConfiguration::describe(outputStream* out) { + describe_available(out); + ConfigurationLock cl; + describe_current_configuration(out); +} + void LogConfiguration::print_command_line_help(FILE* out) { jio_fprintf(out, "-Xlog Usage: -Xlog[:[what][:[output][:[decorators][:output-options]]]]\n" "\t where 'what' is a combination of tags and levels on the form tag1[+tag2...][*][=level][,...]\n" @@ -439,7 +457,10 @@ void LogConfiguration::print_command_line_help(FILE* out) { } jio_fprintf(out, "\n Specifying 'all' instead of a tag combination matches all tag combinations.\n\n"); - jio_fprintf(out, "Available log outputs:\n" + fileStream stream(out, false); + LogTagSet::describe_tagsets(&stream); + + jio_fprintf(out, "\nAvailable log outputs:\n" " stdout, stderr, file=\n" " Specifying %%p and/or %%t in the filename will expand to the JVM's PID and startup timestamp, respectively.\n\n" @@ -454,7 +475,7 @@ void LogConfiguration::print_command_line_help(FILE* out) { " -Xlog:gc=debug:file=gc.txt:none\n" "\t Log messages tagged with 'gc' tag using 'debug' level to file 'gc.txt' with no decorations.\n\n" - " -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1024\n" + " -Xlog:gc=trace:file=gctrace.txt:uptimemillis,pids:filecount=5,filesize=1m\n" "\t Log messages tagged with 'gc' tag using 'trace' level to a rotating fileset of 5 files of size 1MB,\n" "\t using the base name 'gctrace.txt', with 'uptimemillis' and 'pid' decorations.\n\n" diff --git a/hotspot/src/share/vm/logging/logConfiguration.hpp b/hotspot/src/share/vm/logging/logConfiguration.hpp index 9b7325b370e..9efbadddd02 100644 --- a/hotspot/src/share/vm/logging/logConfiguration.hpp +++ b/hotspot/src/share/vm/logging/logConfiguration.hpp @@ -37,6 +37,7 @@ class LogTagLevelExpression; // kept implicitly in the LogTagSets and their LogOutputLists. During configuration the tagsets // are iterated over and updated accordingly. class LogConfiguration : public AllStatic { + friend class VMError; public: // Function for listeners typedef void (*UpdateListenerFunction)(void); @@ -79,6 +80,11 @@ class LogConfiguration : public AllStatic { // This should be called after any configuration change while still holding ConfigurationLock static void notify_update_listeners(); + // Respectively describe the built-in and runtime dependent portions of the configuration. + static void describe_available(outputStream* out); + static void describe_current_configuration(outputStream* out); + + public: // Initialization and finalization of log configuration, to be run at vm startup and shutdown respectively. static void initialize(jlong vm_start_time); diff --git a/hotspot/src/share/vm/logging/logDecorations.cpp b/hotspot/src/share/vm/logging/logDecorations.cpp index 210ab31313a..79c221567a8 100644 --- a/hotspot/src/share/vm/logging/logDecorations.cpp +++ b/hotspot/src/share/vm/logging/logDecorations.cpp @@ -32,7 +32,7 @@ jlong LogDecorations::_vm_start_time_millis = 0; const char* LogDecorations::_host_name = ""; LogDecorations::LogDecorations(LogLevelType level, const LogTagSet &tagset, const LogDecorators &decorators) - : _level(level), _tagset(tagset), _millis(-1) { + : _level(level), _tagset(tagset), _millis(-1) { create_decorations(decorators); } @@ -110,8 +110,9 @@ char * LogDecorations::create_tid_decoration(char* pos) { } char* LogDecorations::create_level_decoration(char* pos) { - int written = jio_snprintf(pos, DecorationsBufferSize - (pos - _decorations_buffer), "%s", LogLevel::name(_level)); - ASSERT_AND_RETURN(written, pos) + // Avoid generating the level decoration because it may change. + // The decoration() method has a special case for level decorations. + return pos; } char* LogDecorations::create_tags_decoration(char* pos) { diff --git a/hotspot/src/share/vm/logging/logDecorations.hpp b/hotspot/src/share/vm/logging/logDecorations.hpp index fcc166147e8..3988bac83b3 100644 --- a/hotspot/src/share/vm/logging/logDecorations.hpp +++ b/hotspot/src/share/vm/logging/logDecorations.hpp @@ -53,7 +53,18 @@ class LogDecorations VALUE_OBJ_CLASS_SPEC { LogDecorations(LogLevelType level, const LogTagSet& tagset, const LogDecorators& decorators); + LogLevelType level() const { + return _level; + } + + void set_level(LogLevelType level) { + _level = level; + } + const char* decoration(LogDecorators::Decorator decorator) const { + if (decorator == LogDecorators::level_decorator) { + return LogLevel::name(_level); + } return _decoration_offset[decorator]; } }; diff --git a/hotspot/src/share/vm/logging/logDecorators.hpp b/hotspot/src/share/vm/logging/logDecorators.hpp index 1e52124060f..2d30700b614 100644 --- a/hotspot/src/share/vm/logging/logDecorators.hpp +++ b/hotspot/src/share/vm/logging/logDecorators.hpp @@ -102,6 +102,10 @@ class LogDecorators VALUE_OBJ_CLASS_SPEC { _decorators |= source._decorators; } + bool is_empty() const { + return _decorators == 0; + } + bool is_decorator(LogDecorators::Decorator decorator) const { return (_decorators & mask(decorator)) != 0; } diff --git a/hotspot/src/share/vm/logging/logFileOutput.cpp b/hotspot/src/share/vm/logging/logFileOutput.cpp index 7f41bd995fb..3000e61229f 100644 --- a/hotspot/src/share/vm/logging/logFileOutput.cpp +++ b/hotspot/src/share/vm/logging/logFileOutput.cpp @@ -26,6 +26,7 @@ #include "logging/logConfiguration.hpp" #include "logging/logFileOutput.hpp" #include "memory/allocation.inline.hpp" +#include "runtime/arguments.hpp" #include "runtime/os.inline.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/defaultStream.hpp" @@ -187,14 +188,15 @@ bool LogFileOutput::parse_options(const char* options, outputStream* errstream) } _file_count = static_cast(value); } else if (strcmp(FileSizeOptionKey, key) == 0) { - size_t value = parse_value(value_str); - if (value == SIZE_MAX || value > SIZE_MAX / K) { + julong value; + success = Arguments::atojulong(value_str, &value); + if (!success || (value > SIZE_MAX)) { errstream->print_cr("Invalid option: %s must be in range [0, " - SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX / K); + SIZE_FORMAT "]", FileSizeOptionKey, SIZE_MAX); success = false; break; } - _rotate_size = value * K; + _rotate_size = static_cast(value); } else { errstream->print_cr("Invalid option '%s' for log file output.", key); success = false; @@ -252,7 +254,7 @@ bool LogFileOutput::initialize(const char* options, outputStream* errstream) { if (_file_count == 0 && is_regular_file(_file_name)) { log_trace(logging)("Truncating log file"); - os::ftruncate(os::fileno(_stream), 0); + os::ftruncate(os::get_fileno(_stream), 0); } return true; @@ -276,6 +278,24 @@ int LogFileOutput::write(const LogDecorations& decorations, const char* msg) { return written; } +int LogFileOutput::write(LogMessageBuffer::Iterator msg_iterator) { + if (_stream == NULL) { + // An error has occurred with this output, avoid writing to it. + return 0; + } + + _rotation_semaphore.wait(); + int written = LogFileStreamOutput::write(msg_iterator); + _current_size += written; + + if (should_rotate()) { + rotate(); + } + _rotation_semaphore.signal(); + + return written; +} + void LogFileOutput::archive() { assert(_archive_name != NULL && _archive_name_len > 0, "Rotation must be configured before using this function."); int ret = jio_snprintf(_archive_name, _archive_name_len, "%s.%0*u", diff --git a/hotspot/src/share/vm/logging/logFileOutput.hpp b/hotspot/src/share/vm/logging/logFileOutput.hpp index adfd3722cef..1831016eb6c 100644 --- a/hotspot/src/share/vm/logging/logFileOutput.hpp +++ b/hotspot/src/share/vm/logging/logFileOutput.hpp @@ -83,6 +83,7 @@ class LogFileOutput : public LogFileStreamOutput { virtual ~LogFileOutput(); virtual bool initialize(const char* options, outputStream* errstream); virtual int write(const LogDecorations& decorations, const char* msg); + virtual int write(LogMessageBuffer::Iterator msg_iterator); virtual void force_rotate(); virtual const char* name() const { diff --git a/hotspot/src/share/vm/logging/logFileStreamOutput.cpp b/hotspot/src/share/vm/logging/logFileStreamOutput.cpp index 00dfcc5b76b..20dfd2db6db 100644 --- a/hotspot/src/share/vm/logging/logFileStreamOutput.cpp +++ b/hotspot/src/share/vm/logging/logFileStreamOutput.cpp @@ -25,14 +25,13 @@ #include "logging/logDecorators.hpp" #include "logging/logDecorations.hpp" #include "logging/logFileStreamOutput.hpp" +#include "logging/logMessageBuffer.hpp" #include "memory/allocation.inline.hpp" LogStdoutOutput LogStdoutOutput::_instance; LogStderrOutput LogStderrOutput::_instance; -int LogFileStreamOutput::write(const LogDecorations& decorations, const char* msg) { - char decoration_buf[LogDecorations::DecorationsBufferSize]; - char* position = decoration_buf; +int LogFileStreamOutput::write_decorations(const LogDecorations& decorations) { int total_written = 0; for (uint i = 0; i < LogDecorators::Count; i++) { @@ -40,23 +39,50 @@ int LogFileStreamOutput::write(const LogDecorations& decorations, const char* ms if (!_decorators.is_decorator(decorator)) { continue; } - int written = jio_snprintf(position, sizeof(decoration_buf) - total_written, "[%-*s]", - _decorator_padding[decorator], - decorations.decoration(decorator)); + + int written = jio_fprintf(_stream, "[%-*s]", + _decorator_padding[decorator], + decorations.decoration(decorator)); if (written <= 0) { return -1; } else if (static_cast(written - 2) > _decorator_padding[decorator]) { _decorator_padding[decorator] = written - 2; } - position += written; total_written += written; } - - if (total_written == 0) { - total_written = jio_fprintf(_stream, "%s\n", msg); - } else { - total_written = jio_fprintf(_stream, "%s %s\n", decoration_buf, msg); - } - fflush(_stream); return total_written; } + +int LogFileStreamOutput::write(const LogDecorations& decorations, const char* msg) { + const bool use_decorations = !_decorators.is_empty(); + + int written = 0; + os::flockfile(_stream); + if (use_decorations) { + written += write_decorations(decorations); + written += jio_fprintf(_stream, " "); + } + written += jio_fprintf(_stream, "%s\n", msg); + fflush(_stream); + os::funlockfile(_stream); + + return written; +} + +int LogFileStreamOutput::write(LogMessageBuffer::Iterator msg_iterator) { + const bool use_decorations = !_decorators.is_empty(); + + int written = 0; + os::flockfile(_stream); + for (; !msg_iterator.is_at_end(); msg_iterator++) { + if (use_decorations) { + written += write_decorations(msg_iterator.decorations()); + written += jio_fprintf(_stream, " "); + } + written += jio_fprintf(_stream, "%s\n", msg_iterator.message()); + } + fflush(_stream); + os::funlockfile(_stream); + + return written; +} diff --git a/hotspot/src/share/vm/logging/logFileStreamOutput.hpp b/hotspot/src/share/vm/logging/logFileStreamOutput.hpp index a4c739cfcfa..3a5c1b5b0fc 100644 --- a/hotspot/src/share/vm/logging/logFileStreamOutput.hpp +++ b/hotspot/src/share/vm/logging/logFileStreamOutput.hpp @@ -42,8 +42,11 @@ class LogFileStreamOutput : public LogOutput { } } + int write_decorations(const LogDecorations& decorations); + public: - virtual int write(const LogDecorations &decorations, const char* msg); + virtual int write(const LogDecorations& decorations, const char* msg); + virtual int write(LogMessageBuffer::Iterator msg_iterator); }; class LogStdoutOutput : public LogFileStreamOutput { diff --git a/hotspot/src/share/vm/logging/logMessage.hpp b/hotspot/src/share/vm/logging/logMessage.hpp new file mode 100644 index 00000000000..e8172d15062 --- /dev/null +++ b/hotspot/src/share/vm/logging/logMessage.hpp @@ -0,0 +1,105 @@ +/* + * 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. + * + */ +#ifndef SHARE_VM_LOGGING_LOGMESSAGE_HPP +#define SHARE_VM_LOGGING_LOGMESSAGE_HPP + +#include "logging/log.hpp" +#include "logging/logMessageBuffer.hpp" +#include "logging/logPrefix.hpp" +#include "logging/logTag.hpp" + +// The LogMessage class represents a multi-part/multi-line message +// that is guaranteed to be sent and written to the log outputs +// in a way that prevents interleaving by other log messages. +// +// The interface of LogMessage is very similar to the Log class, +// with printf functions for each level (trace(), debug(), etc). +// The difference is that these functions will append/write to the +// LogMessage, which only buffers the message-parts until the whole +// message is sent to a log (using Log::write). Internal buffers +// are C heap allocated lazily on first write. LogMessages are +// automatically written when they go out of scope. +// +// Example usage: +// +// { +// LogMessage(logging) msg; +// if (msg.is_debug()) { +// msg.debug("debug message"); +// msg.trace("additional trace information"); +// } +// } +// +// Log outputs on trace level will see both of the messages above, +// and the trace line will immediately follow the debug line. +// They will have identical decorations (apart from level). +// Log outputs on debug level will see the debug message, +// but not the trace message. +// +#define LogMessage(...) LogMessageImpl +template +class LogMessageImpl : public LogMessageBuffer { + private: + LogImpl _log; + bool _has_content; + + public: + LogMessageImpl() : _has_content(false) { + } + + ~LogMessageImpl() { + if (_has_content) { + flush(); + } + } + + void flush() { + _log.write(*this); + reset(); + } + + void reset() { + _has_content = false; + LogMessageBuffer::reset(); + } + + ATTRIBUTE_PRINTF(3, 0) + void vwrite(LogLevelType level, const char* fmt, va_list args) { + if (!_has_content) { + _has_content = true; + set_prefix(LogPrefix::prefix); + } + LogMessageBuffer::vwrite(level, fmt, args); + } + +#define LOG_LEVEL(level, name) \ + bool is_##name() const { \ + return _log.is_level(LogLevel::level); \ + } + LOG_LEVEL_LIST +#undef LOG_LEVEL +}; + +#endif // SHARE_VM_LOGGING_LOGMESSAGE_HPP diff --git a/hotspot/src/share/vm/logging/logMessageBuffer.cpp b/hotspot/src/share/vm/logging/logMessageBuffer.cpp new file mode 100644 index 00000000000..f652dc5bd98 --- /dev/null +++ b/hotspot/src/share/vm/logging/logMessageBuffer.cpp @@ -0,0 +1,146 @@ +/* + * 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. + * + */ +#include "precompiled.hpp" +#include "logging/logMessageBuffer.hpp" +#include "memory/allocation.inline.hpp" +#include "runtime/thread.inline.hpp" + +template +static void grow(T*& buffer, size_t& capacity, size_t minimum_length = 0) { + size_t new_size = capacity * 2; + if (new_size < minimum_length) { + new_size = minimum_length; + } + buffer = REALLOC_C_HEAP_ARRAY(T, buffer, new_size, mtLogging); + capacity = new_size; +} + +LogMessageBuffer::LogMessageBuffer() : _message_buffer_size(0), + _message_buffer_capacity(0), + _message_buffer(NULL), + _line_count(0), + _line_capacity(0), + _lines(NULL), + _allocated(false), + _least_detailed_level(LogLevel::Off), + _prefix_fn(NULL) { +} + +LogMessageBuffer::~LogMessageBuffer() { + if (_allocated) { + FREE_C_HEAP_ARRAY(char, _message_buffer); + FREE_C_HEAP_ARRAY(LogLine, _lines); + } +} + +void LogMessageBuffer::reset() { + _message_buffer_size = 0; + _line_count = 0; +} + +void LogMessageBuffer::initialize_buffers() { + assert(!_allocated, "buffer already initialized/allocated"); + _allocated = true; + _message_buffer = NEW_C_HEAP_ARRAY(char, InitialMessageBufferCapacity, mtLogging); + _lines = NEW_C_HEAP_ARRAY(LogLine, InitialLineCapacity, mtLogging); + _message_buffer_capacity = InitialMessageBufferCapacity; + _line_capacity = InitialLineCapacity; +} + +void LogMessageBuffer::Iterator::skip_messages_with_finer_level() { + for (; _current_line_index < _message._line_count; _current_line_index++) { + if (_message._lines[_current_line_index].level >= _level) { + break; + } + } +} + +void LogMessageBuffer::write(LogLevelType level, const char* fmt, ...) { + va_list args; + va_start(args, fmt); + vwrite(level, fmt, args); + va_end(args); +}; + +void LogMessageBuffer::vwrite(LogLevelType level, const char* fmt, va_list args) { + if (!_allocated) { + initialize_buffers(); + } + + if (level > _least_detailed_level) { + _least_detailed_level = level; + } + + size_t written; + for (int attempts = 0; attempts < 2; attempts++) { + written = 0; + size_t remaining_buffer_length = _message_buffer_capacity - _message_buffer_size; + char* current_buffer_position = _message_buffer + _message_buffer_size; + + if (_prefix_fn != NULL) { + written += _prefix_fn(current_buffer_position, remaining_buffer_length); + current_buffer_position += written; + if (remaining_buffer_length < written) { + remaining_buffer_length = 0; + } else { + remaining_buffer_length -= written; + } + } + + va_list copy; + va_copy(copy, args); + written += (size_t)os::log_vsnprintf(current_buffer_position, remaining_buffer_length, fmt, copy) + 1; + va_end(copy); + if (written > _message_buffer_capacity - _message_buffer_size) { + assert(attempts == 0, "Second attempt should always have a sufficiently large buffer (resized to fit)."); + grow(_message_buffer, _message_buffer_capacity, _message_buffer_size + written); + continue; + } + break; + } + + if (_line_count == _line_capacity) { + grow(_lines, _line_capacity); + } + + _lines[_line_count].level = level; + _lines[_line_count].message_offset = _message_buffer_size; + _message_buffer_size += written; + _line_count++; +} + +#define LOG_LEVEL(level, name) \ +LogMessageBuffer& LogMessageBuffer::v##name(const char* fmt, va_list args) { \ + vwrite(LogLevel::level, fmt, args); \ + return *this; \ +} \ +LogMessageBuffer& LogMessageBuffer::name(const char* fmt, ...) { \ + va_list args; \ + va_start(args, fmt); \ + vwrite(LogLevel::level, fmt, args); \ + va_end(args); \ + return *this; \ +} +LOG_LEVEL_LIST +#undef LOG_LEVEL diff --git a/hotspot/src/share/vm/logging/logMessageBuffer.hpp b/hotspot/src/share/vm/logging/logMessageBuffer.hpp new file mode 100644 index 00000000000..3b722d55e55 --- /dev/null +++ b/hotspot/src/share/vm/logging/logMessageBuffer.hpp @@ -0,0 +1,131 @@ +/* + * 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. + * + */ +#ifndef SHARE_VM_LOGGING_LOGMESSAGEBUFFER_HPP +#define SHARE_VM_LOGGING_LOGMESSAGEBUFFER_HPP + +#include "logging/logDecorations.hpp" +#include "logging/logLevel.hpp" +#include "memory/allocation.hpp" + +class LogMessageBuffer : public StackObj { + friend class LogMessageTest; + protected: + struct LogLine VALUE_OBJ_CLASS_SPEC { + LogLevelType level; + size_t message_offset; + }; + static const size_t InitialLineCapacity = 10; + static const size_t InitialMessageBufferCapacity = 1024; + + size_t _message_buffer_size; + size_t _message_buffer_capacity; + char* _message_buffer; + + size_t _line_count; + size_t _line_capacity; + LogLine* _lines; + + bool _allocated; + LogLevelType _least_detailed_level; + size_t (*_prefix_fn)(char*, size_t); + + void initialize_buffers(); + + private: + // Forbid copy assignment and copy constructor. + void operator=(const LogMessageBuffer& ref) {} + LogMessageBuffer(const LogMessageBuffer& ref) {} + + public: + LogMessageBuffer(); + ~LogMessageBuffer(); + + class Iterator { + private: + const LogMessageBuffer& _message; + size_t _current_line_index; + LogLevelType _level; + LogDecorations &_decorations; + + void skip_messages_with_finer_level(); + + public: + Iterator(const LogMessageBuffer& message, LogLevelType level, LogDecorations& decorations) + : _message(message), _level(level), _decorations(decorations), _current_line_index(0) { + skip_messages_with_finer_level(); + } + + void operator++(int) { + _current_line_index++; + skip_messages_with_finer_level(); + } + + bool is_at_end() { + return _current_line_index == _message._line_count; + } + + const char* message() const { + return _message._message_buffer + _message._lines[_current_line_index].message_offset; + } + + const LogDecorations& decorations() { + _decorations.set_level(_message._lines[_current_line_index].level); + return _decorations; + } + }; + + void reset(); + + LogLevelType least_detailed_level() const { + return _least_detailed_level; + } + + Iterator iterator(LogLevelType level, LogDecorations& decorations) const { + return Iterator(*this, level, decorations); + } + + // Lines in LogMessageBuffers are not automatically prefixed based on tags + // like regular simple messages (see LogPrefix.hpp for more about prefixes). + // It is, however, possible to specify a prefix per LogMessageBuffer, + // using set_prefix(). Lines added to the LogMessageBuffer after a prefix + // function has been set will be prefixed automatically. + // Setting this to NULL will disable prefixing. + void set_prefix(size_t (*prefix_fn)(char*, size_t)) { + _prefix_fn = prefix_fn; + } + + ATTRIBUTE_PRINTF(3, 4) + void write(LogLevelType level, const char* fmt, ...); + + ATTRIBUTE_PRINTF(3, 0) + virtual void vwrite(LogLevelType level, const char* fmt, va_list args); + +#define LOG_LEVEL(level, name) \ + LogMessageBuffer& v##name(const char* fmt, va_list args) ATTRIBUTE_PRINTF(2, 0); \ + LogMessageBuffer& name(const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3); + LOG_LEVEL_LIST +#undef LOG_LEVEL +}; + +#endif // SHARE_VM_LOGGING_LOGMESSAGEBUFFER_HPP diff --git a/hotspot/src/share/vm/logging/logOutput.hpp b/hotspot/src/share/vm/logging/logOutput.hpp index 5f06f388efd..cb5de53c319 100644 --- a/hotspot/src/share/vm/logging/logOutput.hpp +++ b/hotspot/src/share/vm/logging/logOutput.hpp @@ -26,10 +26,12 @@ #include "logging/logDecorators.hpp" #include "logging/logLevel.hpp" +#include "logging/logMessageBuffer.hpp" #include "memory/allocation.hpp" #include "utilities/globalDefinitions.hpp" class LogDecorations; +class LogMessageBuffer; class LogTagSet; // The base class/interface for log outputs. @@ -83,7 +85,8 @@ class LogOutput : public CHeapObj { virtual const char* name() const = 0; virtual bool initialize(const char* options, outputStream* errstream) = 0; - virtual int write(const LogDecorations &decorations, const char* msg) = 0; + virtual int write(const LogDecorations& decorations, const char* msg) = 0; + virtual int write(LogMessageBuffer::Iterator msg_iterator) = 0; }; #endif // SHARE_VM_LOGGING_LOGOUTPUT_HPP diff --git a/hotspot/src/share/vm/logging/logOutputList.hpp b/hotspot/src/share/vm/logging/logOutputList.hpp index c20edd56bf0..e983cb0d7c2 100644 --- a/hotspot/src/share/vm/logging/logOutputList.hpp +++ b/hotspot/src/share/vm/logging/logOutputList.hpp @@ -113,6 +113,10 @@ class LogOutputList VALUE_OBJ_CLASS_SPEC { bool operator!=(const LogOutputNode *ref) const { return _current != ref; } + + LogLevelType level() const { + return _current->_level; + } }; Iterator iterator(LogLevelType level = LogLevel::Last) { diff --git a/hotspot/src/share/vm/logging/logPrefix.hpp b/hotspot/src/share/vm/logging/logPrefix.hpp index 8d2ae12adf3..e4a97ca1fd5 100644 --- a/hotspot/src/share/vm/logging/logPrefix.hpp +++ b/hotspot/src/share/vm/logging/logPrefix.hpp @@ -64,6 +64,7 @@ DEBUG_ONLY(size_t Test_log_prefix_prefixer(char* buf, size_t len);) LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, liveness)) \ LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, marking)) \ LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, metaspace)) \ + LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, mmu)) \ LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, phases)) \ LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, phases, start)) \ LOG_PREFIX(GCId::print_prefix, LOG_TAGS(gc, phases, task)) \ @@ -95,9 +96,14 @@ struct LogPrefix : public AllStatic { #define LOG_PREFIX(fn, ...) \ template <> struct LogPrefix<__VA_ARGS__> { \ static size_t prefix(char* buf, size_t len) { \ - DEBUG_ONLY(buf[0] = '\0';) \ size_t ret = fn(buf, len); \ - assert(ret == strlen(buf), "Length mismatch ret (" SIZE_FORMAT ") != buf length (" SIZE_FORMAT ")", ret, strlen(buf)); \ + /* Either prefix did fit (strlen(buf) == ret && ret < len) */ \ + /* or the prefix didn't fit in buffer (ret > len && strlen(buf) < len) */ \ + assert(ret == 0 || strlen(buf) < len, \ + "Buffer overrun by prefix function."); \ + assert(ret == 0 || strlen(buf) == ret || ret >= len, \ + "Prefix function should return length of prefix written," \ + " or the intended length of prefix if the buffer was too small."); \ return ret; \ } \ }; diff --git a/hotspot/src/share/vm/logging/logTag.hpp b/hotspot/src/share/vm/logging/logTag.hpp index ede507df242..f5dc582c6b5 100644 --- a/hotspot/src/share/vm/logging/logTag.hpp +++ b/hotspot/src/share/vm/logging/logTag.hpp @@ -32,26 +32,28 @@ // (The tags 'all', 'disable' and 'help' are special tags that can // not be used in log calls, and should not be listed below.) #define LOG_TAG_LIST \ - LOG_TAG(alloc) \ + LOG_TAG(add) \ LOG_TAG(age) \ + LOG_TAG(alloc) \ LOG_TAG(arguments) \ + LOG_TAG(annotation) \ LOG_TAG(barrier) \ LOG_TAG(biasedlocking) \ LOG_TAG(bot) \ + LOG_TAG(breakpoint) \ LOG_TAG(census) \ + LOG_TAG(class) \ LOG_TAG(classhisto) \ - LOG_TAG(classresolve) \ - LOG_TAG(classinit) \ - LOG_TAG(classload) /* Trace all classes loaded */ \ - LOG_TAG(classloaderdata) /* class loader loader_data lifetime */ \ - LOG_TAG(classunload) /* Trace unloading of classes */ \ - LOG_TAG(classpath) \ + LOG_TAG(cleanup) \ LOG_TAG(compaction) \ LOG_TAG(constraints) \ + LOG_TAG(constantpool) \ LOG_TAG(coops) \ LOG_TAG(cpu) \ LOG_TAG(cset) \ + LOG_TAG(data) \ LOG_TAG(defaultmethods) \ + LOG_TAG(dump) \ LOG_TAG(ergo) \ LOG_TAG(exceptions) \ LOG_TAG(exit) \ @@ -60,28 +62,45 @@ LOG_TAG(heap) \ LOG_TAG(humongous) \ LOG_TAG(ihop) \ + LOG_TAG(iklass) \ + LOG_TAG(init) \ LOG_TAG(itables) \ LOG_TAG(jni) \ + LOG_TAG(jvmti) \ LOG_TAG(liveness) \ + LOG_TAG(load) /* Trace all classes loaded */ \ + LOG_TAG(loader) \ LOG_TAG(logging) \ + LOG_TAG(mark) \ LOG_TAG(marking) \ + LOG_TAG(methodcomparator) \ + LOG_TAG(metadata) \ LOG_TAG(metaspace) \ + LOG_TAG(mmu) \ LOG_TAG(modules) \ LOG_TAG(monitorinflation) \ LOG_TAG(monitormismatch) \ + LOG_TAG(nmethod) \ + LOG_TAG(normalize) \ + LOG_TAG(objecttagging) \ + LOG_TAG(obsolete) \ + LOG_TAG(oopmap) \ LOG_TAG(os) \ LOG_TAG(pagesize) \ + LOG_TAG(path) \ LOG_TAG(phases) \ LOG_TAG(plab) \ LOG_TAG(promotion) \ LOG_TAG(preorder) /* Trace all classes loaded in order referenced (not loaded) */ \ LOG_TAG(protectiondomain) /* "Trace protection domain verification" */ \ LOG_TAG(ref) \ + LOG_TAG(redefine) \ LOG_TAG(refine) \ LOG_TAG(region) \ LOG_TAG(remset) \ + LOG_TAG(purge) \ + LOG_TAG(resolve) \ LOG_TAG(safepoint) \ - LOG_TAG(safepointcleanup) \ LOG_TAG(scavenge) \ LOG_TAG(scrub) \ LOG_TAG(stacktrace) \ @@ -91,6 +110,8 @@ LOG_TAG(stats) \ LOG_TAG(stringdedup) \ LOG_TAG(stringtable) \ + LOG_TAG(stackmap) \ + LOG_TAG(subclass) \ LOG_TAG(survivor) \ LOG_TAG(sweep) \ LOG_TAG(task) \ @@ -98,6 +119,9 @@ LOG_TAG(thread) \ LOG_TAG(tlab) \ LOG_TAG(time) \ + LOG_TAG(timer) \ + LOG_TAG(update) \ + LOG_TAG(unload) /* Trace unloading of classes */ \ LOG_TAG(verification) \ LOG_TAG(verify) \ LOG_TAG(vmoperation) \ diff --git a/hotspot/src/share/vm/logging/logTagSet.cpp b/hotspot/src/share/vm/logging/logTagSet.cpp index 96aae628857..446c2b46dc0 100644 --- a/hotspot/src/share/vm/logging/logTagSet.cpp +++ b/hotspot/src/share/vm/logging/logTagSet.cpp @@ -24,10 +24,13 @@ #include "precompiled.hpp" #include "logging/logDecorations.hpp" #include "logging/logLevel.hpp" +#include "logging/logMessageBuffer.hpp" #include "logging/logOutput.hpp" #include "logging/logTag.hpp" #include "logging/logTagSet.hpp" +#include "logging/logTagSetDescriptions.hpp" #include "memory/allocation.inline.hpp" +#include "utilities/ostream.hpp" LogTagSet* LogTagSet::_list = NULL; size_t LogTagSet::_ntagsets = 0; @@ -74,6 +77,13 @@ void LogTagSet::log(LogLevelType level, const char* msg) { } } +void LogTagSet::log(const LogMessageBuffer& msg) { + LogDecorations decorations(LogLevel::Invalid, *this, _decorators); + for (LogOutputList::Iterator it = _output_list.iterator(msg.least_detailed_level()); it != _output_list.end(); it++) { + (*it)->write(msg.iterator(it.level(), decorations)); + } +} + int LogTagSet::label(char* buf, size_t len, const char* separator) const { int tot_written = 0; for (size_t i = 0; i < _ntags; i++) { @@ -119,3 +129,44 @@ void LogTagSet::vwrite(LogLevelType level, const char* fmt, va_list args) { } va_end(saved_args); } + +static const size_t TagSetBufferSize = 128; + +void LogTagSet::describe_tagsets(outputStream* out) { + out->print_cr("Described tag combinations:"); + for (const LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) { + char buf[TagSetBufferSize]; + d->tagset->label(buf, sizeof(buf), "+"); + out->print_cr(" %s: %s", buf, d->descr); + } +} + +static int qsort_strcmp(const void* a, const void* b) { + return strcmp((*(const char**)a), (*(const char**)b)); +} + +void LogTagSet::list_all_tagsets(outputStream* out) { + char** tagset_labels = NEW_C_HEAP_ARRAY(char*, _ntagsets, mtLogging); + + // Generate the list of tagset labels + size_t idx = 0; + for (LogTagSet* ts = first(); ts != NULL; ts = ts->next()) { + char buf[TagSetBufferSize]; + ts->label(buf, sizeof(buf), "+"); + tagset_labels[idx++] = os::strdup_check_oom(buf, mtLogging); + } + assert(idx == _ntagsets, "_ntagsets and list of tagsets not in sync"); + + // Sort them lexicographically + qsort(tagset_labels, _ntagsets, sizeof(*tagset_labels), qsort_strcmp); + + // Print and then free the labels + out->print("All available tag sets: "); + for (idx = 0; idx < _ntagsets; idx++) { + out->print("%s%s", (idx == 0 ? "" : ", "), tagset_labels[idx]); + os::free(tagset_labels[idx]); + } + out->cr(); + FREE_C_HEAP_ARRAY(char*, tagset_labels); +} + diff --git a/hotspot/src/share/vm/logging/logTagSet.hpp b/hotspot/src/share/vm/logging/logTagSet.hpp index 60080700d79..0b238b32b52 100644 --- a/hotspot/src/share/vm/logging/logTagSet.hpp +++ b/hotspot/src/share/vm/logging/logTagSet.hpp @@ -31,23 +31,25 @@ #include "logging/logTag.hpp" #include "utilities/globalDefinitions.hpp" +class LogMessageBuffer; + // The tagset represents a combination of tags that occur in a log call somewhere. // Tagsets are created automatically by the LogTagSetMappings and should never be // instantiated directly somewhere else. class LogTagSet VALUE_OBJ_CLASS_SPEC { private: static LogTagSet* _list; - static size_t _ntagsets; + static size_t _ntagsets; - LogTagSet* const _next; - size_t _ntags; - LogTagType _tag[LogTag::MaxTags]; + LogTagSet* const _next; + size_t _ntags; + LogTagType _tag[LogTag::MaxTags]; - LogOutputList _output_list; - LogDecorators _decorators; + LogOutputList _output_list; + LogDecorators _decorators; typedef size_t (*PrefixWriter)(char* buf, size_t size); - PrefixWriter _write_prefix; + PrefixWriter _write_prefix; // Keep constructor private to prevent incorrect instantiations of this class. // Only LogTagSetMappings can create/contain instances of this class. @@ -60,6 +62,9 @@ class LogTagSet VALUE_OBJ_CLASS_SPEC { friend class LogTagSetMapping; public: + static void describe_tagsets(outputStream* out); + static void list_all_tagsets(outputStream* out); + static LogTagSet* first() { return _list; } @@ -110,6 +115,7 @@ class LogTagSet VALUE_OBJ_CLASS_SPEC { return _output_list.is_level(level); } void log(LogLevelType level, const char* msg); + void log(const LogMessageBuffer& msg); ATTRIBUTE_PRINTF(3, 4) void write(LogLevelType level, const char* fmt, ...); diff --git a/hotspot/src/share/vm/logging/logTagSetDescriptions.cpp b/hotspot/src/share/vm/logging/logTagSetDescriptions.cpp new file mode 100644 index 00000000000..807e88dd415 --- /dev/null +++ b/hotspot/src/share/vm/logging/logTagSetDescriptions.cpp @@ -0,0 +1,42 @@ +/* + * 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. + * + */ +#include "precompiled.hpp" +#include "logging/logTag.hpp" +#include "logging/logTagSet.hpp" +#include "logging/logTagSetDescriptions.hpp" + +// List of described tag sets. Tags should be specified using the LOG_TAGS() +// macro. Described tag sets can be listed from command line (or DCMD) using +// -Xlog:help (or "VM.log list") +#define LOG_TAG_SET_DESCRIPTION_LIST \ + LOG_TAG_SET_DESCRIPTION(LOG_TAGS(logging), \ + "Logging for the log framework itself") + +#define LOG_TAG_SET_DESCRIPTION(tags, descr) \ + { &LogTagSetMapping::tagset(), descr }, + +struct LogTagSetDescription tagset_descriptions[] = { + LOG_TAG_SET_DESCRIPTION_LIST + { NULL, NULL } +}; diff --git a/hotspot/src/share/vm/logging/logTagSetDescriptions.hpp b/hotspot/src/share/vm/logging/logTagSetDescriptions.hpp new file mode 100644 index 00000000000..60e3660354d --- /dev/null +++ b/hotspot/src/share/vm/logging/logTagSetDescriptions.hpp @@ -0,0 +1,36 @@ +/* + * 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. + * + */ +#ifndef SHARE_VM_LOGGING_LOGTAGSETDESCRIPTIONS_HPP +#define SHARE_VM_LOGGING_LOGTAGSETDESCRIPTIONS_HPP + +class LogTagSet; + +struct LogTagSetDescription { + const LogTagSet* tagset; + const char* descr; +}; + +extern struct LogTagSetDescription tagset_descriptions[]; + +#endif // SHARE_VM_LOGGING_LOGTAGSETDESCRIPTIONS_HPP diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp index 5a3ae92cb60..f7dea3d6c91 100644 --- a/hotspot/src/share/vm/memory/allocation.cpp +++ b/hotspot/src/share/vm/memory/allocation.cpp @@ -664,64 +664,6 @@ void* Arena::internal_malloc_4(size_t x) { // Non-product code #ifndef PRODUCT -// The global operator new should never be called since it will usually indicate -// a memory leak. Use CHeapObj as the base class of such objects to make it explicit -// that they're allocated on the C heap. -// Commented out in product version to avoid conflicts with third-party C++ native code. -// -// In C++98/03 the throwing new operators are defined with the following signature: -// -// void* operator new(std::size_tsize) throw(std::bad_alloc); -// void* operator new[](std::size_tsize) throw(std::bad_alloc); -// -// while all the other (non-throwing) new and delete operators are defined with an empty -// throw clause (i.e. "operator delete(void* p) throw()") which means that they do not -// throw any exceptions (see section 18.4 of the C++ standard). -// -// In the new C++11/14 standard, the signature of the throwing new operators was changed -// by completely omitting the throw clause (which effectively means they could throw any -// exception) while all the other new/delete operators where changed to have a 'nothrow' -// clause instead of an empty throw clause. -// -// Unfortunately, the support for exception specifications among C++ compilers is still -// very fragile. While some more strict compilers like AIX xlC or HP aCC reject to -// override the default throwing new operator with a user operator with an empty throw() -// clause, the MS Visual C++ compiler warns for every non-empty throw clause like -// throw(std::bad_alloc) that it will ignore the exception specification. The following -// operator definitions have been checked to correctly work with all currently supported -// compilers and they should be upwards compatible with C++11/14. Therefore -// PLEASE BE CAREFUL if you change the signature of the following operators! - -static void * zero = (void *) 0; - -void* operator new(size_t size) /* throw(std::bad_alloc) */ { - fatal("Should not call global operator new"); - return zero; -} - -void* operator new [](size_t size) /* throw(std::bad_alloc) */ { - fatal("Should not call global operator new[]"); - return zero; -} - -void* operator new(size_t size, const std::nothrow_t& nothrow_constant) throw() { - fatal("Should not call global operator new"); - return 0; -} - -void* operator new [](size_t size, std::nothrow_t& nothrow_constant) throw() { - fatal("Should not call global operator new[]"); - return 0; -} - -void operator delete(void* p) throw() { - fatal("Should not call global delete"); -} - -void operator delete [](void* p) throw() { - fatal("Should not call global delete []"); -} - void AllocatedObj::print() const { print_on(tty); } void AllocatedObj::print_value() const { print_value_on(tty); } diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp index f952b3d5511..b442f4c70e1 100644 --- a/hotspot/src/share/vm/memory/filemap.cpp +++ b/hotspot/src/share/vm/memory/filemap.cpp @@ -99,7 +99,8 @@ void FileMapInfo::fail_continue(const char *msg, ...) { fail(msg, ap); } else { if (PrintSharedSpaces) { - tty->print_cr("UseSharedSpaces: %s", msg); + tty->print("UseSharedSpaces: "); + tty->vprint_cr(msg, ap); } } UseSharedSpaces = false; @@ -208,7 +209,7 @@ void FileMapInfo::allocate_classpath_entry_table() { count ++; bytes += (int)entry_size; bytes += name_bytes; - log_info(classpath)("add main shared path (%s) %s", (cpe->is_jar_file() ? "jar" : "dir"), name); + log_info(class, path)("add main shared path (%s) %s", (cpe->is_jar_file() ? "jar" : "dir"), name); } else { SharedClassPathEntry* ent = shared_classpath(cur_entry); if (cpe->is_jar_file()) { @@ -282,7 +283,7 @@ bool FileMapInfo::validate_classpath_entry_table() { struct stat st; const char* name = ent->_name; bool ok = true; - log_info(classpath)("checking shared classpath entry: %s", name); + log_info(class, path)("checking shared classpath entry: %s", name); if (os::stat(name, &st) != 0) { fail_continue("Required classpath entry does not exist: %s", name); ok = false; @@ -306,7 +307,7 @@ bool FileMapInfo::validate_classpath_entry_table() { } } if (ok) { - log_info(classpath)("ok"); + log_info(class, path)("ok"); } else if (!PrintSharedArchiveAndExit) { _validating_classpath_entry_table = false; return false; @@ -896,8 +897,8 @@ bool FileMapInfo::FileMapHeader::validate() { char header_version[JVM_IDENT_MAX]; get_header_version(header_version); if (strncmp(_jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) { - log_info(classpath)("expected: %s", header_version); - log_info(classpath)("actual: %s", _jvm_ident); + log_info(class, path)("expected: %s", header_version); + log_info(class, path)("actual: %s", _jvm_ident); FileMapInfo::fail_continue("The shared archive file was created by a different" " version or build of HotSpot"); return false; @@ -925,7 +926,7 @@ bool FileMapInfo::validate_header() { if (status) { if (!ClassLoader::check_shared_paths_misc_info(_paths_misc_info, _header->_paths_misc_info_size)) { if (!PrintSharedArchiveAndExit) { - fail_continue("shared class paths mismatch (hint: enable -Xlog:classpath=info to diagnose the failure)"); + fail_continue("shared class paths mismatch (hint: enable -Xlog:class+path=info to diagnose the failure)"); status = false; } } diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp index 2f8f40d3d71..0f176899243 100644 --- a/hotspot/src/share/vm/memory/heapInspection.cpp +++ b/hotspot/src/share/vm/memory/heapInspection.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "classfile/classLoaderData.hpp" +#include "classfile/moduleEntry.hpp" #include "classfile/systemDictionary.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/genCollectedHeap.hpp" @@ -105,10 +106,20 @@ void KlassInfoEntry::print_on(outputStream* st) const { ResourceMark rm; // simplify the formatting (ILP32 vs LP64) - always cast the numbers to 64-bit - st->print_cr(INT64_FORMAT_W(13) " " UINT64_FORMAT_W(13) " %s", - (int64_t)_instance_count, - (uint64_t)_instance_words * HeapWordSize, - name()); + ModuleEntry* module = _klass->module(); + if (module->is_named()) { + st->print_cr(INT64_FORMAT_W(13) " " UINT64_FORMAT_W(13) " %s (%s@%s)", + (int64_t)_instance_count, + (uint64_t)_instance_words * HeapWordSize, + name(), + module->name()->as_C_string(), + module->version() != NULL ? module->version()->as_C_string() : ""); + } else { + st->print_cr(INT64_FORMAT_W(13) " " UINT64_FORMAT_W(13) " %s", + (int64_t)_instance_count, + (uint64_t)_instance_words * HeapWordSize, + name()); + } } KlassInfoEntry* KlassInfoBucket::lookup(Klass* const k) { @@ -647,8 +658,8 @@ void KlassInfoHisto::print_histo_on(outputStream* st, bool print_stats, if (print_stats) { print_class_stats(st, csv_format, columns); } else { - st->print_cr(" num #instances #bytes class name"); - st->print_cr("----------------------------------------------"); + st->print_cr(" num #instances #bytes class name (module)"); + st->print_cr("-------------------------------------------------------"); print_elements(st); } } diff --git a/hotspot/src/share/vm/memory/iterator.hpp b/hotspot/src/share/vm/memory/iterator.hpp index 3a36dc6d5f5..cd6df30bdf9 100644 --- a/hotspot/src/share/vm/memory/iterator.hpp +++ b/hotspot/src/share/vm/memory/iterator.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -355,6 +355,9 @@ public: // Read/write the void pointer pointed to by p. virtual void do_ptr(void** p) = 0; + // Read/write the 32-bit unsigned integer pointed to by p. + virtual void do_u4(u4* p) = 0; + // Read/write the region specified. virtual void do_region(u_char* start, size_t size) = 0; @@ -363,6 +366,10 @@ public: // for verification that sections of the serialized data are of the // correct length. virtual void do_tag(int tag) = 0; + + bool writing() { + return !reading(); + } }; class SymbolClosure : public StackObj { diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp index fa4d31a54be..b975e9e1327 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp @@ -31,6 +31,7 @@ #include "classfile/sharedClassUtil.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" +#include "classfile/systemDictionaryShared.hpp" #include "code/codeCache.hpp" #include "gc/shared/gcLocker.hpp" #include "interpreter/bytecodeStream.hpp" @@ -106,7 +107,8 @@ void MetaspaceShared::initialize_shared_rs(ReservedSpace* rs) { // Read/write a data stream for restoring/preserving metadata pointers and // miscellaneous data from/to the shared archive file. -void MetaspaceShared::serialize(SerializeClosure* soc) { +void MetaspaceShared::serialize(SerializeClosure* soc, GrowableArray *string_space, + size_t* space_size) { int tag = 0; soc->do_tag(--tag); @@ -128,6 +130,15 @@ void MetaspaceShared::serialize(SerializeClosure* soc) { vmSymbols::serialize(soc); soc->do_tag(--tag); + // Dump/restore the symbol and string tables + SymbolTable::serialize(soc); + StringTable::serialize(soc, string_space, space_size); + soc->do_tag(--tag); + + // Dump/restore the misc information for system dictionary + SystemDictionaryShared::serialize(soc); + soc->do_tag(--tag); + soc->do_tag(666); } @@ -314,6 +325,11 @@ public: ++top; } + void do_u4(u4* p) { + void* ptr = (void*)(uintx(*p)); + do_ptr(&ptr); + } + void do_tag(int tag) { check_space(); *top = (intptr_t)tag; @@ -348,6 +364,8 @@ public: METASPACE_OBJ_TYPES_DO(f) \ f(SymbolHashentry) \ f(SymbolBucket) \ + f(StringHashentry) \ + f(StringBucket) \ f(Other) #define SHAREDSPACE_OBJ_TYPE_DECLARE(name) name ## Type, @@ -406,13 +424,22 @@ void DumpAllocClosure::dump_stats(int ro_all, int rw_all, int md_all, int mc_all MetaspaceSharedStats *stats = MetaspaceShared::stats(); // symbols - _counts[RW][SymbolHashentryType] = stats->symbol.hashentry_count; - _bytes [RW][SymbolHashentryType] = stats->symbol.hashentry_bytes; - other_bytes -= stats->symbol.hashentry_bytes; + _counts[RO][SymbolHashentryType] = stats->symbol.hashentry_count; + _bytes [RO][SymbolHashentryType] = stats->symbol.hashentry_bytes; + _bytes [RO][TypeArrayU4Type] -= stats->symbol.hashentry_bytes; - _counts[RW][SymbolBucketType] = stats->symbol.bucket_count; - _bytes [RW][SymbolBucketType] = stats->symbol.bucket_bytes; - other_bytes -= stats->symbol.bucket_bytes; + _counts[RO][SymbolBucketType] = stats->symbol.bucket_count; + _bytes [RO][SymbolBucketType] = stats->symbol.bucket_bytes; + _bytes [RO][TypeArrayU4Type] -= stats->symbol.bucket_bytes; + + // strings + _counts[RO][StringHashentryType] = stats->string.hashentry_count; + _bytes [RO][StringHashentryType] = stats->string.hashentry_bytes; + _bytes [RO][TypeArrayU4Type] -= stats->string.hashentry_bytes; + + _counts[RO][StringBucketType] = stats->string.bucket_count; + _bytes [RO][StringBucketType] = stats->string.bucket_bytes; + _bytes [RO][TypeArrayU4Type] -= stats->string.bucket_bytes; // TODO: count things like dictionary, vtable, etc _bytes[RW][OtherType] = other_bytes; @@ -488,7 +515,6 @@ private: GrowableArray *_class_promote_order; VirtualSpace _md_vs; VirtualSpace _mc_vs; - CompactHashtableWriter* _string_cht; GrowableArray *_string_regions; public: @@ -600,39 +626,27 @@ void VM_PopulateDumpSharedSpace::doit() { // Not doing this either. SystemDictionary::reorder_dictionary(); - NOT_PRODUCT(SystemDictionary::verify();) - - // Copy the symbol table, string table, and the system dictionary to the shared - // space in usable form. Copy the hashtable - // buckets first [read-write], then copy the linked lists of entries - // [read-only]. - - NOT_PRODUCT(SymbolTable::verify()); - handle_misc_data_space_failure(SymbolTable::copy_compact_table(&md_top, md_end)); - - size_t ss_bytes = 0; - char* ss_low; - // The string space has maximum two regions. See FileMapInfo::write_string_regions() for details. - _string_regions = new GrowableArray(2); - NOT_PRODUCT(StringTable::verify()); - handle_misc_data_space_failure(StringTable::copy_compact_table(&md_top, md_end, _string_regions, - &ss_bytes)); - ss_low = _string_regions->is_empty() ? NULL : (char*)_string_regions->first().start(); - SystemDictionary::reverse(); SystemDictionary::copy_buckets(&md_top, md_end); SystemDictionary::copy_table(&md_top, md_end); // Write the other data to the output array. + // SymbolTable, StringTable and extra information for system dictionary + NOT_PRODUCT(SymbolTable::verify()); + NOT_PRODUCT(StringTable::verify()); + size_t ss_bytes = 0; + char* ss_low; + // The string space has maximum two regions. See FileMapInfo::write_string_regions() for details. + _string_regions = new GrowableArray(2); + WriteClosure wc(md_top, md_end); - MetaspaceShared::serialize(&wc); + MetaspaceShared::serialize(&wc, _string_regions, &ss_bytes); md_top = wc.get_top(); + ss_low = _string_regions->is_empty() ? NULL : (char*)_string_regions->first().start(); // Print shared spaces all the time -// To make fmt_space be a syntactic constant (for format warnings), use #define. -#define fmt_space "%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%4.1f%% used] at " INTPTR_FORMAT Metaspace* ro_space = _loader_data->ro_metaspace(); Metaspace* rw_space = _loader_data->rw_metaspace(); @@ -665,12 +679,13 @@ void VM_PopulateDumpSharedSpace::doit() { const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0; const double total_u_perc = total_bytes / double(total_alloced) * 100.0; +#define fmt_space "%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used] at " INTPTR_FORMAT tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, p2i(ro_space->bottom())); tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, p2i(rw_space->bottom())); tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, p2i(md_low)); tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, p2i(mc_low)); tty->print_cr(fmt_space, "st", ss_bytes, ss_t_perc, ss_bytes, 100.0, p2i(ss_low)); - tty->print_cr("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%4.1f%% used]", + tty->print_cr("total : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%5.1f%% used]", total_bytes, total_alloced, total_u_perc); // Update the vtable pointers in all of the Klass objects in the @@ -904,7 +919,7 @@ int MetaspaceShared::preload_and_dump(const char* class_list_path, InstanceKlass* ik = InstanceKlass::cast(klass); - // Should be class load order as per -Xlog:classload+preorder + // Should be class load order as per -Xlog:class+preorder class_promote_order->append(ik); // Link the class to cause the bytecodes to be rewritten and the @@ -974,6 +989,11 @@ public: *p = (void*)obj; } + void do_u4(u4* p) { + intptr_t obj = nextPtr(); + *p = (u4)(uintx(obj)); + } + void do_tag(int tag) { int old_tag; old_tag = (int)(intptr_t)nextPtr(); @@ -1097,21 +1117,6 @@ void MetaspaceShared::initialize_shared_spaces() { buffer += sizeof(intptr_t); buffer += vtable_size; - // Create the shared symbol table using the compact table at this spot in the - // misc data space. (Todo: move this to read-only space. Currently - // this is mapped copy-on-write but will never be written into). - - buffer = (char*)SymbolTable::init_shared_table(buffer); - SymbolTable::create_table(); - - // Create the shared string table using the compact table - buffer = (char*)StringTable::init_shared_table(mapinfo, buffer); - - // Create the shared dictionary using the bucket array at this spot in - // the misc data space. Since the shared dictionary table is never - // modified, this region (of mapped pages) will be (effectively, if - // not explicitly) read-only. - int sharedDictionaryLen = *(intptr_t*)buffer; buffer += sizeof(intptr_t); int number_of_entries = *(intptr_t*)buffer; @@ -1129,9 +1134,14 @@ void MetaspaceShared::initialize_shared_spaces() { buffer += sizeof(intptr_t); buffer += len; + // Verify various attributes of the archive, plus initialize the + // shared string/symbol tables intptr_t* array = (intptr_t*)buffer; ReadClosure rc(&array); - serialize(&rc); + serialize(&rc, NULL, NULL); + + // Initialize the run-time symbol table. + SymbolTable::create_table(); // Close the mapinfo file mapinfo->close(); diff --git a/hotspot/src/share/vm/memory/metaspaceShared.hpp b/hotspot/src/share/vm/memory/metaspaceShared.hpp index 7c39f63e092..be7b1bacb97 100644 --- a/hotspot/src/share/vm/memory/metaspaceShared.hpp +++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -43,11 +43,11 @@ // for the x64 platform #define DEFAULT_VTBL_COMMON_CODE_SIZE (1*K) // conservative size of the "common_code" for the x64 platform -#define DEFAULT_SHARED_READ_WRITE_SIZE (NOT_LP64(8*M) LP64_ONLY(10*M)) +#define DEFAULT_SHARED_READ_WRITE_SIZE (NOT_LP64(9*M) LP64_ONLY(10*M)) #define MIN_SHARED_READ_WRITE_SIZE (NOT_LP64(7*M) LP64_ONLY(10*M)) -#define DEFAULT_SHARED_READ_ONLY_SIZE (NOT_LP64(8*M) LP64_ONLY(10*M)) -#define MIN_SHARED_READ_ONLY_SIZE (NOT_LP64(8*M) LP64_ONLY(9*M)) +#define DEFAULT_SHARED_READ_ONLY_SIZE (NOT_LP64(9*M) LP64_ONLY(10*M)) +#define MIN_SHARED_READ_ONLY_SIZE (NOT_LP64(9*M) LP64_ONLY(10*M)) // the MIN_SHARED_MISC_DATA_SIZE and MIN_SHARED_MISC_CODE_SIZE estimates are based on // the sizes required for dumping the archive using the default classlist. The sizes @@ -193,7 +193,8 @@ class MetaspaceShared : AllStatic { void** vtable, char** md_top, char* md_end, char** mc_top, char* mc_end); - static void serialize(SerializeClosure* sc); + static void serialize(SerializeClosure* sc, GrowableArray *string_space, + size_t* space_size); static MetaspaceSharedStats* stats() { return &_stats; diff --git a/hotspot/src/share/vm/memory/operator_new.cpp b/hotspot/src/share/vm/memory/operator_new.cpp new file mode 100644 index 00000000000..69181a40103 --- /dev/null +++ b/hotspot/src/share/vm/memory/operator_new.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1997, 2014, 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. + * + */ + +#include "precompiled.hpp" +#include "utilities/debug.hpp" + +#include + +//-------------------------------------------------------------------------------------- +// Non-product code + +#ifndef PRODUCT +// The global operator new should never be called since it will usually indicate +// a memory leak. Use CHeapObj as the base class of such objects to make it explicit +// that they're allocated on the C heap. +// Commented out in product version to avoid conflicts with third-party C++ native code. +// +// In C++98/03 the throwing new operators are defined with the following signature: +// +// void* operator new(std::size_tsize) throw(std::bad_alloc); +// void* operator new[](std::size_tsize) throw(std::bad_alloc); +// +// while all the other (non-throwing) new and delete operators are defined with an empty +// throw clause (i.e. "operator delete(void* p) throw()") which means that they do not +// throw any exceptions (see section 18.4 of the C++ standard). +// +// In the new C++11/14 standard, the signature of the throwing new operators was changed +// by completely omitting the throw clause (which effectively means they could throw any +// exception) while all the other new/delete operators where changed to have a 'nothrow' +// clause instead of an empty throw clause. +// +// Unfortunately, the support for exception specifications among C++ compilers is still +// very fragile. While some more strict compilers like AIX xlC or HP aCC reject to +// override the default throwing new operator with a user operator with an empty throw() +// clause, the MS Visual C++ compiler warns for every non-empty throw clause like +// throw(std::bad_alloc) that it will ignore the exception specification. The following +// operator definitions have been checked to correctly work with all currently supported +// compilers and they should be upwards compatible with C++11/14. Therefore +// PLEASE BE CAREFUL if you change the signature of the following operators! + +static void * zero = (void *) 0; + +void* operator new(size_t size) /* throw(std::bad_alloc) */ { + fatal("Should not call global operator new"); + return zero; +} + +void* operator new [](size_t size) /* throw(std::bad_alloc) */ { + fatal("Should not call global operator new[]"); + return zero; +} + +void* operator new(size_t size, const std::nothrow_t& nothrow_constant) throw() { + fatal("Should not call global operator new"); + return 0; +} + +void* operator new [](size_t size, std::nothrow_t& nothrow_constant) throw() { + fatal("Should not call global operator new[]"); + return 0; +} + +void operator delete(void* p) throw() { + fatal("Should not call global delete"); +} + +void operator delete [](void* p) throw() { + fatal("Should not call global delete []"); +} + +#endif // Non-product diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 11037c539f0..9c17574bed9 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -55,7 +55,6 @@ #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/typeArrayKlass.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/commandLineFlagConstraintList.hpp" diff --git a/hotspot/src/share/vm/memory/virtualspace.cpp b/hotspot/src/share/vm/memory/virtualspace.cpp index 31fddb745c7..3cb6d21c7e8 100644 --- a/hotspot/src/share/vm/memory/virtualspace.cpp +++ b/hotspot/src/share/vm/memory/virtualspace.cpp @@ -751,6 +751,29 @@ bool VirtualSpace::contains(const void* p) const { return low() <= (const char*) p && (const char*) p < high(); } +static void pretouch_expanded_memory(void* start, void* end) { + assert(is_ptr_aligned(start, os::vm_page_size()), "Unexpected alignment"); + assert(is_ptr_aligned(end, os::vm_page_size()), "Unexpected alignment"); + + os::pretouch_memory(start, end); +} + +static bool commit_expanded(char* start, size_t size, size_t alignment, bool pre_touch, bool executable) { + if (os::commit_memory(start, size, alignment, executable)) { + if (pre_touch || AlwaysPreTouch) { + pretouch_expanded_memory(start, start + size); + } + return true; + } + + debug_only(warning( + "INFO: os::commit_memory(" PTR_FORMAT ", " PTR_FORMAT + " size=" SIZE_FORMAT ", executable=%d) failed", + p2i(start), p2i(start + size), size, executable);) + + return false; +} + /* First we need to determine if a particular virtual space is using large pages. This is done at the initialize function and only virtual spaces @@ -764,7 +787,9 @@ bool VirtualSpace::contains(const void* p) const { allocated with default pages. */ bool VirtualSpace::expand_by(size_t bytes, bool pre_touch) { - if (uncommitted_size() < bytes) return false; + if (uncommitted_size() < bytes) { + return false; + } if (special()) { // don't commit memory if the entire space is pinned in memory @@ -774,30 +799,23 @@ bool VirtualSpace::expand_by(size_t bytes, bool pre_touch) { char* previous_high = high(); char* unaligned_new_high = high() + bytes; - assert(unaligned_new_high <= high_boundary(), - "cannot expand by more than upper boundary"); + assert(unaligned_new_high <= high_boundary(), "cannot expand by more than upper boundary"); // Calculate where the new high for each of the regions should be. If // the low_boundary() and high_boundary() are LargePageSizeInBytes aligned // then the unaligned lower and upper new highs would be the // lower_high() and upper_high() respectively. - char* unaligned_lower_new_high = - MIN2(unaligned_new_high, lower_high_boundary()); - char* unaligned_middle_new_high = - MIN2(unaligned_new_high, middle_high_boundary()); - char* unaligned_upper_new_high = - MIN2(unaligned_new_high, upper_high_boundary()); + char* unaligned_lower_new_high = MIN2(unaligned_new_high, lower_high_boundary()); + char* unaligned_middle_new_high = MIN2(unaligned_new_high, middle_high_boundary()); + char* unaligned_upper_new_high = MIN2(unaligned_new_high, upper_high_boundary()); // Align the new highs based on the regions alignment. lower and upper // alignment will always be default page size. middle alignment will be // LargePageSizeInBytes if the actual size of the virtual space is in // fact larger than LargePageSizeInBytes. - char* aligned_lower_new_high = - (char*) round_to((intptr_t) unaligned_lower_new_high, lower_alignment()); - char* aligned_middle_new_high = - (char*) round_to((intptr_t) unaligned_middle_new_high, middle_alignment()); - char* aligned_upper_new_high = - (char*) round_to((intptr_t) unaligned_upper_new_high, upper_alignment()); + char* aligned_lower_new_high = (char*) round_to((intptr_t) unaligned_lower_new_high, lower_alignment()); + char* aligned_middle_new_high = (char*) round_to((intptr_t) unaligned_middle_new_high, middle_alignment()); + char* aligned_upper_new_high = (char*) round_to((intptr_t) unaligned_upper_new_high, upper_alignment()); // Determine which regions need to grow in this expand_by call. // If you are growing in the lower region, high() must be in that @@ -808,75 +826,48 @@ bool VirtualSpace::expand_by(size_t bytes, bool pre_touch) { // is an intra or inter region growth. size_t lower_needs = 0; if (aligned_lower_new_high > lower_high()) { - lower_needs = - pointer_delta(aligned_lower_new_high, lower_high(), sizeof(char)); + lower_needs = pointer_delta(aligned_lower_new_high, lower_high(), sizeof(char)); } size_t middle_needs = 0; if (aligned_middle_new_high > middle_high()) { - middle_needs = - pointer_delta(aligned_middle_new_high, middle_high(), sizeof(char)); + middle_needs = pointer_delta(aligned_middle_new_high, middle_high(), sizeof(char)); } size_t upper_needs = 0; if (aligned_upper_new_high > upper_high()) { - upper_needs = - pointer_delta(aligned_upper_new_high, upper_high(), sizeof(char)); + upper_needs = pointer_delta(aligned_upper_new_high, upper_high(), sizeof(char)); } // Check contiguity. - assert(low_boundary() <= lower_high() && - lower_high() <= lower_high_boundary(), + assert(low_boundary() <= lower_high() && lower_high() <= lower_high_boundary(), "high address must be contained within the region"); - assert(lower_high_boundary() <= middle_high() && - middle_high() <= middle_high_boundary(), + assert(lower_high_boundary() <= middle_high() && middle_high() <= middle_high_boundary(), "high address must be contained within the region"); - assert(middle_high_boundary() <= upper_high() && - upper_high() <= upper_high_boundary(), + assert(middle_high_boundary() <= upper_high() && upper_high() <= upper_high_boundary(), "high address must be contained within the region"); // Commit regions if (lower_needs > 0) { - assert(low_boundary() <= lower_high() && - lower_high() + lower_needs <= lower_high_boundary(), - "must not expand beyond region"); - if (!os::commit_memory(lower_high(), lower_needs, _executable)) { - debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT - ", lower_needs=" SIZE_FORMAT ", %d) failed", - p2i(lower_high()), lower_needs, _executable);) + assert(lower_high() + lower_needs <= lower_high_boundary(), "must not expand beyond region"); + if (!commit_expanded(lower_high(), lower_needs, _lower_alignment, pre_touch, _executable)) { return false; - } else { - _lower_high += lower_needs; } + _lower_high += lower_needs; } + if (middle_needs > 0) { - assert(lower_high_boundary() <= middle_high() && - middle_high() + middle_needs <= middle_high_boundary(), - "must not expand beyond region"); - if (!os::commit_memory(middle_high(), middle_needs, middle_alignment(), - _executable)) { - debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT - ", middle_needs=" SIZE_FORMAT ", " SIZE_FORMAT - ", %d) failed", p2i(middle_high()), middle_needs, - middle_alignment(), _executable);) + assert(middle_high() + middle_needs <= middle_high_boundary(), "must not expand beyond region"); + if (!commit_expanded(middle_high(), middle_needs, _middle_alignment, pre_touch, _executable)) { return false; } _middle_high += middle_needs; } - if (upper_needs > 0) { - assert(middle_high_boundary() <= upper_high() && - upper_high() + upper_needs <= upper_high_boundary(), - "must not expand beyond region"); - if (!os::commit_memory(upper_high(), upper_needs, _executable)) { - debug_only(warning("INFO: os::commit_memory(" PTR_FORMAT - ", upper_needs=" SIZE_FORMAT ", %d) failed", - p2i(upper_high()), upper_needs, _executable);) - return false; - } else { - _upper_high += upper_needs; - } - } - if (pre_touch || AlwaysPreTouch) { - os::pretouch_memory(previous_high, unaligned_new_high); + if (upper_needs > 0) { + assert(upper_high() + upper_needs <= upper_high_boundary(), "must not expand beyond region"); + if (!commit_expanded(upper_high(), upper_needs, _upper_alignment, pre_touch, _executable)) { + return false; + } + _upper_high += upper_needs; } _high += bytes; @@ -1092,6 +1083,12 @@ class TestReservedSpace : AllStatic { test_log("test_reserved_space3(%p, %p, %d)", (void*)(uintptr_t)size, (void*)(uintptr_t)alignment, maybe_large); + if (size < alignment) { + // Tests might set -XX:LargePageSizeInBytes= and cause unexpected input arguments for this test. + assert((size_t)os::vm_page_size() == os::large_page_size(), "Test needs further refinement"); + return; + } + assert(is_size_aligned(size, os::vm_allocation_granularity()), "Must be at least AG aligned"); assert(is_size_aligned(size, alignment), "Must be at least aligned against alignment"); diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp index 708c2f77d86..ec22e2181c7 100644 --- a/hotspot/src/share/vm/oops/constantPool.cpp +++ b/hotspot/src/share/vm/oops/constantPool.cpp @@ -209,11 +209,11 @@ void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, Kla if (k() != this_cp->pool_holder()) { // only print something if the classes are different if (source_file != NULL) { - log_debug(classresolve)("%s %s %s:%d", + log_debug(class, resolve)("%s %s %s:%d", this_cp->pool_holder()->external_name(), k->external_name(), source_file, line_number); } else { - log_debug(classresolve)("%s %s", + log_debug(class, resolve)("%s %s", this_cp->pool_holder()->external_name(), k->external_name()); } @@ -282,8 +282,8 @@ Klass* ConstantPool::klass_at_impl(const constantPoolHandle& this_cp, int which, ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data(); this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM - // logging for classresolve tag. - if (log_is_enabled(Debug, classresolve)){ + // logging for class+resolve. + if (log_is_enabled(Debug, class, resolve)){ trace_class_resolution(this_cp, k); } this_cp->klass_at_put(which, k()); @@ -341,7 +341,7 @@ Method* ConstantPool::method_at_if_loaded(const constantPoolHandle& cpool, int cache_index = decode_cpcache_index(which, true); if (!(cache_index >= 0 && cache_index < cpool->cache()->length())) { // FIXME: should be an assert - log_debug(classresolve)("bad operand %d in:", which); cpool->print(); + log_debug(class, resolve)("bad operand %d in:", which); cpool->print(); return NULL; } ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index); @@ -672,7 +672,7 @@ oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp, in Symbol* name = this_cp->method_handle_name_ref_at(index); Symbol* signature = this_cp->method_handle_signature_ref_at(index); { ResourceMark rm(THREAD); - log_debug(classresolve)("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s", + log_debug(class, resolve)("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s", ref_kind, index, this_cp->method_handle_index_at(index), callee_index, name->as_C_string(), signature->as_C_string()); } @@ -695,7 +695,7 @@ oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp, in { Symbol* signature = this_cp->method_type_signature_at(index); { ResourceMark rm(THREAD); - log_debug(classresolve)("resolve JVM_CONSTANT_MethodType [%d/%d] %s", + log_debug(class, resolve)("resolve JVM_CONSTANT_MethodType [%d/%d] %s", index, this_cp->method_type_index_at(index), signature->as_C_string()); } diff --git a/hotspot/src/share/vm/oops/cpCache.cpp b/hotspot/src/share/vm/oops/cpCache.cpp index 491688ccc6f..ee2425fc615 100644 --- a/hotspot/src/share/vm/oops/cpCache.cpp +++ b/hotspot/src/share/vm/oops/cpCache.cpp @@ -25,12 +25,12 @@ #include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/rewriter.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.inline.hpp" #include "oops/cpCache.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/methodHandles.hpp" #include "runtime/atomic.inline.hpp" #include "runtime/handles.inline.hpp" @@ -438,17 +438,14 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method, // match old_method so need an update // NOTE: can't use set_f2_as_vfinal_method as it asserts on different values _f2 = (intptr_t)new_method; - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00400000, ("cpc vf-entry update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, constantpool) + ("cpc vf-entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } return true; } @@ -465,17 +462,14 @@ bool ConstantPoolCacheEntry::adjust_method_entry(Method* old_method, if (_f1 == old_method) { _f1 = new_method; - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00400000, ("cpc entry update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, constantpool) + ("cpc entry update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } return true; } @@ -569,7 +563,7 @@ void ConstantPoolCache::initialize(const intArray& inverse_index_map, const intArray& invokedynamic_references_map) { for (int i = 0; i < inverse_index_map.length(); i++) { ConstantPoolCacheEntry* e = entry_at(i); - int original_index = inverse_index_map[i]; + int original_index = inverse_index_map.at(i); e->initialize_entry(original_index); assert(entry_at(i) == e, "sanity"); } @@ -579,19 +573,19 @@ void ConstantPoolCache::initialize(const intArray& inverse_index_map, for (int i = 0; i < invokedynamic_inverse_index_map.length(); i++) { int offset = i + invokedynamic_offset; ConstantPoolCacheEntry* e = entry_at(offset); - int original_index = invokedynamic_inverse_index_map[i]; + int original_index = invokedynamic_inverse_index_map.at(i); e->initialize_entry(original_index); assert(entry_at(offset) == e, "sanity"); } for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) { - const int cpci = invokedynamic_references_map[ref]; + const int cpci = invokedynamic_references_map.at(ref); if (cpci >= 0) { #ifdef ASSERT // invokedynamic and invokehandle have more entries; check if they // all point to the same constant pool cache entry. for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { - const int cpci_next = invokedynamic_references_map[ref + entry]; + const int cpci_next = invokedynamic_references_map.at(ref + entry); assert(cpci == cpci_next, "%d == %d", cpci, cpci_next); } #endif diff --git a/hotspot/src/share/vm/oops/generateOopMap.cpp b/hotspot/src/share/vm/oops/generateOopMap.cpp index 60738d741a5..fe8cdbc64c6 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.cpp +++ b/hotspot/src/share/vm/oops/generateOopMap.cpp @@ -378,11 +378,10 @@ void CellTypeState::print(outputStream *os) { // Basicblock handling methods // -void GenerateOopMap ::initialize_bb() { +void GenerateOopMap::initialize_bb() { _gc_points = 0; _bb_count = 0; - _bb_hdr_bits.clear(); - _bb_hdr_bits.resize(method()->code_size()); + _bb_hdr_bits.reinitialize(method()->code_size()); } void GenerateOopMap::bb_mark_fct(GenerateOopMap *c, int bci, int *data) { @@ -1041,13 +1040,7 @@ void GenerateOopMap::update_basic_blocks(int bci, int delta, assert(new_method_size >= method()->code_size() + delta, "new method size is too small"); - BitMap::bm_word_t* new_bb_hdr_bits = - NEW_RESOURCE_ARRAY(BitMap::bm_word_t, - BitMap::word_align_up(new_method_size)); - _bb_hdr_bits.set_map(new_bb_hdr_bits); - _bb_hdr_bits.set_size(new_method_size); - _bb_hdr_bits.clear(); - + _bb_hdr_bits.reinitialize(new_method_size); for(int k = 0; k < _bb_count; k++) { if (_basic_blocks[k]._bci > bci) { diff --git a/hotspot/src/share/vm/oops/generateOopMap.hpp b/hotspot/src/share/vm/oops/generateOopMap.hpp index 8822ee0d839..a41d14ac897 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.hpp +++ b/hotspot/src/share/vm/oops/generateOopMap.hpp @@ -350,7 +350,7 @@ class GenerateOopMap VALUE_OBJ_CLASS_SPEC { BasicBlock * _basic_blocks; // Array of basicblock info int _gc_points; int _bb_count; - BitMap _bb_hdr_bits; + ResourceBitMap _bb_hdr_bits; // Basicblocks methods void initialize_bb (); diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index f97f826444b..074fc0039d0 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -53,7 +53,6 @@ #include "oops/symbol.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiRedefineClasses.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/jvmtiThreadState.hpp" #include "prims/methodComparator.hpp" #include "runtime/atomic.inline.hpp" @@ -450,9 +449,9 @@ void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_k) { this_k->set_init_state (fully_initialized); this_k->fence_and_clear_init_lock(); // trace - if (log_is_enabled(Info, classinit)) { + if (log_is_enabled(Info, class, init)) { ResourceMark rm(THREAD); - log_info(classinit)("[Initialized %s without side effects]", this_k->external_name()); + log_info(class, init)("[Initialized %s without side effects]", this_k->external_name()); } } } @@ -1088,9 +1087,9 @@ void InstanceKlass::call_class_initializer_impl(instanceKlassHandle this_k, TRAP methodHandle h_method(THREAD, this_k->class_initializer()); assert(!this_k->is_initialized(), "we cannot initialize twice"); - if (log_is_enabled(Info, classinit)) { + if (log_is_enabled(Info, class, init)) { ResourceMark rm; - outputStream* log = Log(classinit)::info_stream(); + outputStream* log = Log(class, init)::info_stream(); log->print("%d Initializing ", call_class_initializer_impl_counter++); this_k->name()->print_value_on(log); log->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", p2i(this_k())); @@ -2032,10 +2031,11 @@ bool InstanceKlass::check_sharing_error_state() { return (old_state != is_in_error_state()); } +#if INCLUDE_JVMTI static void clear_all_breakpoints(Method* m) { m->clear_all_breakpoints(); } - +#endif void InstanceKlass::notify_unload_class(InstanceKlass* ik) { // notify the debugger @@ -2097,6 +2097,7 @@ void InstanceKlass::release_C_heap_structures() { // DC::remove_all_dependents() when it touches unloaded nmethod. dependencies().wipe(); +#if INCLUDE_JVMTI // Deallocate breakpoint records if (breakpoints() != 0x0) { methods_do(clear_all_breakpoints); @@ -2108,6 +2109,7 @@ void InstanceKlass::release_C_heap_structures() { os::free(_cached_class_file); _cached_class_file = NULL; } +#endif // Decrement symbol reference counts associated with the unloaded class. if (_name != NULL) _name->decrement_refcount(); @@ -2293,7 +2295,7 @@ bool InstanceKlass::is_same_class_package(const Klass* class2) const { PackageEntry* classpkg2; if (class2->is_instance_klass()) { classloader2 = class2->class_loader(); - classpkg2 = InstanceKlass::cast(class2)->package(); + classpkg2 = class2->package(); } else { assert(class2->is_typeArray_klass(), "should be type array"); classloader2 = NULL; @@ -2571,17 +2573,17 @@ void InstanceKlass::adjust_default_methods(InstanceKlass* holder, bool* trace_na assert(old_method != new_method, "sanity check"); default_methods()->at_put(index, new_method); - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: klassname=%s default methods from name=%s", - external_name(), - old_method->method_holder()->external_name())); + log_info(redefine, class, update) + ("adjust: klassname=%s default methods from name=%s", + external_name(), old_method->method_holder()->external_name()); *trace_name_printed = true; } - RC_TRACE(0x00100000, ("default method update: %s(%s) ", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, vtables) + ("default method update: %s(%s) ", + new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } } } @@ -2841,7 +2843,7 @@ void InstanceKlass::print_on(outputStream* st) const { { bool have_pv = false; // previous versions are linked together through the InstanceKlass - for (InstanceKlass* pv_node = _previous_versions; + for (InstanceKlass* pv_node = previous_versions(); pv_node != NULL; pv_node = pv_node->previous_versions()) { if (!have_pv) @@ -3011,11 +3013,11 @@ void InstanceKlass::print_loading_log(LogLevel::type type, assert(type == LogLevel::Info || type == LogLevel::Debug, "sanity"); if (type == LogLevel::Info) { - log = Log(classload)::info_stream(); + log = Log(class, load)::info_stream(); } else { assert(type == LogLevel::Debug, "print_loading_log supports only Debug and Info levels"); - log = Log(classload)::debug_stream(); + log = Log(class, load)::debug_stream(); } // Name and class hierarchy info @@ -3334,7 +3336,7 @@ void InstanceKlass::set_init_state(ClassState state) { } #endif - +#if INCLUDE_JVMTI // RedefineClasses() support for previous versions: int InstanceKlass::_previous_version_count = 0; @@ -3350,8 +3352,8 @@ void InstanceKlass::purge_previous_versions(InstanceKlass* ik) { ClassLoaderData* loader_data = ik->class_loader_data(); assert(loader_data != NULL, "should never be null"); - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000200, ("purge: %s: previous versions", ik->external_name())); + ResourceMark rm; + log_trace(redefine, class, iklass, purge)("%s: previous versions", ik->external_name()); // previous versions are linked together through the InstanceKlass InstanceKlass* pv_node = ik->previous_versions(); @@ -3369,8 +3371,7 @@ void InstanceKlass::purge_previous_versions(InstanceKlass* ik) { // are executing. Unlink this previous_version. // The previous version InstanceKlass is on the ClassLoaderData deallocate list // so will be deallocated during the next phase of class unloading. - RC_TRACE(0x00000200, ("purge: previous version " INTPTR_FORMAT " is dead", - p2i(pv_node))); + log_trace(redefine, class, iklass, purge)("previous version " INTPTR_FORMAT " is dead", p2i(pv_node)); // For debugging purposes. pv_node->set_is_scratch_class(); pv_node->class_loader_data()->add_to_deallocate_list(pv_node); @@ -3380,8 +3381,7 @@ void InstanceKlass::purge_previous_versions(InstanceKlass* ik) { version++; continue; } else { - RC_TRACE(0x00000200, ("purge: previous version " INTPTR_FORMAT " is alive", - p2i(pv_node))); + log_trace(redefine, class, iklass, purge)("previous version " INTPTR_FORMAT " is alive", p2i(pv_node)); assert(pvcp->pool_holder() != NULL, "Constant pool with no holder"); guarantee (!loader_data->is_unloading(), "unloaded classes can't be on the stack"); live_count++; @@ -3393,8 +3393,7 @@ void InstanceKlass::purge_previous_versions(InstanceKlass* ik) { // longer running. Array* method_refs = pv_node->methods(); if (method_refs != NULL) { - RC_TRACE(0x00000200, ("purge: previous methods length=%d", - method_refs->length())); + log_trace(redefine, class, iklass, purge)("previous methods length=%d", method_refs->length()); for (int j = 0; j < method_refs->length(); j++) { Method* method = method_refs->at(j); @@ -3406,11 +3405,9 @@ void InstanceKlass::purge_previous_versions(InstanceKlass* ik) { } else { assert (method->is_obsolete() || method->is_running_emcp(), "emcp method cannot run after emcp bit is cleared"); - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000200, + log_trace(redefine, class, iklass, purge) ("purge: %s(%s): prev method @%d in version @%d is alive", - method->name()->as_C_string(), - method->signature()->as_C_string(), j, version)); + method->name()->as_C_string(), method->signature()->as_C_string(), j, version); } } } @@ -3419,9 +3416,9 @@ void InstanceKlass::purge_previous_versions(InstanceKlass* ik) { pv_node = pv_node->previous_versions(); version++; } - RC_TRACE(0x00000200, - ("purge: previous version stats: live=%d, deleted=%d", live_count, - deleted_count)); + log_trace(redefine, class, iklass, purge) + ("previous version stats: live=%d, deleted=%d", + live_count, deleted_count); } } @@ -3456,9 +3453,9 @@ void InstanceKlass::mark_newly_obsolete_methods(Array* old_methods, method->signature() == m_signature) { // The current RedefineClasses() call has made all EMCP // versions of this method obsolete so mark it as obsolete - RC_TRACE(0x00000400, - ("add: %s(%s): flush obsolete method @%d in version @%d", - m_name->as_C_string(), m_signature->as_C_string(), k, j)); + log_trace(redefine, class, iklass, add) + ("%s(%s): flush obsolete method @%d in version @%d", + m_name->as_C_string(), m_signature->as_C_string(), k, j); method->set_is_obsolete(); break; @@ -3490,9 +3487,9 @@ void InstanceKlass::add_previous_version(instanceKlassHandle scratch_class, assert(Thread::current()->is_VM_thread(), "only VMThread can add previous versions"); - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00000400, ("adding previous version ref for %s, EMCP_cnt=%d", - scratch_class->external_name(), emcp_method_count)); + ResourceMark rm; + log_trace(redefine, class, iklass, add) + ("adding previous version ref for %s, EMCP_cnt=%d", scratch_class->external_name(), emcp_method_count); // Clean out old previous versions purge_previous_versions(this); @@ -3508,7 +3505,7 @@ void InstanceKlass::add_previous_version(instanceKlassHandle scratch_class, // we don't need to add this as a previous version. ConstantPool* cp_ref = scratch_class->constants(); if (!cp_ref->on_stack()) { - RC_TRACE(0x00000400, ("add: scratch class not added; no methods are running")); + log_trace(redefine, class, iklass, add)("scratch class not added; no methods are running"); // For debugging purposes. scratch_class->set_is_scratch_class(); scratch_class->class_loader_data()->add_to_deallocate_list(scratch_class()); @@ -3531,17 +3528,17 @@ void InstanceKlass::add_previous_version(instanceKlassHandle scratch_class, // method may exit. If so, we would set a breakpoint in a method that // is never reached, but this won't be noticeable to the programmer. old_method->set_running_emcp(true); - RC_TRACE(0x00000400, ("add: EMCP method %s is on_stack " INTPTR_FORMAT, - old_method->name_and_sig_as_C_string(), p2i(old_method))); + log_trace(redefine, class, iklass, add) + ("EMCP method %s is on_stack " INTPTR_FORMAT, old_method->name_and_sig_as_C_string(), p2i(old_method)); } else if (!old_method->is_obsolete()) { - RC_TRACE(0x00000400, ("add: EMCP method %s is NOT on_stack " INTPTR_FORMAT, - old_method->name_and_sig_as_C_string(), p2i(old_method))); + log_trace(redefine, class, iklass, add) + ("EMCP method %s is NOT on_stack " INTPTR_FORMAT, old_method->name_and_sig_as_C_string(), p2i(old_method)); } } } // Add previous version if any methods are still running. - RC_TRACE(0x00000400, ("add: scratch class added; one of its methods is on_stack")); + log_trace(redefine, class, iklass, add)("scratch class added; one of its methods is on_stack"); assert(scratch_class->previous_versions() == NULL, "shouldn't have a previous version"); scratch_class->link_previous_versions(previous_versions()); link_previous_versions(scratch_class()); @@ -3549,6 +3546,7 @@ void InstanceKlass::add_previous_version(instanceKlassHandle scratch_class, _previous_version_count++; } // end add_previous_version() +#endif // INCLUDE_JVMTI Method* InstanceKlass::method_with_idnum(int idnum) { Method* m = NULL; @@ -3598,7 +3596,7 @@ Method* InstanceKlass::method_with_orig_idnum(int idnum, int version) { return method; } - +#if INCLUDE_JVMTI jint InstanceKlass::get_cached_class_file_len() { return VM_RedefineClasses::get_cached_class_file_len(_cached_class_file); } @@ -3606,3 +3604,4 @@ jint InstanceKlass::get_cached_class_file_len() { unsigned char * InstanceKlass::get_cached_class_file_bytes() { return VM_RedefineClasses::get_cached_class_file_bytes(_cached_class_file); } +#endif diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index 768b3535ab4..494173b3ded 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -27,9 +27,9 @@ #include "classfile/classLoader.hpp" #include "classfile/classLoaderData.hpp" +#include "classfile/moduleEntry.hpp" #include "classfile/packageEntry.hpp" #include "gc/shared/specialized_oop_closures.hpp" -#include "classfile/moduleEntry.hpp" #include "logging/logLevel.hpp" #include "memory/referenceType.hpp" #include "oops/annotations.hpp" @@ -57,7 +57,9 @@ // forward declaration for class -- see below for definition +#if INCLUDE_JVMTI class BreakpointInfo; +#endif class ClassFileParser; class KlassDepChange; class DependencyContext; @@ -188,6 +190,7 @@ class InstanceKlass: public Klass { // _is_marked_dependent can be set concurrently, thus cannot be part of the // _misc_flags. bool _is_marked_dependent; // used for marking during flushing and deoptimization + bool _is_being_redefined; // used for locking redefinition // The low two bits of _misc_flags contains the kind field. // This can be used to quickly discriminate among the four kinds of @@ -230,12 +233,14 @@ class InstanceKlass: public Klass { jmethodID* _methods_jmethod_ids; // jmethodIDs corresponding to method_idnum, or NULL if none intptr_t _dep_context; // packed DependencyContext structure nmethod* _osr_nmethods_head; // Head of list of on-stack replacement nmethods for this class +#if INCLUDE_JVMTI BreakpointInfo* _breakpoints; // bpt lists, managed by Method* // Linked instanceKlasses of previous versions InstanceKlass* _previous_versions; // JVMTI fields can be moved to their own structure - see 6315920 // JVMTI: cached class file, before retransformable agent modified it in CFLH JvmtiCachedClassFileData* _cached_class_file; +#endif volatile u2 _idnum_allocated_count; // JNI/JVMTI: increments with the addition of methods, old ids don't change @@ -245,7 +250,9 @@ class InstanceKlass: public Klass { u1 _init_state; // state of class u1 _reference_type; // reference type +#if INCLUDE_JVMTI JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map; // JVMTI: used during heap iteration +#endif NOT_PRODUCT(int _verify_count;) // to avoid redundant verifies @@ -315,7 +322,7 @@ class InstanceKlass: public Klass { return (_misc_flags & _misc_is_shared_app_class) != 0; } - void set_class_loader_type(jshort loader_type) { + void set_class_loader_type(s2 loader_type) { assert(( _misc_flags & loader_type_bits()) == 0, "Should only be called once for each class."); switch (loader_type) { @@ -687,10 +694,18 @@ class InstanceKlass: public Klass { _nonstatic_oop_map_size = words; } +#if INCLUDE_JVMTI + // Redefinition locking. Class can only be redefined by one thread at a time. + bool is_being_redefined() const { return _is_being_redefined; } + void set_is_being_redefined(bool value) { _is_being_redefined = value; } + // RedefineClasses() support for previous versions: void add_previous_version(instanceKlassHandle ikh, int emcp_method_count); InstanceKlass* previous_versions() const { return _previous_versions; } +#else + InstanceKlass* previous_versions() const { return NULL; } +#endif InstanceKlass* get_klass_version(int version) { for (InstanceKlass* ik = this; ik != NULL; ik = ik->previous_versions()) { @@ -738,6 +753,8 @@ public: bool is_mirror_instance_klass() const { return is_kind(_misc_kind_mirror); } bool is_class_loader_instance_klass() const { return is_kind(_misc_kind_class_loader); } +#if INCLUDE_JVMTI + void init_previous_versions() { _previous_versions = NULL; } @@ -764,6 +781,16 @@ public: return _jvmti_cached_class_field_map; } +#else // INCLUDE_JVMTI + + static void purge_previous_versions(InstanceKlass* ik) { return; }; + static bool has_previous_versions() { return false; } + + void set_cached_class_file(JvmtiCachedClassFileData *data) { ShouldNotReachHere(); } + JvmtiCachedClassFileData * get_cached_class_file() { return (JvmtiCachedClassFileData *)NULL; } + +#endif // INCLUDE_JVMTI + bool has_default_methods() const { return (_misc_flags & _misc_has_default_methods) != 0; } @@ -882,9 +909,11 @@ public: int mark_osr_nmethods(const Method* m); nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const; +#if INCLUDE_JVMTI // Breakpoint support (see methods on Method* for details) BreakpointInfo* breakpoints() const { return _breakpoints; }; void set_breakpoints(BreakpointInfo* bps) { _breakpoints = bps; }; +#endif // support for stub routines static ByteSize init_state_offset() { return in_ByteSize(offset_of(InstanceKlass, _init_state)); } @@ -1253,9 +1282,11 @@ private: // Free CHeap allocated fields. void release_C_heap_structures(); +#if INCLUDE_JVMTI // RedefineClasses support void link_previous_versions(InstanceKlass* pv) { _previous_versions = pv; } void mark_newly_obsolete_methods(Array* old_methods, int emcp_method_count); +#endif public: // CDS support - remove and restore oops from metadata. Oops are not shared. virtual void remove_unshareable_info(); diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index 8e3267868b8..d31e9e5706c 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -401,9 +401,9 @@ void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive Klass* sub = current->subklass(); while (sub != NULL && !sub->is_loader_alive(is_alive)) { #ifndef PRODUCT - if (log_is_enabled(Trace, classunload)) { + if (log_is_enabled(Trace, class, unload)) { ResourceMark rm; - log_trace(classunload)("unlinking class (subclass): %s", sub->external_name()); + log_trace(class, unload)("unlinking class (subclass): %s", sub->external_name()); } #endif sub = sub->next_sibling(); @@ -416,9 +416,9 @@ void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive // Find and set the first alive sibling Klass* sibling = current->next_sibling(); while (sibling != NULL && !sibling->is_loader_alive(is_alive)) { - if (log_is_enabled(Trace, classunload)) { + if (log_is_enabled(Trace, class, unload)) { ResourceMark rm; - log_trace(classunload)("[Unlinking class (sibling) %s]", sibling->external_name()); + log_trace(class, unload)("[Unlinking class (sibling) %s]", sibling->external_name()); } sibling = sibling->next_sibling(); } diff --git a/hotspot/src/share/vm/oops/klass.hpp b/hotspot/src/share/vm/oops/klass.hpp index 14675aa81ee..b6181d4b877 100644 --- a/hotspot/src/share/vm/oops/klass.hpp +++ b/hotspot/src/share/vm/oops/klass.hpp @@ -52,11 +52,13 @@ template class Array; template class GrowableArray; class ClassLoaderData; +class fieldDescriptor; +class KlassSizeStats; class klassVtable; +class ModuleEntry; +class PackageEntry; class ParCompactionManager; class PSPromotionManager; -class KlassSizeStats; -class fieldDescriptor; class vtableEntry; class Klass : public Metadata { @@ -274,6 +276,9 @@ protected: _shared_class_path_index = index; }; + // Obtain the module or package for this class + virtual ModuleEntry* module() const = 0; + virtual PackageEntry* package() const = 0; protected: // internal accessors void set_subklass(Klass* s); diff --git a/hotspot/src/share/vm/oops/klassVtable.cpp b/hotspot/src/share/vm/oops/klassVtable.cpp index af4bde9b751..6d0c895f812 100644 --- a/hotspot/src/share/vm/oops/klassVtable.cpp +++ b/hotspot/src/share/vm/oops/klassVtable.cpp @@ -34,7 +34,6 @@ #include "oops/method.hpp" #include "oops/objArrayOop.hpp" #include "oops/oop.inline.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" #include "utilities/copy.hpp" @@ -887,19 +886,17 @@ void klassVtable::adjust_method_entries(InstanceKlass* holder, bool * trace_name updated_default = adjust_default_method(index, old_method, new_method); } - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: klassname=%s for methods from name=%s", - klass()->external_name(), - old_method->method_holder()->external_name())); + log_info(redefine, class, update) + ("adjust: klassname=%s for methods from name=%s", + klass()->external_name(), old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00100000, ("vtable method update: %s(%s), updated default = %s", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string(), - updated_default ? "true" : "false")); + log_debug(redefine, class, update, vtables) + ("vtable method update: %s(%s), updated default = %s", + new_method->name()->as_C_string(), new_method->signature()->as_C_string(), updated_default ? "true" : "false"); } } } @@ -1205,17 +1202,14 @@ void klassItable::adjust_method_entries(InstanceKlass* holder, bool * trace_name ime->initialize(new_method); - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00200000, ("itable method update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_trace(redefine, class, update, itables) + ("itable method update: %s(%s)", new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } } } diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp index 3491bda1c69..8e7f9c8b42e 100644 --- a/hotspot/src/share/vm/oops/method.cpp +++ b/hotspot/src/share/vm/oops/method.cpp @@ -737,7 +737,7 @@ void Method::set_native_function(address function, bool post_event_flag) { // This function can be called more than once. We must make sure that we always // use the latest registered method -> check if a stub already has been generated. // If so, we have to make it not_entrant. - nmethod* nm = code(); // Put it into local variable to guard against concurrent updates + CompiledMethod* nm = code(); // Put it into local variable to guard against concurrent updates if (nm != NULL) { nm->make_not_entrant(); } @@ -1037,12 +1037,12 @@ address Method::verified_code_entry() { // Not inline to avoid circular ref. bool Method::check_code() const { // cached in a register or local. There's a race on the value of the field. - nmethod *code = (nmethod *)OrderAccess::load_ptr_acquire(&_code); + CompiledMethod *code = (CompiledMethod *)OrderAccess::load_ptr_acquire(&_code); return code == NULL || (code->method() == NULL) || (code->method() == (Method*)this && !code->is_osr_method()); } // Install compiled code. Instantly it can execute. -void Method::set_code(methodHandle mh, nmethod *code) { +void Method::set_code(methodHandle mh, CompiledMethod *code) { assert( code, "use clear_code to remove code" ); assert( mh->check_code(), "" ); @@ -1628,6 +1628,7 @@ bool CompressedLineNumberReadStream::read_pair() { return true; } +#if INCLUDE_JVMTI Bytecodes::Code Method::orig_bytecode_at(int bci) const { BreakpointInfo* bp = method_holder()->breakpoints(); @@ -1708,6 +1709,7 @@ void Method::clear_all_breakpoints() { clear_matches(this, -1); } +#endif // INCLUDE_JVMTI int Method::invocation_count() { MethodCounters *mcs = method_counters(); @@ -1773,6 +1775,8 @@ void Method::set_highest_osr_comp_level(int level) { } } +#if INCLUDE_JVMTI + BreakpointInfo::BreakpointInfo(Method* m, int bci) { _bci = bci; _name_index = m->name_index(); @@ -1810,6 +1814,8 @@ void BreakpointInfo::clear(Method* method) { method->decr_number_of_breakpoints(Thread::current()); } +#endif // INCLUDE_JVMTI + // jmethodID handling // This is a block allocating object, sort of like JNIHandleBlock, only a diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp index 264a07db004..6b852d37502 100644 --- a/hotspot/src/share/vm/oops/method.hpp +++ b/hotspot/src/share/vm/oops/method.hpp @@ -58,6 +58,7 @@ class MethodCounters; class ConstMethod; class InlineTableSizes; class KlassSizeStats; +class CompiledMethod; class Method : public Metadata { friend class VMStructs; @@ -98,7 +99,7 @@ class Method : public Metadata { // field can come and go. It can transition from NULL to not-null at any // time (whenever a compile completes). It can transition from not-null to // NULL only at safepoints (because of a de-opt). - nmethod* volatile _code; // Points to the corresponding piece of native code + CompiledMethod* volatile _code; // Points to the corresponding piece of native code volatile address _from_interpreted_entry; // Cache of _code ? _adapter->i2c_entry() : _i2i_entry // Constructor @@ -187,8 +188,18 @@ class Method : public Metadata { } // JVMTI breakpoints +#if !INCLUDE_JVMTI + Bytecodes::Code orig_bytecode_at(int bci) const { + ShouldNotReachHere(); + return Bytecodes::_shouldnotreachhere; + } + void set_orig_bytecode_at(int bci, Bytecodes::Code code) { + ShouldNotReachHere(); + }; + u2 number_of_breakpoints() const {return 0;} +#else // !INCLUDE_JVMTI Bytecodes::Code orig_bytecode_at(int bci) const; - void set_orig_bytecode_at(int bci, Bytecodes::Code code); + void set_orig_bytecode_at(int bci, Bytecodes::Code code); void set_breakpoint(int bci); void clear_breakpoint(int bci); void clear_all_breakpoints(); @@ -221,6 +232,7 @@ class Method : public Metadata { mcs->clear_number_of_breakpoints(); } } +#endif // !INCLUDE_JVMTI // index into InstanceKlass methods() array // note: also used by jfr @@ -423,9 +435,9 @@ class Method : public Metadata { // nmethod/verified compiler entry address verified_code_entry(); bool check_code() const; // Not inline to avoid circular ref - nmethod* volatile code() const { assert( check_code(), "" ); return (nmethod *)OrderAccess::load_ptr_acquire(&_code); } + CompiledMethod* volatile code() const { assert( check_code(), "" ); return (CompiledMethod *)OrderAccess::load_ptr_acquire(&_code); } void clear_code(); // Clear out any compiled code - static void set_code(methodHandle mh, nmethod* code); + static void set_code(methodHandle mh, CompiledMethod* code); void set_adapter_entry(AdapterHandlerEntry* adapter) { constMethod()->set_adapter_entry(adapter); } @@ -1034,6 +1046,8 @@ class CompressedLineNumberReadStream: public CompressedReadStream { }; +#if INCLUDE_JVMTI + /// Fast Breakpoints. // If this structure gets more complicated (because bpts get numerous), @@ -1078,6 +1092,8 @@ class BreakpointInfo : public CHeapObj { void clear(Method* method); }; +#endif // INCLUDE_JVMTI + // Utility class for access exception handlers class ExceptionTable : public StackObj { private: diff --git a/hotspot/src/share/vm/oops/methodCounters.hpp b/hotspot/src/share/vm/oops/methodCounters.hpp index a0b96b6ba8b..2a06ab6eb2e 100644 --- a/hotspot/src/share/vm/oops/methodCounters.hpp +++ b/hotspot/src/share/vm/oops/methodCounters.hpp @@ -38,7 +38,9 @@ class MethodCounters: public MetaspaceObj { int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered) u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting #endif +#if INCLUDE_JVMTI u2 _number_of_breakpoints; // fullspeed debugging support +#endif InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations // NMethod age is a counter for warm methods detection in the code cache sweeper. @@ -62,8 +64,7 @@ class MethodCounters: public MetaspaceObj { u1 _highest_osr_comp_level; // Same for OSR level #endif - MethodCounters(methodHandle mh) : _number_of_breakpoints(0), - _nmethod_age(INT_MAX) + MethodCounters(methodHandle mh) : _nmethod_age(INT_MAX) #ifdef TIERED , _rate(0), _prev_time(0), @@ -73,6 +74,7 @@ class MethodCounters: public MetaspaceObj { { set_interpreter_invocation_count(0); set_interpreter_throwout_count(0); + JVMTI_ONLY(clear_number_of_breakpoints()); invocation_counter()->init(); backedge_counter()->init(); @@ -153,10 +155,12 @@ class MethodCounters: public MetaspaceObj { #endif // defined(COMPILER2) || INCLUDE_JVMCI +#if INCLUDE_JVMTI u2 number_of_breakpoints() const { return _number_of_breakpoints; } void incr_number_of_breakpoints() { ++_number_of_breakpoints; } void decr_number_of_breakpoints() { --_number_of_breakpoints; } void clear_number_of_breakpoints() { _number_of_breakpoints = 0; } +#endif #ifdef TIERED jlong prev_time() const { return _prev_time; } diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index 7f090471741..1abcc152fc6 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -23,6 +23,8 @@ */ #include "precompiled.hpp" +#include "classfile/moduleEntry.hpp" +#include "classfile/packageEntry.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" @@ -135,14 +137,7 @@ Klass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_data, // GC walks these as strong roots. loader_data->add_class(oak); - // The array is defined in the module of its bottom class - Klass* bottom_klass = oak->bottom_klass(); - ModuleEntry* module; - if (bottom_klass->is_instance_klass()) { - module = InstanceKlass::cast(bottom_klass)->module(); - } else { - module = ModuleEntryTable::javabase_module(); - } + ModuleEntry* module = oak->module(); assert(module != NULL, "No module entry for array"); // Call complete_create_array_klass after all instance variables has been initialized. @@ -422,6 +417,16 @@ jint ObjArrayKlass::compute_modifier_flags(TRAPS) const { | (JVM_ACC_ABSTRACT | JVM_ACC_FINAL); } +ModuleEntry* ObjArrayKlass::module() const { + assert(bottom_klass() != NULL, "ObjArrayKlass returned unexpected NULL bottom_klass"); + // The array is defined in the module of its bottom class + return bottom_klass()->module(); +} + +PackageEntry* ObjArrayKlass::package() const { + assert(bottom_klass() != NULL, "ObjArrayKlass returned unexpected NULL bottom_klass"); + return bottom_klass()->package(); +} // Printing diff --git a/hotspot/src/share/vm/oops/objArrayKlass.hpp b/hotspot/src/share/vm/oops/objArrayKlass.hpp index eabbec56c96..c2d1f7930ba 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.hpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.hpp @@ -54,6 +54,9 @@ class ObjArrayKlass : public ArrayKlass { void set_bottom_klass(Klass* k) { _bottom_klass = k; } Klass** bottom_klass_addr() { return &_bottom_klass; } + ModuleEntry* module() const; + PackageEntry* package() const; + // Compiler/Interpreter offset static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ObjArrayKlass, _element_klass)); } diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.cpp b/hotspot/src/share/vm/oops/typeArrayKlass.cpp index 3fa977001a0..76b2bb8e6b9 100644 --- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -23,6 +23,8 @@ */ #include "precompiled.hpp" +#include "classfile/moduleEntry.hpp" +#include "classfile/packageEntry.hpp" #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" @@ -341,3 +343,12 @@ void TypeArrayKlass::oop_print_on(oop obj, outputStream* st) { const char* TypeArrayKlass::internal_name() const { return Klass::external_name(); } + +// A TypeArrayKlass is an array of a primitive type, its defining module is java.base +ModuleEntry* TypeArrayKlass::module() const { + return ModuleEntryTable::javabase_module(); +} + +PackageEntry* TypeArrayKlass::package() const { + return NULL; +} diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.hpp b/hotspot/src/share/vm/oops/typeArrayKlass.hpp index 7f07e4fb482..031afe8af1b 100644 --- a/hotspot/src/share/vm/oops/typeArrayKlass.hpp +++ b/hotspot/src/share/vm/oops/typeArrayKlass.hpp @@ -150,6 +150,9 @@ class TypeArrayKlass : public ArrayKlass { public: const char* internal_name() const; + + ModuleEntry* module() const; + PackageEntry* package() const; }; #endif // SHARE_VM_OOPS_TYPEARRAYKLASS_HPP diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp index 2dbd3e4b894..bc3d772c3f8 100644 --- a/hotspot/src/share/vm/opto/block.cpp +++ b/hotspot/src/share/vm/opto/block.cpp @@ -73,7 +73,7 @@ void Block_List::print() { } #endif -uint Block::code_alignment() { +uint Block::code_alignment() const { // Check for Root block if (_pre_order == 0) return CodeEntryAlignment; // Check for Start block @@ -1727,8 +1727,14 @@ bool Trace::backedge(CFGEdge *e) { first_block()->set_loop_alignment(targ_block); } else { - // Backbranch into the middle of a trace - targ_block->set_loop_alignment(targ_block); + // That loop may already have a loop top (we're reaching it again + // through the backedge of an outer loop) + Block* b = prev(targ_block); + bool has_top = targ_block->head()->is_Loop() && b->has_loop_alignment() && !b->head()->is_Loop(); + if (!has_top) { + // Backbranch into the middle of a trace + targ_block->set_loop_alignment(targ_block); + } } return loop_rotated; diff --git a/hotspot/src/share/vm/opto/block.hpp b/hotspot/src/share/vm/opto/block.hpp index d7aa5bb783c..e1d4874d3ee 100644 --- a/hotspot/src/share/vm/opto/block.hpp +++ b/hotspot/src/share/vm/opto/block.hpp @@ -197,7 +197,7 @@ public: // Report the alignment required by this block. Must be a power of 2. // The previous block will insert nops to get this alignment. - uint code_alignment(); + uint code_alignment() const; uint compute_loop_alignment(); // BLOCK_FREQUENCY is a sentinel to mark uses of constant block frequencies. diff --git a/hotspot/src/share/vm/opto/c2_globals.cpp b/hotspot/src/share/vm/opto/c2_globals.cpp index 16cdfa711d0..d0a1bae95aa 100644 --- a/hotspot/src/share/vm/opto/c2_globals.cpp +++ b/hotspot/src/share/vm/opto/c2_globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -33,4 +33,5 @@ C2_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_EXPERIMENTAL_FLAG, \ MATERIALIZE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index ca02fd2cc8e..9b276301cda 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -61,7 +61,16 @@ // Defines all globals flags used by the server compiler. // -#define C2_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, range, constraint) \ +#define C2_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + experimental, \ + notproduct, \ + range, \ + constraint, \ + writeable) \ \ develop(bool, StressLCM, false, \ "Randomize instruction scheduling in LCM") \ @@ -587,28 +596,28 @@ range(0, 100) \ \ product(bool, BlockLayoutRotateLoops, true, \ - "Allow back branches to be fall throughs in the block layour") \ + "Allow back branches to be fall throughs in the block layout") \ \ - develop(bool, InlineReflectionGetCallerClass, true, \ + diagnostic(bool, InlineReflectionGetCallerClass, true, \ "inline sun.reflect.Reflection.getCallerClass(), known to be " \ "part of base library DLL") \ \ - develop(bool, InlineObjectCopy, true, \ + diagnostic(bool, InlineObjectCopy, true, \ "inline Object.clone and Arrays.copyOf[Range] intrinsics") \ \ - develop(bool, SpecialStringCompareTo, true, \ + diagnostic(bool, SpecialStringCompareTo, true, \ "special version of string compareTo") \ \ - develop(bool, SpecialStringIndexOf, true, \ + diagnostic(bool, SpecialStringIndexOf, true, \ "special version of string indexOf") \ \ - develop(bool, SpecialStringEquals, true, \ + diagnostic(bool, SpecialStringEquals, true, \ "special version of string equals") \ \ - develop(bool, SpecialArraysEquals, true, \ + diagnostic(bool, SpecialArraysEquals, true, \ "special version of Arrays.equals(char[],char[])") \ \ - product(bool, SpecialEncodeISOArray, true, \ + diagnostic(bool, SpecialEncodeISOArray, true, \ "special version of ISO_8859_1$Encoder.encodeISOArray") \ \ develop(bool, BailoutToInterpreterForThrows, false, \ @@ -710,22 +719,22 @@ diagnostic(bool, OptimizeExpensiveOps, true, \ "Find best control for expensive operations") \ \ - product(bool, UseMathExactIntrinsics, true, \ + diagnostic(bool, UseMathExactIntrinsics, true, \ "Enables intrinsification of various java.lang.Math functions") \ \ - product(bool, UseMultiplyToLenIntrinsic, false, \ + diagnostic(bool, UseMultiplyToLenIntrinsic, false, \ "Enables intrinsification of BigInteger.multiplyToLen()") \ \ - product(bool, UseSquareToLenIntrinsic, false, \ + diagnostic(bool, UseSquareToLenIntrinsic, false, \ "Enables intrinsification of BigInteger.squareToLen()") \ \ - product(bool, UseMulAddIntrinsic, false, \ + diagnostic(bool, UseMulAddIntrinsic, false, \ "Enables intrinsification of BigInteger.mulAdd()") \ \ - product(bool, UseMontgomeryMultiplyIntrinsic, false, \ + diagnostic(bool, UseMontgomeryMultiplyIntrinsic, false, \ "Enables intrinsification of BigInteger.montgomeryMultiply()") \ \ - product(bool, UseMontgomerySquareIntrinsic, false, \ + diagnostic(bool, UseMontgomerySquareIntrinsic, false, \ "Enables intrinsification of BigInteger.montgomerySquare()") \ \ product(bool, UseTypeSpeculation, true, \ @@ -758,6 +767,7 @@ C2_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_EXPERIMENTAL_FLAG, \ DECLARE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // SHARE_VM_OPTO_C2_GLOBALS_HPP diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp index a93742fe545..a91b1c2f6e0 100644 --- a/hotspot/src/share/vm/opto/c2compiler.cpp +++ b/hotspot/src/share/vm/opto/c2compiler.cpp @@ -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 @@ -361,6 +361,9 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt case vmIntrinsics::_getCallerClass: if (SystemDictionary::reflect_CallerSensitive_klass() == NULL) return false; break; + case vmIntrinsics::_onSpinWait: + if (!Matcher::match_rule_supported(Op_OnSpinWait)) return false; + break; case vmIntrinsics::_hashCode: case vmIntrinsics::_identityHashCode: case vmIntrinsics::_getClass: @@ -406,22 +409,6 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt case vmIntrinsics::_putLong: case vmIntrinsics::_putFloat: case vmIntrinsics::_putDouble: - case vmIntrinsics::_getByte_raw: - case vmIntrinsics::_getShort_raw: - case vmIntrinsics::_getChar_raw: - case vmIntrinsics::_getInt_raw: - case vmIntrinsics::_getLong_raw: - case vmIntrinsics::_getFloat_raw: - case vmIntrinsics::_getDouble_raw: - case vmIntrinsics::_getAddress_raw: - case vmIntrinsics::_putByte_raw: - case vmIntrinsics::_putShort_raw: - case vmIntrinsics::_putChar_raw: - case vmIntrinsics::_putInt_raw: - case vmIntrinsics::_putLong_raw: - case vmIntrinsics::_putFloat_raw: - case vmIntrinsics::_putDouble_raw: - case vmIntrinsics::_putAddress_raw: case vmIntrinsics::_getObjectVolatile: case vmIntrinsics::_getBooleanVolatile: case vmIntrinsics::_getByteVolatile: @@ -542,7 +529,7 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt case vmIntrinsics::_updateByteBufferAdler32: case vmIntrinsics::_profileBoolean: case vmIntrinsics::_isCompileConstant: - case vmIntrinsics::_Objects_checkIndex: + case vmIntrinsics::_Preconditions_checkIndex: break; default: return false; diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp index 25e34e57738..594ffd2e70a 100644 --- a/hotspot/src/share/vm/opto/cfgnode.cpp +++ b/hotspot/src/share/vm/opto/cfgnode.cpp @@ -1703,16 +1703,19 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { } if (uncasted) { - // Wait until after parsing for the type information to propagate from the casts + // Add a cast node between the phi to be removed and its unique input. + // Wait until after parsing for the type information to propagate from the casts. assert(can_reshape, "Invalid during parsing"); const Type* phi_type = bottom_type(); assert(phi_type->isa_int() || phi_type->isa_ptr(), "bad phi type"); int opcode; + // Determine the type of cast to be added. if (phi_type->isa_int()) { opcode = Op_CastII; } else { const Type* uin_type = phase->type(uin); - if (phi_type->join(TypePtr::NOTNULL) == uin_type->join(TypePtr::NOTNULL)) { + if ((phi_type->join(TypePtr::NOTNULL) == uin_type->join(TypePtr::NOTNULL)) || + (!phi_type->isa_oopptr() && !uin_type->isa_oopptr())) { opcode = Op_CastPP; } else { opcode = Op_CheckCastPP; diff --git a/hotspot/src/share/vm/opto/classes.hpp b/hotspot/src/share/vm/opto/classes.hpp index ee36282de38..790f4f499be 100644 --- a/hotspot/src/share/vm/opto/classes.hpp +++ b/hotspot/src/share/vm/opto/classes.hpp @@ -171,7 +171,6 @@ macro(LoadN) macro(LoadRange) macro(LoadS) macro(Lock) -macro(Log10D) macro(Loop) macro(LoopLimit) macro(Mach) @@ -179,6 +178,7 @@ macro(MachProj) macro(MaxI) macro(MemBarAcquire) macro(LoadFence) +macro(SetVectMaskI) macro(MemBarAcquireLock) macro(MemBarCPUOrder) macro(MemBarRelease) @@ -205,6 +205,7 @@ macro(Multi) macro(NegD) macro(NegF) macro(NeverBranch) +macro(OnSpinWait) macro(Opaque1) macro(Opaque2) macro(Opaque3) @@ -264,7 +265,6 @@ macro(SubI) macro(SubL) macro(TailCall) macro(TailJump) -macro(TanD) macro(ThreadLocal) macro(Unlock) macro(URShiftI) diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index cd212ea015c..5e1e50ef6af 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -565,7 +565,7 @@ uint Compile::scratch_emit_size(const Node* n) { relocInfo* locs_buf = scratch_locs_memory(); address blob_begin = blob->content_begin(); address blob_end = (address)locs_buf; - assert(blob->content_contains(blob_end), "sanity"); + assert(blob->contains(blob_end), "sanity"); CodeBuffer buf(blob_begin, blob_end - blob_begin); buf.initialize_consts_size(_scratch_const_size); buf.initialize_stubs_size(MAX_stubs_size); @@ -1623,6 +1623,17 @@ void Compile::AliasType::Init(int i, const TypePtr* at) { } } +BasicType Compile::AliasType::basic_type() const { + if (element() != NULL) { + const Type* element = adr_type()->is_aryptr()->elem(); + return element->isa_narrowoop() ? T_OBJECT : element->array_element_basic_type(); + } if (field() != NULL) { + return field()->layout_type(); + } else { + return T_ILLEGAL; // unknown + } +} + //---------------------------------print_on------------------------------------ #ifndef PRODUCT void Compile::AliasType::print_on(outputStream* st) { @@ -2835,7 +2846,7 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { assert( !addp->is_AddP() || addp->in(AddPNode::Base)->is_top() || // Top OK for allocation addp->in(AddPNode::Base) == n->in(AddPNode::Base), - "Base pointers must match" ); + "Base pointers must match (addp %u)", addp->_idx ); #ifdef _LP64 if ((UseCompressedOops || UseCompressedClassPointers) && addp->Opcode() == Op_ConP && @@ -2870,6 +2881,21 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { } else { nn = new DecodeNKlassNode(nn, t); } + // Check for succeeding AddP which uses the same Base. + // Otherwise we will run into the assertion above when visiting that guy. + for (uint i = 0; i < n->outcnt(); ++i) { + Node *out_i = n->raw_out(i); + if (out_i && out_i->is_AddP() && out_i->in(AddPNode::Base) == addp) { + out_i->set_req(AddPNode::Base, nn); +#ifdef ASSERT + for (uint j = 0; j < out_i->outcnt(); ++j) { + Node *out_j = out_i->raw_out(j); + assert(out_j == NULL || !out_j->is_AddP() || out_j->in(AddPNode::Base) != addp, + "more than 2 AddP nodes in a chain (out_j %u)", out_j->_idx); + } +#endif + } + } n->set_req(AddPNode::Base, nn); n->set_req(AddPNode::Address, nn); if (addp->outcnt() == 0) { @@ -2879,6 +2905,8 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { } } #endif + // platform dependent reshaping of the address expression + reshape_address(n->as_AddP()); break; } @@ -3237,6 +3265,43 @@ void Compile::final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc) { frc._tests.push(iff); break; } + case Op_ConvI2L: { + if (!Matcher::convi2l_type_required) { + // Code generation on some platforms doesn't need accurate + // ConvI2L types. Widening the type can help remove redundant + // address computations. + n->as_Type()->set_type(TypeLong::INT); + ResourceMark rm; + Node_List wq; + wq.push(n); + for (uint next = 0; next < wq.size(); next++) { + Node *m = wq.at(next); + + for(;;) { + // Loop over all nodes with identical inputs edges as m + Node* k = m->find_similar(m->Opcode()); + if (k == NULL) { + break; + } + // Push their uses so we get a chance to remove node made + // redundant + for (DUIterator_Fast imax, i = k->fast_outs(imax); i < imax; i++) { + Node* u = k->fast_out(i); + assert(!wq.contains(u), "shouldn't process one node several times"); + if (u->Opcode() == Op_LShiftL || + u->Opcode() == Op_AddL || + u->Opcode() == Op_SubL || + u->Opcode() == Op_AddP) { + wq.push(u); + } + } + // Replace all nodes with identical edges as m with m + k->subsume_by(m, this); + } + } + } + break; + } default: assert( !n->is_Call(), "" ); assert( !n->is_Mem(), "" ); diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 7076f4a68ef..f8743d86ba9 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -44,6 +44,7 @@ #include "trace/tracing.hpp" #include "utilities/ticks.hpp" +class AddPNode; class Block; class Bundle; class C2Compiler; @@ -213,6 +214,8 @@ class Compile : public Phase { _element = e; } + BasicType basic_type() const; + void print_on(outputStream* st) PRODUCT_RETURN; }; @@ -577,6 +580,8 @@ class Compile : public Phase { int _scratch_const_size; // For temporary code buffers. bool _in_scratch_emit_size; // true when in scratch_emit_size. + void reshape_address(AddPNode* n); + public: // Accessors @@ -1099,7 +1104,7 @@ class Compile : public Phase { int code_size() { return _method_size; } CodeBuffer* code_buffer() { return &_code_buffer; } int first_block_size() { return _first_block_size; } - void set_frame_complete(int off) { _code_offsets.set_value(CodeOffsets::Frame_Complete, off); } + void set_frame_complete(int off) { if (!in_scratch_emit_size()) { _code_offsets.set_value(CodeOffsets::Frame_Complete, off); } } ExceptionHandlerTable* handler_table() { return &_handler_table; } ImplicitExceptionTable* inc_table() { return &_inc_table; } OopMapSet* oop_map_set() { return _oop_map_set; } diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index a9f1cd10f29..9350074955a 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -4467,6 +4467,25 @@ void GraphKit::inflate_string_slow(Node* src, Node* dst, Node* start, Node* coun set_memory(st, TypeAryPtr::BYTES); } +Node* GraphKit::make_constant_from_field(ciField* field, Node* obj) { + if (!field->is_constant()) { + return NULL; // Field not marked as constant. + } + ciInstance* holder = NULL; + if (!field->is_static()) { + ciObject* const_oop = obj->bottom_type()->is_oopptr()->const_oop(); + if (const_oop != NULL && const_oop->is_instance()) { + holder = const_oop->as_instance(); + } + } + const Type* con_type = Type::make_constant_from_field(field, holder, field->layout_type(), + /*is_unsigned_load=*/false); + if (con_type != NULL) { + return makecon(con_type); + } + return NULL; +} + Node* GraphKit::cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type) { // Reify the property as a CastPP node in Ideal graph to comply with monotonicity // assumption of CCP analysis. diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index 218e937818b..797705d3a42 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -910,6 +910,8 @@ class GraphKit : public Phase { void add_predicate(int nargs = 0); void add_predicate_impl(Deoptimization::DeoptReason reason, int nargs); + Node* make_constant_from_field(ciField* field, Node* obj); + // Produce new array node of stable type Node* cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type); }; diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 13d153ce70d..5c14d3a7591 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -93,7 +93,7 @@ class LibraryCallKit : public GraphKit { Node* _result; // the result node, if any int _reexecute_sp; // the stack pointer when bytecode needs to be reexecuted - const TypeOopPtr* sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type, bool is_native_ptr = false); + const TypeOopPtr* sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type); public: LibraryCallKit(JVMState* jvms, LibraryIntrinsic* intrinsic) @@ -247,7 +247,7 @@ class LibraryCallKit : public GraphKit { void insert_pre_barrier(Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar); typedef enum { Relaxed, Opaque, Volatile, Acquire, Release } AccessKind; - bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, AccessKind kind, bool is_unaligned); + bool inline_unsafe_access(bool is_store, BasicType type, AccessKind kind, bool is_unaligned); static bool klass_needs_init_guard(Node* kls); bool inline_unsafe_allocate(); bool inline_unsafe_newArray(bool uninitialized); @@ -261,7 +261,7 @@ class LibraryCallKit : public GraphKit { bool inline_native_getLength(); bool inline_array_copyOf(bool is_copyOfRange); bool inline_array_equals(StrIntrinsicNode::ArgEnc ae); - bool inline_objects_checkIndex(); + bool inline_preconditions_checkIndex(); void copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, bool is_array, bool card_mark); bool inline_native_clone(bool is_virtual); bool inline_native_Reflection_getCallerClass(); @@ -281,6 +281,7 @@ class LibraryCallKit : public GraphKit { MemNode::MemOrd access_kind_to_memord(AccessKind access_kind); bool inline_unsafe_load_store(BasicType type, LoadStoreKind kind, AccessKind access_kind); bool inline_unsafe_fence(vmIntrinsics::ID id); + bool inline_onspinwait(); bool inline_fp_conversions(vmIntrinsics::ID id); bool inline_number_methods(vmIntrinsics::ID id); bool inline_reference_get(); @@ -474,7 +475,6 @@ bool LibraryCallKit::try_to_inline(int predicate) { // Handle symbolic names for otherwise undistinguished boolean switches: const bool is_store = true; const bool is_compress = true; - const bool is_native_ptr = true; const bool is_static = true; const bool is_volatile = true; @@ -554,113 +554,95 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_inflateStringC: case vmIntrinsics::_inflateStringB: return inline_string_copy(!is_compress); - case vmIntrinsics::_getObject: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Relaxed, false); - case vmIntrinsics::_getBoolean: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Relaxed, false); - case vmIntrinsics::_getByte: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Relaxed, false); - case vmIntrinsics::_getShort: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Relaxed, false); - case vmIntrinsics::_getChar: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Relaxed, false); - case vmIntrinsics::_getInt: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Relaxed, false); - case vmIntrinsics::_getLong: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Relaxed, false); - case vmIntrinsics::_getFloat: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Relaxed, false); - case vmIntrinsics::_getDouble: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Relaxed, false); + case vmIntrinsics::_getObject: return inline_unsafe_access(!is_store, T_OBJECT, Relaxed, false); + case vmIntrinsics::_getBoolean: return inline_unsafe_access(!is_store, T_BOOLEAN, Relaxed, false); + case vmIntrinsics::_getByte: return inline_unsafe_access(!is_store, T_BYTE, Relaxed, false); + case vmIntrinsics::_getShort: return inline_unsafe_access(!is_store, T_SHORT, Relaxed, false); + case vmIntrinsics::_getChar: return inline_unsafe_access(!is_store, T_CHAR, Relaxed, false); + case vmIntrinsics::_getInt: return inline_unsafe_access(!is_store, T_INT, Relaxed, false); + case vmIntrinsics::_getLong: return inline_unsafe_access(!is_store, T_LONG, Relaxed, false); + case vmIntrinsics::_getFloat: return inline_unsafe_access(!is_store, T_FLOAT, Relaxed, false); + case vmIntrinsics::_getDouble: return inline_unsafe_access(!is_store, T_DOUBLE, Relaxed, false); - case vmIntrinsics::_putObject: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Relaxed, false); - case vmIntrinsics::_putBoolean: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Relaxed, false); - case vmIntrinsics::_putByte: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Relaxed, false); - case vmIntrinsics::_putShort: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Relaxed, false); - case vmIntrinsics::_putChar: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Relaxed, false); - case vmIntrinsics::_putInt: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Relaxed, false); - case vmIntrinsics::_putLong: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Relaxed, false); - case vmIntrinsics::_putFloat: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Relaxed, false); - case vmIntrinsics::_putDouble: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Relaxed, false); + case vmIntrinsics::_putObject: return inline_unsafe_access( is_store, T_OBJECT, Relaxed, false); + case vmIntrinsics::_putBoolean: return inline_unsafe_access( is_store, T_BOOLEAN, Relaxed, false); + case vmIntrinsics::_putByte: return inline_unsafe_access( is_store, T_BYTE, Relaxed, false); + case vmIntrinsics::_putShort: return inline_unsafe_access( is_store, T_SHORT, Relaxed, false); + case vmIntrinsics::_putChar: return inline_unsafe_access( is_store, T_CHAR, Relaxed, false); + case vmIntrinsics::_putInt: return inline_unsafe_access( is_store, T_INT, Relaxed, false); + case vmIntrinsics::_putLong: return inline_unsafe_access( is_store, T_LONG, Relaxed, false); + case vmIntrinsics::_putFloat: return inline_unsafe_access( is_store, T_FLOAT, Relaxed, false); + case vmIntrinsics::_putDouble: return inline_unsafe_access( is_store, T_DOUBLE, Relaxed, false); - case vmIntrinsics::_getByte_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_BYTE, Relaxed, false); - case vmIntrinsics::_getShort_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_SHORT, Relaxed, false); - case vmIntrinsics::_getChar_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_CHAR, Relaxed, false); - case vmIntrinsics::_getInt_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_INT, Relaxed, false); - case vmIntrinsics::_getLong_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_LONG, Relaxed, false); - case vmIntrinsics::_getFloat_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_FLOAT, Relaxed, false); - case vmIntrinsics::_getDouble_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_DOUBLE, Relaxed, false); - case vmIntrinsics::_getAddress_raw: return inline_unsafe_access( is_native_ptr, !is_store, T_ADDRESS, Relaxed, false); + case vmIntrinsics::_getObjectVolatile: return inline_unsafe_access(!is_store, T_OBJECT, Volatile, false); + case vmIntrinsics::_getBooleanVolatile: return inline_unsafe_access(!is_store, T_BOOLEAN, Volatile, false); + case vmIntrinsics::_getByteVolatile: return inline_unsafe_access(!is_store, T_BYTE, Volatile, false); + case vmIntrinsics::_getShortVolatile: return inline_unsafe_access(!is_store, T_SHORT, Volatile, false); + case vmIntrinsics::_getCharVolatile: return inline_unsafe_access(!is_store, T_CHAR, Volatile, false); + case vmIntrinsics::_getIntVolatile: return inline_unsafe_access(!is_store, T_INT, Volatile, false); + case vmIntrinsics::_getLongVolatile: return inline_unsafe_access(!is_store, T_LONG, Volatile, false); + case vmIntrinsics::_getFloatVolatile: return inline_unsafe_access(!is_store, T_FLOAT, Volatile, false); + case vmIntrinsics::_getDoubleVolatile: return inline_unsafe_access(!is_store, T_DOUBLE, Volatile, false); - case vmIntrinsics::_putByte_raw: return inline_unsafe_access( is_native_ptr, is_store, T_BYTE, Relaxed, false); - case vmIntrinsics::_putShort_raw: return inline_unsafe_access( is_native_ptr, is_store, T_SHORT, Relaxed, false); - case vmIntrinsics::_putChar_raw: return inline_unsafe_access( is_native_ptr, is_store, T_CHAR, Relaxed, false); - case vmIntrinsics::_putInt_raw: return inline_unsafe_access( is_native_ptr, is_store, T_INT, Relaxed, false); - case vmIntrinsics::_putLong_raw: return inline_unsafe_access( is_native_ptr, is_store, T_LONG, Relaxed, false); - case vmIntrinsics::_putFloat_raw: return inline_unsafe_access( is_native_ptr, is_store, T_FLOAT, Relaxed, false); - case vmIntrinsics::_putDouble_raw: return inline_unsafe_access( is_native_ptr, is_store, T_DOUBLE, Relaxed, false); - case vmIntrinsics::_putAddress_raw: return inline_unsafe_access( is_native_ptr, is_store, T_ADDRESS, Relaxed, false); + case vmIntrinsics::_putObjectVolatile: return inline_unsafe_access( is_store, T_OBJECT, Volatile, false); + case vmIntrinsics::_putBooleanVolatile: return inline_unsafe_access( is_store, T_BOOLEAN, Volatile, false); + case vmIntrinsics::_putByteVolatile: return inline_unsafe_access( is_store, T_BYTE, Volatile, false); + case vmIntrinsics::_putShortVolatile: return inline_unsafe_access( is_store, T_SHORT, Volatile, false); + case vmIntrinsics::_putCharVolatile: return inline_unsafe_access( is_store, T_CHAR, Volatile, false); + case vmIntrinsics::_putIntVolatile: return inline_unsafe_access( is_store, T_INT, Volatile, false); + case vmIntrinsics::_putLongVolatile: return inline_unsafe_access( is_store, T_LONG, Volatile, false); + case vmIntrinsics::_putFloatVolatile: return inline_unsafe_access( is_store, T_FLOAT, Volatile, false); + case vmIntrinsics::_putDoubleVolatile: return inline_unsafe_access( is_store, T_DOUBLE, Volatile, false); - case vmIntrinsics::_getObjectVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Volatile, false); - case vmIntrinsics::_getBooleanVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Volatile, false); - case vmIntrinsics::_getByteVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Volatile, false); - case vmIntrinsics::_getShortVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Volatile, false); - case vmIntrinsics::_getCharVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Volatile, false); - case vmIntrinsics::_getIntVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Volatile, false); - case vmIntrinsics::_getLongVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Volatile, false); - case vmIntrinsics::_getFloatVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Volatile, false); - case vmIntrinsics::_getDoubleVolatile: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Volatile, false); + case vmIntrinsics::_getShortUnaligned: return inline_unsafe_access(!is_store, T_SHORT, Relaxed, true); + case vmIntrinsics::_getCharUnaligned: return inline_unsafe_access(!is_store, T_CHAR, Relaxed, true); + case vmIntrinsics::_getIntUnaligned: return inline_unsafe_access(!is_store, T_INT, Relaxed, true); + case vmIntrinsics::_getLongUnaligned: return inline_unsafe_access(!is_store, T_LONG, Relaxed, true); - case vmIntrinsics::_putObjectVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Volatile, false); - case vmIntrinsics::_putBooleanVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Volatile, false); - case vmIntrinsics::_putByteVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Volatile, false); - case vmIntrinsics::_putShortVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Volatile, false); - case vmIntrinsics::_putCharVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Volatile, false); - case vmIntrinsics::_putIntVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Volatile, false); - case vmIntrinsics::_putLongVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Volatile, false); - case vmIntrinsics::_putFloatVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Volatile, false); - case vmIntrinsics::_putDoubleVolatile: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Volatile, false); + case vmIntrinsics::_putShortUnaligned: return inline_unsafe_access( is_store, T_SHORT, Relaxed, true); + case vmIntrinsics::_putCharUnaligned: return inline_unsafe_access( is_store, T_CHAR, Relaxed, true); + case vmIntrinsics::_putIntUnaligned: return inline_unsafe_access( is_store, T_INT, Relaxed, true); + case vmIntrinsics::_putLongUnaligned: return inline_unsafe_access( is_store, T_LONG, Relaxed, true); - case vmIntrinsics::_getShortUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Relaxed, true); - case vmIntrinsics::_getCharUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Relaxed, true); - case vmIntrinsics::_getIntUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Relaxed, true); - case vmIntrinsics::_getLongUnaligned: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Relaxed, true); + case vmIntrinsics::_getObjectAcquire: return inline_unsafe_access(!is_store, T_OBJECT, Acquire, false); + case vmIntrinsics::_getBooleanAcquire: return inline_unsafe_access(!is_store, T_BOOLEAN, Acquire, false); + case vmIntrinsics::_getByteAcquire: return inline_unsafe_access(!is_store, T_BYTE, Acquire, false); + case vmIntrinsics::_getShortAcquire: return inline_unsafe_access(!is_store, T_SHORT, Acquire, false); + case vmIntrinsics::_getCharAcquire: return inline_unsafe_access(!is_store, T_CHAR, Acquire, false); + case vmIntrinsics::_getIntAcquire: return inline_unsafe_access(!is_store, T_INT, Acquire, false); + case vmIntrinsics::_getLongAcquire: return inline_unsafe_access(!is_store, T_LONG, Acquire, false); + case vmIntrinsics::_getFloatAcquire: return inline_unsafe_access(!is_store, T_FLOAT, Acquire, false); + case vmIntrinsics::_getDoubleAcquire: return inline_unsafe_access(!is_store, T_DOUBLE, Acquire, false); - case vmIntrinsics::_putShortUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Relaxed, true); - case vmIntrinsics::_putCharUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Relaxed, true); - case vmIntrinsics::_putIntUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Relaxed, true); - case vmIntrinsics::_putLongUnaligned: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Relaxed, true); + case vmIntrinsics::_putObjectRelease: return inline_unsafe_access( is_store, T_OBJECT, Release, false); + case vmIntrinsics::_putBooleanRelease: return inline_unsafe_access( is_store, T_BOOLEAN, Release, false); + case vmIntrinsics::_putByteRelease: return inline_unsafe_access( is_store, T_BYTE, Release, false); + case vmIntrinsics::_putShortRelease: return inline_unsafe_access( is_store, T_SHORT, Release, false); + case vmIntrinsics::_putCharRelease: return inline_unsafe_access( is_store, T_CHAR, Release, false); + case vmIntrinsics::_putIntRelease: return inline_unsafe_access( is_store, T_INT, Release, false); + case vmIntrinsics::_putLongRelease: return inline_unsafe_access( is_store, T_LONG, Release, false); + case vmIntrinsics::_putFloatRelease: return inline_unsafe_access( is_store, T_FLOAT, Release, false); + case vmIntrinsics::_putDoubleRelease: return inline_unsafe_access( is_store, T_DOUBLE, Release, false); - case vmIntrinsics::_getObjectAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Acquire, false); - case vmIntrinsics::_getBooleanAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Acquire, false); - case vmIntrinsics::_getByteAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Acquire, false); - case vmIntrinsics::_getShortAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Acquire, false); - case vmIntrinsics::_getCharAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Acquire, false); - case vmIntrinsics::_getIntAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Acquire, false); - case vmIntrinsics::_getLongAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Acquire, false); - case vmIntrinsics::_getFloatAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Acquire, false); - case vmIntrinsics::_getDoubleAcquire: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Acquire, false); + case vmIntrinsics::_getObjectOpaque: return inline_unsafe_access(!is_store, T_OBJECT, Opaque, false); + case vmIntrinsics::_getBooleanOpaque: return inline_unsafe_access(!is_store, T_BOOLEAN, Opaque, false); + case vmIntrinsics::_getByteOpaque: return inline_unsafe_access(!is_store, T_BYTE, Opaque, false); + case vmIntrinsics::_getShortOpaque: return inline_unsafe_access(!is_store, T_SHORT, Opaque, false); + case vmIntrinsics::_getCharOpaque: return inline_unsafe_access(!is_store, T_CHAR, Opaque, false); + case vmIntrinsics::_getIntOpaque: return inline_unsafe_access(!is_store, T_INT, Opaque, false); + case vmIntrinsics::_getLongOpaque: return inline_unsafe_access(!is_store, T_LONG, Opaque, false); + case vmIntrinsics::_getFloatOpaque: return inline_unsafe_access(!is_store, T_FLOAT, Opaque, false); + case vmIntrinsics::_getDoubleOpaque: return inline_unsafe_access(!is_store, T_DOUBLE, Opaque, false); - case vmIntrinsics::_putObjectRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Release, false); - case vmIntrinsics::_putBooleanRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Release, false); - case vmIntrinsics::_putByteRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Release, false); - case vmIntrinsics::_putShortRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Release, false); - case vmIntrinsics::_putCharRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Release, false); - case vmIntrinsics::_putIntRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Release, false); - case vmIntrinsics::_putLongRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Release, false); - case vmIntrinsics::_putFloatRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Release, false); - case vmIntrinsics::_putDoubleRelease: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Release, false); - - case vmIntrinsics::_getObjectOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_OBJECT, Opaque, false); - case vmIntrinsics::_getBooleanOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_BOOLEAN, Opaque, false); - case vmIntrinsics::_getByteOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_BYTE, Opaque, false); - case vmIntrinsics::_getShortOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_SHORT, Opaque, false); - case vmIntrinsics::_getCharOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_CHAR, Opaque, false); - case vmIntrinsics::_getIntOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_INT, Opaque, false); - case vmIntrinsics::_getLongOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_LONG, Opaque, false); - case vmIntrinsics::_getFloatOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_FLOAT, Opaque, false); - case vmIntrinsics::_getDoubleOpaque: return inline_unsafe_access(!is_native_ptr, !is_store, T_DOUBLE, Opaque, false); - - case vmIntrinsics::_putObjectOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_OBJECT, Opaque, false); - case vmIntrinsics::_putBooleanOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_BOOLEAN, Opaque, false); - case vmIntrinsics::_putByteOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_BYTE, Opaque, false); - case vmIntrinsics::_putShortOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_SHORT, Opaque, false); - case vmIntrinsics::_putCharOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_CHAR, Opaque, false); - case vmIntrinsics::_putIntOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_INT, Opaque, false); - case vmIntrinsics::_putLongOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_LONG, Opaque, false); - case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_FLOAT, Opaque, false); - case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access(!is_native_ptr, is_store, T_DOUBLE, Opaque, false); + case vmIntrinsics::_putObjectOpaque: return inline_unsafe_access( is_store, T_OBJECT, Opaque, false); + case vmIntrinsics::_putBooleanOpaque: return inline_unsafe_access( is_store, T_BOOLEAN, Opaque, false); + case vmIntrinsics::_putByteOpaque: return inline_unsafe_access( is_store, T_BYTE, Opaque, false); + case vmIntrinsics::_putShortOpaque: return inline_unsafe_access( is_store, T_SHORT, Opaque, false); + case vmIntrinsics::_putCharOpaque: return inline_unsafe_access( is_store, T_CHAR, Opaque, false); + case vmIntrinsics::_putIntOpaque: return inline_unsafe_access( is_store, T_INT, Opaque, false); + case vmIntrinsics::_putLongOpaque: return inline_unsafe_access( is_store, T_LONG, Opaque, false); + case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false); + case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false); case vmIntrinsics::_compareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile); case vmIntrinsics::_compareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile); @@ -669,12 +651,15 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_weakCompareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSwapObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSwapObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSwapObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_weakCompareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSwapIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSwapIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSwapIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_weakCompareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed); case vmIntrinsics::_weakCompareAndSwapLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire); case vmIntrinsics::_weakCompareAndSwapLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release); + case vmIntrinsics::_weakCompareAndSwapLongVolatile: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile); case vmIntrinsics::_compareAndExchangeObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile); case vmIntrinsics::_compareAndExchangeObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Acquire); @@ -696,6 +681,8 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_storeFence: case vmIntrinsics::_fullFence: return inline_unsafe_fence(intrinsic_id()); + case vmIntrinsics::_onSpinWait: return inline_onspinwait(); + case vmIntrinsics::_currentThread: return inline_native_currentThread(); case vmIntrinsics::_isInterrupted: return inline_native_isInterrupted(); @@ -711,7 +698,7 @@ bool LibraryCallKit::try_to_inline(int predicate) { case vmIntrinsics::_copyOfRange: return inline_array_copyOf(true); case vmIntrinsics::_equalsB: return inline_array_equals(StrIntrinsicNode::LL); case vmIntrinsics::_equalsC: return inline_array_equals(StrIntrinsicNode::UU); - case vmIntrinsics::_Objects_checkIndex: return inline_objects_checkIndex(); + case vmIntrinsics::_Preconditions_checkIndex: return inline_preconditions_checkIndex(); case vmIntrinsics::_clone: return inline_native_clone(intrinsic()->is_virtual()); case vmIntrinsics::_allocateUninitializedArray: return inline_unsafe_newArray(true); @@ -1138,7 +1125,7 @@ bool LibraryCallKit::inline_hasNegatives() { return true; } -bool LibraryCallKit::inline_objects_checkIndex() { +bool LibraryCallKit::inline_preconditions_checkIndex() { Node* index = argument(0); Node* length = argument(1); if (too_many_traps(Deoptimization::Reason_intrinsic) || too_many_traps(Deoptimization::Reason_range_check)) { @@ -1677,7 +1664,6 @@ bool LibraryCallKit::inline_math(vmIntrinsics::ID id) { switch (id) { case vmIntrinsics::_dabs: n = new AbsDNode( arg); break; case vmIntrinsics::_dsqrt: n = new SqrtDNode(C, control(), arg); break; - case vmIntrinsics::_dlog10: n = new Log10DNode(C, control(), arg); break; default: fatal_unexpected_iid(id); break; } set_result(_gvn.transform(n)); @@ -1691,10 +1677,6 @@ bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) { Node* arg = round_double_node(argument(0)); Node* n = NULL; - switch (id) { - case vmIntrinsics::_dtan: n = new TanDNode(C, control(), arg); break; - default: fatal_unexpected_iid(id); break; - } n = _gvn.transform(n); // Rounding required? Check for argument reduction! @@ -1812,15 +1794,18 @@ bool LibraryCallKit::inline_math_native(vmIntrinsics::ID id) { return StubRoutines::dcos() != NULL ? runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dcos(), "dcos") : runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dcos), "COS"); - case vmIntrinsics::_dtan: return Matcher::has_match_rule(Op_TanD) ? inline_trig(id) : - runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dtan), "TAN"); - + case vmIntrinsics::_dtan: + return StubRoutines::dtan() != NULL ? + runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dtan(), "dtan") : + runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dtan), "TAN"); case vmIntrinsics::_dlog: return StubRoutines::dlog() != NULL ? runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dlog(), "dlog") : runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dlog), "LOG"); - case vmIntrinsics::_dlog10: return Matcher::has_match_rule(Op_Log10D) ? inline_math(id) : - runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dlog10), "LOG10"); + case vmIntrinsics::_dlog10: + return StubRoutines::dlog10() != NULL ? + runtime_math(OptoRuntime::Math_D_D_Type(), StubRoutines::dlog10(), "dlog10") : + runtime_math(OptoRuntime::Math_D_D_Type(), FN_PTR(SharedRuntime::dlog10), "LOG10"); // These intrinsics are supported on all hardware case vmIntrinsics::_dsqrt: return Matcher::match_rule_supported(Op_SqrtD) ? inline_math(id) : false; @@ -2195,8 +2180,6 @@ bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) { //----------------------------inline_unsafe_access---------------------------- -const static BasicType T_ADDRESS_HOLDER = T_LONG; - // Helper that guards and inserts a pre-barrier. void LibraryCallKit::insert_pre_barrier(Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar) { @@ -2297,13 +2280,12 @@ void LibraryCallKit::insert_pre_barrier(Node* base_oop, Node* offset, } -const TypeOopPtr* LibraryCallKit::sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type, bool is_native_ptr) { +const TypeOopPtr* LibraryCallKit::sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type) { // Attempt to infer a sharper value type from the offset and base type. ciKlass* sharpened_klass = NULL; // See if it is an instance field, with an object type. if (alias_type->field() != NULL) { - assert(!is_native_ptr, "native pointer op cannot use a java address"); if (alias_type->field()->type()->is_klass()) { sharpened_klass = alias_type->field()->type()->as_klass(); } @@ -2336,10 +2318,11 @@ const TypeOopPtr* LibraryCallKit::sharpen_unsafe_type(Compile::AliasType* alias_ return NULL; } -bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_store, const BasicType type, const AccessKind kind, const bool unaligned) { +bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, const AccessKind kind, const bool unaligned) { if (callee()->is_static()) return false; // caller must have the capability! guarantee(!is_store || kind != Acquire, "Acquire accesses can be produced only for loads"); guarantee( is_store || kind != Release, "Release accesses can be produced only for stores"); + assert(type != T_OBJECT || !unaligned, "unaligned access not supported with object type"); #ifndef PRODUCT { @@ -2350,31 +2333,17 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor if (!is_store) { // Object getObject(Object base, int/long offset), etc. BasicType rtype = sig->return_type()->basic_type(); - if (rtype == T_ADDRESS_HOLDER && callee()->name() == ciSymbol::getAddress_name()) - rtype = T_ADDRESS; // it is really a C void* assert(rtype == type, "getter must return the expected value"); - if (!is_native_ptr) { - assert(sig->count() == 2, "oop getter has 2 arguments"); - assert(sig->type_at(0)->basic_type() == T_OBJECT, "getter base is object"); - assert(sig->type_at(1)->basic_type() == T_LONG, "getter offset is correct"); - } else { - assert(sig->count() == 1, "native getter has 1 argument"); - assert(sig->type_at(0)->basic_type() == T_LONG, "getter base is long"); - } + assert(sig->count() == 2, "oop getter has 2 arguments"); + assert(sig->type_at(0)->basic_type() == T_OBJECT, "getter base is object"); + assert(sig->type_at(1)->basic_type() == T_LONG, "getter offset is correct"); } else { // void putObject(Object base, int/long offset, Object x), etc. assert(sig->return_type()->basic_type() == T_VOID, "putter must not return a value"); - if (!is_native_ptr) { - assert(sig->count() == 3, "oop putter has 3 arguments"); - assert(sig->type_at(0)->basic_type() == T_OBJECT, "putter base is object"); - assert(sig->type_at(1)->basic_type() == T_LONG, "putter offset is correct"); - } else { - assert(sig->count() == 2, "native putter has 2 arguments"); - assert(sig->type_at(0)->basic_type() == T_LONG, "putter base is long"); - } + assert(sig->count() == 3, "oop putter has 3 arguments"); + assert(sig->type_at(0)->basic_type() == T_OBJECT, "putter base is object"); + assert(sig->type_at(1)->basic_type() == T_LONG, "putter offset is correct"); BasicType vtype = sig->type_at(sig->count()-1)->basic_type(); - if (vtype == T_ADDRESS_HOLDER && callee()->name() == ciSymbol::putAddress_name()) - vtype = T_ADDRESS; // it is really a C void* assert(vtype == type, "putter must accept the expected value"); } #endif // ASSERT @@ -2391,38 +2360,54 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor Node* offset = top(); Node* val; - if (!is_native_ptr) { - // The base is either a Java object or a value produced by Unsafe.staticFieldBase - Node* base = argument(1); // type: oop - // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset - offset = argument(2); // type: long - // We currently rely on the cookies produced by Unsafe.xxxFieldOffset - // to be plain byte offsets, which are also the same as those accepted - // by oopDesc::field_base. - assert(Unsafe_field_offset_to_byte_offset(11) == 11, - "fieldOffset must be byte-scaled"); - // 32-bit machines ignore the high half! - offset = ConvL2X(offset); - adr = make_unsafe_address(base, offset); + // The base is either a Java object or a value produced by Unsafe.staticFieldBase + Node* base = argument(1); // type: oop + // The offset is a value produced by Unsafe.staticFieldOffset or Unsafe.objectFieldOffset + offset = argument(2); // type: long + // We currently rely on the cookies produced by Unsafe.xxxFieldOffset + // to be plain byte offsets, which are also the same as those accepted + // by oopDesc::field_base. + assert(Unsafe_field_offset_to_byte_offset(11) == 11, + "fieldOffset must be byte-scaled"); + // 32-bit machines ignore the high half! + offset = ConvL2X(offset); + adr = make_unsafe_address(base, offset); + if (_gvn.type(base)->isa_ptr() != TypePtr::NULL_PTR) { heap_base_oop = base; - val = is_store ? argument(4) : NULL; - } else { - Node* ptr = argument(1); // type: long - ptr = ConvL2X(ptr); // adjust Java long to machine word - adr = make_unsafe_address(NULL, ptr); - val = is_store ? argument(3) : NULL; } + val = is_store ? argument(4) : NULL; const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); - // First guess at the value type. - const Type *value_type = Type::get_const_basic_type(type); - // Try to categorize the address. If it comes up as TypeJavaPtr::BOTTOM, // there was not enough information to nail it down. Compile::AliasType* alias_type = C->alias_type(adr_type); assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); + assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || + alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); + bool mismatched = false; + BasicType bt = alias_type->basic_type(); + if (bt != T_ILLEGAL) { + if (bt == T_BYTE && adr_type->isa_aryptr()) { + // Alias type doesn't differentiate between byte[] and boolean[]). + // Use address type to get the element type. + bt = adr_type->is_aryptr()->elem()->array_element_basic_type(); + } + if (bt == T_ARRAY || bt == T_NARROWOOP) { + // accessing an array field with getObject is not a mismatch + bt = T_OBJECT; + } + if ((bt == T_OBJECT) != (type == T_OBJECT)) { + // Don't intrinsify mismatched object accesses + return false; + } + mismatched = (bt != type); + } + + // First guess at the value type. + const Type *value_type = Type::get_const_basic_type(type); + // We will need memory barriers unless we can determine a unique // alias category for this reference. (Note: If for some reason // the barriers get omitted and the unsafe reference begins to "pollute" @@ -2449,9 +2434,10 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor bool requires_atomic_access = false; switch (kind) { case Relaxed: - case Opaque: requires_atomic_access = AlwaysAtomicAccesses; break; + case Opaque: + // Opaque accesses are atomic. case Acquire: case Release: case Volatile: @@ -2471,11 +2457,11 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor // SATB log buffer using the pre-barrier mechanism. // Also we need to add memory barrier to prevent commoning reads // from this field across safepoint since GC can change its value. - bool need_read_barrier = !is_native_ptr && !is_store && + bool need_read_barrier = !is_store && offset != top() && heap_base_oop != top(); if (!is_store && type == T_OBJECT) { - const TypeOopPtr* tjp = sharpen_unsafe_type(alias_type, adr_type, is_native_ptr); + const TypeOopPtr* tjp = sharpen_unsafe_type(alias_type, adr_type); if (tjp != NULL) { value_type = tjp; } @@ -2523,40 +2509,13 @@ bool LibraryCallKit::inline_unsafe_access(const bool is_native_ptr, bool is_stor // of safe & unsafe memory. if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder); - assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || - alias_type->field() != NULL || alias_type->element() != NULL, "field, array element or unknown"); - bool mismatched = false; - if (alias_type->element() != NULL || alias_type->field() != NULL) { - BasicType bt; - if (alias_type->element() != NULL) { - // Use address type to get the element type. Alias type doesn't provide - // enough information (e.g., doesn't differentiate between byte[] and boolean[]). - const Type* element = adr_type->is_aryptr()->elem(); - bt = element->isa_narrowoop() ? T_OBJECT : element->array_element_basic_type(); - } else { - bt = alias_type->field()->layout_type(); - } - if (bt == T_ARRAY) { - // accessing an array field with getObject is not a mismatch - bt = T_OBJECT; - } - if (bt != type) { - mismatched = true; - } - } - assert(type != T_OBJECT || !unaligned, "unaligned access not supported with object type"); - if (!is_store) { Node* p = NULL; // Try to constant fold a load from a constant field ciField* field = alias_type->field(); - if (heap_base_oop != top() && - field != NULL && field->is_constant() && !mismatched) { + if (heap_base_oop != top() && field != NULL && field->is_constant() && !mismatched) { // final or stable field - const Type* con_type = Type::make_constant(alias_type->field(), heap_base_oop); - if (con_type != NULL) { - p = makecon(con_type); - } + p = make_constant_from_field(field, heap_base_oop); } if (p == NULL) { // To be valid, unsafe loads may depend on other conditions than @@ -2817,11 +2776,20 @@ bool LibraryCallKit::inline_unsafe_load_store(const BasicType type, const LoadSt Node* adr = make_unsafe_address(base, offset); const TypePtr *adr_type = _gvn.type(adr)->isa_ptr(); + Compile::AliasType* alias_type = C->alias_type(adr_type); + assert(alias_type->adr_type() == TypeRawPtr::BOTTOM || alias_type->adr_type() == TypeOopPtr::BOTTOM || + alias_type->basic_type() != T_ILLEGAL, "field, array element or unknown"); + BasicType bt = alias_type->basic_type(); + if (bt != T_ILLEGAL && + ((bt == T_OBJECT || bt == T_ARRAY) != (type == T_OBJECT))) { + // Don't intrinsify mismatched object accesses. + return false; + } + // For CAS, unlike inline_unsafe_access, there seems no point in // trying to refine types. Just use the coarse types here. - const Type *value_type = Type::get_const_basic_type(type); - Compile::AliasType* alias_type = C->alias_type(adr_type); assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here"); + const Type *value_type = Type::get_const_basic_type(type); switch (kind) { case LS_get_set: @@ -3127,6 +3095,11 @@ bool LibraryCallKit::inline_unsafe_fence(vmIntrinsics::ID id) { } } +bool LibraryCallKit::inline_onspinwait() { + insert_mem_bar(Op_OnSpinWait); + return true; +} + bool LibraryCallKit::klass_needs_init_guard(Node* kls) { if (!kls->is_Con()) { return true; diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index f2bf2eff8da..7e33dc3dd84 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -2819,7 +2819,7 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_ if (phase->do_range_check(this, old_new) != 0) { cl->mark_has_range_checks(); } - } else { + } else if (PostLoopMultiversioning) { phase->has_range_checks(this); } diff --git a/hotspot/src/share/vm/opto/loopUnswitch.cpp b/hotspot/src/share/vm/opto/loopUnswitch.cpp index 697ff0c9f95..72201c2e282 100644 --- a/hotspot/src/share/vm/opto/loopUnswitch.cpp +++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp @@ -374,10 +374,17 @@ bool CountedLoopReserveKit::create_reserve() { return false; // skip malformed counted loop } if (!cl->is_main_loop()) { - if (TraceLoopOpts) { - tty->print_cr("CountedLoopReserveKit::create_reserve: %d not main loop", cl->_idx); + bool loop_not_canonical = true; + if (cl->is_post_loop() && (cl->slp_max_unroll() > 0)) { + loop_not_canonical = false; + } + // only reject some loop forms + if (loop_not_canonical) { + if (TraceLoopOpts) { + tty->print_cr("CountedLoopReserveKit::create_reserve: %d not canonical loop", cl->_idx); + } + return false; // skip normal, pre, and post (conditionally) loops } - return false; // skip normal, pre, and post loops } _lp = _lpt->_head->as_Loop(); diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp index 33f5de7f10a..4068e27bf90 100644 --- a/hotspot/src/share/vm/opto/loopnode.cpp +++ b/hotspot/src/share/vm/opto/loopnode.cpp @@ -2369,11 +2369,13 @@ void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool skip_loop_opts) if (multi_version_post_loops(lpt, lpt_next) == false) { // Cause the rce loop to be optimized away if we fail cl->mark_is_multiversioned(); + cl->set_slp_max_unroll(0); poison_rce_post_loop(lpt); } } } } + sw.transform_loop(lpt, true); } } else if (cl->is_main_loop()) { sw.transform_loop(lpt, true); diff --git a/hotspot/src/share/vm/opto/machnode.cpp b/hotspot/src/share/vm/opto/machnode.cpp index fc5b08625e5..cd0839c3294 100644 --- a/hotspot/src/share/vm/opto/machnode.cpp +++ b/hotspot/src/share/vm/opto/machnode.cpp @@ -600,8 +600,8 @@ const TypePtr *MachProjNode::adr_type() const { void MachProjNode::dump_spec(outputStream *st) const { ProjNode::dump_spec(st); switch (_ideal_reg) { - case unmatched_proj: st->print("/unmatched"); break; - case fat_proj: st->print("/fat"); if (WizardMode) _rout.dump(); break; + case unmatched_proj: st->print("/unmatched"); break; + case fat_proj: st->print("/fat"); if (WizardMode) _rout.dump(st); break; } } #endif diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 06f443b3fe7..106257aae5b 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -860,7 +860,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray is_loaded()) { field_type = TypeInstPtr::BOTTOM; - } else if (field != NULL && field->is_constant() && field->is_static()) { + } else if (field != NULL && field->is_static_constant()) { // This can happen if the constant oop is non-perm. ciObject* con = field->constant_value().as_object(); // Do not "join" in the previous type; it doesn't add value, @@ -1897,7 +1897,7 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, Node *prefetch_adr; Node *prefetch; - uint lines = AllocatePrefetchDistance / AllocatePrefetchStepSize; + uint lines = (length != NULL) ? AllocatePrefetchLines : AllocateInstancePrefetchLines; uint step_size = AllocatePrefetchStepSize; uint distance = 0; @@ -1926,12 +1926,8 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, contended_phi_rawmem = pf_phi_rawmem; i_o = pf_phi_abio; } else if( UseTLAB && AllocatePrefetchStyle == 3 ) { - // Insert a prefetch for each allocation. - // This code is used for Sparc with BIS. - Node *pf_region = new RegionNode(3); - Node *pf_phi_rawmem = new PhiNode( pf_region, Type::MEMORY, - TypeRawPtr::BOTTOM ); - transform_later(pf_region); + // Insert a prefetch instruction for each allocation. + // This code is used for SPARC with BIS. // Generate several prefetch instructions. uint lines = (length != NULL) ? AllocatePrefetchLines : AllocateInstancePrefetchLines; @@ -1940,10 +1936,15 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false, // Next cache address. Node *cache_adr = new AddPNode(old_eden_top, old_eden_top, - _igvn.MakeConX(distance)); + _igvn.MakeConX(step_size + distance)); transform_later(cache_adr); cache_adr = new CastP2XNode(needgc_false, cache_adr); transform_later(cache_adr); + // For BIS instructions to be emitted, the address must be aligned at cache line size. + // (The VM sets AllocatePrefetchStepSize to the cache line size, unless a value is + // specified at the command line.) If the address is not aligned at cache line size + // boundary, a standard store instruction is triggered (instead of the BIS). For the + // latter, 8-byte alignment is necessary. Node* mask = _igvn.MakeConX(~(intptr_t)(step_size-1)); cache_adr = new AndXNode(cache_adr, mask); transform_later(cache_adr); diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 2d91f411174..44127f3bc23 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -944,6 +944,7 @@ static void match_alias_type(Compile* C, Node* n, Node* m) { case Op_MemBarCPUOrder: // %%% these ideals should have narrower adr_type? case Op_StrInflatedCopy: case Op_StrCompressedCopy: + case Op_OnSpinWait: case Op_EncodeISOArray: nidx = Compile::AliasIdxTop; nat = NULL; @@ -962,44 +963,6 @@ static void match_alias_type(Compile* C, Node* n, Node* m) { } #endif - -//------------------------------MStack----------------------------------------- -// State and MStack class used in xform() and find_shared() iterative methods. -enum Node_State { Pre_Visit, // node has to be pre-visited - Visit, // visit node - Post_Visit, // post-visit node - Alt_Post_Visit // alternative post-visit path - }; - -class MStack: public Node_Stack { - public: - MStack(int size) : Node_Stack(size) { } - - void push(Node *n, Node_State ns) { - Node_Stack::push(n, (uint)ns); - } - void push(Node *n, Node_State ns, Node *parent, int indx) { - ++_inode_top; - if ((_inode_top + 1) >= _inode_max) grow(); - _inode_top->node = parent; - _inode_top->indx = (uint)indx; - ++_inode_top; - _inode_top->node = n; - _inode_top->indx = (uint)ns; - } - Node *parent() { - pop(); - return node(); - } - Node_State state() const { - return (Node_State)index(); - } - void set_state(Node_State ns) { - set_index((uint)ns); - } -}; - - //------------------------------xform------------------------------------------ // Given a Node in old-space, Match him (Label/Reduce) to produce a machine // Node in new-space. Given a new-space Node, recursively walk his children. @@ -2045,37 +2008,22 @@ bool Matcher::is_bmi_pattern(Node *n, Node *m) { } #endif // X86 -// A method-klass-holder may be passed in the inline_cache_reg -// and then expanded into the inline_cache_reg and a method_oop register -// defined in ad_.cpp - -// Check for shift by small constant as well -static bool clone_shift(Node* shift, Matcher* matcher, MStack& mstack, VectorSet& address_visited) { - if (shift->Opcode() == Op_LShiftX && shift->in(2)->is_Con() && - shift->in(2)->get_int() <= 3 && - // Are there other uses besides address expressions? - !matcher->is_visited(shift)) { - address_visited.set(shift->_idx); // Flag as address_visited - mstack.push(shift->in(2), Visit); - Node *conv = shift->in(1); -#ifdef _LP64 - // Allow Matcher to match the rule which bypass - // ConvI2L operation for an array index on LP64 - // if the index value is positive. - if (conv->Opcode() == Op_ConvI2L && - conv->as_Type()->type()->is_long()->_lo >= 0 && - // Are there other uses besides address expressions? - !matcher->is_visited(conv)) { - address_visited.set(conv->_idx); // Flag as address_visited - mstack.push(conv->in(1), Pre_Visit); - } else -#endif - mstack.push(conv, Pre_Visit); +bool Matcher::clone_base_plus_offset_address(AddPNode* m, Matcher::MStack& mstack, VectorSet& address_visited) { + Node *off = m->in(AddPNode::Offset); + if (off->is_Con()) { + address_visited.test_set(m->_idx); // Flag as address_visited + mstack.push(m->in(AddPNode::Address), Pre_Visit); + // Clone X+offset as it also folds into most addressing expressions + mstack.push(off, Visit); + mstack.push(m->in(AddPNode::Base), Pre_Visit); return true; } return false; } +// A method-klass-holder may be passed in the inline_cache_reg +// and then expanded into the inline_cache_reg and a method_oop register +// defined in ad_.cpp //------------------------------find_shared------------------------------------ // Set bits if Node is shared or otherwise a root @@ -2250,40 +2198,9 @@ void Matcher::find_shared( Node *n ) { // But they should be marked as shared if there are other uses // besides address expressions. - Node *off = m->in(AddPNode::Offset); - if (off->is_Con()) { - address_visited.test_set(m->_idx); // Flag as address_visited - Node *adr = m->in(AddPNode::Address); - - // Intel, ARM and friends can handle 2 adds in addressing mode - if( clone_shift_expressions && adr->is_AddP() && - // AtomicAdd is not an addressing expression. - // Cheap to find it by looking for screwy base. - !adr->in(AddPNode::Base)->is_top() && - // Are there other uses besides address expressions? - !is_visited(adr) ) { - address_visited.set(adr->_idx); // Flag as address_visited - Node *shift = adr->in(AddPNode::Offset); - if (!clone_shift(shift, this, mstack, address_visited)) { - mstack.push(shift, Pre_Visit); - } - mstack.push(adr->in(AddPNode::Address), Pre_Visit); - mstack.push(adr->in(AddPNode::Base), Pre_Visit); - } else { // Sparc, Alpha, PPC and friends - mstack.push(adr, Pre_Visit); - } - - // Clone X+offset as it also folds into most addressing expressions - mstack.push(off, Visit); - mstack.push(m->in(AddPNode::Base), Pre_Visit); - continue; // for(int i = ...) - } else if (clone_shift_expressions && - clone_shift(off, this, mstack, address_visited)) { - address_visited.test_set(m->_idx); // Flag as address_visited - mstack.push(m->in(AddPNode::Address), Pre_Visit); - mstack.push(m->in(AddPNode::Base), Pre_Visit); - continue; - } // if( off->is_Con() ) + if (clone_address_expressions(m->as_AddP(), mstack, address_visited)) { + continue; + } } // if( mem_op && mstack.push(m, Pre_Visit); } // for(int i = ...) diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp index dad3854e3f2..74d7361d08c 100644 --- a/hotspot/src/share/vm/opto/matcher.hpp +++ b/hotspot/src/share/vm/opto/matcher.hpp @@ -40,6 +40,45 @@ class MachOper; //---------------------------Matcher------------------------------------------- class Matcher : public PhaseTransform { friend class VMStructs; + +public: + + // State and MStack class used in xform() and find_shared() iterative methods. + enum Node_State { Pre_Visit, // node has to be pre-visited + Visit, // visit node + Post_Visit, // post-visit node + Alt_Post_Visit // alternative post-visit path + }; + + class MStack: public Node_Stack { + public: + MStack(int size) : Node_Stack(size) { } + + void push(Node *n, Node_State ns) { + Node_Stack::push(n, (uint)ns); + } + void push(Node *n, Node_State ns, Node *parent, int indx) { + ++_inode_top; + if ((_inode_top + 1) >= _inode_max) grow(); + _inode_top->node = parent; + _inode_top->indx = (uint)indx; + ++_inode_top; + _inode_top->node = n; + _inode_top->indx = (uint)ns; + } + Node *parent() { + pop(); + return node(); + } + Node_State state() const { + return (Node_State)index(); + } + void set_state(Node_State ns) { + set_index((uint)ns); + } + }; + +private: // Private arena of State objects ResourceArea _states_arena; @@ -273,6 +312,9 @@ public: // e.g. Op_ vector nodes and other intrinsics while guarding with vlen static const bool match_rule_supported_vector(int opcode, int vlen); + // Some microarchitectures have mask registers used on vectors + static const bool has_predicated_vectors(void); + // Some uarchs have different sized float register resources static const int float_pressure(int default_pressure_threshold); @@ -408,7 +450,9 @@ public: // Should the Matcher clone shifts on addressing modes, expecting them to // be subsumed into complex addressing expressions or compute them into // registers? True for Intel but false for most RISCs - static const bool clone_shift_expressions; + bool clone_address_expressions(AddPNode* m, MStack& mstack, VectorSet& address_visited); + // Clone base + offset address expression + bool clone_base_plus_offset_address(AddPNode* m, MStack& mstack, VectorSet& address_visited); static bool narrow_oop_use_complex_address(); static bool narrow_klass_use_complex_address(); @@ -485,6 +529,9 @@ public: // ourselves. static const bool need_masked_shift_count; + // Whether code generation need accurate ConvI2L types. + static const bool convi2l_type_required; + // This routine is run whenever a graph fails to match. // If it returns, the compiler should bailout to interpreter without error. // In non-product mode, SoftMatchFailure is false to detect non-canonical diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index 5580c7901d4..4be9e24b883 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -797,7 +797,7 @@ Node *LoadNode::make(PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const TypeP #endif { assert(!adr->bottom_type()->is_ptr_to_narrowoop() && !adr->bottom_type()->is_ptr_to_narrowklass(), "should have got back a narrow oop"); - load = new LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr(), mo, control_dependency); + load = new LoadPNode(ctl, mem, adr, adr_type, rt->is_ptr(), mo, control_dependency); } break; } @@ -1621,72 +1621,6 @@ LoadNode::load_array_final_field(const TypeKlassPtr *tkls, return NULL; } -static ciConstant check_mismatched_access(ciConstant con, BasicType loadbt, bool is_unsigned) { - BasicType conbt = con.basic_type(); - switch (conbt) { - case T_BOOLEAN: conbt = T_BYTE; break; - case T_ARRAY: conbt = T_OBJECT; break; - } - switch (loadbt) { - case T_BOOLEAN: loadbt = T_BYTE; break; - case T_NARROWOOP: loadbt = T_OBJECT; break; - case T_ARRAY: loadbt = T_OBJECT; break; - case T_ADDRESS: loadbt = T_OBJECT; break; - } - if (conbt == loadbt) { - if (is_unsigned && conbt == T_BYTE) { - // LoadB (T_BYTE) with a small mask (<=8-bit) is converted to LoadUB (T_BYTE). - return ciConstant(T_INT, con.as_int() & 0xFF); - } else { - return con; - } - } - if (conbt == T_SHORT && loadbt == T_CHAR) { - // LoadS (T_SHORT) with a small mask (<=16-bit) is converted to LoadUS (T_CHAR). - return ciConstant(T_INT, con.as_int() & 0xFFFF); - } - return ciConstant(); // T_ILLEGAL -} - -// Try to constant-fold a stable array element. -static const Type* fold_stable_ary_elem(const TypeAryPtr* ary, int off, bool is_unsigned_load, BasicType loadbt) { - assert(ary->const_oop(), "array should be constant"); - assert(ary->is_stable(), "array should be stable"); - - // Decode the results of GraphKit::array_element_address. - ciArray* aobj = ary->const_oop()->as_array(); - ciConstant element_value = aobj->element_value_by_offset(off); - if (element_value.basic_type() == T_ILLEGAL) { - return NULL; // wrong offset - } - ciConstant con = check_mismatched_access(element_value, loadbt, is_unsigned_load); - assert(con.basic_type() != T_ILLEGAL, "elembt=%s; loadbt=%s; unsigned=%d", - type2name(element_value.basic_type()), type2name(loadbt), is_unsigned_load); - - if (con.basic_type() != T_ILLEGAL && // not a mismatched access - !con.is_null_or_zero()) { // not a default value - const Type* con_type = Type::make_from_constant(con); - if (con_type != NULL) { - if (con_type->isa_aryptr()) { - // Join with the array element type, in case it is also stable. - int dim = ary->stable_dimension(); - con_type = con_type->is_aryptr()->cast_to_stable(true, dim-1); - } - if (loadbt == T_NARROWOOP && con_type->isa_oopptr()) { - con_type = con_type->make_narrowoop(); - } -#ifndef PRODUCT - if (TraceIterativeGVN) { - tty->print("FoldStableValues: array element [off=%d]: con_type=", off); - con_type->dump(); tty->cr(); - } -#endif //PRODUCT - return con_type; - } - } - return NULL; -} - //------------------------------Value----------------------------------------- const Type* LoadNode::Value(PhaseGVN* phase) const { // Either input is TOP ==> the result is TOP @@ -1715,10 +1649,14 @@ const Type* LoadNode::Value(PhaseGVN* phase) const { const bool off_beyond_header = ((uint)off >= (uint)min_base_off); // Try to constant-fold a stable array element. - if (FoldStableValues && !is_mismatched_access() && ary->is_stable() && ary->const_oop() != NULL) { + if (FoldStableValues && !is_mismatched_access() && ary->is_stable()) { // Make sure the reference is not into the header and the offset is constant - if (off_beyond_header && adr->is_AddP() && off != Type::OffsetBot) { - const Type* con_type = fold_stable_ary_elem(ary, off, is_unsigned(), memory_type()); + ciObject* aobj = ary->const_oop(); + if (aobj != NULL && off_beyond_header && adr->is_AddP() && off != Type::OffsetBot) { + int stable_dimension = (ary->stable_dimension() > 0 ? ary->stable_dimension() - 1 : 0); + const Type* con_type = Type::make_constant_from_array_element(aobj->as_array(), off, + stable_dimension, + memory_type(), is_unsigned()); if (con_type != NULL) { return con_type; } @@ -1785,28 +1723,10 @@ const Type* LoadNode::Value(PhaseGVN* phase) const { // For oop loads, we expect the _type to be precise. // Optimizations for constant objects ciObject* const_oop = tinst->const_oop(); - if (const_oop != NULL) { - // For constant CallSites treat the target field as a compile time constant. - if (const_oop->is_call_site()) { - ciCallSite* call_site = const_oop->as_call_site(); - ciField* field = call_site->klass()->as_instance_klass()->get_field_by_offset(off, /*is_static=*/ false); - if (field != NULL && field->is_call_site_target()) { - ciMethodHandle* target = call_site->get_target(); - if (target != NULL) { // just in case - ciConstant constant(T_OBJECT, target); - const Type* t; - if (adr->bottom_type()->is_ptr_to_narrowoop()) { - t = TypeNarrowOop::make_from_constant(constant.as_object(), true); - } else { - t = TypeOopPtr::make_from_constant(constant.as_object(), true); - } - // Add a dependence for invalidation of the optimization. - if (!call_site->is_constant_call_site()) { - C->dependencies()->assert_call_site_target_value(call_site, target); - } - return t; - } - } + if (const_oop != NULL && const_oop->is_instance()) { + const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type()); + if (con_type != NULL) { + return con_type; } } } else if (tp->base() == Type::KlassPtr) { @@ -2979,6 +2899,7 @@ MemBarNode* MemBarNode::make(Compile* C, int opcode, int atp, Node* pn) { case Op_MemBarReleaseLock: return new MemBarReleaseLockNode(C, atp, pn); case Op_MemBarVolatile: return new MemBarVolatileNode(C, atp, pn); case Op_MemBarCPUOrder: return new MemBarCPUOrderNode(C, atp, pn); + case Op_OnSpinWait: return new OnSpinWaitNode(C, atp, pn); case Op_Initialize: return new InitializeNode(C, atp, pn); case Op_MemBarStoreStore: return new MemBarStoreStoreNode(C, atp, pn); default: ShouldNotReachHere(); return NULL; diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp index 87238ac4cfe..438fc7476e6 100644 --- a/hotspot/src/share/vm/opto/memnode.hpp +++ b/hotspot/src/share/vm/opto/memnode.hpp @@ -1186,6 +1186,13 @@ public: virtual uint ideal_reg() const { return 0; } // not matched in the AD file }; +class OnSpinWaitNode: public MemBarNode { +public: + OnSpinWaitNode(Compile* C, int alias_idx, Node* precedent) + : MemBarNode(C, alias_idx, precedent) {} + virtual int Opcode() const; +}; + // Isolation of object setup after an AllocateNode and before next safepoint. // (See comment in memnode.cpp near InitializeNode::InitializeNode for semantics.) class InitializeNode: public MemBarNode { diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp index 2973183f91f..6d8b13a59bc 100644 --- a/hotspot/src/share/vm/opto/node.cpp +++ b/hotspot/src/share/vm/opto/node.cpp @@ -2297,7 +2297,8 @@ Node* Node::find_similar(int opc) { if (def && def->outcnt() >= 2) { for (DUIterator_Fast dmax, i = def->fast_outs(dmax); i < dmax; i++) { Node* use = def->fast_out(i); - if (use->Opcode() == opc && + if (use != this && + use->Opcode() == opc && use->req() == req()) { uint j; for (j = 0; j < use->req(); j++) { diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp index b14505d3c4c..e368e628e6b 100644 --- a/hotspot/src/share/vm/opto/node.hpp +++ b/hotspot/src/share/vm/opto/node.hpp @@ -722,8 +722,9 @@ public: Flag_avoid_back_to_back_after = Flag_avoid_back_to_back_before << 1, Flag_has_call = Flag_avoid_back_to_back_after << 1, Flag_is_reduction = Flag_has_call << 1, - Flag_is_scheduled = Flag_is_reduction, - Flag_is_expensive = Flag_is_scheduled << 1, + Flag_is_scheduled = Flag_is_reduction << 1, + Flag_has_vector_mask_set = Flag_is_scheduled << 1, + Flag_is_expensive = Flag_has_vector_mask_set << 1, _max_flags = (Flag_is_expensive << 1) - 1 // allow flags combination }; @@ -912,6 +913,9 @@ public: // It must have the loop's phi as input and provide a def to the phi. bool is_reduction() const { return (_flags & Flag_is_reduction) != 0; } + // The node is a CountedLoopEnd with a mask annotation so as to emit a restore context + bool has_vector_mask_set() const { return (_flags & Flag_has_vector_mask_set) != 0; } + // Used in lcm to mark nodes that have scheduled bool is_scheduled() const { return (_flags & Flag_is_scheduled) != 0; } diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index 7d90d638ed4..39f4abd80b6 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -1483,8 +1483,6 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { // Compute the size of the first block _first_block_size = blk_labels[1].loc_pos() - blk_labels[0].loc_pos(); - assert(cb->insts_size() < 500000, "method is unreasonably large"); - #ifdef ASSERT for (uint i = 0; i < nblocks; i++) { // For all blocks if (jmp_target[i] != 0) { @@ -1550,6 +1548,10 @@ void Compile::fill_buffer(CodeBuffer* cb, uint* blk_starts) { } dump_asm(node_offsets, node_offset_limit); if (xtty != NULL) { + // print_metadata and dump_asm above may safepoint which makes us loose the ttylock. + // Retake lock too make sure the end tag is coherent, and that xmlStream->pop_tag is done + // thread safe + ttyLocker ttyl2; xtty->tail("opto_assembly"); } } diff --git a/hotspot/src/share/vm/opto/parse.hpp b/hotspot/src/share/vm/opto/parse.hpp index b26a59f8497..cb9a3e3f104 100644 --- a/hotspot/src/share/vm/opto/parse.hpp +++ b/hotspot/src/share/vm/opto/parse.hpp @@ -168,7 +168,7 @@ class Parse : public GraphKit { // Use init_node/init_graph to initialize Blocks. // Block() : _live_locals((uintptr_t*)NULL,0) { ShouldNotReachHere(); } - Block() : _live_locals(NULL,0) { ShouldNotReachHere(); } + Block() : _live_locals() { ShouldNotReachHere(); } public: diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index 22b3e27292e..80885d9a836 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -261,7 +261,7 @@ void Parse::load_interpreter_state(Node* osr_buf) { Node *locals_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals-1)*wordSize); // find all the locals that the interpreter thinks contain live oops - const BitMap live_oops = method()->live_local_oops_at_bci(osr_bci()); + const ResourceBitMap live_oops = method()->live_local_oops_at_bci(osr_bci()); for (index = 0; index < max_locals; index++) { if (!live_locals.at(index)) { diff --git a/hotspot/src/share/vm/opto/parse3.cpp b/hotspot/src/share/vm/opto/parse3.cpp index d9ad4ced928..bd6dcf30b84 100644 --- a/hotspot/src/share/vm/opto/parse3.cpp +++ b/hotspot/src/share/vm/opto/parse3.cpp @@ -149,9 +149,9 @@ void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) { // Does this field have a constant value? If so, just push the value. if (field->is_constant()) { // final or stable field - const Type* con_type = Type::make_constant(field, obj); - if (con_type != NULL) { - push_node(con_type->basic_type(), makecon(con_type)); + Node* con = make_constant_from_field(field, obj); + if (con != NULL) { + push_node(field->layout_type(), con); return; } } @@ -174,12 +174,16 @@ void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) { if (!field->type()->is_loaded()) { type = TypeInstPtr::BOTTOM; must_assert_null = true; - } else if (field->is_constant() && field->is_static()) { + } else if (field->is_static_constant()) { // This can happen if the constant oop is non-perm. ciObject* con = field->constant_value().as_object(); // Do not "join" in the previous type; it doesn't add value, // and may yield a vacuous result if the field is of interface type. - type = TypeOopPtr::make_from_constant(con)->isa_oopptr(); + if (con->is_null_object()) { + type = TypePtr::NULL_PTR; + } else { + type = TypeOopPtr::make_from_constant(con)->isa_oopptr(); + } assert(type != NULL, "field singleton type must be consistent"); } else { type = TypeOopPtr::make_from_klass(field_klass->as_klass()); diff --git a/hotspot/src/share/vm/opto/regmask.cpp b/hotspot/src/share/vm/opto/regmask.cpp index 80b418bda08..2e04c42eb7e 100644 --- a/hotspot/src/share/vm/opto/regmask.cpp +++ b/hotspot/src/share/vm/opto/regmask.cpp @@ -389,7 +389,7 @@ bool RegMask::is_UP() const { //------------------------------Size------------------------------------------- // Compute size of register mask in bits uint RegMask::Size() const { - extern uint8_t bitsInByte[512]; + extern uint8_t bitsInByte[BITS_IN_BYTE_ARRAY_SIZE]; uint sum = 0; for( int i = 0; i < RM_SIZE; i++ ) sum += diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index 37e33ef76ba..53db5ec4d0c 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -1663,9 +1663,9 @@ static void trace_exception(outputStream* st, oop exception_oop, address excepti exception_oop->print_value_on(&tempst); tempst.print(" in "); CodeBlob* blob = CodeCache::find_blob(exception_pc); - if (blob->is_nmethod()) { - nmethod* nm = blob->as_nmethod_or_null(); - nm->method()->print_value_on(&tempst); + if (blob->is_compiled()) { + CompiledMethod* cm = blob->as_compiled_method_or_null(); + cm->method()->print_value_on(&tempst); } else if (blob->is_runtime_stub()) { tempst.print(""); } else { diff --git a/hotspot/src/share/vm/opto/stringopts.cpp b/hotspot/src/share/vm/opto/stringopts.cpp index af5c5c4cfaa..4ec1419250b 100644 --- a/hotspot/src/share/vm/opto/stringopts.cpp +++ b/hotspot/src/share/vm/opto/stringopts.cpp @@ -1112,7 +1112,7 @@ Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) { if( bt == T_OBJECT ) { if (!field->type()->is_loaded()) { type = TypeInstPtr::BOTTOM; - } else if (field->is_constant()) { + } else if (field->is_static_constant()) { // This can happen if the constant oop is non-perm. ciObject* con = field->constant_value().as_object(); // Do not "join" in the previous type; it doesn't add value, diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 0d06c083183..022f28cb8af 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -1533,25 +1533,3 @@ const Type* SqrtDNode::Value(PhaseGVN* phase) const { if( d < 0.0 ) return Type::DOUBLE; return TypeD::make( sqrt( d ) ); } - -//============================================================================= -//------------------------------Value------------------------------------------ -// Compute tan -const Type* TanDNode::Value(PhaseGVN* phase) const { - const Type *t1 = phase->type( in(1) ); - if( t1 == Type::TOP ) return Type::TOP; - if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; - double d = t1->getd(); - return TypeD::make( StubRoutines::intrinsic_tan( d ) ); -} - -//============================================================================= -//------------------------------Value------------------------------------------ -// Compute log10 -const Type* Log10DNode::Value(PhaseGVN* phase) const { - const Type *t1 = phase->type( in(1) ); - if( t1 == Type::TOP ) return Type::TOP; - if( t1->base() != Type::DoubleCon ) return Type::DOUBLE; - double d = t1->getd(); - return TypeD::make( StubRoutines::intrinsic_log10( d ) ); -} diff --git a/hotspot/src/share/vm/opto/subnode.hpp b/hotspot/src/share/vm/opto/subnode.hpp index 1812853a8a9..63bcd3cc2b4 100644 --- a/hotspot/src/share/vm/opto/subnode.hpp +++ b/hotspot/src/share/vm/opto/subnode.hpp @@ -408,21 +408,6 @@ public: virtual uint ideal_reg() const { return Op_RegD; } }; -//------------------------------TanDNode--------------------------------------- -// tangens of a double -class TanDNode : public Node { -public: - TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) { - init_flags(Flag_is_expensive); - C->add_expensive_node(this); - } - virtual int Opcode() const; - const Type *bottom_type() const { return Type::DOUBLE; } - virtual uint ideal_reg() const { return Op_RegD; } - virtual const Type* Value(PhaseGVN* phase) const; -}; - - //------------------------------AtanDNode-------------------------------------- // arcus tangens of a double class AtanDNode : public Node { @@ -448,20 +433,6 @@ public: virtual const Type* Value(PhaseGVN* phase) const; }; -//------------------------------Log10DNode--------------------------------------- -// Log_10 of a double -class Log10DNode : public Node { -public: - Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) { - init_flags(Flag_is_expensive); - C->add_expensive_node(this); - } - virtual int Opcode() const; - const Type *bottom_type() const { return Type::DOUBLE; } - virtual uint ideal_reg() const { return Op_RegD; } - virtual const Type* Value(PhaseGVN* phase) const; -}; - //-------------------------------ReverseBytesINode-------------------------------- // reverse bytes of an integer class ReverseBytesINode : public Node { diff --git a/hotspot/src/share/vm/opto/superword.cpp b/hotspot/src/share/vm/opto/superword.cpp index 00862021ae0..695ab06c573 100644 --- a/hotspot/src/share/vm/opto/superword.cpp +++ b/hotspot/src/share/vm/opto/superword.cpp @@ -52,6 +52,7 @@ SuperWord::SuperWord(PhaseIdealLoop* phase) : _packset(arena(), 8, 0, NULL), // packs for the current block _bb_idx(arena(), (int)(1.10 * phase->C->unique()), 0, 0), // node idx to index in bb _block(arena(), 8, 0, NULL), // nodes in current block + _post_block(arena(), 8, 0, NULL), // nodes common to current block which are marked as post loop vectorizable _data_entry(arena(), 8, 0, NULL), // nodes with all inputs from outside _mem_slice_head(arena(), 8, 0, NULL), // memory slice heads _mem_slice_tail(arena(), 8, 0, NULL), // memory slice tails @@ -100,10 +101,30 @@ void SuperWord::transform_loop(IdealLoopTree* lpt, bool do_optimization) { if (!cl->is_valid_counted_loop()) return; // skip malformed counted loop - if (!cl->is_main_loop() ) return; // skip normal, pre, and post loops + bool post_loop_allowed = (PostLoopMultiversioning && Matcher::has_predicated_vectors() && cl->is_post_loop()); + if (post_loop_allowed) { + if (cl->is_reduction_loop()) return; // no predication mapping + Node *limit = cl->limit(); + if (limit->is_Con()) return; // non constant limits only + // Now check the limit for expressions we do not handle + if (limit->is_Add()) { + Node *in2 = limit->in(2); + if (in2->is_Con()) { + int val = in2->get_int(); + // should not try to program these cases + if (val < 0) return; + } + } + } + + // skip any loop that has not been assigned max unroll by analysis + if (do_optimization) { + if (SuperWordLoopUnrollAnalysis && cl->slp_max_unroll() == 0) return; + } + // Check for no control flow in body (other than exit) Node *cl_exit = cl->loopexit(); - if (cl_exit->in(0) != lpt->_head) { + if (cl->is_main_loop() && (cl_exit->in(0) != lpt->_head)) { #ifndef PRODUCT if (TraceSuperWord) { tty->print_cr("SuperWord::transform_loop: loop too complicated, cl_exit->in(0) != lpt->_head"); @@ -121,15 +142,16 @@ void SuperWord::transform_loop(IdealLoopTree* lpt, bool do_optimization) { return; } - // We only re-enter slp when we vector mapped a queried loop and we want to - // continue unrolling, in this case, slp is not subsequently done. - if (cl->do_unroll_only()) return; + // Skip any loops already optimized by slp + if (cl->is_vectorized_loop()) return; - // Check for pre-loop ending with CountedLoopEnd(Bool(Cmp(x,Opaque1(limit)))) - CountedLoopEndNode* pre_end = get_pre_loop_end(cl); - if (pre_end == NULL) return; - Node *pre_opaq1 = pre_end->limit(); - if (pre_opaq1->Opcode() != Op_Opaque1) return; + if (cl->is_main_loop()) { + // Check for pre-loop ending with CountedLoopEnd(Bool(Cmp(x,Opaque1(limit)))) + CountedLoopEndNode* pre_end = get_pre_loop_end(cl); + if (pre_end == NULL) return; + Node *pre_opaq1 = pre_end->limit(); + if (pre_opaq1->Opcode() != Op_Opaque1) return; + } init(); // initialize data structures @@ -142,6 +164,19 @@ void SuperWord::transform_loop(IdealLoopTree* lpt, bool do_optimization) { if (do_optimization) { assert(_packset.length() == 0, "packset must be empty"); SLP_extract(); + if (PostLoopMultiversioning && Matcher::has_predicated_vectors()) { + if (cl->is_vectorized_loop() && cl->is_main_loop() && !cl->is_reduction_loop()) { + IdealLoopTree *lpt_next = lpt->_next; + CountedLoopNode *cl_next = lpt_next->_head->as_CountedLoop(); + _phase->has_range_checks(lpt_next); + if (cl_next->is_post_loop() && !cl_next->range_checks_present()) { + if (!cl_next->is_vectorized_loop()) { + int slp_max_unroll_factor = cl->slp_max_unroll(); + cl_next->set_slp_max_unroll(slp_max_unroll_factor); + } + } + } + } } } @@ -154,13 +189,17 @@ void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) { Node_Stack nstack((int)ignored_size); CountedLoopNode *cl = lpt()->_head->as_CountedLoop(); Node *cl_exit = cl->loopexit(); + int rpo_idx = _post_block.length(); + + assert(rpo_idx == 0, "post loop block is empty"); // First clear the entries for (uint i = 0; i < lpt()->_body.size(); i++) { ignored_loop_nodes[i] = -1; } - int max_vector = Matcher::max_vector_size(T_INT); + int max_vector = Matcher::max_vector_size(T_BYTE); + bool post_loop_allowed = (PostLoopMultiversioning && Matcher::has_predicated_vectors() && cl->is_post_loop()); // Process the loop, some/all of the stack entries will not be in order, ergo // need to preprocess the ignored initial state before we process the loop @@ -259,6 +298,7 @@ void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) { if (is_slp) { // Now we try to find the maximum supported consistent vector which the machine // description can use + bool small_basic_type = false; for (uint i = 0; i < lpt()->_body.size(); i++) { if (ignored_loop_nodes[i] != -1) continue; @@ -269,6 +309,26 @@ void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) { } else { bt = n->bottom_type()->basic_type(); } + + if (post_loop_allowed) { + if (!small_basic_type) { + switch (bt) { + case T_CHAR: + case T_BYTE: + case T_SHORT: + small_basic_type = true; + break; + + case T_LONG: + // TODO: Remove when support completed for mask context with LONG. + // Support needs to be augmented for logical qword operations, currently we map to dword + // buckets for vectors on logicals as these were legacy. + small_basic_type = true; + break; + } + } + } + if (is_java_primitive(bt) == false) continue; int cur_max_vector = Matcher::max_vector_size(bt); @@ -288,6 +348,12 @@ void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) { if (cur_max_vector < max_vector) { max_vector = cur_max_vector; } + + // We only process post loops on predicated targets where we want to + // mask map the loop to a single iteration + if (post_loop_allowed) { + _post_block.at_put_grow(rpo_idx++, n); + } } } if (is_slp) { @@ -295,7 +361,14 @@ void SuperWord::unrolling_analysis(int &local_loop_unroll_factor) { cl->mark_passed_slp(); } cl->mark_was_slp(); - cl->set_slp_max_unroll(local_loop_unroll_factor); + if (cl->is_main_loop()) { + cl->set_slp_max_unroll(local_loop_unroll_factor); + } else if (post_loop_allowed) { + if (!small_basic_type) { + // avoid replication context for small basic types in programmable masked loops + cl->set_slp_max_unroll(local_loop_unroll_factor); + } + } } } @@ -350,67 +423,104 @@ void SuperWord::SLP_extract() { if (!construct_bb()) { return; // Exit if no interesting nodes or complex graph. } + // build _dg, _disjoint_ptrs dependence_graph(); // compute function depth(Node*) compute_max_depth(); - if (_do_vector_loop) { - if (mark_generations() != -1) { - hoist_loads_in_graph(); // this only rebuild the graph; all basic structs need rebuild explicitly + CountedLoopNode *cl = lpt()->_head->as_CountedLoop(); + bool post_loop_allowed = (PostLoopMultiversioning && Matcher::has_predicated_vectors() && cl->is_post_loop()); + if (cl->is_main_loop()) { + if (_do_vector_loop) { + if (mark_generations() != -1) { + hoist_loads_in_graph(); // this only rebuild the graph; all basic structs need rebuild explicitly - if (!construct_bb()) { - return; // Exit if no interesting nodes or complex graph. + if (!construct_bb()) { + return; // Exit if no interesting nodes or complex graph. + } + dependence_graph(); + compute_max_depth(); } - dependence_graph(); - compute_max_depth(); - } #ifndef PRODUCT - if (TraceSuperWord) { - tty->print_cr("\nSuperWord::_do_vector_loop: graph after hoist_loads_in_graph"); - _lpt->dump_head(); - for (int j = 0; j < _block.length(); j++) { - Node* n = _block.at(j); - int d = depth(n); - for (int i = 0; i < d; i++) tty->print("%s", " "); - tty->print("%d :", d); - n->dump(); - } - } -#endif - } - - compute_vector_element_type(); - - // Attempt vectorization - - find_adjacent_refs(); - - extend_packlist(); - - if (_do_vector_loop) { - if (_packset.length() == 0) { if (TraceSuperWord) { - tty->print_cr("\nSuperWord::_do_vector_loop DFA could not build packset, now trying to build anyway"); + tty->print_cr("\nSuperWord::_do_vector_loop: graph after hoist_loads_in_graph"); + _lpt->dump_head(); + for (int j = 0; j < _block.length(); j++) { + Node* n = _block.at(j); + int d = depth(n); + for (int i = 0; i < d; i++) tty->print("%s", " "); + tty->print("%d :", d); + n->dump(); + } } - pack_parallel(); +#endif + } + + compute_vector_element_type(); + + // Attempt vectorization + + find_adjacent_refs(); + + extend_packlist(); + + if (_do_vector_loop) { + if (_packset.length() == 0) { + if (TraceSuperWord) { + tty->print_cr("\nSuperWord::_do_vector_loop DFA could not build packset, now trying to build anyway"); + } + pack_parallel(); + } + } + + combine_packs(); + + construct_my_pack_map(); + + if (_do_vector_loop) { + merge_packs_to_cmovd(); + } + + filter_packs(); + + schedule(); + } else if (post_loop_allowed) { + int saved_mapped_unroll_factor = cl->slp_max_unroll(); + if (saved_mapped_unroll_factor) { + int vector_mapped_unroll_factor = saved_mapped_unroll_factor; + + // now reset the slp_unroll_factor so that we can check the analysis mapped + // what the vector loop was mapped to + cl->set_slp_max_unroll(0); + + // do the analysis on the post loop + unrolling_analysis(vector_mapped_unroll_factor); + + // if our analyzed loop is a canonical fit, start processing it + if (vector_mapped_unroll_factor == saved_mapped_unroll_factor) { + // now add the vector nodes to packsets + for (int i = 0; i < _post_block.length(); i++) { + Node* n = _post_block.at(i); + Node_List* singleton = new Node_List(); + singleton->push(n); + _packset.append(singleton); + set_my_pack(n, singleton); + } + + // map base types for vector usage + compute_vector_element_type(); + } else { + return; + } + } else { + // for some reason we could not map the slp analysis state of the vectorized loop + return; } } - combine_packs(); - - construct_my_pack_map(); - - if (_do_vector_loop) { - merge_packs_to_cmovd(); - } - - filter_packs(); - - schedule(); - output(); } @@ -811,6 +921,7 @@ int SuperWord::get_iv_adjustment(MemNode* mem_ref) { // Add dependence edges to load/store nodes for memory dependence // A.out()->DependNode.in(1) and DependNode.out()->B.prec(x) void SuperWord::dependence_graph() { + CountedLoopNode *cl = lpt()->_head->as_CountedLoop(); // First, assign a dependence node to each memory node for (int i = 0; i < _block.length(); i++ ) { Node *n = _block.at(i); @@ -825,7 +936,9 @@ void SuperWord::dependence_graph() { Node* n_tail = _mem_slice_tail.at(i); // Get slice in predecessor order (last is first) - mem_slice_preds(n_tail, n, _nlist); + if (cl->is_main_loop()) { + mem_slice_preds(n_tail, n, _nlist); + } #ifndef PRODUCT if(TraceSuperWord && Verbose) { @@ -2029,20 +2142,23 @@ void SuperWord::output() { } #endif - // MUST ENSURE main loop's initial value is properly aligned: - // (iv_initial_value + min_iv_offset) % vector_width_in_bytes() == 0 + CountedLoopNode *cl = lpt()->_head->as_CountedLoop(); + if (cl->is_main_loop()) { + // MUST ENSURE main loop's initial value is properly aligned: + // (iv_initial_value + min_iv_offset) % vector_width_in_bytes() == 0 - align_initial_loop_index(align_to_ref()); + align_initial_loop_index(align_to_ref()); - // Insert extract (unpack) operations for scalar uses - for (int i = 0; i < _packset.length(); i++) { - insert_extracts(_packset.at(i)); + // Insert extract (unpack) operations for scalar uses + for (int i = 0; i < _packset.length(); i++) { + insert_extracts(_packset.at(i)); + } } Compile* C = _phase->C; - CountedLoopNode *cl = lpt()->_head->as_CountedLoop(); uint max_vlen_in_bytes = 0; uint max_vlen = 0; + bool can_process_post_loop = (PostLoopMultiversioning && Matcher::has_predicated_vectors() && cl->is_post_loop()); NOT_PRODUCT(if(is_trace_loop_reverse()) {tty->print_cr("SWPointer::output: print loop before create_reserve_version_of_loop"); print_loop(true);}) @@ -2064,6 +2180,10 @@ void SuperWord::output() { Node* vn = NULL; Node* low_adr = p->at(0); Node* first = executed_first(p); + if (can_process_post_loop) { + // override vlen with the main loops vector length + vlen = cl->slp_max_unroll(); + } NOT_PRODUCT(if(is_trace_cmov()) {tty->print_cr("SWPointer::output: %d executed first, %d executed last in pack", first->_idx, n->_idx); print_pack(p);}) int opc = n->Opcode(); if (n->is_Load()) { @@ -2153,6 +2273,10 @@ void SuperWord::output() { vn = VectorNode::make(opc, in, NULL, vlen, velt_basic_type(n)); vlen_in_bytes = vn->as_Vector()->length_in_bytes(); } else if (is_cmov_pack(p)) { + if (can_process_post_loop) { + // do not refactor of flow in post loop context + return; + } if (!n->is_CMove()) { continue; } @@ -2217,6 +2341,7 @@ void SuperWord::output() { ShouldNotReachHere(); } + _block.at_put(i, vn); _igvn.register_new_node_with_optimizer(vn); _phase->set_ctrl(vn, _phase->get_ctrl(p->at(0))); for (uint j = 0; j < p->size(); j++) { @@ -2225,6 +2350,14 @@ void SuperWord::output() { } _igvn._worklist.push(vn); + if (can_process_post_loop) { + // first check if the vector size if the maximum vector which we can use on the machine, + // other vector size have reduced values for predicated data mapping. + if (vlen_in_bytes != (uint)MaxVectorSize) { + return; + } + } + if (vlen_in_bytes > max_vlen_in_bytes) { max_vlen = vlen; max_vlen_in_bytes = vlen_in_bytes; @@ -2247,15 +2380,38 @@ void SuperWord::output() { if (TraceSuperWordLoopUnrollAnalysis) { tty->print_cr("vector loop(unroll=%d, len=%d)\n", max_vlen, max_vlen_in_bytes*BitsPerByte); } - // For atomic unrolled loops which are vector mapped, instigate more unrolling. + + // For atomic unrolled loops which are vector mapped, instigate more unrolling cl->set_notpassed_slp(); - // if vector resources are limited, do not allow additional unrolling - if (FLOATPRESSURE > 8) { - C->set_major_progress(); + if (cl->is_main_loop()) { + // if vector resources are limited, do not allow additional unrolling, also + // do not unroll more on pure vector loops which were not reduced so that we can + // program the post loop to single iteration execution. + if (FLOATPRESSURE > 8) { + C->set_major_progress(); + cl->mark_do_unroll_only(); + } } - cl->mark_do_unroll_only(); + if (do_reserve_copy()) { cl->mark_loop_vectorized(); + if (can_process_post_loop) { + // Now create the difference of trip and limit and use it as our mask index. + // Note: We limited the unroll of the vectorized loop so that + // only vlen-1 size iterations can remain to be mask programmed. + Node *incr = cl->incr(); + SubINode *index = new SubINode(cl->limit(), cl->init_trip()); + _igvn.register_new_node_with_optimizer(index); + SetVectMaskINode *mask = new SetVectMaskINode(_phase->get_ctrl(cl->init_trip()), index); + _igvn.register_new_node_with_optimizer(mask); + // make this a single iteration loop + AddINode *new_incr = new AddINode(incr->in(1), mask); + _igvn.register_new_node_with_optimizer(new_incr); + _phase->set_ctrl(new_incr, _phase->get_ctrl(incr)); + _igvn.replace_node(incr, new_incr); + cl->mark_is_multiversioned(); + cl->loopexit()->add_flag(Node::Flag_has_vector_mask_set); + } } } } @@ -2274,6 +2430,12 @@ Node* SuperWord::vector_opd(Node_List* p, int opd_idx) { Node* p0 = p->at(0); uint vlen = p->size(); Node* opd = p0->in(opd_idx); + CountedLoopNode *cl = lpt()->_head->as_CountedLoop(); + + if (PostLoopMultiversioning && Matcher::has_predicated_vectors() && cl->is_post_loop()) { + // override vlen with the main loops vector length + vlen = cl->slp_max_unroll(); + } if (same_inputs(p, opd_idx)) { if (opd->is_Vector() || opd->is_LoadVector()) { @@ -3068,8 +3230,7 @@ void SuperWord::align_initial_loop_index(MemNode* align_to_ref) { : (Node*) new MaxINode(lim, orig_limit); _igvn.register_new_node_with_optimizer(constrained); _phase->set_ctrl(constrained, pre_ctrl); - _igvn.hash_delete(pre_opaq); - pre_opaq->set_req(1, constrained); + _igvn.replace_input_of(pre_opaq, 1, constrained); } //----------------------------get_pre_loop_end--------------------------- @@ -3090,13 +3251,13 @@ CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode* cl) { return pre_end; } - //------------------------------init--------------------------- void SuperWord::init() { _dg.init(); _packset.clear(); _disjoint_ptrs.clear(); _block.clear(); + _post_block.clear(); _data_entry.clear(); _mem_slice_head.clear(); _mem_slice_tail.clear(); @@ -3120,6 +3281,7 @@ void SuperWord::restart() { _packset.clear(); _disjoint_ptrs.clear(); _block.clear(); + _post_block.clear(); _data_entry.clear(); _mem_slice_head.clear(); _mem_slice_tail.clear(); diff --git a/hotspot/src/share/vm/opto/superword.hpp b/hotspot/src/share/vm/opto/superword.hpp index ccc154ff96b..eea7c555d11 100644 --- a/hotspot/src/share/vm/opto/superword.hpp +++ b/hotspot/src/share/vm/opto/superword.hpp @@ -261,6 +261,7 @@ class SuperWord : public ResourceObj { GrowableArray _bb_idx; // Map from Node _idx to index within block GrowableArray _block; // Nodes in current block + GrowableArray _post_block; // Nodes in post loop block GrowableArray _data_entry; // Nodes with all inputs from outside GrowableArray _mem_slice_head; // Memory slice head nodes GrowableArray _mem_slice_tail; // Memory slice tail nodes diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index babc67b2433..84cf9d27ca6 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -225,74 +225,156 @@ const Type* Type::get_typeflow_type(ciType* type) { //-----------------------make_from_constant------------------------------------ -const Type* Type::make_from_constant(ciConstant constant, bool require_constant) { +const Type* Type::make_from_constant(ciConstant constant, bool require_constant, + int stable_dimension, bool is_narrow_oop, + bool is_autobox_cache) { switch (constant.basic_type()) { - case T_BOOLEAN: return TypeInt::make(constant.as_boolean()); - case T_CHAR: return TypeInt::make(constant.as_char()); - case T_BYTE: return TypeInt::make(constant.as_byte()); - case T_SHORT: return TypeInt::make(constant.as_short()); - case T_INT: return TypeInt::make(constant.as_int()); - case T_LONG: return TypeLong::make(constant.as_long()); - case T_FLOAT: return TypeF::make(constant.as_float()); - case T_DOUBLE: return TypeD::make(constant.as_double()); - case T_ARRAY: - case T_OBJECT: - { - // cases: - // can_be_constant = (oop not scavengable || ScavengeRootsInCode != 0) - // should_be_constant = (oop not scavengable || ScavengeRootsInCode >= 2) - // An oop is not scavengable if it is in the perm gen. - ciObject* oop_constant = constant.as_object(); - if (oop_constant->is_null_object()) { - return Type::get_zero_type(T_OBJECT); - } else if (require_constant || oop_constant->should_be_constant()) { - return TypeOopPtr::make_from_constant(oop_constant, require_constant); + case T_BOOLEAN: return TypeInt::make(constant.as_boolean()); + case T_CHAR: return TypeInt::make(constant.as_char()); + case T_BYTE: return TypeInt::make(constant.as_byte()); + case T_SHORT: return TypeInt::make(constant.as_short()); + case T_INT: return TypeInt::make(constant.as_int()); + case T_LONG: return TypeLong::make(constant.as_long()); + case T_FLOAT: return TypeF::make(constant.as_float()); + case T_DOUBLE: return TypeD::make(constant.as_double()); + case T_ARRAY: + case T_OBJECT: { + // cases: + // can_be_constant = (oop not scavengable || ScavengeRootsInCode != 0) + // should_be_constant = (oop not scavengable || ScavengeRootsInCode >= 2) + // An oop is not scavengable if it is in the perm gen. + const Type* con_type = NULL; + ciObject* oop_constant = constant.as_object(); + if (oop_constant->is_null_object()) { + con_type = Type::get_zero_type(T_OBJECT); + } else if (require_constant || oop_constant->should_be_constant()) { + con_type = TypeOopPtr::make_from_constant(oop_constant, require_constant); + if (con_type != NULL) { + if (Compile::current()->eliminate_boxing() && is_autobox_cache) { + con_type = con_type->is_aryptr()->cast_to_autobox_cache(true); + } + if (stable_dimension > 0) { + assert(FoldStableValues, "sanity"); + assert(!con_type->is_zero_type(), "default value for stable field"); + con_type = con_type->is_aryptr()->cast_to_stable(true, stable_dimension); + } + } + } + if (is_narrow_oop) { + con_type = con_type->make_narrowoop(); + } + return con_type; } - } - case T_ILLEGAL: - // Invalid ciConstant returned due to OutOfMemoryError in the CI - assert(Compile::current()->env()->failing(), "otherwise should not see this"); - return NULL; + case T_ILLEGAL: + // Invalid ciConstant returned due to OutOfMemoryError in the CI + assert(Compile::current()->env()->failing(), "otherwise should not see this"); + return NULL; } // Fall through to failure return NULL; } +static ciConstant check_mismatched_access(ciConstant con, BasicType loadbt, bool is_unsigned) { + BasicType conbt = con.basic_type(); + switch (conbt) { + case T_BOOLEAN: conbt = T_BYTE; break; + case T_ARRAY: conbt = T_OBJECT; break; + } + switch (loadbt) { + case T_BOOLEAN: loadbt = T_BYTE; break; + case T_NARROWOOP: loadbt = T_OBJECT; break; + case T_ARRAY: loadbt = T_OBJECT; break; + case T_ADDRESS: loadbt = T_OBJECT; break; + } + if (conbt == loadbt) { + if (is_unsigned && conbt == T_BYTE) { + // LoadB (T_BYTE) with a small mask (<=8-bit) is converted to LoadUB (T_BYTE). + return ciConstant(T_INT, con.as_int() & 0xFF); + } else { + return con; + } + } + if (conbt == T_SHORT && loadbt == T_CHAR) { + // LoadS (T_SHORT) with a small mask (<=16-bit) is converted to LoadUS (T_CHAR). + return ciConstant(T_INT, con.as_int() & 0xFFFF); + } + return ciConstant(); // T_ILLEGAL +} -const Type* Type::make_constant(ciField* field, Node* obj) { - if (!field->is_constant()) return NULL; +// Try to constant-fold a stable array element. +const Type* Type::make_constant_from_array_element(ciArray* array, int off, int stable_dimension, + BasicType loadbt, bool is_unsigned_load) { + // Decode the results of GraphKit::array_element_address. + ciConstant element_value = array->element_value_by_offset(off); + if (element_value.basic_type() == T_ILLEGAL) { + return NULL; // wrong offset + } + ciConstant con = check_mismatched_access(element_value, loadbt, is_unsigned_load); - const Type* con_type = NULL; + assert(con.basic_type() != T_ILLEGAL, "elembt=%s; loadbt=%s; unsigned=%d", + type2name(element_value.basic_type()), type2name(loadbt), is_unsigned_load); + + if (con.is_valid() && // not a mismatched access + !con.is_null_or_zero()) { // not a default value + bool is_narrow_oop = (loadbt == T_NARROWOOP); + return Type::make_from_constant(con, /*require_constant=*/true, stable_dimension, is_narrow_oop, /*is_autobox_cache=*/false); + } + return NULL; +} + +const Type* Type::make_constant_from_field(ciInstance* holder, int off, bool is_unsigned_load, BasicType loadbt) { + ciField* field; + ciType* type = holder->java_mirror_type(); + if (type != NULL && type->is_instance_klass() && off >= InstanceMirrorKlass::offset_of_static_fields()) { + // Static field + field = type->as_instance_klass()->get_field_by_offset(off, /*is_static=*/true); + } else { + // Instance field + field = holder->klass()->as_instance_klass()->get_field_by_offset(off, /*is_static=*/false); + } + if (field == NULL) { + return NULL; // Wrong offset + } + return Type::make_constant_from_field(field, holder, loadbt, is_unsigned_load); +} + +const Type* Type::make_constant_from_field(ciField* field, ciInstance* holder, + BasicType loadbt, bool is_unsigned_load) { + if (!field->is_constant()) { + return NULL; // Non-constant field + } + ciConstant field_value; if (field->is_static()) { // final static field - con_type = Type::make_from_constant(field->constant_value(), /*require_const=*/true); - if (Compile::current()->eliminate_boxing() && field->is_autobox_cache() && con_type != NULL) { - con_type = con_type->is_aryptr()->cast_to_autobox_cache(true); - } - } else { + field_value = field->constant_value(); + } else if (holder != NULL) { // final or stable non-static field // Treat final non-static fields of trusted classes (classes in // java.lang.invoke and sun.invoke packages and subpackages) as // compile time constants. - if (obj->is_Con()) { - const TypeOopPtr* oop_ptr = obj->bottom_type()->isa_oopptr(); - ciObject* constant_oop = oop_ptr->const_oop(); - ciConstant constant = field->constant_value_of(constant_oop); - con_type = Type::make_from_constant(constant, /*require_const=*/true); - } + field_value = field->constant_value_of(holder); } - if (FoldStableValues && field->is_stable() && con_type != NULL) { - if (con_type->is_zero_type()) { - return NULL; // the field hasn't been initialized yet - } else if (con_type->isa_oopptr()) { - const Type* stable_type = Type::get_const_type(field->type()); - if (field->type()->is_array_klass()) { - int stable_dimension = field->type()->as_array_klass()->dimension(); - stable_type = stable_type->is_aryptr()->cast_to_stable(true, stable_dimension); - } - if (stable_type != NULL) { - con_type = con_type->join_speculative(stable_type); - } + if (!field_value.is_valid()) { + return NULL; // Not a constant + } + + ciConstant con = check_mismatched_access(field_value, loadbt, is_unsigned_load); + + assert(con.is_valid(), "elembt=%s; loadbt=%s; unsigned=%d", + type2name(field_value.basic_type()), type2name(loadbt), is_unsigned_load); + + bool is_stable_array = FoldStableValues && field->is_stable() && field->type()->is_array_klass(); + int stable_dimension = (is_stable_array ? field->type()->as_array_klass()->dimension() : 0); + bool is_narrow_oop = (loadbt == T_NARROWOOP); + + const Type* con_type = make_from_constant(con, /*require_constant=*/ true, + stable_dimension, is_narrow_oop, + field->is_autobox_cache()); + if (con_type != NULL && field->is_call_site_target()) { + ciCallSite* call_site = holder->as_call_site(); + if (!call_site->is_constant_call_site()) { + ciMethodHandle* target = call_site->get_target(); + Compile::current()->dependencies()->assert_call_site_target_value(call_site, target); } } return con_type; diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index 6636af716b4..4c79e900bf2 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -417,9 +417,26 @@ public: static const Type* get_typeflow_type(ciType* type); static const Type* make_from_constant(ciConstant constant, - bool require_constant = false); + bool require_constant = false, + int stable_dimension = 0, + bool is_narrow = false, + bool is_autobox_cache = false); - static const Type* make_constant(ciField* field, Node* obj); + static const Type* make_constant_from_field(ciInstance* holder, + int off, + bool is_unsigned_load, + BasicType loadbt); + + static const Type* make_constant_from_field(ciField* field, + ciInstance* holder, + BasicType loadbt, + bool is_unsigned_load); + + static const Type* make_constant_from_array_element(ciArray* array, + int off, + int stable_dimension, + BasicType loadbt, + bool is_unsigned_load); // Speculative type helper methods. See TypePtr. virtual const TypePtr* speculative() const { return NULL; } diff --git a/hotspot/src/share/vm/opto/vectornode.hpp b/hotspot/src/share/vm/opto/vectornode.hpp index ee7b736e7c8..04df1eb0140 100644 --- a/hotspot/src/share/vm/opto/vectornode.hpp +++ b/hotspot/src/share/vm/opto/vectornode.hpp @@ -529,6 +529,7 @@ class LoadVectorNode : public LoadNode { Node* adr, const TypePtr* atyp, uint vlen, BasicType bt, ControlDependency control_dependency = LoadNode::DependsOnlyOnTest); + uint element_size(void) { return type2aelembytes(vect_type()->element_basic_type()); } }; //------------------------------StoreVectorNode-------------------------------- @@ -553,6 +554,8 @@ class StoreVectorNode : public StoreNode { static StoreVectorNode* make(int opc, Node* ctl, Node* mem, Node* adr, const TypePtr* atyp, Node* val, uint vlen); + + uint element_size(void) { return type2aelembytes(vect_type()->element_basic_type()); } }; @@ -791,4 +794,15 @@ class ExtractDNode : public ExtractNode { virtual uint ideal_reg() const { return Op_RegD; } }; +//------------------------------SetVectMaskINode------------------------------- +// Provide a mask for a vector predicate machine +class SetVectMaskINode : public Node { +public: + SetVectMaskINode(Node *c, Node *in1) : Node(c, in1) {} + virtual int Opcode() const; + const Type *bottom_type() const { return TypeInt::INT; } + virtual uint ideal_reg() const { return Op_RegI; } + virtual const Type *Value(PhaseGVN *phase) const { return TypeInt::INT; } +}; + #endif // SHARE_VM_OPTO_VECTORNODE_HPP diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index 8c1a020ac0f..a6f10fc768d 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -350,7 +350,7 @@ JNI_ENTRY(jclass, jni_DefineClass(JNIEnv *env, const char *name, jobject loaderR &st, CHECK_NULL); - if (log_is_enabled(Debug, classresolve) && k != NULL) { + if (log_is_enabled(Debug, class, resolve) && k != NULL) { trace_class_resolution(k); } @@ -420,7 +420,7 @@ JNI_ENTRY(jclass, jni_FindClass(JNIEnv *env, const char *name)) result = find_class_from_class_loader(env, sym, true, loader, protection_domain, true, thread); - if (log_is_enabled(Debug, classresolve) && result != NULL) { + if (log_is_enabled(Debug, class, resolve) && result != NULL) { trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result))); } @@ -3296,7 +3296,7 @@ static jclass lookupOne(JNIEnv* env, const char* name, TRAPS) { TempNewSymbol sym = SymbolTable::new_symbol(name, CHECK_NULL); jclass result = find_class_from_class_loader(env, sym, true, loader, protection_domain, true, CHECK_NULL); - if (log_is_enabled(Debug, classresolve) && result != NULL) { + if (log_is_enabled(Debug, class, resolve) && result != NULL) { trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result))); } return result; diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 834e1ae88fc..a0cb1185487 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -210,9 +210,9 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) { const char * to = to_class->external_name(); // print in a single call to reduce interleaving between threads if (source_file != NULL) { - log_debug(classresolve)("%s %s %s:%d (%s)", from, to, source_file, line_number, trace); + log_debug(class, resolve)("%s %s %s:%d (%s)", from, to, source_file, line_number, trace); } else { - log_debug(classresolve)("%s %s (%s)", from, to, trace); + log_debug(class, resolve)("%s %s (%s)", from, to, trace); } } } @@ -389,7 +389,7 @@ JVM_ENTRY(jobject, JVM_InitProperties(JNIEnv *env, jobject properties)) PUTPROP(props, "sun.nio.MaxDirectMemorySize", "-1"); } else { char as_chars[256]; - jio_snprintf(as_chars, sizeof(as_chars), SIZE_FORMAT, MaxDirectMemorySize); + jio_snprintf(as_chars, sizeof(as_chars), JULONG_FORMAT, MaxDirectMemorySize); PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars); } } @@ -805,7 +805,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env, return NULL; } - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { trace_class_resolution(k); } return (jclass) JNIHandles::make_local(env, k->java_mirror()); @@ -842,7 +842,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromCaller(JNIEnv* env, const char* name, jclass result = find_class_from_class_loader(env, h_name, init, h_loader, h_prot, false, THREAD); - if (log_is_enabled(Debug, classresolve) && result != NULL) { + if (log_is_enabled(Debug, class, resolve) && result != NULL) { trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result))); } return result; @@ -872,7 +872,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name, jclass result = find_class_from_class_loader(env, h_name, init, h_loader, h_prot, true, thread); - if (log_is_enabled(Debug, classresolve) && result != NULL) { + if (log_is_enabled(Debug, class, resolve) && result != NULL) { // this function is generally only used for class loading during verification. ResourceMark rm; oop from_mirror = JNIHandles::resolve_non_null(from); @@ -882,7 +882,7 @@ JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name, oop mirror = JNIHandles::resolve_non_null(result); Klass* to_class = java_lang_Class::as_Klass(mirror); const char * to = to_class->external_name(); - log_debug(classresolve)("%s %s (verification)", from_name, to); + log_debug(class, resolve)("%s %s (verification)", from_name, to); } return result; @@ -950,7 +950,7 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name, &st, CHECK_NULL); - if (log_is_enabled(Debug, classresolve) && k != NULL) { + if (log_is_enabled(Debug, class, resolve) && k != NULL) { trace_class_resolution(k); } diff --git a/hotspot/src/share/vm/prims/jvmti.xml b/hotspot/src/share/vm/prims/jvmti.xml index f6a18c771ac..54af0643f3b 100644 --- a/hotspot/src/share/vm/prims/jvmti.xml +++ b/hotspot/src/share/vm/prims/jvmti.xml @@ -6482,6 +6482,7 @@ class C2 extends C1 implements I2 { Get All Modules Return an array of all modules loaded in the virtual machine. + The array includes the unnamed module for each class loader. The number of modules in the array is returned via module_count_ptr, and the array itself via modules_ptr. @@ -9994,6 +9995,17 @@ myInit() { See . + + + Can generate the events + in the primordial phase. If this capability and + + can_generate_all_class_hook_events + are enabled then the events + can be posted for classes loaded in the primordial phase. + See . + + @@ -12404,7 +12416,7 @@ myInit() { - This event is sent when the VM obtains class file data, @@ -12420,7 +12432,13 @@ myInit() { bytecode instrumentation for usage information.

- This event may be sent before the VM is initialized (the start + When the capabilities + + can_generate_early_class_hook_events and + + can_generate_all_class_hook_events + are enabled then this event may be sent in the primordial phase. + Otherwise, this event may be sent before the VM is initialized (the start phase). Some classes might not be compatible with the function (eg. ROMized classes) and this event will not be @@ -12470,6 +12488,7 @@ myInit() { jvmpi + @@ -12542,7 +12561,7 @@ myInit() { - The VM initialization event signals the start of the VM. + The VM start event signals the start of the VM. At this time JNI is live but the VM is not yet fully initialized. Once this event is generated, the agent is free to call any JNI function. This event signals the beginning of the start phase, @@ -14419,6 +14438,10 @@ typedef void (JNICALL *jvmtiEventVMInit) - Add new capability can_generate_early_vmstart - Allow CompiledMethodLoad events at start phase + + Support for modules: + - Add new capability can_generate_early_class_hook_events + diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp index c48de41227b..c197919eb1c 100644 --- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp +++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -693,7 +693,7 @@ void JvmtiClassFileReconstituter::write_method_infos() { if (JvmtiExport::can_maintain_original_method_order()) { int index; int original_index; - intArray method_order(num_methods, 0); + intArray method_order(num_methods, num_methods, 0); // invert the method order mapping for (index = 0; index < num_methods; index++) { diff --git a/hotspot/src/share/vm/prims/jvmtiEnter.xsl b/hotspot/src/share/vm/prims/jvmtiEnter.xsl index 2d012a82129..bdb7915513d 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl +++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl @@ -40,6 +40,7 @@ # include "memory/resourceArea.hpp" # include "utilities/macros.hpp" #if INCLUDE_JVMTI +# include "logging/log.hpp" # include "oops/oop.inline.hpp" # include "prims/jvmtiEnter.hpp" # include "prims/jvmtiRawMonitor.hpp" @@ -415,7 +416,7 @@ struct jvmtiInterface_1_ jvmti if (trace_flags) { - tty->print_cr("JVMTI [non-attached thread] %s %s", func_name, + log_trace(jvmti)("[non-attached thread] %s %s", func_name, JvmtiUtil::error_name(JVMTI_ERROR_UNATTACHED_THREAD)); @@ -452,7 +453,7 @@ struct jvmtiInterface_1_ jvmti if (trace_flags) { - tty->print_cr("JVMTI [%s] %s %s", curr_thread_name, func_name, + log_trace(jvmti)("[%s] %s %s", curr_thread_name, func_name, JvmtiUtil::error_name(JVMTI_ERROR_MUST_POSSESS_CAPABILITY)); } @@ -486,7 +487,7 @@ static jvmtiError JNICALL if (trace_flags) { - tty->print_cr("JVMTI [-] %s %s", func_name, + log_trace(jvmti)("[-] %s %s", func_name, JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE)); } @@ -509,7 +510,7 @@ static jvmtiError JNICALL if (trace_flags) { - tty->print_cr("JVMTI [-] %s %s", func_name, + log_trace(jvmti)("[-] %s %s", func_name, JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE)); } @@ -522,7 +523,7 @@ static jvmtiError JNICALL if (trace_flags) { - tty->print_cr("JVMTI [-] %s %s", func_name, + log_trace(jvmti)("[-] %s %s", func_name, JvmtiUtil::error_name(JVMTI_ERROR_WRONG_PHASE)); } @@ -541,7 +542,7 @@ static jvmtiError JNICALL if (trace_flags) { - tty->print_cr("JVMTI [%s] %s %s env=" PTR_FORMAT, curr_thread_name, func_name, + log_trace(jvmti)("[%s] %s %s env=" PTR_FORMAT, curr_thread_name, func_name, JvmtiUtil::error_name(JVMTI_ERROR_INVALID_ENVIRONMENT), p2i(env)); } @@ -667,7 +668,7 @@ static jvmtiError JNICALL } - tty->print_cr("JVMTI [%s] %s } %s - erroneous arg is + log_error(jvmti)("[%s] %s } %s - erroneous arg is ", curr_thread_name, func_name, @@ -692,10 +693,10 @@ static jvmtiError JNICALL } - tty->print_cr("JVMTI [%s] %s } %s", curr_thread_name, func_name, + log_error(jvmti)("[%s] %s } %s", curr_thread_name, func_name, JvmtiUtil::error_name(err)); } else if ((trace_flags & JvmtiTrace::SHOW_OUT) != 0) { - tty->print_cr("JVMTI [%s] %s }", curr_thread_name, func_name); + log_trace(jvmti)("[%s] %s }", curr_thread_name, func_name); } @@ -703,7 +704,7 @@ static jvmtiError JNICALL - tty->print_cr("JVMTI [%s] %s { + log_trace(jvmti)("[%s] %s { diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp index 6dffe9876a1..d6f60a28f77 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp @@ -489,7 +489,7 @@ JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) { ObjectLocker ol(loader_lock, thread); // add the jar file to the bootclasspath - log_info(classload)("opened: %s", zip_entry->name()); + log_info(class, load)("opened: %s", zip_entry->name()); ClassLoaderExt::append_boot_classpath(zip_entry); return JVMTI_ERROR_NONE; } else { @@ -640,11 +640,11 @@ JvmtiEnv::SetVerboseFlag(jvmtiVerboseFlag flag, jboolean value) { break; case JVMTI_VERBOSE_CLASS: if (value == 0) { - LogConfiguration::parse_log_arguments("stdout", "classunload=off", NULL, NULL, NULL); - LogConfiguration::parse_log_arguments("stdout", "classload=off", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+unload=off", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+load=off", NULL, NULL, NULL); } else { - LogConfiguration::parse_log_arguments("stdout", "classload=info", NULL, NULL, NULL); - LogConfiguration::parse_log_arguments("stdout", "classunload=info", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+load=info", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+unload=info", NULL, NULL, NULL); } break; case JVMTI_VERBOSE_GC: @@ -1675,7 +1675,7 @@ JvmtiEnv::FollowReferences(jint heap_filter, jclass klass, jobject initial_objec HandleMark hm(thread); KlassHandle kh (thread, k_oop); - TraceTime t("FollowReferences", TraceJVMTIObjectTagging); + TraceTime t("FollowReferences", TRACETIME_LOG(Debug, jvmti, objecttagging)); JvmtiTagMap::tag_map_for(this)->follow_references(heap_filter, kh, initial_object, callbacks, user_data); return JVMTI_ERROR_NONE; } /* end FollowReferences */ @@ -1706,7 +1706,7 @@ JvmtiEnv::IterateThroughHeap(jint heap_filter, jclass klass, const jvmtiHeapCall HandleMark hm(thread); KlassHandle kh (thread, k_oop); - TraceTime t("IterateThroughHeap", TraceJVMTIObjectTagging); + TraceTime t("IterateThroughHeap", TRACETIME_LOG(Debug, jvmti, objecttagging)); JvmtiTagMap::tag_map_for(this)->iterate_through_heap(heap_filter, kh, callbacks, user_data); return JVMTI_ERROR_NONE; } /* end IterateThroughHeap */ @@ -1738,7 +1738,7 @@ JvmtiEnv::SetTag(jobject object, jlong tag) { // tag_result_ptr - NULL is a valid value, must be checked jvmtiError JvmtiEnv::GetObjectsWithTags(jint tag_count, const jlong* tags, jint* count_ptr, jobject** object_result_ptr, jlong** tag_result_ptr) { - TraceTime t("GetObjectsWithTags", TraceJVMTIObjectTagging); + TraceTime t("GetObjectsWithTags", TRACETIME_LOG(Debug, jvmti, objecttagging)); return JvmtiTagMap::tag_map_for(this)->get_objects_with_tags((jlong*)tags, tag_count, count_ptr, object_result_ptr, tag_result_ptr); } /* end GetObjectsWithTags */ @@ -1771,7 +1771,7 @@ JvmtiEnv::IterateOverObjectsReachableFromObject(jobject object, jvmtiObjectRefer // user_data - NULL is a valid value, must be checked jvmtiError JvmtiEnv::IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback, jvmtiStackReferenceCallback stack_ref_callback, jvmtiObjectReferenceCallback object_ref_callback, const void* user_data) { - TraceTime t("IterateOverReachableObjects", TraceJVMTIObjectTagging); + TraceTime t("IterateOverReachableObjects", TRACETIME_LOG(Debug, jvmti, objecttagging)); JvmtiTagMap::tag_map_for(this)->iterate_over_reachable_objects(heap_root_callback, stack_ref_callback, object_ref_callback, user_data); return JVMTI_ERROR_NONE; } /* end IterateOverReachableObjects */ @@ -1781,7 +1781,7 @@ JvmtiEnv::IterateOverReachableObjects(jvmtiHeapRootCallback heap_root_callback, // user_data - NULL is a valid value, must be checked jvmtiError JvmtiEnv::IterateOverHeap(jvmtiHeapObjectFilter object_filter, jvmtiHeapObjectCallback heap_object_callback, const void* user_data) { - TraceTime t("IterateOverHeap", TraceJVMTIObjectTagging); + TraceTime t("IterateOverHeap", TRACETIME_LOG(Debug, jvmti, objecttagging)); Thread *thread = Thread::current(); HandleMark hm(thread); JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, KlassHandle(), heap_object_callback, user_data); @@ -1805,7 +1805,7 @@ JvmtiEnv::IterateOverInstancesOfClass(oop k_mirror, jvmtiHeapObjectFilter object Thread *thread = Thread::current(); HandleMark hm(thread); KlassHandle klass (thread, k_oop); - TraceTime t("IterateOverInstancesOfClass", TraceJVMTIObjectTagging); + TraceTime t("IterateOverInstancesOfClass", TRACETIME_LOG(Debug, jvmti, objecttagging)); JvmtiTagMap::tag_map_for(this)->iterate_over_heap(object_filter, klass, heap_object_callback, user_data); return JVMTI_ERROR_NONE; } /* end IterateOverInstancesOfClass */ diff --git a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp index 1c199bd18ba..04e68694459 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp +++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp @@ -162,6 +162,11 @@ class JvmtiEnvBase : public CHeapObj { jvmtiCapabilities *get_prohibited_capabilities() { return &_prohibited_capabilities; } + bool early_class_hook_env() { + return get_capabilities()->can_generate_early_class_hook_events != 0 + && get_capabilities()->can_generate_all_class_hook_events != 0; + } + bool early_vmstart_env() { return get_capabilities()->can_generate_early_vmstart != 0; } diff --git a/hotspot/src/share/vm/prims/jvmtiEventController.cpp b/hotspot/src/share/vm/prims/jvmtiEventController.cpp index 81ca1d7d6e3..006feeab4c0 100644 --- a/hotspot/src/share/vm/prims/jvmtiEventController.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEventController.cpp @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "interpreter/interpreter.hpp" #include "jvmtifiles/jvmtiEnv.hpp" +#include "logging/log.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiEventController.hpp" #include "prims/jvmtiEventController.inline.hpp" @@ -42,7 +43,7 @@ #define EC_TRACE(out) do { \ if (JvmtiTrace::trace_event_controller()) { \ SafeResourceMark rm; \ - tty->print_cr out; \ + log_trace(jvmti) out; \ } \ } while (0) #else @@ -344,7 +345,7 @@ void VM_ChangeSingleStep::doit() { void JvmtiEventControllerPrivate::enter_interp_only_mode(JvmtiThreadState *state) { - EC_TRACE(("JVMTI [%s] # Entering interpreter only mode", + EC_TRACE(("[%s] # Entering interpreter only mode", JvmtiTrace::safe_get_thread_name(state->get_thread()))); VM_EnterInterpOnlyMode op(state); @@ -354,7 +355,7 @@ void JvmtiEventControllerPrivate::enter_interp_only_mode(JvmtiThreadState *state void JvmtiEventControllerPrivate::leave_interp_only_mode(JvmtiThreadState *state) { - EC_TRACE(("JVMTI [%s] # Leaving interpreter only mode", + EC_TRACE(("[%s] # Leaving interpreter only mode", JvmtiTrace::safe_get_thread_name(state->get_thread()))); state->leave_interp_only_mode(); } @@ -370,7 +371,7 @@ JvmtiEventControllerPrivate::trace_changed(JvmtiThreadState *state, jlong now_en jlong bit = JvmtiEventEnabled::bit_for((jvmtiEvent)ei); if (changed & bit) { // it changed, print it - tty->print_cr("JVMTI [%s] # %s event %s", + log_trace(jvmti)("[%s] # %s event %s", JvmtiTrace::safe_get_thread_name(state->get_thread()), (now_enabled & bit)? "Enabling" : "Disabling", JvmtiTrace::event_name((jvmtiEvent)ei)); } @@ -390,7 +391,7 @@ JvmtiEventControllerPrivate::trace_changed(jlong now_enabled, jlong changed) { jlong bit = JvmtiEventEnabled::bit_for((jvmtiEvent)ei); if (changed & bit) { // it changed, print it - tty->print_cr("JVMTI [-] # %s event %s", + log_trace(jvmti)("[-] # %s event %s", (now_enabled & bit)? "Enabling" : "Disabling", JvmtiTrace::event_name((jvmtiEvent)ei)); } } @@ -563,7 +564,7 @@ JvmtiEventControllerPrivate::recompute_enabled() { jlong was_any_env_thread_enabled = JvmtiEventController::_universal_global_event_enabled.get_bits(); jlong any_env_thread_enabled = 0; - EC_TRACE(("JVMTI [-] # recompute enabled - before " UINT64_FORMAT_X, was_any_env_thread_enabled)); + EC_TRACE(("[-] # recompute enabled - before " UINT64_FORMAT_X, was_any_env_thread_enabled)); // compute non-thread-filters events. // This must be done separately from thread-filtered events, since some @@ -643,7 +644,7 @@ JvmtiEventControllerPrivate::recompute_enabled() { } - EC_TRACE(("JVMTI [-] # recompute enabled - after " UINT64_FORMAT_X, any_env_thread_enabled)); + EC_TRACE(("[-] # recompute enabled - after " UINT64_FORMAT_X, any_env_thread_enabled)); } @@ -653,7 +654,7 @@ JvmtiEventControllerPrivate::thread_started(JavaThread *thread) { assert(thread == Thread::current(), "must be current thread"); assert(JvmtiEnvBase::environments_might_exist(), "to enter event controller, JVM TI environments must exist"); - EC_TRACE(("JVMTI [%s] # thread started", JvmtiTrace::safe_get_thread_name(thread))); + EC_TRACE(("[%s] # thread started", JvmtiTrace::safe_get_thread_name(thread))); // if we have any thread filtered events globally enabled, create/update the thread state if ((JvmtiEventController::_universal_global_event_enabled.get_bits() & THREAD_FILTERED_EVENT_BITS) != 0) { @@ -673,7 +674,7 @@ JvmtiEventControllerPrivate::thread_ended(JavaThread *thread) { // May be called after all environments have been disposed. assert(JvmtiThreadState_lock->is_locked(), "sanity check"); - EC_TRACE(("JVMTI [%s] # thread ended", JvmtiTrace::safe_get_thread_name(thread))); + EC_TRACE(("[%s] # thread ended", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadState *state = thread->jvmti_thread_state(); assert(state != NULL, "else why are we here?"); @@ -684,7 +685,7 @@ void JvmtiEventControllerPrivate::set_event_callbacks(JvmtiEnvBase *env, const jvmtiEventCallbacks* callbacks, jint size_of_callbacks) { assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); - EC_TRACE(("JVMTI [*] # set event callbacks")); + EC_TRACE(("[*] # set event callbacks")); env->set_event_callbacks(callbacks, size_of_callbacks); jlong enabled_bits = 0; @@ -704,7 +705,7 @@ JvmtiEventControllerPrivate::set_extension_event_callback(JvmtiEnvBase *env, jvmtiExtensionEvent callback) { assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); - EC_TRACE(("JVMTI [*] # set extension event callback")); + EC_TRACE(("[*] # set extension event callback")); // extension events are allocated below JVMTI_MIN_EVENT_TYPE_VAL assert(extension_event_index >= (jint)EXT_MIN_EVENT_TYPE_VAL && @@ -750,7 +751,7 @@ JvmtiEventControllerPrivate::set_extension_event_callback(JvmtiEnvBase *env, void JvmtiEventControllerPrivate::env_initialize(JvmtiEnvBase *env) { assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); - EC_TRACE(("JVMTI [*] # env initialize")); + EC_TRACE(("[*] # env initialize")); if (JvmtiEnvBase::is_vm_live()) { // if we didn't initialize event info already (this is a late @@ -772,7 +773,7 @@ JvmtiEventControllerPrivate::env_initialize(JvmtiEnvBase *env) { void JvmtiEventControllerPrivate::env_dispose(JvmtiEnvBase *env) { assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); - EC_TRACE(("JVMTI [*] # env dispose")); + EC_TRACE(("[*] # env dispose")); // Before the environment is marked disposed, disable all events on this // environment (by zapping the callbacks). As a result, the disposed @@ -794,7 +795,7 @@ JvmtiEventControllerPrivate::set_user_enabled(JvmtiEnvBase *env, JavaThread *thr jvmtiEvent event_type, bool enabled) { assert(Threads::number_of_threads() == 0 || JvmtiThreadState_lock->is_locked(), "sanity check"); - EC_TRACE(("JVMTI [%s] # user %s event %s", + EC_TRACE(("[%s] # user %s event %s", thread==NULL? "ALL": JvmtiTrace::safe_get_thread_name(thread), enabled? "enabled" : "disabled", JvmtiTrace::event_name(event_type))); @@ -813,7 +814,7 @@ JvmtiEventControllerPrivate::set_user_enabled(JvmtiEnvBase *env, JavaThread *thr void JvmtiEventControllerPrivate::set_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) { - EC_TRACE(("JVMTI [%s] # set frame pop - frame=%d", + EC_TRACE(("[%s] # set frame pop - frame=%d", JvmtiTrace::safe_get_thread_name(ets->get_thread()), fpop.frame_number() )); @@ -824,7 +825,7 @@ JvmtiEventControllerPrivate::set_frame_pop(JvmtiEnvThreadState *ets, JvmtiFrameP void JvmtiEventControllerPrivate::clear_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) { - EC_TRACE(("JVMTI [%s] # clear frame pop - frame=%d", + EC_TRACE(("[%s] # clear frame pop - frame=%d", JvmtiTrace::safe_get_thread_name(ets->get_thread()), fpop.frame_number() )); @@ -837,7 +838,7 @@ void JvmtiEventControllerPrivate::clear_to_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) { int cleared_cnt = ets->get_frame_pops()->clear_to(fpop); - EC_TRACE(("JVMTI [%s] # clear to frame pop - frame=%d, count=%d", + EC_TRACE(("[%s] # clear to frame pop - frame=%d, count=%d", JvmtiTrace::safe_get_thread_name(ets->get_thread()), fpop.frame_number(), cleared_cnt )); @@ -863,7 +864,7 @@ JvmtiEventControllerPrivate::change_field_watch(jvmtiEvent event_type, bool adde return; } - EC_TRACE(("JVMTI [-] # change field watch - %s %s count=%d", + EC_TRACE(("[-] # change field watch - %s %s count=%d", event_type==JVMTI_EVENT_FIELD_MODIFICATION? "modification" : "access", added? "add" : "remove", *count_addr)); @@ -893,7 +894,7 @@ JvmtiEventControllerPrivate::event_init() { return; } - EC_TRACE(("JVMTI [-] # VM live")); + EC_TRACE(("[-] # VM live")); #ifdef ASSERT // check that our idea and the spec's idea of threaded events match diff --git a/hotspot/src/share/vm/prims/jvmtiExport.cpp b/hotspot/src/share/vm/prims/jvmtiExport.cpp index 984c5f910d2..a388f29dc9e 100644 --- a/hotspot/src/share/vm/prims/jvmtiExport.cpp +++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp @@ -29,6 +29,8 @@ #include "code/scopeDesc.hpp" #include "interpreter/interpreter.hpp" #include "jvmtifiles/jvmtiEnv.hpp" +#include "logging/log.hpp" +#include "logging/logStream.hpp" #include "memory/resourceArea.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.hpp" @@ -60,8 +62,8 @@ #endif // INCLUDE_ALL_GCS #ifdef JVMTI_TRACE -#define EVT_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_SENT) != 0) { SafeResourceMark rm; tty->print_cr out; } -#define EVT_TRIG_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_TRIGGER) != 0) { SafeResourceMark rm; tty->print_cr out; } +#define EVT_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_SENT) != 0) { SafeResourceMark rm; log_trace(jvmti) out; } +#define EVT_TRIG_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_TRIGGER) != 0) { SafeResourceMark rm; log_trace(jvmti) out; } #else #define EVT_TRIG_TRACE(evt,out) #define EVT_TRACE(evt,out) @@ -423,7 +425,10 @@ JvmtiExport::add_default_read_edges(Handle h_module, TRAPS) { THREAD); if (HAS_PENDING_EXCEPTION) { - java_lang_Throwable::print(PENDING_EXCEPTION, tty); + LogTarget(Trace, jvmti) log; + LogStreamCHeap log_stream(log); + java_lang_Throwable::print(PENDING_EXCEPTION, &log_stream); + log_stream.cr(); CLEAR_PENDING_EXCEPTION; return; } @@ -465,7 +470,7 @@ void JvmtiExport::enter_live_phase() { // void JvmtiExport::post_early_vm_start() { - EVT_TRIG_TRACE(JVMTI_EVENT_VM_START, ("JVMTI Trg Early VM start event triggered" )); + EVT_TRIG_TRACE(JVMTI_EVENT_VM_START, ("Trg Early VM start event triggered" )); // can now enable some events JvmtiEventController::vm_start(); @@ -474,7 +479,7 @@ void JvmtiExport::post_early_vm_start() { for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { // Only early vmstart envs post early VMStart event if (env->early_vmstart_env() && env->is_enabled(JVMTI_EVENT_VM_START)) { - EVT_TRACE(JVMTI_EVENT_VM_START, ("JVMTI Evt Early VM start event sent" )); + EVT_TRACE(JVMTI_EVENT_VM_START, ("Evt Early VM start event sent" )); JavaThread *thread = JavaThread::current(); JvmtiThreadEventMark jem(thread); JvmtiJavaThreadEventTransition jet(thread); @@ -487,7 +492,7 @@ void JvmtiExport::post_early_vm_start() { } void JvmtiExport::post_vm_start() { - EVT_TRIG_TRACE(JVMTI_EVENT_VM_START, ("JVMTI Trg VM start event triggered" )); + EVT_TRIG_TRACE(JVMTI_EVENT_VM_START, ("Trg VM start event triggered" )); // can now enable some events JvmtiEventController::vm_start(); @@ -496,7 +501,7 @@ void JvmtiExport::post_vm_start() { for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { // Early vmstart envs do not post normal VMStart event if (!env->early_vmstart_env() && env->is_enabled(JVMTI_EVENT_VM_START)) { - EVT_TRACE(JVMTI_EVENT_VM_START, ("JVMTI Evt VM start event sent" )); + EVT_TRACE(JVMTI_EVENT_VM_START, ("Evt VM start event sent" )); JavaThread *thread = JavaThread::current(); JvmtiThreadEventMark jem(thread); @@ -511,7 +516,7 @@ void JvmtiExport::post_vm_start() { void JvmtiExport::post_vm_initialized() { - EVT_TRIG_TRACE(JVMTI_EVENT_VM_INIT, ("JVMTI Trg VM init event triggered" )); + EVT_TRIG_TRACE(JVMTI_EVENT_VM_INIT, ("Trg VM init event triggered" )); // can now enable events JvmtiEventController::vm_init(); @@ -519,7 +524,7 @@ void JvmtiExport::post_vm_initialized() { JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_VM_INIT)) { - EVT_TRACE(JVMTI_EVENT_VM_INIT, ("JVMTI Evt VM init event sent" )); + EVT_TRACE(JVMTI_EVENT_VM_INIT, ("Evt VM init event sent" )); JavaThread *thread = JavaThread::current(); JvmtiThreadEventMark jem(thread); @@ -534,12 +539,12 @@ void JvmtiExport::post_vm_initialized() { void JvmtiExport::post_vm_death() { - EVT_TRIG_TRACE(JVMTI_EVENT_VM_DEATH, ("JVMTI Trg VM death event triggered" )); + EVT_TRIG_TRACE(JVMTI_EVENT_VM_DEATH, ("Trg VM death event triggered" )); JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_VM_DEATH)) { - EVT_TRACE(JVMTI_EVENT_VM_DEATH, ("JVMTI Evt VM death event sent" )); + EVT_TRACE(JVMTI_EVENT_VM_DEATH, ("Evt VM death event sent" )); JavaThread *thread = JavaThread::current(); JvmtiEventMark jem(thread); @@ -632,9 +637,6 @@ class JvmtiClassFileLoadHookPoster : public StackObj { } void post() { -// EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, -// ("JVMTI [%s] class file load hook event triggered", -// JvmtiTrace::safe_get_thread_name(_thread))); post_all_envs(); copy_modified_data(); } @@ -665,16 +667,11 @@ class JvmtiClassFileLoadHookPoster : public StackObj { } void post_to_env(JvmtiEnv* env, bool caching_needed) { - if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { + if (env->phase() == JVMTI_PHASE_PRIMORDIAL && !env->early_class_hook_env()) { return; } unsigned char *new_data = NULL; jint new_len = 0; -// EVT_TRACE(JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, -// ("JVMTI [%s] class file load hook event sent %s data_ptr = %d, data_len = %d", -// JvmtiTrace::safe_get_thread_name(_thread), -// _h_name == NULL ? "NULL" : _h_name->as_utf8(), -// _curr_data, _curr_len )); JvmtiClassFileLoadEventMark jem(_thread, _h_name, _class_loader, _h_protection_domain, _h_class_being_redefined); @@ -840,7 +837,7 @@ void JvmtiExport::post_compiled_method_unload( } JavaThread* thread = JavaThread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_COMPILED_METHOD_UNLOAD, - ("JVMTI [%s] method compile unload event triggered", + ("[%s] method compile unload event triggered", JvmtiTrace::safe_get_thread_name(thread))); // post the event for each environment that has this event enabled. @@ -851,7 +848,7 @@ void JvmtiExport::post_compiled_method_unload( continue; } EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_UNLOAD, - ("JVMTI [%s] class compile method unload event sent jmethodID " PTR_FORMAT, + ("[%s] class compile method unload event sent jmethodID " PTR_FORMAT, JvmtiTrace::safe_get_thread_name(thread), p2i(method))); ResourceMark rm(thread); @@ -879,7 +876,7 @@ void JvmtiExport::post_raw_breakpoint(JavaThread *thread, Method* method, addres if (state == NULL) { return; } - EVT_TRIG_TRACE(JVMTI_EVENT_BREAKPOINT, ("JVMTI [%s] Trg Breakpoint triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_BREAKPOINT, ("[%s] Trg Breakpoint triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { @@ -887,7 +884,7 @@ void JvmtiExport::post_raw_breakpoint(JavaThread *thread, Method* method, addres if (!ets->breakpoint_posted() && ets->is_enabled(JVMTI_EVENT_BREAKPOINT)) { ThreadState old_os_state = thread->osthread()->get_state(); thread->osthread()->set_state(BREAKPOINTED); - EVT_TRACE(JVMTI_EVENT_BREAKPOINT, ("JVMTI [%s] Evt Breakpoint sent %s.%s @ " INTX_FORMAT, + EVT_TRACE(JVMTI_EVENT_BREAKPOINT, ("[%s] Evt Breakpoint sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -965,7 +962,7 @@ void JvmtiExport::at_single_stepping_point(JavaThread *thread, Method* method, a if (state == NULL) { return; } - EVT_TRIG_TRACE(JVMTI_EVENT_SINGLE_STEP, ("JVMTI [%s] Trg Single Step triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_SINGLE_STEP, ("[%s] Trg Single Step triggered", JvmtiTrace::safe_get_thread_name(thread))); if (!state->hide_single_stepping()) { if (state->is_pending_step_for_popframe()) { @@ -1004,7 +1001,7 @@ void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) { HandleMark hm(thread); KlassHandle kh(thread, klass); - EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, ("JVMTI [%s] Trg Class Load triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Trg Class Load triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadState* state = thread->jvmti_thread_state(); if (state == NULL) { @@ -1017,7 +1014,7 @@ void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) { if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } - EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("JVMTI [%s] Evt Class Load sent %s", + EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Evt Class Load sent %s", JvmtiTrace::safe_get_thread_name(thread), kh()==NULL? "NULL" : kh()->external_name() )); JvmtiClassEventMark jem(thread, kh()); @@ -1038,7 +1035,7 @@ void JvmtiExport::post_class_prepare(JavaThread *thread, Klass* klass) { HandleMark hm(thread); KlassHandle kh(thread, klass); - EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("JVMTI [%s] Trg Class Prepare triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("[%s] Trg Class Prepare triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadState* state = thread->jvmti_thread_state(); if (state == NULL) { @@ -1051,7 +1048,7 @@ void JvmtiExport::post_class_prepare(JavaThread *thread, Klass* klass) { if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } - EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("JVMTI [%s] Evt Class Prepare sent %s", + EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("[%s] Evt Class Prepare sent %s", JvmtiTrace::safe_get_thread_name(thread), kh()==NULL? "NULL" : kh()->external_name() )); JvmtiClassEventMark jem(thread, kh()); @@ -1072,7 +1069,7 @@ void JvmtiExport::post_class_unload(Klass* klass) { HandleMark hm(thread); KlassHandle kh(thread, klass); - EVT_TRIG_TRACE(EXT_EVENT_CLASS_UNLOAD, ("JVMTI [?] Trg Class Unload triggered" )); + EVT_TRIG_TRACE(EXT_EVENT_CLASS_UNLOAD, ("[?] Trg Class Unload triggered" )); if (JvmtiEventController::is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) { assert(thread->is_VM_thread(), "wrong thread"); @@ -1086,7 +1083,7 @@ void JvmtiExport::post_class_unload(Klass* klass) { continue; } if (env->is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) { - EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("JVMTI [?] Evt Class Unload sent %s", + EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("[?] Evt Class Unload sent %s", kh()==NULL? "NULL" : kh()->external_name() )); // do everything manually, since this is a proxy - needs special care @@ -1125,7 +1122,7 @@ void JvmtiExport::post_thread_start(JavaThread *thread) { } assert(thread->thread_state() == _thread_in_vm, "must be in vm state"); - EVT_TRIG_TRACE(JVMTI_EVENT_THREAD_START, ("JVMTI [%s] Trg Thread Start event triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_THREAD_START, ("[%s] Trg Thread Start event triggered", JvmtiTrace::safe_get_thread_name(thread))); // do JVMTI thread initialization (if needed) @@ -1140,7 +1137,7 @@ void JvmtiExport::post_thread_start(JavaThread *thread) { continue; } if (env->is_enabled(JVMTI_EVENT_THREAD_START)) { - EVT_TRACE(JVMTI_EVENT_THREAD_START, ("JVMTI [%s] Evt Thread Start event sent", + EVT_TRACE(JVMTI_EVENT_THREAD_START, ("[%s] Evt Thread Start event sent", JvmtiTrace::safe_get_thread_name(thread) )); JvmtiThreadEventMark jem(thread); @@ -1159,7 +1156,7 @@ void JvmtiExport::post_thread_end(JavaThread *thread) { if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) { return; } - EVT_TRIG_TRACE(JVMTI_EVENT_THREAD_END, ("JVMTI [%s] Trg Thread End event triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_THREAD_END, ("[%s] Trg Thread End event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadState *state = thread->jvmti_thread_state(); @@ -1178,7 +1175,7 @@ void JvmtiExport::post_thread_end(JavaThread *thread) { if (env->phase() == JVMTI_PHASE_PRIMORDIAL) { continue; } - EVT_TRACE(JVMTI_EVENT_THREAD_END, ("JVMTI [%s] Evt Thread End event sent", + EVT_TRACE(JVMTI_EVENT_THREAD_END, ("[%s] Evt Thread End event sent", JvmtiTrace::safe_get_thread_name(thread) )); JvmtiThreadEventMark jem(thread); @@ -1196,8 +1193,8 @@ void JvmtiExport::post_object_free(JvmtiEnv* env, jlong tag) { assert(SafepointSynchronize::is_at_safepoint(), "must be executed at safepoint"); assert(env->is_enabled(JVMTI_EVENT_OBJECT_FREE), "checking"); - EVT_TRIG_TRACE(JVMTI_EVENT_OBJECT_FREE, ("JVMTI [?] Trg Object Free triggered" )); - EVT_TRACE(JVMTI_EVENT_OBJECT_FREE, ("JVMTI [?] Evt Object Free sent")); + EVT_TRIG_TRACE(JVMTI_EVENT_OBJECT_FREE, ("[?] Trg Object Free triggered" )); + EVT_TRACE(JVMTI_EVENT_OBJECT_FREE, ("[?] Evt Object Free sent")); jvmtiEventObjectFree callback = env->callbacks()->ObjectFree; if (callback != NULL) { @@ -1206,12 +1203,12 @@ void JvmtiExport::post_object_free(JvmtiEnv* env, jlong tag) { } void JvmtiExport::post_resource_exhausted(jint resource_exhausted_flags, const char* description) { - EVT_TRIG_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("JVMTI Trg resource exhausted event triggered" )); + EVT_TRIG_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("Trg resource exhausted event triggered" )); JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_RESOURCE_EXHAUSTED)) { - EVT_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("JVMTI Evt resource exhausted event sent" )); + EVT_TRACE(JVMTI_EVENT_RESOURCE_EXHAUSTED, ("Evt resource exhausted event sent" )); JavaThread *thread = JavaThread::current(); JvmtiThreadEventMark jem(thread); @@ -1229,7 +1226,7 @@ void JvmtiExport::post_method_entry(JavaThread *thread, Method* method, frame cu HandleMark hm(thread); methodHandle mh(thread, method); - EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_ENTRY, ("JVMTI [%s] Trg Method Entry triggered %s.%s", + EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_ENTRY, ("[%s] Trg Method Entry triggered %s.%s", JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string() )); @@ -1246,7 +1243,7 @@ void JvmtiExport::post_method_entry(JavaThread *thread, Method* method, frame cu JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_METHOD_ENTRY)) { - EVT_TRACE(JVMTI_EVENT_METHOD_ENTRY, ("JVMTI [%s] Evt Method Entry sent %s.%s", + EVT_TRACE(JVMTI_EVENT_METHOD_ENTRY, ("[%s] Evt Method Entry sent %s.%s", JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string() )); @@ -1267,7 +1264,7 @@ void JvmtiExport::post_method_exit(JavaThread *thread, Method* method, frame cur HandleMark hm(thread); methodHandle mh(thread, method); - EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_EXIT, ("JVMTI [%s] Trg Method Exit triggered %s.%s", + EVT_TRIG_TRACE(JVMTI_EVENT_METHOD_EXIT, ("[%s] Trg Method Exit triggered %s.%s", JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string() )); @@ -1303,7 +1300,7 @@ void JvmtiExport::post_method_exit(JavaThread *thread, Method* method, frame cur JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_METHOD_EXIT)) { - EVT_TRACE(JVMTI_EVENT_METHOD_EXIT, ("JVMTI [%s] Evt Method Exit sent %s.%s", + EVT_TRACE(JVMTI_EVENT_METHOD_EXIT, ("[%s] Evt Method Exit sent %s.%s", JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string() )); @@ -1332,7 +1329,7 @@ void JvmtiExport::post_method_exit(JavaThread *thread, Method* method, frame cur // we have a NotifyFramePop entry for this frame. // now check that this env/thread wants this event if (ets->is_enabled(JVMTI_EVENT_FRAME_POP)) { - EVT_TRACE(JVMTI_EVENT_FRAME_POP, ("JVMTI [%s] Evt Frame Pop sent %s.%s", + EVT_TRACE(JVMTI_EVENT_FRAME_POP, ("[%s] Evt Frame Pop sent %s.%s", JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string() )); @@ -1370,7 +1367,7 @@ void JvmtiExport::post_single_step(JavaThread *thread, Method* method, address l for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { ets->compare_and_set_current_location(mh(), location, JVMTI_EVENT_SINGLE_STEP); if (!ets->single_stepping_posted() && ets->is_enabled(JVMTI_EVENT_SINGLE_STEP)) { - EVT_TRACE(JVMTI_EVENT_SINGLE_STEP, ("JVMTI [%s] Evt Single Step sent %s.%s @ " INTX_FORMAT, + EVT_TRACE(JVMTI_EVENT_SINGLE_STEP, ("[%s] Evt Single Step sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1401,7 +1398,7 @@ void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, addre return; } - EVT_TRIG_TRACE(JVMTI_EVENT_EXCEPTION, ("JVMTI [%s] Trg Exception thrown triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_EXCEPTION, ("[%s] Trg Exception thrown triggered", JvmtiTrace::safe_get_thread_name(thread))); if (!state->is_exception_detected()) { state->set_exception_detected(); @@ -1410,7 +1407,7 @@ void JvmtiExport::post_exception_throw(JavaThread *thread, Method* method, addre if (ets->is_enabled(JVMTI_EVENT_EXCEPTION) && (exception != NULL)) { EVT_TRACE(JVMTI_EVENT_EXCEPTION, - ("JVMTI [%s] Evt Exception thrown sent %s.%s @ " INTX_FORMAT, + ("[%s] Evt Exception thrown sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1486,7 +1483,7 @@ void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, Method* met return; } EVT_TRIG_TRACE(JVMTI_EVENT_EXCEPTION_CATCH, - ("JVMTI [%s] Trg unwind_due_to_exception triggered %s.%s @ %s" INTX_FORMAT " - %s", + ("[%s] Trg unwind_due_to_exception triggered %s.%s @ %s" INTX_FORMAT " - %s", JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1521,7 +1518,7 @@ void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, Method* met for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_EXCEPTION_CATCH) && (exception_handle() != NULL)) { EVT_TRACE(JVMTI_EVENT_EXCEPTION_CATCH, - ("JVMTI [%s] Evt ExceptionCatch sent %s.%s @ " INTX_FORMAT, + ("[%s] Evt ExceptionCatch sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1610,12 +1607,12 @@ void JvmtiExport::post_field_access(JavaThread *thread, Method* method, if (state == NULL) { return; } - EVT_TRIG_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("JVMTI [%s] Trg Field Access event triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("[%s] Trg Field Access event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_FIELD_ACCESS)) { - EVT_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("JVMTI [%s] Evt Field Access event sent %s.%s @ " INTX_FORMAT, + EVT_TRACE(JVMTI_EVENT_FIELD_ACCESS, ("[%s] Evt Field Access event sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1772,14 +1769,14 @@ void JvmtiExport::post_field_modification(JavaThread *thread, Method* method, return; } EVT_TRIG_TRACE(JVMTI_EVENT_FIELD_MODIFICATION, - ("JVMTI [%s] Trg Field Modification event triggered", + ("[%s] Trg Field Modification event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_FIELD_MODIFICATION)) { EVT_TRACE(JVMTI_EVENT_FIELD_MODIFICATION, - ("JVMTI [%s] Evt Field Modification event sent %s.%s @ " INTX_FORMAT, + ("[%s] Evt Field Modification event sent %s.%s @ " INTX_FORMAT, JvmtiTrace::safe_get_thread_name(thread), (mh() == NULL) ? "NULL" : mh()->klass_name()->as_C_string(), (mh() == NULL) ? "NULL" : mh()->name()->as_C_string(), @@ -1807,14 +1804,14 @@ void JvmtiExport::post_native_method_bind(Method* method, address* function_ptr) HandleMark hm(thread); methodHandle mh(thread, method); - EVT_TRIG_TRACE(JVMTI_EVENT_NATIVE_METHOD_BIND, ("JVMTI [%s] Trg Native Method Bind event triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_NATIVE_METHOD_BIND, ("[%s] Trg Native Method Bind event triggered", JvmtiTrace::safe_get_thread_name(thread))); if (JvmtiEventController::is_enabled(JVMTI_EVENT_NATIVE_METHOD_BIND)) { JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_NATIVE_METHOD_BIND)) { - EVT_TRACE(JVMTI_EVENT_NATIVE_METHOD_BIND, ("JVMTI [%s] Evt Native Method Bind event sent", + EVT_TRACE(JVMTI_EVENT_NATIVE_METHOD_BIND, ("[%s] Evt Native Method Bind event sent", JvmtiTrace::safe_get_thread_name(thread) )); JvmtiMethodEventMark jem(thread, mh); @@ -1878,7 +1875,7 @@ void JvmtiExport::post_compiled_method_load(nmethod *nm) { JavaThread* thread = JavaThread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, - ("JVMTI [%s] method compile load event triggered", + ("[%s] method compile load event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvIterator it; @@ -1888,7 +1885,7 @@ void JvmtiExport::post_compiled_method_load(nmethod *nm) { continue; } EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, - ("JVMTI [%s] class compile method load event sent %s.%s ", + ("[%s] class compile method load event sent %s.%s ", JvmtiTrace::safe_get_thread_name(thread), (nm->method() == NULL) ? "NULL" : nm->method()->klass_name()->as_C_string(), (nm->method() == NULL) ? "NULL" : nm->method()->name()->as_C_string())); @@ -1921,12 +1918,12 @@ void JvmtiExport::post_compiled_method_load(JvmtiEnv* env, const jmethodID metho } JavaThread* thread = JavaThread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, - ("JVMTI [%s] method compile load event triggered (by GenerateEvents)", + ("[%s] method compile load event triggered (by GenerateEvents)", JvmtiTrace::safe_get_thread_name(thread))); if (env->is_enabled(JVMTI_EVENT_COMPILED_METHOD_LOAD)) { EVT_TRACE(JVMTI_EVENT_COMPILED_METHOD_LOAD, - ("JVMTI [%s] class compile method load event sent (by GenerateEvents), jmethodID=" PTR_FORMAT, + ("[%s] class compile method load event sent (by GenerateEvents), jmethodID=" PTR_FORMAT, JvmtiTrace::safe_get_thread_name(thread), p2i(method))); JvmtiEventMark jem(thread); @@ -1949,13 +1946,13 @@ void JvmtiExport::post_dynamic_code_generated_internal(const char *name, const v ThreadInVMfromUnknown __tiv; EVT_TRIG_TRACE(JVMTI_EVENT_DYNAMIC_CODE_GENERATED, - ("JVMTI [%s] method dynamic code generated event triggered", + ("[%s] method dynamic code generated event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) { EVT_TRACE(JVMTI_EVENT_DYNAMIC_CODE_GENERATED, - ("JVMTI [%s] dynamic code generated event sent for %s", + ("[%s] dynamic code generated event sent for %s", JvmtiTrace::safe_get_thread_name(thread), name)); JvmtiEventMark jem(thread); JvmtiJavaThreadEventTransition jet(thread); @@ -1991,11 +1988,11 @@ void JvmtiExport::post_dynamic_code_generated(JvmtiEnv* env, const char *name, { JavaThread* thread = JavaThread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_DYNAMIC_CODE_GENERATED, - ("JVMTI [%s] dynamic code generated event triggered (by GenerateEvents)", + ("[%s] dynamic code generated event triggered (by GenerateEvents)", JvmtiTrace::safe_get_thread_name(thread))); if (env->is_enabled(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)) { EVT_TRACE(JVMTI_EVENT_DYNAMIC_CODE_GENERATED, - ("JVMTI [%s] dynamic code generated event sent for %s", + ("[%s] dynamic code generated event sent for %s", JvmtiTrace::safe_get_thread_name(thread), name)); JvmtiEventMark jem(thread); JvmtiJavaThreadEventTransition jet(thread); @@ -2048,13 +2045,13 @@ void JvmtiExport::record_vm_internal_object_allocation(oop obj) { void JvmtiExport::post_garbage_collection_finish() { Thread *thread = Thread::current(); // this event is posted from VM-Thread. EVT_TRIG_TRACE(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, - ("JVMTI [%s] garbage collection finish event triggered", + ("[%s] garbage collection finish event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)) { EVT_TRACE(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, - ("JVMTI [%s] garbage collection finish event sent ", + ("[%s] garbage collection finish event sent", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadEventTransition jet(thread); // JNIEnv is NULL here because this event is posted from VM Thread @@ -2069,13 +2066,13 @@ void JvmtiExport::post_garbage_collection_finish() { void JvmtiExport::post_garbage_collection_start() { Thread* thread = Thread::current(); // this event is posted from vm-thread. EVT_TRIG_TRACE(JVMTI_EVENT_GARBAGE_COLLECTION_START, - ("JVMTI [%s] garbage collection start event triggered", + ("[%s] garbage collection start event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_GARBAGE_COLLECTION_START)) { EVT_TRACE(JVMTI_EVENT_GARBAGE_COLLECTION_START, - ("JVMTI [%s] garbage collection start event sent ", + ("[%s] garbage collection start event sent", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadEventTransition jet(thread); // JNIEnv is NULL here because this event is posted from VM Thread @@ -2090,13 +2087,13 @@ void JvmtiExport::post_garbage_collection_start() { void JvmtiExport::post_data_dump() { Thread *thread = Thread::current(); EVT_TRIG_TRACE(JVMTI_EVENT_DATA_DUMP_REQUEST, - ("JVMTI [%s] data dump request event triggered", + ("[%s] data dump request event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_DATA_DUMP_REQUEST)) { EVT_TRACE(JVMTI_EVENT_DATA_DUMP_REQUEST, - ("JVMTI [%s] data dump request event sent ", + ("[%s] data dump request event sent", JvmtiTrace::safe_get_thread_name(thread))); JvmtiThreadEventTransition jet(thread); // JNIEnv is NULL here because this event is posted from VM Thread @@ -2123,14 +2120,14 @@ void JvmtiExport::post_monitor_contended_enter(JavaThread *thread, ObjectMonitor Handle h(thread, object); EVT_TRIG_TRACE(JVMTI_EVENT_MONITOR_CONTENDED_ENTER, - ("JVMTI [%s] montior contended enter event triggered", + ("[%s] montior contended enter event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_MONITOR_CONTENDED_ENTER)) { EVT_TRACE(JVMTI_EVENT_MONITOR_CONTENDED_ENTER, - ("JVMTI [%s] monitor contended enter event sent", + ("[%s] monitor contended enter event sent", JvmtiTrace::safe_get_thread_name(thread))); JvmtiMonitorEventMark jem(thread, h()); JvmtiEnv *env = ets->get_env(); @@ -2158,14 +2155,14 @@ void JvmtiExport::post_monitor_contended_entered(JavaThread *thread, ObjectMonit Handle h(thread, object); EVT_TRIG_TRACE(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, - ("JVMTI [%s] montior contended entered event triggered", + ("[%s] montior contended entered event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED)) { EVT_TRACE(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, - ("JVMTI [%s] monitor contended enter event sent", + ("[%s] monitor contended enter event sent", JvmtiTrace::safe_get_thread_name(thread))); JvmtiMonitorEventMark jem(thread, h()); JvmtiEnv *env = ets->get_env(); @@ -2189,14 +2186,14 @@ void JvmtiExport::post_monitor_wait(JavaThread *thread, oop object, Handle h(thread, object); EVT_TRIG_TRACE(JVMTI_EVENT_MONITOR_WAIT, - ("JVMTI [%s] montior wait event triggered", + ("[%s] montior wait event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_MONITOR_WAIT)) { EVT_TRACE(JVMTI_EVENT_MONITOR_WAIT, - ("JVMTI [%s] monitor wait event sent ", + ("[%s] monitor wait event sent", JvmtiTrace::safe_get_thread_name(thread))); JvmtiMonitorEventMark jem(thread, h()); JvmtiEnv *env = ets->get_env(); @@ -2225,14 +2222,14 @@ void JvmtiExport::post_monitor_waited(JavaThread *thread, ObjectMonitor *obj_mnt Handle h(thread, object); EVT_TRIG_TRACE(JVMTI_EVENT_MONITOR_WAITED, - ("JVMTI [%s] montior waited event triggered", + ("[%s] montior waited event triggered", JvmtiTrace::safe_get_thread_name(thread))); JvmtiEnvThreadStateIterator it(state); for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) { if (ets->is_enabled(JVMTI_EVENT_MONITOR_WAITED)) { EVT_TRACE(JVMTI_EVENT_MONITOR_WAITED, - ("JVMTI [%s] monitor waited event sent ", + ("[%s] monitor waited event sent", JvmtiTrace::safe_get_thread_name(thread))); JvmtiMonitorEventMark jem(thread, h()); JvmtiEnv *env = ets->get_env(); @@ -2248,7 +2245,7 @@ void JvmtiExport::post_monitor_waited(JavaThread *thread, ObjectMonitor *obj_mnt void JvmtiExport::post_vm_object_alloc(JavaThread *thread, oop object) { - EVT_TRIG_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("JVMTI [%s] Trg vm object alloc triggered", + EVT_TRIG_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("[%s] Trg vm object alloc triggered", JvmtiTrace::safe_get_thread_name(thread))); if (object == NULL) { return; @@ -2258,7 +2255,7 @@ void JvmtiExport::post_vm_object_alloc(JavaThread *thread, oop object) { JvmtiEnvIterator it; for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) { if (env->is_enabled(JVMTI_EVENT_VM_OBJECT_ALLOC)) { - EVT_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("JVMTI [%s] Evt vmobject alloc sent %s", + EVT_TRACE(JVMTI_EVENT_VM_OBJECT_ALLOC, ("[%s] Evt vmobject alloc sent %s", JvmtiTrace::safe_get_thread_name(thread), object==NULL? "NULL" : object->klass()->external_name())); diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.cpp b/hotspot/src/share/vm/prims/jvmtiImpl.cpp index 986517d34df..398f5720b13 100644 --- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp +++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp @@ -27,6 +27,8 @@ #include "interpreter/interpreter.hpp" #include "interpreter/oopMapCache.hpp" #include "jvmtifiles/jvmtiEnv.hpp" +#include "logging/log.hpp" +#include "logging/logStream.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.inline.hpp" @@ -276,7 +278,7 @@ bool JvmtiBreakpoint::is_valid() { _bci >= 0; } -address JvmtiBreakpoint::getBcp() { +address JvmtiBreakpoint::getBcp() const { return _method->bcp_from(_bci); } @@ -301,11 +303,10 @@ void JvmtiBreakpoint::each_method_version_do(method_action meth_act) { if (method->is_running_emcp() && method->name() == m_name && method->signature() == m_signature) { - RC_TRACE(0x00000800, ("%sing breakpoint in %s(%s)", - meth_act == &Method::set_breakpoint ? "sett" : "clear", - method->name()->as_C_string(), - method->signature()->as_C_string())); - + ResourceMark rm; + log_debug(redefine, class, breakpoint) + ("%sing breakpoint in %s(%s)", meth_act == &Method::set_breakpoint ? "sett" : "clear", + method->name()->as_C_string(), method->signature()->as_C_string()); (method->*meth_act)(_bci); break; } @@ -321,12 +322,12 @@ void JvmtiBreakpoint::clear() { each_method_version_do(&Method::clear_breakpoint); } -void JvmtiBreakpoint::print() { +void JvmtiBreakpoint::print_on(outputStream* out) const { #ifndef PRODUCT + ResourceMark rm; const char *class_name = (_method == NULL) ? "NULL" : _method->klass_name()->as_C_string(); const char *method_name = (_method == NULL) ? "NULL" : _method->name()->as_C_string(); - - tty->print("Breakpoint(%s,%s,%d,%p)",class_name, method_name, _bci, getBcp()); + out->print("Breakpoint(%s,%s,%d,%p)", class_name, method_name, _bci, getBcp()); #endif } @@ -389,16 +390,17 @@ void JvmtiBreakpoints::gc_epilogue() { _bps.gc_epilogue(); } -void JvmtiBreakpoints::print() { +void JvmtiBreakpoints::print() { #ifndef PRODUCT - ResourceMark rm; + LogTarget(Trace, jvmti) log; + LogStreamCHeap log_stream(log); int n = _bps.length(); for (int i=0; iprint("%d: ", i); - bp.print(); - tty->cr(); + log_stream.print("%d: ", i); + bp.print_on(&log_stream); + log_stream.cr(); } #endif } @@ -875,22 +877,21 @@ bool JvmtiSuspendControl::resume(JavaThread *java_thread) { void JvmtiSuspendControl::print() { #ifndef PRODUCT MutexLocker mu(Threads_lock); - ResourceMark rm; - - tty->print("Suspended Threads: ["); + LogStreamHandle(Trace, jvmti) log_stream; + log_stream.print("Suspended Threads: ["); for (JavaThread *thread = Threads::first(); thread != NULL; thread = thread->next()) { #ifdef JVMTI_TRACE const char *name = JvmtiTrace::safe_get_thread_name(thread); #else const char *name = ""; #endif /*JVMTI_TRACE */ - tty->print("%s(%c ", name, thread->is_being_ext_suspended() ? 'S' : '_'); + log_stream.print("%s(%c ", name, thread->is_being_ext_suspended() ? 'S' : '_'); if (!thread->has_last_Java_frame()) { - tty->print("no stack"); + log_stream.print("no stack"); } - tty->print(") "); + log_stream.print(") "); } - tty->print_cr("]"); + log_stream.print_cr("]"); #endif } diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.hpp b/hotspot/src/share/vm/prims/jvmtiImpl.hpp index c1e4b81b66e..ebb20273a1c 100644 --- a/hotspot/src/share/vm/prims/jvmtiImpl.hpp +++ b/hotspot/src/share/vm/prims/jvmtiImpl.hpp @@ -34,6 +34,7 @@ #include "prims/jvmtiUtil.hpp" #include "runtime/stackValueCollection.hpp" #include "runtime/vm_operations.hpp" +#include "utilities/ostream.hpp" // // Forward Declarations @@ -182,11 +183,11 @@ public: bool lessThan(JvmtiBreakpoint &bp); void copy(JvmtiBreakpoint& bp); bool is_valid(); - address getBcp(); + address getBcp() const; void each_method_version_do(method_action meth_act); void set(); void clear(); - void print(); + void print_on(outputStream* out) const; Method* method() { return _method; } diff --git a/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp b/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp index a9ce01c93d1..e0c3cb5c34b 100644 --- a/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp +++ b/hotspot/src/share/vm/prims/jvmtiManageCapabilities.cpp @@ -24,8 +24,10 @@ #include "precompiled.hpp" #include "jvmtifiles/jvmtiEnv.hpp" +#include "logging/log.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiManageCapabilities.hpp" + static const jint CAPA_SIZE = (JVMTI_INTERNAL_CAPABILITY_COUNT + 7) / 8; // capabilities which are always potentially available @@ -134,6 +136,7 @@ jvmtiCapabilities JvmtiManageCapabilities::init_onload_capabilities() { jc.can_get_owned_monitor_stack_depth_info = 1; jc.can_get_current_contended_monitor = 1; jc.can_generate_early_vmstart = 1; + jc.can_generate_early_class_hook_events = 1; return jc; } @@ -373,87 +376,89 @@ void JvmtiManageCapabilities::update() { #ifndef PRODUCT void JvmtiManageCapabilities:: print(const jvmtiCapabilities* cap) { - tty->print_cr("----- capabilities -----"); + log_trace(jvmti)("----- capabilities -----"); if (cap->can_tag_objects) - tty->print_cr("can_tag_objects"); + log_trace(jvmti)("can_tag_objects"); if (cap->can_generate_field_modification_events) - tty->print_cr("can_generate_field_modification_events"); + log_trace(jvmti)("can_generate_field_modification_events"); if (cap->can_generate_field_access_events) - tty->print_cr("can_generate_field_access_events"); + log_trace(jvmti)("can_generate_field_access_events"); if (cap->can_get_bytecodes) - tty->print_cr("can_get_bytecodes"); + log_trace(jvmti)("can_get_bytecodes"); if (cap->can_get_synthetic_attribute) - tty->print_cr("can_get_synthetic_attribute"); + log_trace(jvmti)("can_get_synthetic_attribute"); if (cap->can_get_owned_monitor_info) - tty->print_cr("can_get_owned_monitor_info"); + log_trace(jvmti)("can_get_owned_monitor_info"); if (cap->can_get_current_contended_monitor) - tty->print_cr("can_get_current_contended_monitor"); + log_trace(jvmti)("can_get_current_contended_monitor"); if (cap->can_get_monitor_info) - tty->print_cr("can_get_monitor_info"); + log_trace(jvmti)("can_get_monitor_info"); if (cap->can_get_constant_pool) - tty->print_cr("can_get_constant_pool"); + log_trace(jvmti)("can_get_constant_pool"); if (cap->can_pop_frame) - tty->print_cr("can_pop_frame"); + log_trace(jvmti)("can_pop_frame"); if (cap->can_force_early_return) - tty->print_cr("can_force_early_return"); + log_trace(jvmti)("can_force_early_return"); if (cap->can_redefine_classes) - tty->print_cr("can_redefine_classes"); + log_trace(jvmti)("can_redefine_classes"); if (cap->can_retransform_classes) - tty->print_cr("can_retransform_classes"); + log_trace(jvmti)("can_retransform_classes"); if (cap->can_signal_thread) - tty->print_cr("can_signal_thread"); + log_trace(jvmti)("can_signal_thread"); if (cap->can_get_source_file_name) - tty->print_cr("can_get_source_file_name"); + log_trace(jvmti)("can_get_source_file_name"); if (cap->can_get_line_numbers) - tty->print_cr("can_get_line_numbers"); + log_trace(jvmti)("can_get_line_numbers"); if (cap->can_get_source_debug_extension) - tty->print_cr("can_get_source_debug_extension"); + log_trace(jvmti)("can_get_source_debug_extension"); if (cap->can_access_local_variables) - tty->print_cr("can_access_local_variables"); + log_trace(jvmti)("can_access_local_variables"); if (cap->can_maintain_original_method_order) - tty->print_cr("can_maintain_original_method_order"); + log_trace(jvmti)("can_maintain_original_method_order"); if (cap->can_generate_single_step_events) - tty->print_cr("can_generate_single_step_events"); + log_trace(jvmti)("can_generate_single_step_events"); if (cap->can_generate_exception_events) - tty->print_cr("can_generate_exception_events"); + log_trace(jvmti)("can_generate_exception_events"); if (cap->can_generate_frame_pop_events) - tty->print_cr("can_generate_frame_pop_events"); + log_trace(jvmti)("can_generate_frame_pop_events"); if (cap->can_generate_breakpoint_events) - tty->print_cr("can_generate_breakpoint_events"); + log_trace(jvmti)("can_generate_breakpoint_events"); if (cap->can_suspend) - tty->print_cr("can_suspend"); + log_trace(jvmti)("can_suspend"); if (cap->can_redefine_any_class ) - tty->print_cr("can_redefine_any_class"); + log_trace(jvmti)("can_redefine_any_class"); if (cap->can_retransform_any_class ) - tty->print_cr("can_retransform_any_class"); + log_trace(jvmti)("can_retransform_any_class"); if (cap->can_get_current_thread_cpu_time) - tty->print_cr("can_get_current_thread_cpu_time"); + log_trace(jvmti)("can_get_current_thread_cpu_time"); if (cap->can_get_thread_cpu_time) - tty->print_cr("can_get_thread_cpu_time"); + log_trace(jvmti)("can_get_thread_cpu_time"); if (cap->can_generate_method_entry_events) - tty->print_cr("can_generate_method_entry_events"); + log_trace(jvmti)("can_generate_method_entry_events"); if (cap->can_generate_method_exit_events) - tty->print_cr("can_generate_method_exit_events"); + log_trace(jvmti)("can_generate_method_exit_events"); if (cap->can_generate_all_class_hook_events) - tty->print_cr("can_generate_all_class_hook_events"); + log_trace(jvmti)("can_generate_all_class_hook_events"); if (cap->can_generate_compiled_method_load_events) - tty->print_cr("can_generate_compiled_method_load_events"); + log_trace(jvmti)("can_generate_compiled_method_load_events"); if (cap->can_generate_monitor_events) - tty->print_cr("can_generate_monitor_events"); + log_trace(jvmti)("can_generate_monitor_events"); if (cap->can_generate_vm_object_alloc_events) - tty->print_cr("can_generate_vm_object_alloc_events"); + log_trace(jvmti)("can_generate_vm_object_alloc_events"); if (cap->can_generate_native_method_bind_events) - tty->print_cr("can_generate_native_method_bind_events"); + log_trace(jvmti)("can_generate_native_method_bind_events"); if (cap->can_generate_garbage_collection_events) - tty->print_cr("can_generate_garbage_collection_events"); + log_trace(jvmti)("can_generate_garbage_collection_events"); if (cap->can_generate_object_free_events) - tty->print_cr("can_generate_object_free_events"); + log_trace(jvmti)("can_generate_object_free_events"); if (cap->can_generate_resource_exhaustion_heap_events) - tty->print_cr("can_generate_resource_exhaustion_heap_events"); + log_trace(jvmti)("can_generate_resource_exhaustion_heap_events"); if (cap->can_generate_resource_exhaustion_threads_events) - tty->print_cr("can_generate_resource_exhaustion_threads_events"); + log_trace(jvmti)("can_generate_resource_exhaustion_threads_events"); if (cap->can_generate_early_vmstart) - tty->print_cr("can_generate_early_vmstart"); + log_trace(jvmti)("can_generate_early_vmstart"); + if (cap->can_generate_early_class_hook_events) + log_trace(jvmti)("can_generate_early_class_hook_events"); } #endif diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp index c6737e73617..f173e570dce 100644 --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp @@ -32,6 +32,7 @@ #include "gc/shared/gcLocker.hpp" #include "interpreter/oopMapCache.hpp" #include "interpreter/rewriter.hpp" +#include "logging/logStream.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceShared.hpp" #include "memory/resourceArea.hpp" @@ -68,6 +69,43 @@ VM_RedefineClasses::VM_RedefineClasses(jint class_count, _res = JVMTI_ERROR_NONE; } +static inline InstanceKlass* get_ik(jclass def) { + oop mirror = JNIHandles::resolve_non_null(def); + return InstanceKlass::cast(java_lang_Class::as_Klass(mirror)); +} + +// If any of the classes are being redefined, wait +// Parallel constant pool merging leads to indeterminate constant pools. +void VM_RedefineClasses::lock_classes() { + MutexLocker ml(RedefineClasses_lock); + bool has_redefined; + do { + has_redefined = false; + // Go through classes each time until none are being redefined. + for (int i = 0; i < _class_count; i++) { + if (get_ik(_class_defs[i].klass)->is_being_redefined()) { + RedefineClasses_lock->wait(); + has_redefined = true; + break; // for loop + } + } + } while (has_redefined); + for (int i = 0; i < _class_count; i++) { + get_ik(_class_defs[i].klass)->set_is_being_redefined(true); + } + RedefineClasses_lock->notify_all(); +} + +void VM_RedefineClasses::unlock_classes() { + MutexLocker ml(RedefineClasses_lock); + for (int i = 0; i < _class_count; i++) { + assert(get_ik(_class_defs[i].klass)->is_being_redefined(), + "should be being redefined to get here"); + get_ik(_class_defs[i].klass)->set_is_being_redefined(false); + } + RedefineClasses_lock->notify_all(); +} + bool VM_RedefineClasses::doit_prologue() { if (_class_count == 0) { _res = JVMTI_ERROR_NONE; @@ -90,12 +128,23 @@ bool VM_RedefineClasses::doit_prologue() { _res = JVMTI_ERROR_NULL_POINTER; return false; } + + oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass); + // classes for primitives and arrays cannot be redefined + // check here so following code can assume these classes are InstanceKlass + if (!is_modifiable_class(mirror)) { + _res = JVMTI_ERROR_UNMODIFIABLE_CLASS; + return false; + } } // Start timer after all the sanity checks; not quite accurate, but // better than adding a bunch of stop() calls. - RC_TIMER_START(_timer_vm_op_prologue); + if (log_is_enabled(Info, redefine, class, timer)) { + _timer_vm_op_prologue.start(); + } + lock_classes(); // We first load new class versions in the prologue, because somewhere down the // call chain it is required that the current thread is a Java thread. _res = load_new_class_versions(Thread::current()); @@ -111,11 +160,12 @@ bool VM_RedefineClasses::doit_prologue() { } // Free os::malloc allocated memory in load_new_class_version. os::free(_scratch_classes); - RC_TIMER_STOP(_timer_vm_op_prologue); + _timer_vm_op_prologue.stop(); + unlock_classes(); return false; } - RC_TIMER_STOP(_timer_vm_op_prologue); + _timer_vm_op_prologue.stop(); return true; } @@ -128,8 +178,7 @@ void VM_RedefineClasses::doit() { // a shared class. We do the remap during the doit() phase of // the safepoint to be safer. if (!MetaspaceShared::remap_shared_readonly_as_readwrite()) { - RC_TRACE_WITH_THREAD(0x00000001, thread, - ("failed to remap shared readonly space to readwrite, private")); + log_info(redefine, class, load)("failed to remap shared readonly space to readwrite, private"); _res = JVMTI_ERROR_INTERNAL; return; } @@ -161,9 +210,9 @@ void VM_RedefineClasses::doit() { // check_class() is optionally called for product bits, but is // always called for non-product bits. #ifdef PRODUCT - if (RC_TRACE_ENABLED(0x00004000)) { + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { #endif - RC_TRACE_WITH_THREAD(0x00004000, thread, ("calling check_class")); + log_trace(redefine, class, obsolete, metadata)("calling check_class"); CheckClass check_class(thread); ClassLoaderDataGraph::classes_do(&check_class); #ifdef PRODUCT @@ -172,25 +221,27 @@ void VM_RedefineClasses::doit() { } void VM_RedefineClasses::doit_epilogue() { + unlock_classes(); + // Free os::malloc allocated memory. os::free(_scratch_classes); // Reset the_class_oop to null for error printing. _the_class_oop = NULL; - if (RC_TRACE_ENABLED(0x00000004)) { + if (log_is_enabled(Info, redefine, class, timer)) { // Used to have separate timers for "doit" and "all", but the timer // overhead skewed the measurements. jlong doit_time = _timer_rsc_phase1.milliseconds() + _timer_rsc_phase2.milliseconds(); jlong all_time = _timer_vm_op_prologue.milliseconds() + doit_time; - RC_TRACE(0x00000004, ("vm_op: all=" UINT64_FORMAT - " prologue=" UINT64_FORMAT " doit=" UINT64_FORMAT, all_time, - _timer_vm_op_prologue.milliseconds(), doit_time)); - RC_TRACE(0x00000004, + log_info(redefine, class, timer) + ("vm_op: all=" UINT64_FORMAT " prologue=" UINT64_FORMAT " doit=" UINT64_FORMAT, + all_time, _timer_vm_op_prologue.milliseconds(), doit_time); + log_info(redefine, class, timer) ("redefine_single_class: phase1=" UINT64_FORMAT " phase2=" UINT64_FORMAT, - _timer_rsc_phase1.milliseconds(), _timer_rsc_phase2.milliseconds())); + _timer_rsc_phase1.milliseconds(), _timer_rsc_phase2.milliseconds()); } } @@ -305,14 +356,14 @@ void VM_RedefineClasses::append_entry(const constantPoolHandle& scratch_cp, // both new_name_ref_i and new_signature_ref_i will both be 0. // In that case, all we are appending is the current entry. if (new_name_ref_i != name_ref_i) { - RC_TRACE(0x00080000, + log_trace(redefine, class, constantpool) ("NameAndType entry@%d name_ref_index change: %d to %d", - *merge_cp_length_p, name_ref_i, new_name_ref_i)); + *merge_cp_length_p, name_ref_i, new_name_ref_i); } if (new_signature_ref_i != signature_ref_i) { - RC_TRACE(0x00080000, + log_trace(redefine, class, constantpool) ("NameAndType entry@%d signature_ref_index change: %d to %d", - *merge_cp_length_p, signature_ref_i, new_signature_ref_i)); + *merge_cp_length_p, signature_ref_i, new_signature_ref_i); } (*merge_cp_p)->name_and_type_at_put(*merge_cp_length_p, @@ -361,14 +412,13 @@ void VM_RedefineClasses::append_entry(const constantPoolHandle& scratch_cp, } if (klass_ref_i != new_klass_ref_i) { - RC_TRACE(0x00080000, ("%s entry@%d class_index changed: %d to %d", - entry_name, *merge_cp_length_p, klass_ref_i, new_klass_ref_i)); + log_trace(redefine, class, constantpool) + ("%s entry@%d class_index changed: %d to %d", entry_name, *merge_cp_length_p, klass_ref_i, new_klass_ref_i); } if (name_and_type_ref_i != new_name_and_type_ref_i) { - RC_TRACE(0x00080000, + log_trace(redefine, class, constantpool) ("%s entry@%d name_and_type_index changed: %d to %d", - entry_name, *merge_cp_length_p, name_and_type_ref_i, - new_name_and_type_ref_i)); + entry_name, *merge_cp_length_p, name_and_type_ref_i, new_name_and_type_ref_i); } if (scratch_i != *merge_cp_length_p) { @@ -386,9 +436,8 @@ void VM_RedefineClasses::append_entry(const constantPoolHandle& scratch_cp, int new_ref_i = find_or_append_indirect_entry(scratch_cp, ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_ref_i != ref_i) { - RC_TRACE(0x00080000, - ("MethodType entry@%d ref_index change: %d to %d", - *merge_cp_length_p, ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("MethodType entry@%d ref_index change: %d to %d", *merge_cp_length_p, ref_i, new_ref_i); } (*merge_cp_p)->method_type_index_at_put(*merge_cp_length_p, new_ref_i); if (scratch_i != *merge_cp_length_p) { @@ -407,9 +456,8 @@ void VM_RedefineClasses::append_entry(const constantPoolHandle& scratch_cp, int new_ref_i = find_or_append_indirect_entry(scratch_cp, ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_ref_i != ref_i) { - RC_TRACE(0x00080000, - ("MethodHandle entry@%d ref_index change: %d to %d", - *merge_cp_length_p, ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("MethodHandle entry@%d ref_index change: %d to %d", *merge_cp_length_p, ref_i, new_ref_i); } (*merge_cp_p)->method_handle_index_at_put(*merge_cp_length_p, ref_kind, new_ref_i); if (scratch_i != *merge_cp_length_p) { @@ -432,14 +480,13 @@ void VM_RedefineClasses::append_entry(const constantPoolHandle& scratch_cp, int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_bs_i != old_bs_i) { - RC_TRACE(0x00080000, - ("InvokeDynamic entry@%d bootstrap_method_attr_index change: %d to %d", - *merge_cp_length_p, old_bs_i, new_bs_i)); + log_trace(redefine, class, constantpool) + ("InvokeDynamic entry@%d bootstrap_method_attr_index change: %d to %d", + *merge_cp_length_p, old_bs_i, new_bs_i); } if (new_ref_i != old_ref_i) { - RC_TRACE(0x00080000, - ("InvokeDynamic entry@%d name_and_type_index change: %d to %d", - *merge_cp_length_p, old_ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("InvokeDynamic entry@%d name_and_type_index change: %d to %d", *merge_cp_length_p, old_ref_i, new_ref_i); } (*merge_cp_p)->invoke_dynamic_at_put(*merge_cp_length_p, new_bs_i, new_ref_i); @@ -516,9 +563,8 @@ void VM_RedefineClasses::append_operand(const constantPoolHandle& scratch_cp, in int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p, merge_cp_length_p, THREAD); if (new_ref_i != old_ref_i) { - RC_TRACE(0x00080000, - ("operands entry@%d bootstrap method ref_index change: %d to %d", - _operands_cur_length, old_ref_i, new_ref_i)); + log_trace(redefine, class, constantpool) + ("operands entry@%d bootstrap method ref_index change: %d to %d", _operands_cur_length, old_ref_i, new_ref_i); } Array* merge_ops = (*merge_cp_p)->operands(); @@ -539,9 +585,9 @@ void VM_RedefineClasses::append_operand(const constantPoolHandle& scratch_cp, in merge_cp_length_p, THREAD); merge_ops->at_put(new_base++, new_arg_ref_i); if (new_arg_ref_i != old_arg_ref_i) { - RC_TRACE(0x00080000, - ("operands entry@%d bootstrap method argument ref_index change: %d to %d", - _operands_cur_length, old_arg_ref_i, new_arg_ref_i)); + log_trace(redefine, class, constantpool) + ("operands entry@%d bootstrap method argument ref_index change: %d to %d", + _operands_cur_length, old_arg_ref_i, new_arg_ref_i); } } if (old_bs_i != _operands_cur_length) { @@ -586,14 +632,13 @@ void VM_RedefineClasses::finalize_operands_merge(const constantPoolHandle& merge // Shrink the merge_cp operands merge_cp->shrink_operands(_operands_cur_length, CHECK); - if (RC_TRACE_ENABLED(0x00040000)) { + if (log_is_enabled(Trace, redefine, class, constantpool)) { // don't want to loop unless we are tracing int count = 0; for (int i = 1; i < _operands_index_map_p->length(); i++) { int value = _operands_index_map_p->at(i); if (value != -1) { - RC_TRACE_WITH_THREAD(0x00040000, THREAD, - ("operands_index_map[%d]: old=%d new=%d", count, i, value)); + log_trace(redefine, class, constantpool)("operands_index_map[%d]: old=%d new=%d", count, i, value); count++; } } @@ -795,9 +840,9 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions( } } } - RC_TRACE(0x00008000, ("Method matched: new: %s [%d] == old: %s [%d]", - k_new_method->name_and_sig_as_C_string(), ni, - k_old_method->name_and_sig_as_C_string(), oi)); + log_trace(redefine, class, normalize) + ("Method matched: new: %s [%d] == old: %s [%d]", + k_new_method->name_and_sig_as_C_string(), ni, k_old_method->name_and_sig_as_C_string(), oi); // advance to next pair of methods ++oi; ++ni; @@ -832,8 +877,8 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions( return JVMTI_ERROR_OUT_OF_MEMORY; } } - RC_TRACE(0x00008000, ("Method added: new: %s [%d]", - k_new_method->name_and_sig_as_C_string(), ni)); + log_trace(redefine, class, normalize) + ("Method added: new: %s [%d]", k_new_method->name_and_sig_as_C_string(), ni); ++ni; // advance to next new method break; case deleted: @@ -846,8 +891,8 @@ jvmtiError VM_RedefineClasses::compare_and_normalize_class_versions( // deleted methods must be private return JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED; } - RC_TRACE(0x00008000, ("Method deleted: old: %s [%d]", - k_old_method->name_and_sig_as_C_string(), oi)); + log_trace(redefine, class, normalize) + ("Method deleted: old: %s [%d]", k_old_method->name_and_sig_as_C_string(), oi); ++oi; // advance to next old method break; default: @@ -963,21 +1008,12 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { // versions are deleted. Constant pools are deallocated while merging // constant pools HandleMark hm(THREAD); - - oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass); - // classes for primitives cannot be redefined - if (!is_modifiable_class(mirror)) { - return JVMTI_ERROR_UNMODIFIABLE_CLASS; - } - Klass* the_class_oop = java_lang_Class::as_Klass(mirror); - instanceKlassHandle the_class = instanceKlassHandle(THREAD, the_class_oop); + instanceKlassHandle the_class(THREAD, get_ik(_class_defs[i].klass)); Symbol* the_class_sym = the_class->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000001, THREAD, + log_debug(redefine, class, load) ("loading name=%s kind=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), _class_load_kind, - os::available_memory() >> 10)); + the_class->external_name(), _class_load_kind, os::available_memory() >> 10); ClassFileStream st((u1*)_class_defs[i].class_bytes, _class_defs[i].class_byte_count, @@ -1011,9 +1047,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, ("parse_stream exception: '%s'", - ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("parse_stream exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_UnsupportedClassVersionError()) { @@ -1037,9 +1071,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { the_class->link_class(THREAD); if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, ("link_class exception: '%s'", - ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("link_class exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1075,9 +1107,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("verify_byte_codes exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("verify_byte_codes exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1090,9 +1120,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { res = merge_cp_and_rewrite(the_class, scratch_class, THREAD); if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("merge_cp_and_rewrite exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("merge_cp_and_rewrite exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1110,10 +1138,8 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("verify_byte_codes post merge-CP exception: '%s'", - ex_name->as_C_string())); + log_info(redefine, class, load, exceptions) + ("verify_byte_codes post merge-CP exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1130,9 +1156,8 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { } if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("Rewriter::rewrite or link_methods exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions) + ("Rewriter::rewrite or link_methods exception: '%s'", ex_name->as_C_string()); CLEAR_PENDING_EXCEPTION; if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) { return JVMTI_ERROR_OUT_OF_MEMORY; @@ -1141,10 +1166,8 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { } } - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000001, THREAD, - ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), os::available_memory() >> 10)); + log_debug(redefine, class, load) + ("loaded name=%s (avail_mem=" UINT64_FORMAT "K)", the_class->external_name(), os::available_memory() >> 10); } return JVMTI_ERROR_NONE; @@ -1152,7 +1175,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { // Map old_index to new_index as needed. scratch_cp is only needed -// for RC_TRACE() calls. +// for log calls. void VM_RedefineClasses::map_index(const constantPoolHandle& scratch_cp, int old_index, int new_index) { if (find_new_index(old_index) != 0) { @@ -1168,8 +1191,8 @@ void VM_RedefineClasses::map_index(const constantPoolHandle& scratch_cp, _index_map_p->at_put(old_index, new_index); _index_map_count++; - RC_TRACE(0x00040000, ("mapped tag %d at index %d to %d", - scratch_cp->tag_at(old_index).value(), old_index, new_index)); + log_trace(redefine, class, constantpool) + ("mapped tag %d at index %d to %d", scratch_cp->tag_at(old_index).value(), old_index, new_index); } // end map_index() @@ -1188,7 +1211,7 @@ void VM_RedefineClasses::map_operand_index(int old_index, int new_index) { _operands_index_map_p->at_put(old_index, new_index); _operands_index_map_count++; - RC_TRACE(0x00040000, ("mapped bootstrap specifier at index %d to %d", old_index, new_index)); + log_trace(redefine, class, constantpool)("mapped bootstrap specifier at index %d to %d", old_index, new_index); } // end map_index() @@ -1219,9 +1242,7 @@ bool VM_RedefineClasses::merge_constant_pools(const constantPoolHandle& old_cp, return false; // robustness } - RC_TRACE_WITH_THREAD(0x00010000, THREAD, - ("old_cp_len=%d, scratch_cp_len=%d", old_cp->length(), - scratch_cp->length())); + log_info(redefine, class, constantpool)("old_cp_len=%d, scratch_cp_len=%d", old_cp->length(), scratch_cp->length()); { // Pass 0: @@ -1273,8 +1294,7 @@ bool VM_RedefineClasses::merge_constant_pools(const constantPoolHandle& old_cp, // merge_cp_len should be the same as old_cp->length() at this point // so this trace message is really a "warm-and-breathing" message. - RC_TRACE_WITH_THREAD(0x00020000, THREAD, - ("after pass 0: merge_cp_len=%d", *merge_cp_length_p)); + log_debug(redefine, class, constantpool)("after pass 0: merge_cp_len=%d", *merge_cp_length_p); int scratch_i; // index into scratch_cp { @@ -1339,9 +1359,9 @@ bool VM_RedefineClasses::merge_constant_pools(const constantPoolHandle& old_cp, } } - RC_TRACE_WITH_THREAD(0x00020000, THREAD, + log_debug(redefine, class, constantpool) ("after pass 1a: merge_cp_len=%d, scratch_i=%d, index_map_len=%d", - *merge_cp_length_p, scratch_i, _index_map_count)); + *merge_cp_length_p, scratch_i, _index_map_count); if (scratch_i < scratch_cp->length()) { // Pass 1b: @@ -1377,9 +1397,9 @@ bool VM_RedefineClasses::merge_constant_pools(const constantPoolHandle& old_cp, CHECK_0); } - RC_TRACE_WITH_THREAD(0x00020000, THREAD, + log_debug(redefine, class, constantpool) ("after pass 1b: merge_cp_len=%d, scratch_i=%d, index_map_len=%d", - *merge_cp_length_p, scratch_i, _index_map_count)); + *merge_cp_length_p, scratch_i, _index_map_count); } finalize_operands_merge(*merge_cp_p, THREAD); @@ -1449,12 +1469,12 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite( ResourceMark rm(THREAD); _index_map_count = 0; - _index_map_p = new intArray(scratch_cp->length(), -1); + _index_map_p = new intArray(scratch_cp->length(), scratch_cp->length(), -1); _operands_cur_length = ConstantPool::operand_array_length(old_cp->operands()); _operands_index_map_count = 0; - _operands_index_map_p = new intArray( - ConstantPool::operand_array_length(scratch_cp->operands()), -1); + int operands_index_map_len = ConstantPool::operand_array_length(scratch_cp->operands()); + _operands_index_map_p = new intArray(operands_index_map_len, operands_index_map_len, -1); // reference to the cp holder is needed for copy_operands() merge_cp->set_pool_holder(scratch_class()); @@ -1468,8 +1488,7 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite( return JVMTI_ERROR_INTERNAL; } - RC_TRACE_WITH_THREAD(0x00010000, THREAD, - ("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count)); + log_info(redefine, class, constantpool)("merge_cp_len=%d, index_map_len=%d", merge_cp_length, _index_map_count); if (_index_map_count == 0) { // there is nothing to map between the new and merged constant pools @@ -1508,15 +1527,14 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite( cp_cleaner.add_scratch_cp(scratch_cp()); } } else { - if (RC_TRACE_ENABLED(0x00040000)) { + if (log_is_enabled(Trace, redefine, class, constantpool)) { // don't want to loop unless we are tracing int count = 0; for (int i = 1; i < _index_map_p->length(); i++) { int value = _index_map_p->at(i); if (value != -1) { - RC_TRACE_WITH_THREAD(0x00040000, THREAD, - ("index_map[%d]: old=%d new=%d", count, i, value)); + log_trace(redefine, class, constantpool)("index_map[%d]: old=%d new=%d", count, i, value); count++; } } @@ -1653,9 +1671,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_methods( } if (HAS_PENDING_EXCEPTION) { Symbol* ex_name = PENDING_EXCEPTION->klass()->name(); - // RC_TRACE_WITH_THREAD macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000002, THREAD, - ("rewrite_cp_refs_in_method exception: '%s'", ex_name->as_C_string())); + log_info(redefine, class, load, exceptions)("rewrite_cp_refs_in_method exception: '%s'", ex_name->as_C_string()); // Need to clear pending exception here as the super caller sets // the JVMTI_ERROR_INTERNAL if the returned value is false. CLEAR_PENDING_EXCEPTION; @@ -1715,14 +1731,12 @@ void VM_RedefineClasses::rewrite_cp_refs_in_method(methodHandle method, if (!StressLdcRewrite && new_index <= max_jubyte) { // The new value can still use ldc instead of ldc_w // unless we are trying to stress ldc -> ldc_w rewriting - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), - p2i(bcp), cp_index, new_index)); + log_trace(redefine, class, constantpool) + ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), p2i(bcp), cp_index, new_index); *(bcp + 1) = new_index; } else { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("%s->ldc_w@" INTPTR_FORMAT " old=%d, new=%d", - Bytecodes::name(c), p2i(bcp), cp_index, new_index)); + log_trace(redefine, class, constantpool) + ("%s->ldc_w@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), p2i(bcp), cp_index, new_index); // the new value needs ldc_w instead of ldc u_char inst_buffer[4]; // max instruction size is 4 bytes bcp = (address)inst_buffer; @@ -1781,9 +1795,8 @@ void VM_RedefineClasses::rewrite_cp_refs_in_method(methodHandle method, int new_index = find_new_index(cp_index); if (new_index != 0) { // the original index is mapped so update w/ new value - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c), - p2i(bcp), cp_index, new_index)); + log_trace(redefine, class, constantpool) + ("%s@" INTPTR_FORMAT " old=%d, new=%d", Bytecodes::name(c),p2i(bcp), cp_index, new_index); // Rewriter::rewrite_method() uses put_native_u2() in this // situation because it is reusing the constant pool index // location for a native index into the ConstantPoolCache. @@ -1823,8 +1836,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_class_annotations( return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("class_annotations length=%d", class_annotations->length())); + log_debug(redefine, class, annotation)("class_annotations length=%d", class_annotations->length()); int byte_i = 0; // byte index into class_annotations return rewrite_cp_refs_in_annotations_typeArray(class_annotations, byte_i, @@ -1846,8 +1858,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_annotations_typeArray( if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for num_annotations field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for num_annotations field")); + log_debug(redefine, class, annotation)("length() is too small for num_annotations field"); return false; } @@ -1855,15 +1866,13 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_annotations_typeArray( annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("num_annotations=%d", num_annotations)); + log_debug(redefine, class, annotation)("num_annotations=%d", num_annotations); int calc_num_annotations = 0; for (; calc_num_annotations < num_annotations; calc_num_annotations++) { if (!rewrite_cp_refs_in_annotation_struct(annotations_typeArray, byte_i_ref, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad annotation_struct at %d", calc_num_annotations)); + log_debug(redefine, class, annotation)("bad annotation_struct at %d", calc_num_annotations); // propagate failure back to caller return false; } @@ -1891,8 +1900,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_annotation_struct( AnnotationArray* annotations_typeArray, int &byte_i_ref, TRAPS) { if ((byte_i_ref + 2 + 2) > annotations_typeArray->length()) { // not enough room for smallest annotation_struct - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for annotation_struct")); + log_debug(redefine, class, annotation)("length() is too small for annotation_struct"); return false; } @@ -1903,9 +1911,8 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_annotation_struct( annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_index=%d num_element_value_pairs=%d", type_index, - num_element_value_pairs)); + log_debug(redefine, class, annotation) + ("type_index=%d num_element_value_pairs=%d", type_index, num_element_value_pairs); int calc_num_element_value_pairs = 0; for (; calc_num_element_value_pairs < num_element_value_pairs; @@ -1913,8 +1920,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_annotation_struct( if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for another element_name_index, let alone // the rest of another component - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for element_name_index")); + log_debug(redefine, class, annotation)("length() is too small for element_name_index"); return false; } @@ -1922,13 +1928,11 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_annotation_struct( annotations_typeArray, byte_i_ref, "element_name_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("element_name_index=%d", element_name_index)); + log_debug(redefine, class, annotation)("element_name_index=%d", element_name_index); if (!rewrite_cp_refs_in_element_value(annotations_typeArray, byte_i_ref, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad element_value at %d", calc_num_element_value_pairs)); + log_debug(redefine, class, annotation)("bad element_value at %d", calc_num_element_value_pairs); // propagate failure back to caller return false; } @@ -1953,7 +1957,7 @@ u2 VM_RedefineClasses::rewrite_cp_ref_in_annotation_data( u2 old_cp_index = Bytes::get_Java_u2(cp_index_addr); u2 new_cp_index = find_new_index(old_cp_index); if (new_cp_index != 0) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("mapped old %s=%d", trace_mesg, old_cp_index)); + log_debug(redefine, class, annotation)("mapped old %s=%d", trace_mesg, old_cp_index); Bytes::put_Java_u2(cp_index_addr, new_cp_index); old_cp_index = new_cp_index; } @@ -1988,14 +1992,13 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( if ((byte_i_ref + 1) > annotations_typeArray->length()) { // not enough room for a tag let alone the rest of an element_value - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a tag")); + log_debug(redefine, class, annotation)("length() is too small for a tag"); return false; } u1 tag = annotations_typeArray->at(byte_i_ref); byte_i_ref++; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("tag='%c'", tag)); + log_debug(redefine, class, annotation)("tag='%c'", tag); switch (tag) { // These BaseType tag values are from Table 4.2 in VM spec: @@ -2017,8 +2020,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for a const_value_index - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a const_value_index")); + log_debug(redefine, class, annotation)("length() is too small for a const_value_index"); return false; } @@ -2026,8 +2028,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( annotations_typeArray, byte_i_ref, "const_value_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("const_value_index=%d", const_value_index)); + log_debug(redefine, class, annotation)("const_value_index=%d", const_value_index); } break; case 'e': @@ -2036,8 +2037,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( if ((byte_i_ref + 4) > annotations_typeArray->length()) { // not enough room for a enum_const_value - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a enum_const_value")); + log_debug(redefine, class, annotation)("length() is too small for a enum_const_value"); return false; } @@ -2049,9 +2049,8 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( annotations_typeArray, byte_i_ref, "const_name_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_name_index=%d const_name_index=%d", type_name_index, - const_name_index)); + log_debug(redefine, class, annotation) + ("type_name_index=%d const_name_index=%d", type_name_index, const_name_index); } break; case 'c': @@ -2060,8 +2059,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for a class_info_index - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a class_info_index")); + log_debug(redefine, class, annotation)("length() is too small for a class_info_index"); return false; } @@ -2069,8 +2067,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( annotations_typeArray, byte_i_ref, "class_info_index", THREAD); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("class_info_index=%d", class_info_index)); + log_debug(redefine, class, annotation)("class_info_index=%d", class_info_index); } break; case '@': @@ -2087,8 +2084,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( { if ((byte_i_ref + 2) > annotations_typeArray->length()) { // not enough room for a num_values field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a num_values field")); + log_debug(redefine, class, annotation)("length() is too small for a num_values field"); return false; } @@ -2097,14 +2093,13 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( u2 num_values = Bytes::get_Java_u2((address) annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("num_values=%d", num_values)); + log_debug(redefine, class, annotation)("num_values=%d", num_values); int calc_num_values = 0; for (; calc_num_values < num_values; calc_num_values++) { if (!rewrite_cp_refs_in_element_value( annotations_typeArray, byte_i_ref, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad nested element_value at %d", calc_num_values)); + log_debug(redefine, class, annotation)("bad nested element_value at %d", calc_num_values); // propagate failure back to caller return false; } @@ -2113,7 +2108,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_element_value( } break; default: - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("bad tag=0x%x", tag)); + log_debug(redefine, class, annotation)("bad tag=0x%x", tag); return false; } // end decode tag field @@ -2132,8 +2127,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_fields_annotations( return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("fields_annotations length=%d", fields_annotations->length())); + log_debug(redefine, class, annotation)("fields_annotations length=%d", fields_annotations->length()); for (int i = 0; i < fields_annotations->length(); i++) { AnnotationArray* field_annotations = fields_annotations->at(i); @@ -2145,8 +2139,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_fields_annotations( int byte_i = 0; // byte index into field_annotations if (!rewrite_cp_refs_in_annotations_typeArray(field_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad field_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad field_annotations at %d", i); // propagate failure back to caller return false; } @@ -2172,8 +2165,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_methods_annotations( int byte_i = 0; // byte index into method_annotations if (!rewrite_cp_refs_in_annotations_typeArray(method_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad method_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad method_annotations at %d", i); // propagate failure back to caller return false; } @@ -2210,8 +2202,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_methods_parameter_annotations( if (method_parameter_annotations->length() < 1) { // not enough room for a num_parameters field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a num_parameters field at %d", i)); + log_debug(redefine, class, annotation)("length() is too small for a num_parameters field at %d", i); return false; } @@ -2220,15 +2211,13 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_methods_parameter_annotations( u1 num_parameters = method_parameter_annotations->at(byte_i); byte_i++; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("num_parameters=%d", num_parameters)); + log_debug(redefine, class, annotation)("num_parameters=%d", num_parameters); int calc_num_parameters = 0; for (; calc_num_parameters < num_parameters; calc_num_parameters++) { if (!rewrite_cp_refs_in_annotations_typeArray( method_parameter_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad method_parameter_annotations at %d", calc_num_parameters)); + log_debug(redefine, class, annotation)("bad method_parameter_annotations at %d", calc_num_parameters); // propagate failure back to caller return false; } @@ -2264,8 +2253,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_methods_default_annotations( if (!rewrite_cp_refs_in_element_value( method_default_annotations, byte_i, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad default element_value at %d", i)); + log_debug(redefine, class, annotation)("bad default element_value at %d", i); // propagate failure back to caller return false; } @@ -2285,8 +2273,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_class_type_annotations( return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("class_type_annotations length=%d", class_type_annotations->length())); + log_debug(redefine, class, annotation)("class_type_annotations length=%d", class_type_annotations->length()); int byte_i = 0; // byte index into class_type_annotations return rewrite_cp_refs_in_type_annotations_typeArray(class_type_annotations, @@ -2304,8 +2291,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_fields_type_annotations( return true; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("fields_type_annotations length=%d", fields_type_annotations->length())); + log_debug(redefine, class, annotation)("fields_type_annotations length=%d", fields_type_annotations->length()); for (int i = 0; i < fields_type_annotations->length(); i++) { AnnotationArray* field_type_annotations = fields_type_annotations->at(i); @@ -2317,8 +2303,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_fields_type_annotations( int byte_i = 0; // byte index into field_type_annotations if (!rewrite_cp_refs_in_type_annotations_typeArray(field_type_annotations, byte_i, "field_info", THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad field_type_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad field_type_annotations at %d", i); // propagate failure back to caller return false; } @@ -2341,14 +2326,12 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_methods_type_annotations( continue; } - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("methods type_annotations length=%d", method_type_annotations->length())); + log_debug(redefine, class, annotation)("methods type_annotations length=%d", method_type_annotations->length()); int byte_i = 0; // byte index into method_type_annotations if (!rewrite_cp_refs_in_type_annotations_typeArray(method_type_annotations, byte_i, "method_info", THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad method_type_annotations at %d", i)); + log_debug(redefine, class, annotation)("bad method_type_annotations at %d", i); // propagate failure back to caller return false; } @@ -2374,8 +2357,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_type_annotations_typeArray( if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { // not enough room for num_annotations field - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for num_annotations field")); + log_debug(redefine, class, annotation)("length() is too small for num_annotations field"); return false; } @@ -2383,15 +2365,13 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_type_annotations_typeArray( type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("num_type_annotations=%d", num_annotations)); + log_debug(redefine, class, annotation)("num_type_annotations=%d", num_annotations); int calc_num_annotations = 0; for (; calc_num_annotations < num_annotations; calc_num_annotations++) { if (!rewrite_cp_refs_in_type_annotation_struct(type_annotations_typeArray, byte_i_ref, location_mesg, THREAD)) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("bad type_annotation_struct at %d", calc_num_annotations)); + log_debug(redefine, class, annotation)("bad type_annotation_struct at %d", calc_num_annotations); // propagate failure back to caller return false; } @@ -2399,10 +2379,9 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_type_annotations_typeArray( assert(num_annotations == calc_num_annotations, "sanity check"); if (byte_i_ref != type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("read wrong amount of bytes at end of processing " - "type_annotations_typeArray (%d of %d bytes were read)", - byte_i_ref, type_annotations_typeArray->length())); + log_debug(redefine, class, annotation) + ("read wrong amount of bytes at end of processing type_annotations_typeArray (%d of %d bytes were read)", + byte_i_ref, type_annotations_typeArray->length()); return false; } @@ -2479,15 +2458,14 @@ bool VM_RedefineClasses::skip_type_annotation_target( if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { // not enough room for a target_type let alone the rest of a type_annotation - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a target_type")); + log_debug(redefine, class, annotation)("length() is too small for a target_type"); return false; } u1 target_type = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("target_type=0x%.2x", target_type)); - RC_TRACE_WITH_THREAD(0x02000000, THREAD, ("location=%s", location_mesg)); + log_debug(redefine, class, annotation)("target_type=0x%.2x", target_type); + log_debug(redefine, class, annotation)("location=%s", location_mesg); // Skip over target_info switch (target_type) { @@ -2505,17 +2483,14 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_parameter_target")); + log_debug(redefine, class, annotation)("length() is too small for a type_parameter_target"); return false; } u1 type_parameter_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_parameter_target: type_parameter_index=%d", - type_parameter_index)); + log_debug(redefine, class, annotation)("type_parameter_target: type_parameter_index=%d", type_parameter_index); } break; case 0x10: @@ -2531,8 +2506,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a supertype_target")); + log_debug(redefine, class, annotation)("length() is too small for a supertype_target"); return false; } @@ -2540,8 +2514,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("supertype_target: supertype_index=%d", supertype_index)); + log_debug(redefine, class, annotation)("supertype_target: supertype_index=%d", supertype_index); } break; case 0x11: @@ -2559,8 +2532,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_parameter_bound_target")); + log_debug(redefine, class, annotation)("length() is too small for a type_parameter_bound_target"); return false; } @@ -2569,9 +2541,8 @@ bool VM_RedefineClasses::skip_type_annotation_target( u1 bound_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_parameter_bound_target: type_parameter_index=%d, bound_index=%d", - type_parameter_index, bound_index)); + log_debug(redefine, class, annotation) + ("type_parameter_bound_target: type_parameter_index=%d, bound_index=%d", type_parameter_index, bound_index); } break; case 0x13: @@ -2589,8 +2560,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // empty_target { // } // - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("empty_target")); + log_debug(redefine, class, annotation)("empty_target"); } break; case 0x16: @@ -2604,17 +2574,15 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a formal_parameter_target")); + log_debug(redefine, class, annotation)("length() is too small for a formal_parameter_target"); return false; } u1 formal_parameter_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("formal_parameter_target: formal_parameter_index=%d", - formal_parameter_index)); + log_debug(redefine, class, annotation) + ("formal_parameter_target: formal_parameter_index=%d", formal_parameter_index); } break; case 0x17: @@ -2628,8 +2596,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a throws_target")); + log_debug(redefine, class, annotation)("length() is too small for a throws_target"); return false; } @@ -2637,8 +2604,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("throws_target: throws_type_index=%d", throws_type_index)); + log_debug(redefine, class, annotation)("throws_target: throws_type_index=%d", throws_type_index); } break; case 0x40: @@ -2661,8 +2627,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { // not enough room for a table_length let alone the rest of a localvar_target - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a localvar_target table_length")); + log_debug(redefine, class, annotation)("length() is too small for a localvar_target table_length"); return false; } @@ -2670,16 +2635,14 @@ bool VM_RedefineClasses::skip_type_annotation_target( type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("localvar_target: table_length=%d", table_length)); + log_debug(redefine, class, annotation)("localvar_target: table_length=%d", table_length); int table_struct_size = 2 + 2 + 2; // 3 u2 variables per table entry int table_size = table_length * table_struct_size; if ((byte_i_ref + table_size) > type_annotations_typeArray->length()) { // not enough room for a table - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a table array of length %d", table_length)); + log_debug(redefine, class, annotation)("length() is too small for a table array of length %d", table_length); return false; } @@ -2698,8 +2661,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a catch_target")); + log_debug(redefine, class, annotation)("length() is too small for a catch_target"); return false; } @@ -2707,8 +2669,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("catch_target: exception_table_index=%d", exception_table_index)); + log_debug(redefine, class, annotation)("catch_target: exception_table_index=%d", exception_table_index); } break; case 0x43: @@ -2731,8 +2692,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 2) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a offset_target")); + log_debug(redefine, class, annotation)("length() is too small for a offset_target"); return false; } @@ -2740,8 +2700,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( type_annotations_typeArray->adr_at(byte_i_ref)); byte_i_ref += 2; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("offset_target: offset=%d", offset)); + log_debug(redefine, class, annotation)("offset_target: offset=%d", offset); } break; case 0x47: @@ -2769,8 +2728,7 @@ bool VM_RedefineClasses::skip_type_annotation_target( // } // if ((byte_i_ref + 3) > type_annotations_typeArray->length()) { - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_argument_target")); + log_debug(redefine, class, annotation)("length() is too small for a type_argument_target"); return false; } @@ -2780,14 +2738,12 @@ bool VM_RedefineClasses::skip_type_annotation_target( u1 type_argument_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_argument_target: offset=%d, type_argument_index=%d", - offset, type_argument_index)); + log_debug(redefine, class, annotation) + ("type_argument_target: offset=%d, type_argument_index=%d", offset, type_argument_index); } break; default: - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("unknown target_type")); + log_debug(redefine, class, annotation)("unknown target_type"); #ifdef ASSERT ShouldNotReachHere(); #endif @@ -2814,24 +2770,21 @@ bool VM_RedefineClasses::skip_type_annotation_type_path( if ((byte_i_ref + 1) > type_annotations_typeArray->length()) { // not enough room for a path_length let alone the rest of the type_path - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for a type_path")); + log_debug(redefine, class, annotation)("length() is too small for a type_path"); return false; } u1 path_length = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("type_path: path_length=%d", path_length)); + log_debug(redefine, class, annotation)("type_path: path_length=%d", path_length); int calc_path_length = 0; for (; calc_path_length < path_length; calc_path_length++) { if ((byte_i_ref + 1 + 1) > type_annotations_typeArray->length()) { // not enough room for a path - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("length() is too small for path entry %d of %d", - calc_path_length, path_length)); + log_debug(redefine, class, annotation) + ("length() is too small for path entry %d of %d", calc_path_length, path_length); return false; } @@ -2840,14 +2793,13 @@ bool VM_RedefineClasses::skip_type_annotation_type_path( u1 type_argument_index = type_annotations_typeArray->at(byte_i_ref); byte_i_ref += 1; - RC_TRACE_WITH_THREAD(0x02000000, THREAD, + log_debug(redefine, class, annotation) ("type_path: path[%d]: type_path_kind=%d, type_argument_index=%d", - calc_path_length, type_path_kind, type_argument_index)); + calc_path_length, type_path_kind, type_argument_index); if (type_path_kind > 3 || (type_path_kind != 3 && type_argument_index != 0)) { // not enough room for a path - RC_TRACE_WITH_THREAD(0x02000000, THREAD, - ("inconsistent type_path values")); + log_debug(redefine, class, annotation)("inconsistent type_path values"); return false; } } @@ -2883,8 +2835,7 @@ void VM_RedefineClasses::rewrite_cp_refs_in_stack_map_table( u2 number_of_entries = Bytes::get_Java_u2(stackmap_p); stackmap_p += 2; - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("number_of_entries=%u", number_of_entries)); + log_debug(redefine, class, stackmap)("number_of_entries=%u", number_of_entries); // walk through each stack_map_frame u2 calc_number_of_entries = 0; @@ -3084,16 +3035,14 @@ void VM_RedefineClasses::rewrite_cp_refs_in_verification_type_info( u2 cpool_index = Bytes::get_Java_u2(stackmap_p_ref); u2 new_cp_index = find_new_index(cpool_index); if (new_cp_index != 0) { - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("mapped old cpool_index=%d", cpool_index)); + log_debug(redefine, class, stackmap)("mapped old cpool_index=%d", cpool_index); Bytes::put_Java_u2(stackmap_p_ref, new_cp_index); cpool_index = new_cp_index; } stackmap_p_ref += 2; - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("frame_i=%u, frame_type=%u, cpool_index=%d", frame_i, - frame_type, cpool_index)); + log_debug(redefine, class, stackmap) + ("frame_i=%u, frame_type=%u, cpool_index=%d", frame_i, frame_type, cpool_index); } break; // Uninitialized_variable_info { @@ -3106,8 +3055,7 @@ void VM_RedefineClasses::rewrite_cp_refs_in_verification_type_info( break; default: - RC_TRACE_WITH_THREAD(0x04000000, THREAD, - ("frame_i=%u, frame_type=%u, bad tag=0x%x", frame_i, frame_type, tag)); + log_debug(redefine, class, stackmap)("frame_i=%u, frame_type=%u, bad tag=0x%x", frame_i, frame_type, tag); ShouldNotReachHere(); break; } // end switch (tag) @@ -3157,29 +3105,25 @@ void VM_RedefineClasses::set_new_constant_pool( jshort cur_index = fs.name_index(); jshort new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-name_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-name_index change: %d to %d", cur_index, new_index); fs.set_name_index(new_index); } cur_index = fs.signature_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-signature_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-signature_index change: %d to %d", cur_index, new_index); fs.set_signature_index(new_index); } cur_index = fs.initval_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-initval_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-initval_index change: %d to %d", cur_index, new_index); fs.set_initval_index(new_index); } cur_index = fs.generic_signature_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("field-generic_signature change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("field-generic_signature change: %d to %d", cur_index, new_index); fs.set_generic_signature_index(new_index); } } // end for each field @@ -3196,22 +3140,19 @@ void VM_RedefineClasses::set_new_constant_pool( } int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("inner_class_info change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("inner_class_info change: %d to %d", cur_index, new_index); iter.set_inner_class_info_index(new_index); } cur_index = iter.outer_class_info_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("outer_class_info change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("outer_class_info change: %d to %d", cur_index, new_index); iter.set_outer_class_info_index(new_index); } cur_index = iter.inner_name_index(); new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("inner_name change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("inner_name change: %d to %d", cur_index, new_index); iter.set_inner_name_index(new_index); } } // end for each inner class @@ -3225,23 +3166,20 @@ void VM_RedefineClasses::set_new_constant_pool( int new_index = find_new_index(method->name_index()); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("method-name_index change: %d to %d", method->name_index(), - new_index)); + log_trace(redefine, class, constantpool) + ("method-name_index change: %d to %d", method->name_index(), new_index); method->set_name_index(new_index); } new_index = find_new_index(method->signature_index()); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("method-signature_index change: %d to %d", - method->signature_index(), new_index)); + log_trace(redefine, class, constantpool) + ("method-signature_index change: %d to %d", method->signature_index(), new_index); method->set_signature_index(new_index); } new_index = find_new_index(method->generic_signature_index()); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("method-generic_signature_index change: %d to %d", - method->generic_signature_index(), new_index)); + log_trace(redefine, class, constantpool) + ("method-generic_signature_index change: %d to %d", method->generic_signature_index(), new_index); method->set_generic_signature_index(new_index); } @@ -3255,8 +3193,7 @@ void VM_RedefineClasses::set_new_constant_pool( int cur_index = cext_table[j].class_cp_index; int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("cext-class_cp_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("cext-class_cp_index change: %d to %d", cur_index, new_index); cext_table[j].class_cp_index = (u2)new_index; } } // end for each checked exception table entry @@ -3274,8 +3211,7 @@ void VM_RedefineClasses::set_new_constant_pool( int cur_index = ex_table.catch_type_index(j); int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("ext-klass_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("ext-klass_index change: %d to %d", cur_index, new_index); ex_table.set_catch_type_index(j, new_index); } } // end for each exception table entry @@ -3292,23 +3228,19 @@ void VM_RedefineClasses::set_new_constant_pool( int cur_index = lv_table[j].name_cp_index; int new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("lvt-name_cp_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("lvt-name_cp_index change: %d to %d", cur_index, new_index); lv_table[j].name_cp_index = (u2)new_index; } cur_index = lv_table[j].descriptor_cp_index; new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("lvt-descriptor_cp_index change: %d to %d", cur_index, - new_index)); + log_trace(redefine, class, constantpool)("lvt-descriptor_cp_index change: %d to %d", cur_index, new_index); lv_table[j].descriptor_cp_index = (u2)new_index; } cur_index = lv_table[j].signature_cp_index; new_index = find_new_index(cur_index); if (new_index != 0) { - RC_TRACE_WITH_THREAD(0x00080000, THREAD, - ("lvt-signature_cp_index change: %d to %d", cur_index, new_index)); + log_trace(redefine, class, constantpool)("lvt-signature_cp_index change: %d to %d", cur_index, new_index); lv_table[j].signature_cp_index = (u2)new_index; } } // end for each local variable table entry @@ -3332,13 +3264,6 @@ void VM_RedefineClasses::AdjustCpoolCacheAndVtable::do_klass(Klass* k) { bool trace_name_printed = false; InstanceKlass *the_class = InstanceKlass::cast(_the_class_oop); - // Very noisy: only enable this call if you are trying to determine - // that a specific class gets found by this routine. - // RC_TRACE macro has an embedded ResourceMark - // RC_TRACE_WITH_THREAD(0x00100000, THREAD, - // ("adjust check: name=%s", k->external_name())); - // trace_name_printed = true; - // If the class being redefined is java.lang.Object, we need to fix all // array class vtables also if (k->is_array_klass() && _the_class_oop == SystemDictionary::Object_klass()) { @@ -3576,9 +3501,11 @@ int VM_RedefineClasses::check_methods_and_mark_as_obsolete() { // With tracing we try not to "yack" too much. The position of // this trace assumes there are fewer obsolete methods than // EMCP methods. - RC_TRACE(0x00000100, ("mark %s(%s) as obsolete", - old_method->name()->as_C_string(), - old_method->signature()->as_C_string())); + if (log_is_enabled(Trace, redefine, class, obsolete, mark)) { + ResourceMark rm; + log_trace(redefine, class, obsolete, mark) + ("mark %s(%s) as obsolete", old_method->name()->as_C_string(), old_method->signature()->as_C_string()); + } } old_method->set_is_old(); } @@ -3596,14 +3523,15 @@ int VM_RedefineClasses::check_methods_and_mark_as_obsolete() { // With tracing we try not to "yack" too much. The position of // this trace assumes there are fewer obsolete methods than // EMCP methods. - RC_TRACE(0x00000100, ("mark deleted %s(%s) as obsolete", - old_method->name()->as_C_string(), - old_method->signature()->as_C_string())); + if (log_is_enabled(Trace, redefine, class, obsolete, mark)) { + ResourceMark rm; + log_trace(redefine, class, obsolete, mark) + ("mark deleted %s(%s) as obsolete", old_method->name()->as_C_string(), old_method->signature()->as_C_string()); + } } assert((emcp_method_count + obsolete_count) == _old_methods->length(), "sanity check"); - RC_TRACE(0x00000100, ("EMCP_cnt=%d, obsolete_cnt=%d", emcp_method_count, - obsolete_count)); + log_trace(redefine, class, obsolete, mark)("EMCP_cnt=%d, obsolete_cnt=%d", emcp_method_count, obsolete_count); return emcp_method_count; } @@ -3866,24 +3794,24 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass, Klass* scratch_class_oop, TRAPS) { HandleMark hm(THREAD); // make sure handles from this call are freed - RC_TIMER_START(_timer_rsc_phase1); - instanceKlassHandle scratch_class(scratch_class_oop); + if (log_is_enabled(Info, redefine, class, timer)) { + _timer_rsc_phase1.start(); + } - oop the_class_mirror = JNIHandles::resolve_non_null(the_jclass); - Klass* the_class_oop = java_lang_Class::as_Klass(the_class_mirror); - instanceKlassHandle the_class = instanceKlassHandle(THREAD, the_class_oop); + instanceKlassHandle scratch_class(THREAD, scratch_class_oop); + instanceKlassHandle the_class(THREAD, get_ik(the_jclass)); // Remove all breakpoints in methods of this class JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints(); - jvmti_breakpoints.clearall_in_class_at_safepoint(the_class_oop); + jvmti_breakpoints.clearall_in_class_at_safepoint(the_class()); // Deoptimize all compiled code that depends on this class flush_dependent_code(the_class, THREAD); _old_methods = the_class->methods(); _new_methods = scratch_class->methods(); - _the_class_oop = the_class_oop; + _the_class_oop = the_class(); compute_added_deleted_matching_methods(); update_jmethod_ids(); @@ -4083,8 +4011,10 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass, // keep track of previous versions of this class the_class->add_previous_version(scratch_class, emcp_method_count); - RC_TIMER_STOP(_timer_rsc_phase1); - RC_TIMER_START(_timer_rsc_phase2); + _timer_rsc_phase1.stop(); + if (log_is_enabled(Info, redefine, class, timer)) { + _timer_rsc_phase2.start(); + } // Adjust constantpool caches and vtables for all classes // that reference methods of the evolved class. @@ -4104,25 +4034,20 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass, the_class->oop_map_cache()->flush_obsolete_entries(); } - // increment the classRedefinedCount field in the_class and in any - // direct and indirect subclasses of the_class - increment_class_counter((InstanceKlass *)the_class(), THREAD); - - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00000001, THREAD, - ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)", - the_class->external_name(), - java_lang_Class::classRedefinedCount(the_class_mirror), - os::available_memory() >> 10)); - { ResourceMark rm(THREAD); + // increment the classRedefinedCount field in the_class and in any + // direct and indirect subclasses of the_class + increment_class_counter((InstanceKlass *)the_class(), THREAD); + log_info(redefine, class, load) + ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)", + the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror()), os::available_memory() >> 10); Events::log_redefinition(THREAD, "redefined class name=%s, count=%d", the_class->external_name(), - java_lang_Class::classRedefinedCount(the_class_mirror)); + java_lang_Class::classRedefinedCount(the_class->java_mirror())); } - RC_TIMER_STOP(_timer_rsc_phase2); + _timer_rsc_phase2.stop(); } // end redefine_single_class() @@ -4136,8 +4061,7 @@ void VM_RedefineClasses::increment_class_counter(InstanceKlass *ik, TRAPS) { if (class_oop != _the_class_oop) { // _the_class_oop count is printed at end of redefine_single_class() - RC_TRACE_WITH_THREAD(0x00000008, THREAD, - ("updated count in subclass=%s to %d", ik->external_name(), new_count)); + log_debug(redefine, class, subclass)("updated count in subclass=%s to %d", ik->external_name(), new_count); } for (Klass *subk = ik->subklass(); subk != NULL; @@ -4159,11 +4083,10 @@ void VM_RedefineClasses::CheckClass::do_klass(Klass* k) { ResourceMark rm(_thread); if (k->vtable_length() > 0 && !k->vtable()->check_no_old_or_obsolete_entries()) { - if (RC_TRACE_ENABLED(0x00004000)) { - RC_TRACE_WITH_THREAD(0x00004000, _thread, - ("klassVtable::check_no_old_or_obsolete_entries failure" - " -- OLD or OBSOLETE method found -- class: %s", - k->signature_name())); + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { + log_trace(redefine, class, obsolete, metadata) + ("klassVtable::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: %s", + k->signature_name()); k->vtable()->dump_vtable(); } no_old_methods = false; @@ -4176,11 +4099,10 @@ void VM_RedefineClasses::CheckClass::do_klass(Klass* k) { // an itable should never contain old or obsolete methods if (ik->itable_length() > 0 && !ik->itable()->check_no_old_or_obsolete_entries()) { - if (RC_TRACE_ENABLED(0x00004000)) { - RC_TRACE_WITH_THREAD(0x00004000, _thread, - ("klassItable::check_no_old_or_obsolete_entries failure" - " -- OLD or OBSOLETE method found -- class: %s", - ik->signature_name())); + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { + log_trace(redefine, class, obsolete, metadata) + ("klassItable::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: %s", + ik->signature_name()); ik->itable()->dump_itable(); } no_old_methods = false; @@ -4190,11 +4112,10 @@ void VM_RedefineClasses::CheckClass::do_klass(Klass* k) { if (ik->constants() != NULL && ik->constants()->cache() != NULL && !ik->constants()->cache()->check_no_old_or_obsolete_entries()) { - if (RC_TRACE_ENABLED(0x00004000)) { - RC_TRACE_WITH_THREAD(0x00004000, _thread, - ("cp-cache::check_no_old_or_obsolete_entries failure" - " -- OLD or OBSOLETE method found -- class: %s", - ik->signature_name())); + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { + log_trace(redefine, class, obsolete, metadata) + ("cp-cache::check_no_old_or_obsolete_entries failure -- OLD or OBSOLETE method found -- class: %s", + ik->signature_name()); ik->constants()->cache()->dump_cache(); } no_old_methods = false; @@ -4203,10 +4124,10 @@ void VM_RedefineClasses::CheckClass::do_klass(Klass* k) { // print and fail guarantee if old methods are found. if (!no_old_methods) { - if (RC_TRACE_ENABLED(0x00004000)) { + if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) { dump_methods(); } else { - tty->print_cr("INFO: use the '-XX:TraceRedefineClasses=16384' option " + log_trace(redefine, class)("Use the '-Xlog:redefine+class*:' option " "to see more info about the following guarantee() failure."); } guarantee(false, "OLD and/or OBSOLETE method(s) found"); @@ -4216,54 +4137,60 @@ void VM_RedefineClasses::CheckClass::do_klass(Klass* k) { void VM_RedefineClasses::dump_methods() { int j; - RC_TRACE(0x00004000, ("_old_methods --")); + log_trace(redefine, class, dump)("_old_methods --"); for (j = 0; j < _old_methods->length(); ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _old_methods->at(j); - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_new_methods --")); + log_trace(redefine, class, dump)("_new_methods --"); for (j = 0; j < _new_methods->length(); ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _new_methods->at(j); - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_matching_(old/new)_methods --")); + log_trace(redefine, class, dump)("_matching_methods --"); for (j = 0; j < _matching_methods_length; ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _matching_old_methods[j]; - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(); + log_stream.cr(); + m = _matching_new_methods[j]; - RC_TRACE_NO_CR(0x00004000, (" (%5d) ", m->vtable_index())); - m->access_flags().print_on(tty); - tty->cr(); + log_stream.print(" (%5d) ", m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_deleted_methods --")); + log_trace(redefine, class, dump)("_deleted_methods --"); for (j = 0; j < _deleted_methods_length; ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _deleted_methods[j]; - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } - RC_TRACE(0x00004000, ("_added_methods --")); + log_trace(redefine, class, dump)("_added_methods --"); for (j = 0; j < _added_methods_length; ++j) { + LogStreamHandle(Trace, redefine, class, dump) log_stream; Method* m = _added_methods[j]; - RC_TRACE_NO_CR(0x00004000, ("%4d (%5d) ", j, m->vtable_index())); - m->access_flags().print_on(tty); - tty->print(" -- "); - m->print_name(tty); - tty->cr(); + log_stream.print("%4d (%5d) ", j, m->vtable_index()); + m->access_flags().print_on(&log_stream); + log_stream.print(" -- "); + m->print_name(&log_stream); + log_stream.cr(); } } diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp index b4c0cc63694..edba3dd51a0 100644 --- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp +++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -30,7 +30,6 @@ #include "memory/resourceArea.hpp" #include "oops/objArrayKlass.hpp" #include "oops/objArrayOop.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/vm_operations.hpp" // Introduction: @@ -490,6 +489,10 @@ class VM_RedefineClasses: public VM_Operation { void flush_dependent_code(instanceKlassHandle k_h, TRAPS); + // lock classes to redefine since constant pool merging isn't thread safe. + void lock_classes(); + void unlock_classes(); + static void dump_methods(); // Check that there are no old or obsolete methods diff --git a/hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp b/hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp deleted file mode 100644 index 43174e49426..00000000000 --- a/hotspot/src/share/vm/prims/jvmtiRedefineClassesTrace.hpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP -#define SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP - -// RedefineClasses tracing support via the TraceRedefineClasses -// option. A bit is assigned to each group of trace messages. -// Groups of messages are individually selectable. We have to use -// decimal values on the command line since the command option -// parsing logic doesn't like non-decimal numerics. The HEX values -// are used in the actual RC_TRACE() calls for sanity. To achieve -// the old cumulative behavior, pick the level after the one in -// which you are interested and subtract one, e.g., 33554431 will -// print every tracing message. -// -// 0x00000000 | 0 - default; no tracing messages -// 0x00000001 | 1 - name each target class before loading, after -// loading and after redefinition is completed -// 0x00000002 | 2 - print info if parsing, linking or -// verification throws an exception -// 0x00000004 | 4 - print timer info for the VM operation -// 0x00000008 | 8 - print subclass counter updates -// 0x00000010 | 16 - unused -// 0x00000020 | 32 - unused -// 0x00000040 | 64 - unused -// 0x00000080 | 128 - unused -// 0x00000100 | 256 - previous class weak reference addition -// 0x00000200 | 512 - previous class weak reference mgmt during -// class unloading checks (GC) -// 0x00000400 | 1024 - previous class weak reference mgmt during -// add previous ops (GC) -// 0x00000800 | 2048 - previous class breakpoint mgmt -// 0x00001000 | 4096 - detect calls to obsolete methods -// 0x00002000 | 8192 - fail a guarantee() in addition to detection -// 0x00004000 | 16384 - detect old/obsolete methods in metadata -// 0x00008000 | 32768 - old/new method matching/add/delete -// 0x00010000 | 65536 - impl details: CP size info -// 0x00020000 | 131072 - impl details: CP merge pass info -// 0x00040000 | 262144 - impl details: CP index maps -// 0x00080000 | 524288 - impl details: modified CP index values -// 0x00100000 | 1048576 - impl details: vtable updates -// 0x00200000 | 2097152 - impl details: itable updates -// 0x00400000 | 4194304 - impl details: constant pool cache updates -// 0x00800000 | 8388608 - impl details: methodComparator info -// 0x01000000 | 16777216 - impl details: nmethod evolution info -// 0x02000000 | 33554432 - impl details: annotation updates -// 0x04000000 | 67108864 - impl details: StackMapTable updates -// 0x08000000 | 134217728 - impl details: OopMapCache updates -// 0x10000000 | 268435456 - unused -// 0x20000000 | 536870912 - unused -// 0x40000000 | 1073741824 - unused -// 0x80000000 | 2147483648 - unused - -// Macro for checking if TraceRedefineClasses has a specific bit -// enabled. Returns true if the bit specified by level is set. -#define RC_TRACE_ENABLED(level) ((TraceRedefineClasses & level) != 0) - -// Macro for checking if TraceRedefineClasses has one or more bits -// set in a range of bit values. Returns true if one or more bits -// is set in the range from low..high inclusive. Assumes that low -// and high are single bit values. -// -// ((high << 1) - 1) -// Yields a mask that removes bits greater than the high bit value. -// This algorithm doesn't work with highest bit. -// ~(low - 1) -// Yields a mask that removes bits lower than the low bit value. -#define RC_TRACE_IN_RANGE(low, high) \ -(((TraceRedefineClasses & ((high << 1) - 1)) & ~(low - 1)) != 0) - -// Note: The ResourceMark is to cleanup resource allocated args. -// The "do {...} while (0)" is so we can use semi-colon at end of RC_TRACE(). -#define RC_TRACE(level, args) do { \ - if (RC_TRACE_ENABLED(level)) { \ - ResourceMark rm; \ - tty->print("RedefineClasses-0x%x: ", level); \ - tty->print_cr args; \ - } \ -} while (0) - -#define RC_TRACE_NO_CR(level, args) do { \ - if (RC_TRACE_ENABLED(level)) { \ - ResourceMark rm; \ - tty->print("RedefineClasses-0x%x: ", level); \ - tty->print args; \ - } \ -} while (0) - -#define RC_TRACE_WITH_THREAD(level, thread, args) do { \ - if (RC_TRACE_ENABLED(level)) { \ - ResourceMark rm(thread); \ - tty->print("RedefineClasses-0x%x: ", level); \ - tty->print_cr args; \ - } \ -} while (0) - -#define RC_TRACE_MESG(args) do { \ - ResourceMark rm; \ - tty->print("RedefineClasses: "); \ - tty->print_cr args; \ -} while (0) - -// Timer support macros. Only do timer operations if timer tracing is enabled. -// The "do {...} while (0)" is so we can use semi-colon at end of the macro. -#define RC_TIMER_START(t) do { \ - if (RC_TRACE_ENABLED(0x00000004)) { \ - t.start(); \ - } \ -} while (0) -#define RC_TIMER_STOP(t) do { \ - if (RC_TRACE_ENABLED(0x00000004)) { \ - t.stop(); \ - } \ -} while (0) - -#endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSESTRACE_HPP diff --git a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp index b164c7ae45a..fa9d5131e31 100644 --- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp @@ -146,11 +146,7 @@ class JvmtiTagHashmap : public CHeapObj { _size_index = size_index; _size = initial_size; _entry_count = 0; - if (TraceJVMTIObjectTagging) { - _trace_threshold = initial_trace_threshold; - } else { - _trace_threshold = -1; - } + _trace_threshold = initial_trace_threshold; _load_factor = load_factor; _resize_threshold = (int)(_load_factor * _size); _resizing_enabled = true; @@ -329,8 +325,7 @@ class JvmtiTagHashmap : public CHeapObj { } _entry_count++; - if (trace_threshold() > 0 && entry_count() >= trace_threshold()) { - assert(TraceJVMTIObjectTagging, "should only get here when tracing"); + if (log_is_enabled(Debug, jvmti, objecttagging) && entry_count() >= trace_threshold()) { print_memory_usage(); compute_next_trace_threshold(); } @@ -409,6 +404,7 @@ void JvmtiTagHashmap::print_memory_usage() { // compute threshold for the next trace message void JvmtiTagHashmap::compute_next_trace_threshold() { + _trace_threshold = entry_count(); if (trace_threshold() < medium_trace_threshold) { _trace_threshold += small_trace_threshold; } else { @@ -3413,12 +3409,6 @@ void JvmtiTagMap::do_weak_oops(BoolObjectClosure* is_alive, OopClosure* f) { delayed_add = next; } - // stats - if (TraceJVMTIObjectTagging) { - int post_total = hashmap->_entry_count; - int pre_total = post_total + freed; - - tty->print_cr("(%d->%d, %d freed, %d total moves)", - pre_total, post_total, freed, moved); - } + log_debug(jvmti, objecttagging)("(%d->%d, %d freed, %d total moves)", + hashmap->_entry_count + freed, hashmap->_entry_count, freed, moved); } diff --git a/hotspot/src/share/vm/prims/jvmtiThreadState.cpp b/hotspot/src/share/vm/prims/jvmtiThreadState.cpp index e98891e8ef3..1e3a6e8c03e 100644 --- a/hotspot/src/share/vm/prims/jvmtiThreadState.cpp +++ b/hotspot/src/share/vm/prims/jvmtiThreadState.cpp @@ -224,18 +224,11 @@ int JvmtiThreadState::count_frames() { RegisterMap reg_map(get_thread()); javaVFrame *jvf = get_thread()->last_java_vframe(®_map); int n = 0; - // tty->print_cr("CSD: counting frames on %s ...", - // JvmtiTrace::safe_get_thread_name(get_thread())); while (jvf != NULL) { Method* method = jvf->method(); - // tty->print_cr("CSD: frame - method %s.%s - loc %d", - // method->klass_name()->as_C_string(), - // method->name()->as_C_string(), - // jvf->bci() ); jvf = jvf->java_sender(); n++; } - // tty->print_cr("CSD: frame count: %d", n); return n; } diff --git a/hotspot/src/share/vm/prims/jvmtiTrace.cpp b/hotspot/src/share/vm/prims/jvmtiTrace.cpp index 01edd16c63f..bb92c7bb51c 100644 --- a/hotspot/src/share/vm/prims/jvmtiTrace.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTrace.cpp @@ -24,6 +24,8 @@ #include "precompiled.hpp" #include "jvmtifiles/jvmtiEnv.hpp" +#include "logging/log.hpp" +#include "logging/logConfiguration.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiTrace.hpp" @@ -80,6 +82,17 @@ void JvmtiTrace::initialize() { } else { curr = ""; // hack in fixed tracing here } + + // Enable UL for JVMTI tracing + if (strlen(curr) > 0) { + if (!log_is_enabled(Trace, jvmti)) { + log_warning(arguments)("-XX:+TraceJVMTI specified, " + "but no log output configured for the 'jvmti' tag on Trace level. " + "Defaulting to -Xlog:jvmti=trace"); + LogConfiguration::configure_stdout(LogLevel::Trace, true, LOG_TAGS(jvmti)); + } + } + very_end = curr + strlen(curr); while (curr < very_end) { const char *curr_end = strchr(curr, ','); @@ -127,7 +140,7 @@ void JvmtiTrace::initialize() { bits |= SHOW_EVENT_SENT; break; default: - tty->print_cr("Invalid trace flag '%c'", *flags); + log_warning(jvmti)("Invalid trace flag '%c'", *flags); break; } } @@ -152,7 +165,7 @@ void JvmtiTrace::initialize() { domain = ALL_EVENT | EVENT; } else if (len==2 && strncmp(curr, "ec", 2)==0) { _trace_event_controller = true; - tty->print_cr("JVMTI Tracing the event controller"); + log_trace(jvmti)("Tracing the event controller"); } else { domain = FUNC | EVENT; // go searching } @@ -161,9 +174,9 @@ void JvmtiTrace::initialize() { if (domain & FUNC) { if (domain & ALL_FUNC) { if (domain & EXCLUDE) { - tty->print("JVMTI Tracing all significant functions"); + log_trace(jvmti)("Tracing all significant functions"); } else { - tty->print_cr("JVMTI Tracing all functions"); + log_trace(jvmti)("Tracing all functions"); } } for (int i = 0; i <= _max_function_index; ++i) { @@ -178,7 +191,7 @@ void JvmtiTrace::initialize() { if (fname != NULL) { size_t fnlen = strlen(fname); if (len==fnlen && strncmp(curr, fname, fnlen)==0) { - tty->print_cr("JVMTI Tracing the function: %s", fname); + log_trace(jvmti)("Tracing the function: %s", fname); do_op = true; } } @@ -196,7 +209,7 @@ void JvmtiTrace::initialize() { } if (domain & EVENT) { if (domain & ALL_EVENT) { - tty->print_cr("JVMTI Tracing all events"); + log_trace(jvmti)("Tracing all events"); } for (int i = 0; i <= _max_event_index; ++i) { bool do_op = false; @@ -207,7 +220,7 @@ void JvmtiTrace::initialize() { if (ename != NULL) { size_t evtlen = strlen(ename); if (len==evtlen && strncmp(curr, ename, evtlen)==0) { - tty->print_cr("JVMTI Tracing the event: %s", ename); + log_trace(jvmti)("Tracing the event: %s", ename); do_op = true; } } @@ -223,7 +236,7 @@ void JvmtiTrace::initialize() { } } if (!_on && (domain & (FUNC|EVENT))) { - tty->print_cr("JVMTI Trace domain not found"); + log_warning(jvmti)("Trace domain not found"); } curr = curr_end + 1; } diff --git a/hotspot/src/share/vm/prims/methodComparator.cpp b/hotspot/src/share/vm/prims/methodComparator.cpp index e143409c6f4..5a5575729d5 100644 --- a/hotspot/src/share/vm/prims/methodComparator.cpp +++ b/hotspot/src/share/vm/prims/methodComparator.cpp @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/methodComparator.hpp" #include "runtime/handles.inline.hpp" #include "utilities/globalDefinitions.hpp" @@ -39,10 +38,12 @@ bool MethodComparator::methods_EMCP(Method* old_method, Method* new_method) { if (old_method->code_size() != new_method->code_size()) return false; if (check_stack_and_locals_size(old_method, new_method) != 0) { - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00800000, ("Methods %s non-comparable with diagnosis %d", - old_method->name()->as_C_string(), - check_stack_and_locals_size(old_method, new_method))); + if (log_is_enabled(Debug, redefine, class, methodcomparator)) { + ResourceMark rm; + log_debug(redefine, class, methodcomparator) + ("Methods %s non-comparable with diagnosis %d", + old_method->name()->as_C_string(), check_stack_and_locals_size(old_method, new_method)); + } return false; } diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp index b4abd306781..7b1782a2904 100644 --- a/hotspot/src/share/vm/prims/methodHandles.cpp +++ b/hotspot/src/share/vm/prims/methodHandles.cpp @@ -38,7 +38,6 @@ #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/methodHandles.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/javaCalls.hpp" #include "runtime/timerTrace.hpp" @@ -1084,17 +1083,15 @@ void MemberNameTable::adjust_method_entries(InstanceKlass* holder, bool * trace_ java_lang_invoke_MemberName::set_vmtarget(mem_name, new_method); - if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) { + if (log_is_enabled(Info, redefine, class, update)) { + ResourceMark rm; if (!(*trace_name_printed)) { - // RC_TRACE_MESG macro has an embedded ResourceMark - RC_TRACE_MESG(("adjust: name=%s", - old_method->method_holder()->external_name())); + log_info(redefine, class, update)("adjust: name=%s", old_method->method_holder()->external_name()); *trace_name_printed = true; } - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE(0x00400000, ("MemberName method update: %s(%s)", - new_method->name()->as_C_string(), - new_method->signature()->as_C_string())); + log_debug(redefine, class, update, constantpool) + ("MemberName method update: %s(%s)", + new_method->name()->as_C_string(), new_method->signature()->as_C_string()); } } } diff --git a/hotspot/src/share/vm/prims/stackwalk.cpp b/hotspot/src/share/vm/prims/stackwalk.cpp index d772620dcf5..70f46f747d2 100644 --- a/hotspot/src/share/vm/prims/stackwalk.cpp +++ b/hotspot/src/share/vm/prims/stackwalk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -37,44 +37,44 @@ #include "utilities/globalDefinitions.hpp" // setup and cleanup actions -void StackWalkAnchor::setup_magic_on_entry(objArrayHandle frames_array) { +void JavaFrameStream::setup_magic_on_entry(objArrayHandle frames_array) { frames_array->obj_at_put(magic_pos, _thread->threadObj()); _anchor = address_value(); assert(check_magic(frames_array), "invalid magic"); } -bool StackWalkAnchor::check_magic(objArrayHandle frames_array) { +bool JavaFrameStream::check_magic(objArrayHandle frames_array) { oop m1 = frames_array->obj_at(magic_pos); jlong m2 = _anchor; if (m1 == _thread->threadObj() && m2 == address_value()) return true; return false; } -bool StackWalkAnchor::cleanup_magic_on_exit(objArrayHandle frames_array) { +bool JavaFrameStream::cleanup_magic_on_exit(objArrayHandle frames_array) { bool ok = check_magic(frames_array); frames_array->obj_at_put(magic_pos, NULL); _anchor = 0L; return ok; } -// Returns StackWalkAnchor for the current stack being traversed. +// Returns JavaFrameStream for the current stack being traversed. // // Parameters: // thread Current Java thread. // magic Magic value used for each stack walking // frames_array User-supplied buffers. The 0th element is reserved -// to this StackWalkAnchor to use +// to this JavaFrameStream to use // -StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic, +JavaFrameStream* JavaFrameStream::from_current(JavaThread* thread, jlong magic, objArrayHandle frames_array) { assert(thread != NULL && thread->is_Java_thread(), ""); oop m1 = frames_array->obj_at(magic_pos); if (m1 != thread->threadObj()) return NULL; if (magic == 0L) return NULL; - StackWalkAnchor* anchor = (StackWalkAnchor*) (intptr_t) magic; - if (!anchor->is_valid_in(thread, frames_array)) return NULL; - return anchor; + JavaFrameStream* stream = (JavaFrameStream*) (intptr_t) magic; + if (!stream->is_valid_in(thread, frames_array)) return NULL; + return stream; } // Unpacks one or more frames into user-supplied buffers. @@ -84,19 +84,19 @@ StackWalkAnchor* StackWalkAnchor::from_current(JavaThread* thread, jlong magic, // In other words, do not leave any stale data in the vfst. // // Parameters: -// mode Restrict which frames to be decoded. -// vfst vFrameStream. -// max_nframes Maximum number of frames to be filled. -// start_index Start index to the user-supplied buffers. -// frames_array Buffer to store Class or StackFrame in, starting at start_index. -// frames array is a Class[] array when only getting caller -// reference, and a StackFrameInfo[] array (or derivative) -// otherwise. It should never be null. -// end_index End index to the user-supplied buffers with unpacked frames. +// mode Restrict which frames to be decoded. +// JavaFrameStream stream of javaVFrames +// max_nframes Maximum number of frames to be filled. +// start_index Start index to the user-supplied buffers. +// frames_array Buffer to store Class or StackFrame in, starting at start_index. +// frames array is a Class[] array when only getting caller +// reference, and a StackFrameInfo[] array (or derivative) +// otherwise. It should never be null. +// end_index End index to the user-supplied buffers with unpacked frames. // // Returns the number of frames whose information was transferred into the buffers. // -int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst, +int StackWalk::fill_in_frames(jlong mode, JavaFrameStream& stream, int max_nframes, int start_index, objArrayHandle frames_array, int& end_index, TRAPS) { @@ -108,9 +108,9 @@ int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst, assert(start_index + max_nframes <= frames_array->length(), "oob"); int frames_decoded = 0; - for (; !vfst.at_end(); vfst.next()) { - Method* method = vfst.method(); - int bci = vfst.bci(); + for (; !stream.at_end(); stream.next()) { + Method* method = stream.method(); + int bci = stream.bci(); if (method == NULL) continue; if (!ShowHiddenFrames && StackWalk::skip_hidden_frames(mode)) { @@ -133,7 +133,7 @@ int StackWalk::fill_in_frames(jlong mode, vframeStream& vfst, if (live_frame_info(mode)) { assert (use_frames_array(mode), "Bad mode for get live frame"); Handle stackFrame(frames_array->obj_at(index)); - fill_live_stackframe(stackFrame, method, bci, vfst.java_frame(), CHECK_0); + fill_live_stackframe(stackFrame, method, bci, stream.java_frame(), CHECK_0); } else if (need_method_info(mode)) { assert (use_frames_array(mode), "Bad mode for get stack frame"); Handle stackFrame(frames_array->obj_at(index)); @@ -294,6 +294,7 @@ oop StackWalk::walk(Handle stackStream, jlong mode, int skip_frames, int frame_count, int start_index, objArrayHandle frames_array, TRAPS) { + ResourceMark rm(THREAD); JavaThread* jt = (JavaThread*)THREAD; if (TraceStackWalk) { tty->print_cr("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d", @@ -309,41 +310,39 @@ oop StackWalk::walk(Handle stackStream, jlong mode, methodHandle m_doStackWalk(THREAD, Universe::do_stack_walk_method()); - // Open up a traversable stream onto my stack. - // This stream will be made available by *reference* to the inner Java call. - StackWalkAnchor anchor(jt); - vframeStream& vfst = anchor.vframe_stream(); - + // Setup traversal onto my stack. + RegisterMap regMap(jt, true); + JavaFrameStream stream(jt, ®Map); { - while (!vfst.at_end()) { - InstanceKlass* ik = vfst.method()->method_holder(); + while (!stream.at_end()) { + InstanceKlass* ik = stream.method()->method_holder(); if (ik != stackWalker_klass && ik != abstractStackWalker_klass && ik->super() != abstractStackWalker_klass) { break; } if (TraceStackWalk) { - tty->print(" skip "); vfst.method()->print_short_name(); tty->print("\n"); + tty->print(" skip "); stream.method()->print_short_name(); tty->print("\n"); } - vfst.next(); + stream.next(); } // stack frame has been traversed individually and resume stack walk // from the stack frame at depth == skip_frames. - for (int n=0; n < skip_frames && !vfst.at_end(); vfst.next(), n++) { + for (int n=0; n < skip_frames && !stream.at_end(); stream.next(), n++) { if (TraceStackWalk) { - tty->print(" skip "); vfst.method()->print_short_name(); + tty->print(" skip "); stream.method()->print_short_name(); tty->print_cr(" frame id: " PTR_FORMAT " pc: " PTR_FORMAT, - p2i(vfst.frame_id()), p2i(vfst.frame_pc())); + p2i(stream.java_frame()->fr().id()), + p2i(stream.java_frame()->fr().pc())); } } } - // The Method* pointer in the vfst has a very short shelf life. Grab it now. int end_index = start_index; int numFrames = 0; - if (!vfst.at_end()) { - numFrames = fill_in_frames(mode, vfst, frame_count, start_index, + if (!stream.at_end()) { + numFrames = fill_in_frames(mode, stream, frame_count, start_index, frames_array, end_index, CHECK_NULL); if (numFrames < 1) { THROW_MSG_(vmSymbols::java_lang_InternalError(), "stack walk: decode failed", NULL); @@ -356,19 +355,19 @@ oop StackWalk::walk(Handle stackStream, jlong mode, // When JVM_CallStackWalk returns, it invalidates the stack stream. JavaValue result(T_OBJECT); JavaCallArguments args(stackStream); - args.push_long(anchor.address_value()); + args.push_long(stream.address_value()); args.push_int(skip_frames); args.push_int(frame_count); args.push_int(start_index); args.push_int(end_index); // Link the thread and vframe stream into the callee-visible object - anchor.setup_magic_on_entry(frames_array); + stream.setup_magic_on_entry(frames_array); JavaCalls::call(&result, m_doStackWalk, &args, THREAD); // Do this before anything else happens, to disable any lingering stream objects - bool ok = anchor.cleanup_magic_on_exit(frames_array); + bool ok = stream.cleanup_magic_on_exit(frames_array); // Throw pending exception if we must (void) (CHECK_NULL); @@ -379,7 +378,6 @@ oop StackWalk::walk(Handle stackStream, jlong mode, // Return normally return (oop)result.get_jobject(); - } // Walk the next batch of stack frames @@ -400,8 +398,8 @@ jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic, TRAPS) { JavaThread* jt = (JavaThread*)THREAD; - StackWalkAnchor* existing_anchor = StackWalkAnchor::from_current(jt, magic, frames_array); - if (existing_anchor == NULL) { + JavaFrameStream* existing_stream = JavaFrameStream::from_current(jt, magic, frames_array); + if (existing_stream == NULL) { THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers", 0L); } @@ -410,8 +408,8 @@ jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic, } if (TraceStackWalk) { - tty->print_cr("StackWalk::moreFrames frame_count %d existing_anchor " PTR_FORMAT " start %d frames %d", - frame_count, p2i(existing_anchor), start_index, frames_array->length()); + tty->print_cr("StackWalk::moreFrames frame_count %d existing_stream " PTR_FORMAT " start %d frames %d", + frame_count, p2i(existing_stream), start_index, frames_array->length()); } int end_index = start_index; if (frame_count <= 0) { @@ -421,12 +419,11 @@ jint StackWalk::moreFrames(Handle stackStream, jlong mode, jlong magic, int count = frame_count + start_index; assert (frames_array->length() >= count, "not enough space in buffers"); - StackWalkAnchor& anchor = (*existing_anchor); - vframeStream& vfst = anchor.vframe_stream(); - if (!vfst.at_end()) { - vfst.next(); // this was the last frame decoded in the previous batch - if (!vfst.at_end()) { - int n = fill_in_frames(mode, vfst, frame_count, start_index, + JavaFrameStream& stream = (*existing_stream); + if (!stream.at_end()) { + stream.next(); // advance past the last frame decoded in previous batch + if (!stream.at_end()) { + int n = fill_in_frames(mode, stream, frame_count, start_index, frames_array, end_index, CHECK_0); if (n < 1) { THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: later decode failed", 0L); diff --git a/hotspot/src/share/vm/prims/stackwalk.hpp b/hotspot/src/share/vm/prims/stackwalk.hpp index 2eb41aeb711..e222e623f6d 100644 --- a/hotspot/src/share/vm/prims/stackwalk.hpp +++ b/hotspot/src/share/vm/prims/stackwalk.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -29,21 +29,31 @@ #include "oops/oop.hpp" #include "runtime/vframe.hpp" -class StackWalkAnchor : public StackObj { +// +// JavaFrameStream is used by StackWalker to iterate through Java stack frames +// on the given JavaThread. +// +class JavaFrameStream : public StackObj { private: enum { magic_pos = 0 }; JavaThread* _thread; - vframeStream _vfst; + javaVFrame* _jvf; jlong _anchor; public: - StackWalkAnchor(JavaThread* thread) - : _thread(thread), _vfst(thread), _anchor(0L) {} + JavaFrameStream(JavaThread* thread, RegisterMap* rm) + : _thread(thread), _anchor(0L) { + _jvf = _thread->last_java_vframe(rm); + } - vframeStream& vframe_stream() { return _vfst; } - JavaThread* thread() { return _thread; } + javaVFrame* java_frame() { return _jvf; } + void next() { _jvf = _jvf->java_sender(); } + bool at_end() { return _jvf == NULL; } + + Method* method() { return _jvf->method(); } + int bci() { return _jvf->bci(); } void setup_magic_on_entry(objArrayHandle frames_array); bool check_magic(objArrayHandle frames_array); @@ -57,12 +67,12 @@ public: return (jlong) castable_address(this); } - static StackWalkAnchor* from_current(JavaThread* thread, jlong anchor, objArrayHandle frames_array); + static JavaFrameStream* from_current(JavaThread* thread, jlong magic, objArrayHandle frames_array); }; class StackWalk : public AllStatic { private: - static int fill_in_frames(jlong mode, vframeStream& vfst, + static int fill_in_frames(jlong mode, JavaFrameStream& stream, int max_nframes, int start_index, objArrayHandle frames_array, int& end_index, TRAPS); diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index 72226385d3e..71116760c07 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -131,38 +131,137 @@ jlong Unsafe_field_offset_from_byte_offset(jlong byte_offset) { } -///// Data in the Java heap. +///// Data read/writes on the Java heap and in native (off-heap) memory -#define truncate_jboolean(x) ((x) & 1) -#define truncate_jbyte(x) (x) -#define truncate_jshort(x) (x) -#define truncate_jchar(x) (x) -#define truncate_jint(x) (x) -#define truncate_jlong(x) (x) -#define truncate_jfloat(x) (x) -#define truncate_jdouble(x) (x) +/** + * Helper class for accessing memory. + * + * Normalizes values and wraps accesses in + * JavaThread::doing_unsafe_access() if needed. + */ +class MemoryAccess : StackObj { + JavaThread* _thread; + jobject _obj; + jlong _offset; -#define GET_FIELD(obj, offset, type_name, v) \ - oop p = JNIHandles::resolve(obj); \ - type_name v = *(type_name*)index_oop_from_field_offset_long(p, offset) + // Resolves and returns the address of the memory access + void* addr() { + return index_oop_from_field_offset_long(JNIHandles::resolve(_obj), _offset); + } -#define SET_FIELD(obj, offset, type_name, x) \ - oop p = JNIHandles::resolve(obj); \ - *(type_name*)index_oop_from_field_offset_long(p, offset) = truncate_##type_name(x) + template + T normalize(T x) { + return x; + } -#define GET_FIELD_VOLATILE(obj, offset, type_name, v) \ - oop p = JNIHandles::resolve(obj); \ - if (support_IRIW_for_not_multiple_copy_atomic_cpu) { \ - OrderAccess::fence(); \ - } \ - volatile type_name v = OrderAccess::load_acquire((volatile type_name*)index_oop_from_field_offset_long(p, offset)); + jboolean normalize(jboolean x) { + return x & 1; + } -#define SET_FIELD_VOLATILE(obj, offset, type_name, x) \ - oop p = JNIHandles::resolve(obj); \ - OrderAccess::release_store_fence((volatile type_name*)index_oop_from_field_offset_long(p, offset), truncate_##type_name(x)); + /** + * Helper class to wrap memory accesses in JavaThread::doing_unsafe_access() + */ + class GuardUnsafeAccess { + JavaThread* _thread; + bool _active; + + public: + GuardUnsafeAccess(JavaThread* thread, jobject _obj) : _thread(thread) { + if (JNIHandles::resolve(_obj) == NULL) { + // native/off-heap access which may raise SIGBUS if accessing + // memory mapped file data in a region of the file which has + // been truncated and is now invalid + _thread->set_doing_unsafe_access(true); + _active = true; + } else { + _active = false; + } + } + + ~GuardUnsafeAccess() { + if (_active) { + _thread->set_doing_unsafe_access(false); + } + } + }; + +public: + MemoryAccess(JavaThread* thread, jobject obj, jlong offset) + : _thread(thread), _obj(obj), _offset(offset) { + } + + template + T get() { + GuardUnsafeAccess guard(_thread, _obj); + + T* p = (T*)addr(); + + T x = *p; + + return x; + } + + template + void put(T x) { + GuardUnsafeAccess guard(_thread, _obj); + + T* p = (T*)addr(); + + *p = normalize(x); + } -// Get/SetObject must be special-cased, since it works with handles. + template + T get_volatile() { + GuardUnsafeAccess guard(_thread, _obj); + + T* p = (T*)addr(); + + if (support_IRIW_for_not_multiple_copy_atomic_cpu) { + OrderAccess::fence(); + } + + T x = OrderAccess::load_acquire((volatile T*)p); + + return x; + } + + template + void put_volatile(T x) { + GuardUnsafeAccess guard(_thread, _obj); + + T* p = (T*)addr(); + + OrderAccess::release_store_fence((volatile T*)p, normalize(x)); + } + + +#ifndef SUPPORTS_NATIVE_CX8 + jlong get_jlong_locked() { + GuardUnsafeAccess guard(_thread, _obj); + + MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag); + + jlong* p = (jlong*)addr(); + + jlong x = Atomic::load(p); + + return x; + } + + void put_jlong_locked(jlong x) { + GuardUnsafeAccess guard(_thread, _obj); + + MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag); + + jlong* p = (jlong*)addr(); + + Atomic::store(normalize(x), p); + } +#endif +}; + +// Get/PutObject must be special-cased, since it works with handles. // These functions allow a null base pointer with an arbitrary address. // But if the base pointer is non-null, the offset should make some sense. @@ -208,7 +307,7 @@ UNSAFE_ENTRY(jobject, Unsafe_GetObject(JNIEnv *env, jobject unsafe, jobject obj, return ret; } UNSAFE_END -UNSAFE_ENTRY(void, Unsafe_SetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) { +UNSAFE_ENTRY(void, Unsafe_PutObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) { oop x = JNIHandles::resolve(x_h); oop p = JNIHandles::resolve(obj); @@ -236,7 +335,7 @@ UNSAFE_ENTRY(jobject, Unsafe_GetObjectVolatile(JNIEnv *env, jobject unsafe, jobj return JNIHandles::make_local(env, v); } UNSAFE_END -UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) { +UNSAFE_ENTRY(void, Unsafe_PutObjectVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject x_h)) { oop x = JNIHandles::resolve(x_h); oop p = JNIHandles::resolve(obj); void* addr = index_oop_from_field_offset_long(p, offset); @@ -301,25 +400,17 @@ UNSAFE_ENTRY(jlong, Unsafe_GetKlassPointer(JNIEnv *env, jobject unsafe, jobject UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { if (VM_Version::supports_cx8()) { - GET_FIELD_VOLATILE(obj, offset, jlong, v); - return v; + return MemoryAccess(thread, obj, offset).get_volatile(); } else { - Handle p (THREAD, JNIHandles::resolve(obj)); - jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); - MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag); - jlong value = Atomic::load(addr); - return value; + return MemoryAccess(thread, obj, offset).get_jlong_locked(); } } UNSAFE_END -UNSAFE_ENTRY(void, Unsafe_SetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) { +UNSAFE_ENTRY(void, Unsafe_PutLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong x)) { if (VM_Version::supports_cx8()) { - SET_FIELD_VOLATILE(obj, offset, jlong, x); + MemoryAccess(thread, obj, offset).put_volatile(x); } else { - Handle p (THREAD, JNIHandles::resolve(obj)); - jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); - MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag); - Atomic::store(x, addr); + MemoryAccess(thread, obj, offset).put_jlong_locked(x); } } UNSAFE_END @@ -337,15 +428,14 @@ UNSAFE_LEAF(jint, Unsafe_unalignedAccess0(JNIEnv *env, jobject unsafe)) { return UseUnalignedAccesses; } UNSAFE_END -#define DEFINE_GETSETOOP(java_type, Type) \ +#define DEFINE_GETSETOOP(java_type, Type) \ \ UNSAFE_ENTRY(java_type, Unsafe_Get##Type(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { \ - GET_FIELD(obj, offset, java_type, v); \ - return v; \ + return MemoryAccess(thread, obj, offset).get(); \ } UNSAFE_END \ \ -UNSAFE_ENTRY(void, Unsafe_Set##Type(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \ - SET_FIELD(obj, offset, java_type, x); \ +UNSAFE_ENTRY(void, Unsafe_Put##Type(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \ + MemoryAccess(thread, obj, offset).put(x); \ } UNSAFE_END \ \ // END DEFINE_GETSETOOP. @@ -364,12 +454,11 @@ DEFINE_GETSETOOP(jdouble, Double); #define DEFINE_GETSETOOP_VOLATILE(java_type, Type) \ \ UNSAFE_ENTRY(java_type, Unsafe_Get##Type##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) { \ - GET_FIELD_VOLATILE(obj, offset, java_type, v); \ - return v; \ + return MemoryAccess(thread, obj, offset).get_volatile(); \ } UNSAFE_END \ \ -UNSAFE_ENTRY(void, Unsafe_Set##Type##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \ - SET_FIELD_VOLATILE(obj, offset, java_type, x); \ +UNSAFE_ENTRY(void, Unsafe_Put##Type##Volatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, java_type x)) { \ + MemoryAccess(thread, obj, offset).put_volatile(x); \ } UNSAFE_END \ \ // END DEFINE_GETSETOOP_VOLATILE. @@ -400,98 +489,6 @@ UNSAFE_LEAF(void, Unsafe_FullFence(JNIEnv *env, jobject unsafe)) { OrderAccess::fence(); } UNSAFE_END -////// Data in the C heap. - -// Note: These do not throw NullPointerException for bad pointers. -// They just crash. Only a oop base pointer can generate a NullPointerException. -// -#define DEFINE_GETSETNATIVE(java_type, Type, native_type) \ - \ -UNSAFE_ENTRY(java_type, Unsafe_GetNative##Type(JNIEnv *env, jobject unsafe, jlong addr)) { \ - void* p = addr_from_java(addr); \ - JavaThread* t = JavaThread::current(); \ - t->set_doing_unsafe_access(true); \ - java_type x = *(volatile native_type*)p; \ - t->set_doing_unsafe_access(false); \ - return x; \ -} UNSAFE_END \ - \ -UNSAFE_ENTRY(void, Unsafe_SetNative##Type(JNIEnv *env, jobject unsafe, jlong addr, java_type x)) { \ - JavaThread* t = JavaThread::current(); \ - t->set_doing_unsafe_access(true); \ - void* p = addr_from_java(addr); \ - *(volatile native_type*)p = x; \ - t->set_doing_unsafe_access(false); \ -} UNSAFE_END \ - \ -// END DEFINE_GETSETNATIVE. - -DEFINE_GETSETNATIVE(jbyte, Byte, signed char) -DEFINE_GETSETNATIVE(jshort, Short, signed short); -DEFINE_GETSETNATIVE(jchar, Char, unsigned short); -DEFINE_GETSETNATIVE(jint, Int, jint); -// no long -- handled specially -DEFINE_GETSETNATIVE(jfloat, Float, float); -DEFINE_GETSETNATIVE(jdouble, Double, double); - -#undef DEFINE_GETSETNATIVE - -UNSAFE_ENTRY(jlong, Unsafe_GetNativeLong(JNIEnv *env, jobject unsafe, jlong addr)) { - JavaThread* t = JavaThread::current(); - // We do it this way to avoid problems with access to heap using 64 - // bit loads, as jlong in heap could be not 64-bit aligned, and on - // some CPUs (SPARC) it leads to SIGBUS. - t->set_doing_unsafe_access(true); - void* p = addr_from_java(addr); - jlong x; - - if (is_ptr_aligned(p, sizeof(jlong)) == 0) { - // jlong is aligned, do a volatile access - x = *(volatile jlong*)p; - } else { - jlong_accessor acc; - acc.words[0] = ((volatile jint*)p)[0]; - acc.words[1] = ((volatile jint*)p)[1]; - x = acc.long_value; - } - - t->set_doing_unsafe_access(false); - - return x; -} UNSAFE_END - -UNSAFE_ENTRY(void, Unsafe_SetNativeLong(JNIEnv *env, jobject unsafe, jlong addr, jlong x)) { - JavaThread* t = JavaThread::current(); - // see comment for Unsafe_GetNativeLong - t->set_doing_unsafe_access(true); - void* p = addr_from_java(addr); - - if (is_ptr_aligned(p, sizeof(jlong))) { - // jlong is aligned, do a volatile access - *(volatile jlong*)p = x; - } else { - jlong_accessor acc; - acc.long_value = x; - ((volatile jint*)p)[0] = acc.words[0]; - ((volatile jint*)p)[1] = acc.words[1]; - } - - t->set_doing_unsafe_access(false); -} UNSAFE_END - - -UNSAFE_LEAF(jlong, Unsafe_GetNativeAddress(JNIEnv *env, jobject unsafe, jlong addr)) { - void* p = addr_from_java(addr); - - return addr_to_java(*(void**)p); -} UNSAFE_END - -UNSAFE_LEAF(void, Unsafe_SetNativeAddress(JNIEnv *env, jobject unsafe, jlong addr, jlong x)) { - void* p = addr_from_java(addr); - *(void**)p = addr_from_java(x); -} UNSAFE_END - - ////// Allocation requests UNSAFE_ENTRY(jobject, Unsafe_AllocateInstance(JNIEnv *env, jobject unsafe, jclass cls)) { @@ -943,7 +940,7 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass0(JNIEnv *env, jobject unsafe, j // this point. The mirror and any instances of this class have to keep // it alive afterwards. if (anon_klass() != NULL) { - anon_klass->class_loader_data()->set_keep_alive(false); + anon_klass->class_loader_data()->dec_keep_alive(); } // let caller initialize it as needed... @@ -980,8 +977,8 @@ UNSAFE_ENTRY(jint, Unsafe_CompareAndExchangeInt(JNIEnv *env, jobject unsafe, job } UNSAFE_END UNSAFE_ENTRY(jlong, Unsafe_CompareAndExchangeLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) { - Handle p (THREAD, JNIHandles::resolve(obj)); - jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); + Handle p(THREAD, JNIHandles::resolve(obj)); + jlong* addr = (jlong*)index_oop_from_field_offset_long(p(), offset); #ifdef SUPPORTS_NATIVE_CX8 return (jlong)(Atomic::cmpxchg(x, addr, e)); @@ -1017,7 +1014,7 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe, UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) { oop p = JNIHandles::resolve(obj); - jint* addr = (jint *) index_oop_from_field_offset_long(p, offset); + jint* addr = (jint *)index_oop_from_field_offset_long(p, offset); return (jint)(Atomic::cmpxchg(x, addr, e)) == e; } UNSAFE_END @@ -1143,20 +1140,16 @@ UNSAFE_ENTRY(jint, Unsafe_GetLoadAverage0(JNIEnv *env, jobject unsafe, jdoubleAr #define DECLARE_GETPUTOOP(Type, Desc) \ {CC "get" #Type, CC "(" OBJ "J)" #Desc, FN_PTR(Unsafe_Get##Type)}, \ - {CC "put" #Type, CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Set##Type)}, \ + {CC "put" #Type, CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Put##Type)}, \ {CC "get" #Type "Volatile", CC "(" OBJ "J)" #Desc, FN_PTR(Unsafe_Get##Type##Volatile)}, \ - {CC "put" #Type "Volatile", CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Set##Type##Volatile)} + {CC "put" #Type "Volatile", CC "(" OBJ "J" #Desc ")V", FN_PTR(Unsafe_Put##Type##Volatile)} -#define DECLARE_GETPUTNATIVE(Byte, B) \ - {CC "get" #Byte, CC "(" ADR ")" #B, FN_PTR(Unsafe_GetNative##Byte)}, \ - {CC "put" #Byte, CC "(" ADR#B ")V", FN_PTR(Unsafe_SetNative##Byte)} - static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = { {CC "getObject", CC "(" OBJ "J)" OBJ "", FN_PTR(Unsafe_GetObject)}, - {CC "putObject", CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_SetObject)}, + {CC "putObject", CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutObject)}, {CC "getObjectVolatile",CC "(" OBJ "J)" OBJ "", FN_PTR(Unsafe_GetObjectVolatile)}, - {CC "putObjectVolatile",CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_SetObjectVolatile)}, + {CC "putObjectVolatile",CC "(" OBJ "J" OBJ ")V", FN_PTR(Unsafe_PutObjectVolatile)}, {CC "getUncompressedObject", CC "(" ADR ")" OBJ, FN_PTR(Unsafe_GetUncompressedObject)}, {CC "getJavaMirror", CC "(" ADR ")" CLS, FN_PTR(Unsafe_GetJavaMirror)}, @@ -1171,17 +1164,6 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = { DECLARE_GETPUTOOP(Float, F), DECLARE_GETPUTOOP(Double, D), - DECLARE_GETPUTNATIVE(Byte, B), - DECLARE_GETPUTNATIVE(Short, S), - DECLARE_GETPUTNATIVE(Char, C), - DECLARE_GETPUTNATIVE(Int, I), - DECLARE_GETPUTNATIVE(Long, J), - DECLARE_GETPUTNATIVE(Float, F), - DECLARE_GETPUTNATIVE(Double, D), - - {CC "getAddress", CC "(" ADR ")" ADR, FN_PTR(Unsafe_GetNativeAddress)}, - {CC "putAddress", CC "(" ADR "" ADR ")V", FN_PTR(Unsafe_SetNativeAddress)}, - {CC "allocateMemory0", CC "(J)" ADR, FN_PTR(Unsafe_AllocateMemory0)}, {CC "reallocateMemory0", CC "(" ADR "J)" ADR, FN_PTR(Unsafe_ReallocateMemory0)}, {CC "freeMemory0", CC "(" ADR ")V", FN_PTR(Unsafe_FreeMemory0)}, @@ -1239,7 +1221,6 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = { #undef DAC_Args #undef DECLARE_GETPUTOOP -#undef DECLARE_GETPUTNATIVE // This function is exported, used by NativeLookup. diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp index 88a732370f6..dc354b40ffb 100644 --- a/hotspot/src/share/vm/prims/whitebox.cpp +++ b/hotspot/src/share/vm/prims/whitebox.cpp @@ -38,6 +38,7 @@ #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "memory/oopFactory.hpp" #include "oops/constantPool.hpp" #include "oops/oop.inline.hpp" #include "prims/wbtestmethods/parserTests.hpp" @@ -374,6 +375,68 @@ WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env)) Handle h = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL); return JNIHandles::make_local(env, h()); WB_END + +class OldRegionsLivenessClosure: public HeapRegionClosure { + + private: + const int _liveness; + size_t _total_count; + size_t _total_memory; + size_t _total_memory_to_free; + + public: + OldRegionsLivenessClosure(int liveness) : + _liveness(liveness), + _total_count(0), + _total_memory(0), + _total_memory_to_free(0) { } + + size_t total_count() { return _total_count; } + size_t total_memory() { return _total_memory; } + size_t total_memory_to_free() { return _total_memory_to_free; } + + bool doHeapRegion(HeapRegion* r) { + if (r->is_old()) { + size_t prev_live = r->marked_bytes(); + size_t live = r->live_bytes(); + size_t size = r->used(); + size_t reg_size = HeapRegion::GrainBytes; + if (size > 0 && ((int)(live * 100 / size) < _liveness)) { + _total_memory += size; + ++_total_count; + if (size == reg_size) { + // we don't include non-full regions since they are unlikely included in mixed gc + // for testing purposes it's enough to have lowest estimation of total memory that is expected to be freed + _total_memory_to_free += size - prev_live; + } + } + } + return false; + } +}; + + +WB_ENTRY(jlongArray, WB_G1GetMixedGCInfo(JNIEnv* env, jobject o, jint liveness)) + if (!UseG1GC) { + THROW_MSG_NULL(vmSymbols::java_lang_RuntimeException(), "WB_G1GetMixedGCInfo: G1 is not enabled"); + } + if (liveness < 0) { + THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), "liveness value should be non-negative"); + } + + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + OldRegionsLivenessClosure rli(liveness); + g1h->heap_region_iterate(&rli); + + typeArrayOop result = oopFactory::new_longArray(3, CHECK_NULL); + result->long_at_put(0, rli.total_count()); + result->long_at_put(1, rli.total_memory()); + result->long_at_put(2, rli.total_memory_to_free()); + return (jlongArray) JNIHandles::make_local(env, result); +WB_END + + + #endif // INCLUDE_ALL_GCS #if INCLUDE_NMT @@ -483,9 +546,9 @@ class VM_WhiteBoxDeoptimizeFrames : public VM_WhiteBoxOperation { RegisterMap* reg_map = fst.register_map(); Deoptimization::deoptimize(t, *f, reg_map); if (_make_not_entrant) { - nmethod* nm = CodeCache::find_nmethod(f->pc()); - assert(nm != NULL, "sanity check"); - nm->make_not_entrant(); + CompiledMethod* cm = CodeCache::find_compiled(f->pc()); + assert(cm != NULL, "sanity check"); + cm->make_not_entrant(); } ++_result; } @@ -533,7 +596,7 @@ WB_ENTRY(jboolean, WB_IsMethodCompiled(JNIEnv* env, jobject o, jobject method, j CHECK_JNI_EXCEPTION_(env, JNI_FALSE); MutexLockerEx mu(Compile_lock); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); - nmethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code(); + CompiledMethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code(); if (code == NULL) { return JNI_FALSE; } @@ -589,7 +652,7 @@ WB_ENTRY(jint, WB_GetMethodCompilationLevel(JNIEnv* env, jobject o, jobject meth jmethodID jmid = reflected_method_to_jmid(thread, env, method); CHECK_JNI_EXCEPTION_(env, CompLevel_none); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); - nmethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code(); + CompiledMethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code(); return (code != NULL ? code->comp_level() : CompLevel_none); WB_END @@ -608,7 +671,7 @@ WB_ENTRY(jint, WB_GetMethodEntryBci(JNIEnv* env, jobject o, jobject method)) jmethodID jmid = reflected_method_to_jmid(thread, env, method); CHECK_JNI_EXCEPTION_(env, InvocationEntryBci); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); - nmethod* code = mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false); + CompiledMethod* code = mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false); return (code != NULL && code->is_osr_method() ? code->osr_entry_bci() : InvocationEntryBci); WB_END @@ -639,17 +702,27 @@ WB_ENTRY(jboolean, WB_TestSetForceInlineMethod(JNIEnv* env, jobject o, jobject m return result; WB_END -WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci)) - // Screen for unavailable/bad comp level - if (CompileBroker::compiler(comp_level) == NULL) { +bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) { + // Screen for unavailable/bad comp level or null method + if (method == NULL || comp_level > TieredStopAtLevel || + CompileBroker::compiler(comp_level) == NULL) { return false; } - jmethodID jmid = reflected_method_to_jmid(thread, env, method); - CHECK_JNI_EXCEPTION_(env, JNI_FALSE); - methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); - nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), "WhiteBox", THREAD); + methodHandle mh(THREAD, method); + nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), CompileTask::Reason_Whitebox, THREAD); MutexLockerEx mu(Compile_lock); return (mh->queued_for_compilation() || nm != NULL); +} + +WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci)) + jmethodID jmid = reflected_method_to_jmid(thread, env, method); + CHECK_JNI_EXCEPTION_(env, JNI_FALSE); + return WhiteBox::compile_method(Method::checked_resolve_jmethod_id(jmid), comp_level, bci, THREAD); +WB_END + +WB_ENTRY(jboolean, WB_EnqueueInitializerForCompilation(JNIEnv* env, jobject o, jclass klass, jint comp_level)) + instanceKlassHandle ikh(java_lang_Class::as_Klass(JNIHandles::resolve(klass))); + return WhiteBox::compile_method(ikh->class_initializer(), comp_level, InvocationEntryBci, THREAD); WB_END WB_ENTRY(jboolean, WB_ShouldPrintAssembly(JNIEnv* env, jobject o, jobject method, jint comp_level)) @@ -1083,7 +1156,7 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo jmethodID jmid = reflected_method_to_jmid(thread, env, method); CHECK_JNI_EXCEPTION_(env, NULL); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); - nmethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code(); + CompiledMethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code(); jobjectArray result = NULL; if (code == NULL) { return result; @@ -1482,7 +1555,7 @@ int WhiteBox::offset_for_field(const char* field_name, oop object, if (res == NULL) { tty->print_cr("Invalid layout of %s at %s", ik->external_name(), name_symbol->as_C_string()); - vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:classload=info to see the origin of the problem class"); + vm_exit_during_initialization("Invalid layout of preloaded class: use -Xlog:class+load=info to see the origin of the problem class"); } //fetch the field at the offset we've found @@ -1601,6 +1674,7 @@ static JNINativeMethod methods[] = { (void*)&WB_G1AuxiliaryMemoryUsage }, {CC"psVirtualSpaceAlignment",CC"()J", (void*)&WB_PSVirtualSpaceAlignment}, {CC"psHeapGenerationAlignment",CC"()J", (void*)&WB_PSHeapGenerationAlignment}, + {CC"g1GetMixedGCInfo", CC"(I)[J", (void*)&WB_G1GetMixedGCInfo }, #endif // INCLUDE_ALL_GCS #if INCLUDE_NMT {CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc }, @@ -1640,6 +1714,8 @@ static JNINativeMethod methods[] = { CC"(Ljava/lang/reflect/Executable;Z)Z", (void*)&WB_TestSetForceInlineMethod}, {CC"enqueueMethodForCompilation0", CC"(Ljava/lang/reflect/Executable;II)Z", (void*)&WB_EnqueueMethodForCompilation}, + {CC"enqueueInitializerForCompilation0", + CC"(Ljava/lang/Class;I)Z", (void*)&WB_EnqueueInitializerForCompilation}, {CC"clearMethodState0", CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState}, {CC"lockCompilation", CC"()V", (void*)&WB_LockCompilation}, diff --git a/hotspot/src/share/vm/prims/whitebox.hpp b/hotspot/src/share/vm/prims/whitebox.hpp index 3ebada8fe5e..6398b4ca0d9 100644 --- a/hotspot/src/share/vm/prims/whitebox.hpp +++ b/hotspot/src/share/vm/prims/whitebox.hpp @@ -77,6 +77,7 @@ class WhiteBox : public AllStatic { static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread, JNINativeMethod* method_array, int method_count); static void register_extended(JNIEnv* env, jclass wbclass, JavaThread* thread); + static bool compile_method(Method* method, int comp_level, int bci, Thread* THREAD); }; diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp index ad739cf05d6..f8f6a454548 100644 --- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp +++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp @@ -191,8 +191,8 @@ CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) { max_method = method; } else { // If a method has been stale for some time, remove it from the queue. - // Blocking tasks don't become stale - if (!task->is_blocking() && is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) { + // Blocking tasks and tasks submitted from whitebox API don't become stale + if (task->can_become_stale() && is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) { if (PrintTieredEvents) { print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level()); } @@ -491,12 +491,12 @@ CompLevel AdvancedThresholdPolicy::loop_event(Method* method, CompLevel cur_leve void AdvancedThresholdPolicy::submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) { int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count(); update_rate(os::javaTimeMillis(), mh()); - CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread); + CompileBroker::compile_method(mh, bci, level, mh, hot_count, CompileTask::Reason_Tiered, thread); } // Handle the invocation event. void AdvancedThresholdPolicy::method_invocation_event(const methodHandle& mh, const methodHandle& imh, - CompLevel level, nmethod* nm, JavaThread* thread) { + CompLevel level, CompiledMethod* nm, JavaThread* thread) { if (should_create_mdo(mh(), level)) { create_mdo(mh, thread); } @@ -511,7 +511,7 @@ void AdvancedThresholdPolicy::method_invocation_event(const methodHandle& mh, co // Handle the back branch event. Notice that we can compile the method // with a regular entry from here. void AdvancedThresholdPolicy::method_back_branch_event(const methodHandle& mh, const methodHandle& imh, - int bci, CompLevel level, nmethod* nm, JavaThread* thread) { + int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread) { if (should_create_mdo(mh(), level)) { create_mdo(mh, thread); } diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp index 2ae2ce9e151..0e8494fc020 100644 --- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp +++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -216,9 +216,9 @@ protected: virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread); // event() from SimpleThresholdPolicy would call these. virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee, - CompLevel level, nmethod* nm, JavaThread* thread); + CompLevel level, CompiledMethod* nm, JavaThread* thread); virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee, - int bci, CompLevel level, nmethod* nm, JavaThread* thread); + int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread); public: AdvancedThresholdPolicy() : _start_time(0) { } // Select task is called by CompileBroker. We should return a task or NULL. diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 8fb0519bb35..9395a5ccc49 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -42,6 +42,7 @@ #include "runtime/arguments.hpp" #include "runtime/arguments_ext.hpp" #include "runtime/commandLineFlagConstraintList.hpp" +#include "runtime/commandLineFlagWriteableList.hpp" #include "runtime/commandLineFlagRangeList.hpp" #include "runtime/globals.hpp" #include "runtime/globals_extension.hpp" @@ -410,23 +411,25 @@ static AliasedFlag const aliased_jvm_flags[] = { static AliasedLoggingFlag const aliased_logging_flags[] = { { "PrintCompressedOopsMode", LogLevel::Info, true, LOG_TAGS(gc, heap, coops) }, { "TraceBiasedLocking", LogLevel::Info, true, LOG_TAGS(biasedlocking) }, - { "TraceClassLoading", LogLevel::Info, true, LOG_TAGS(classload) }, - { "TraceClassLoadingPreorder", LogLevel::Debug, true, LOG_TAGS(classload, preorder) }, - { "TraceClassPaths", LogLevel::Info, true, LOG_TAGS(classpath) }, - { "TraceClassResolution", LogLevel::Debug, true, LOG_TAGS(classresolve) }, - { "TraceClassUnloading", LogLevel::Info, true, LOG_TAGS(classunload) }, + { "TraceClassLoading", LogLevel::Info, true, LOG_TAGS(class, load) }, + { "TraceClassLoadingPreorder", LogLevel::Debug, true, LOG_TAGS(class, preorder) }, + { "TraceClassPaths", LogLevel::Info, true, LOG_TAGS(class, path) }, + { "TraceClassResolution", LogLevel::Debug, true, LOG_TAGS(class, resolve) }, + { "TraceClassUnloading", LogLevel::Info, true, LOG_TAGS(class, unload) }, { "TraceExceptions", LogLevel::Info, true, LOG_TAGS(exceptions) }, - { "TraceLoaderConstraints", LogLevel::Info, true, LOG_TAGS(classload, constraints) }, + { "TraceLoaderConstraints", LogLevel::Info, true, LOG_TAGS(class, loader, constraints) }, { "TraceMonitorInflation", LogLevel::Debug, true, LOG_TAGS(monitorinflation) }, - { "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepointcleanup) }, + { "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepoint, cleanup) }, + { "TraceJVMTIObjectTagging", LogLevel::Debug, true, LOG_TAGS(jvmti, objecttagging) }, + { "TraceRedefineClasses", LogLevel::Info, false, LOG_TAGS(redefine, class) }, { NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG) } }; #ifndef PRODUCT // These options are removed in jdk9. Remove this code for jdk10. static AliasedFlag const removed_develop_logging_flags[] = { - { "TraceClassInitialization", "-Xlog:classinit" }, - { "TraceClassLoaderData", "-Xlog:classloaderdata" }, + { "TraceClassInitialization", "-Xlog:class+init" }, + { "TraceClassLoaderData", "-Xlog:class+loader+data" }, { "TraceDefaultMethods", "-Xlog:defaultmethods=debug" }, { "TraceItables", "-Xlog:itables=debug" }, { "TraceMonitorMismatch", "-Xlog:monitormismatch=info" }, @@ -578,8 +581,8 @@ static bool verify_special_jvm_flags() { } #endif -// Parses a memory size specification string. -static bool atomull(const char *s, julong* result) { +// Parses a size specification string. +bool Arguments::atojulong(const char *s, julong* result) { julong n = 0; int args_read = 0; bool is_hex = false; @@ -685,7 +688,7 @@ static bool set_numeric_flag(const char* name, char* value, Flag::Flags origin) return false; } - // Check the sign first since atomull() parses only unsigned values. + // Check the sign first since atojulong() parses only unsigned values. if (*value == '-') { if (!result->is_intx() && !result->is_int()) { return false; @@ -693,7 +696,7 @@ static bool set_numeric_flag(const char* name, char* value, Flag::Flags origin) value++; is_neg = true; } - if (!atomull(value, &v)) { + if (!Arguments::atojulong(value, &v)) { return false; } if (result->is_int()) { @@ -799,11 +802,13 @@ void log_deprecated_flag(const char* name, bool on, AliasedLoggingFlag alf) { int max_tags = sizeof(tagSet)/sizeof(tagSet[0]); for (int i = 0; i < max_tags && tagSet[i] != LogTag::__NO_TAG; i++) { if (i > 0) { - strncat(tagset_buffer, ",", max_tagset_len - strlen(tagset_buffer)); + strncat(tagset_buffer, "+", max_tagset_len - strlen(tagset_buffer)); } strncat(tagset_buffer, LogTag::name(tagSet[i]), max_tagset_len - strlen(tagset_buffer)); } - + if (!alf.exactMatch) { + strncat(tagset_buffer, "*", max_tagset_len - strlen(tagset_buffer)); + } log_warning(arguments)("-XX:%s%s is deprecated. Will use -Xlog:%s=%s instead.", (on) ? "+" : "-", name, @@ -864,6 +869,11 @@ bool Arguments::parse_argument(const char* arg, Flag::Flags origin) { Flag* flag; // this scanf pattern matches both strings (handled here) and numbers (handled later)) + AliasedLoggingFlag alf = catch_logging_aliases(name, true); + if (alf.alias_name != NULL) { + LogConfiguration::configure_stdout(alf.level, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5); + return true; + } real_name = handle_aliases_and_deprecation(name, warn_if_deprecated); if (real_name == NULL) { return false; @@ -1916,6 +1926,28 @@ void Arguments::set_g1_gc_flags() { FLAG_SET_DEFAULT(GCTimeRatio, 12); } + // Below, we might need to calculate the pause time interval based on + // the pause target. When we do so we are going to give G1 maximum + // flexibility and allow it to do pauses when it needs to. So, we'll + // arrange that the pause interval to be pause time target + 1 to + // ensure that a) the pause time target is maximized with respect to + // the pause interval and b) we maintain the invariant that pause + // time target < pause interval. If the user does not want this + // maximum flexibility, they will have to set the pause interval + // explicitly. + + if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) { + // The default pause time target in G1 is 200ms + FLAG_SET_DEFAULT(MaxGCPauseMillis, 200); + } + + // Then, if the interval parameter was not set, set it according to + // the pause time target (this will also deal with the case when the + // pause time target is the default value). + if (FLAG_IS_DEFAULT(GCPauseIntervalMillis)) { + FLAG_SET_DEFAULT(GCPauseIntervalMillis, MaxGCPauseMillis + 1); + } + log_trace(gc)("MarkStackSize: %uk MarkStackSizeMax: %uk", (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K)); log_trace(gc)("ConcGCThreads: %u", ConcGCThreads); } @@ -2420,6 +2452,20 @@ bool Arguments::check_vm_args_consistency() { } FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); } + if (UseCompiler && is_interpreter_only()) { + if (!FLAG_IS_DEFAULT(UseCompiler)) { + warning("UseCompiler disabled due to -Xint."); + } + FLAG_SET_CMDLINE(bool, UseCompiler, false); + } +#ifdef COMPILER2 + if (PostLoopMultiversioning && !RangeCheckElimination) { + if (!FLAG_IS_DEFAULT(PostLoopMultiversioning)) { + warning("PostLoopMultiversioning disabled because RangeCheckElimination is disabled."); + } + FLAG_SET_CMDLINE(bool, PostLoopMultiversioning, false); + } +#endif return status; } @@ -2457,12 +2503,12 @@ bool Arguments::parse_uintx(const char* value, uintx* uintx_arg, uintx min_size) { - // Check the sign first since atomull() parses only unsigned values. + // Check the sign first since atojulong() parses only unsigned values. bool value_is_positive = !(*value == '-'); if (value_is_positive) { julong n; - bool good_return = atomull(value, &n); + bool good_return = atojulong(value, &n); if (good_return) { bool above_minimum = n >= min_size; bool value_is_too_large = n > max_uintx; @@ -2479,7 +2525,7 @@ bool Arguments::parse_uintx(const char* value, Arguments::ArgsRange Arguments::parse_memory_size(const char* s, julong* long_arg, julong min_size) { - if (!atomull(s, long_arg)) return arg_unreadable; + if (!atojulong(s, long_arg)) return arg_unreadable; return check_memory_size(*long_arg, min_size); } @@ -2602,8 +2648,8 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_ // -verbose:[class/gc/jni] if (match_option(option, "-verbose", &tail)) { if (!strcmp(tail, ":class") || !strcmp(tail, "")) { - LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(classload)); - LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(classunload)); + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, load)); + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, unload)); } else if (!strcmp(tail, ":gc")) { LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); } else if (!strcmp(tail, ":jni")) { @@ -3236,7 +3282,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_ // PrintSharedArchiveAndExit will turn on // -Xshare:on - // -Xlog:classpath=info + // -Xlog:class+path=info if (PrintSharedArchiveAndExit) { if (FLAG_SET_CMDLINE(bool, UseSharedSpaces, true) != Flag::SUCCESS) { return JNI_EINVAL; @@ -3244,7 +3290,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* xpatch_ if (FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true) != Flag::SUCCESS) { return JNI_EINVAL; } - LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(classpath)); + LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, path)); } // Change the default value for flags which have different default values @@ -4036,9 +4082,10 @@ bool Arguments::handle_deprecated_print_gc_flags() { jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) { assert(verify_special_jvm_flags(), "deprecated and obsolete flag table inconsistent"); - // Initialize ranges and constraints + // Initialize ranges, constraints and writeables CommandLineFlagRangeList::init(); CommandLineFlagConstraintList::init(); + CommandLineFlagWriteableList::init(); // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. const char* hotspotrc = ".hotspotrc"; @@ -4314,6 +4361,11 @@ jint Arguments::apply_ergo() { warning("Setting CompressedClassSpaceSize has no effect when compressed class pointers are not used"); } + if (UseOnStackReplacement && !UseLoopCounter) { + warning("On-stack-replacement requires loop counters; enabling loop counters"); + FLAG_SET_DEFAULT(UseLoopCounter, true); + } + #ifndef PRODUCT if (!LogVMOutput && FLAG_IS_DEFAULT(LogVMOutput)) { if (use_vm_log()) { diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index 9fd8ae093b2..8c8399d56ea 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -769,6 +769,8 @@ class Arguments : AllStatic { static bool copy_expand_pid(const char* src, size_t srclen, char* buf, size_t buflen); static void check_unsupported_dumping_properties() NOT_CDS_RETURN; + + static bool atojulong(const char *s, julong* result); }; // Disable options not supported in this release, with a warning if they diff --git a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp index c79a48c9700..27d7a3291ba 100644 --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintList.cpp @@ -217,7 +217,7 @@ void emit_constraint_double(const char* name, CommandLineFlagConstraintFunc_doub #define EMIT_CONSTRAINT_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_constraint_##type(#name // Generate func argument to pass into emit_constraint_xxx functions -#define EMIT_CONSTRAINT_CHECK(func, type) , func, CommandLineFlagConstraint::type +#define EMIT_CONSTRAINT_CHECK(func, type) , func, CommandLineFlagConstraint::type // the "name" argument must be a string literal #define INITIAL_CONSTRAINTS_SIZE 72 @@ -239,7 +239,8 @@ void CommandLineFlagConstraintList::init(void) { EMIT_CONSTRAINT_PRODUCT_RW_FLAG, EMIT_CONSTRAINT_LP64_PRODUCT_FLAG, IGNORE_RANGE, - EMIT_CONSTRAINT_CHECK)); + EMIT_CONSTRAINT_CHECK, + IGNORE_WRITEABLE)); EMIT_CONSTRAINTS_FOR_GLOBALS_EXT @@ -249,7 +250,8 @@ void CommandLineFlagConstraintList::init(void) { EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, EMIT_CONSTRAINT_NOTPRODUCT_FLAG, IGNORE_RANGE, - EMIT_CONSTRAINT_CHECK)); + EMIT_CONSTRAINT_CHECK, + IGNORE_WRITEABLE)); #ifdef COMPILER1 @@ -260,7 +262,8 @@ void CommandLineFlagConstraintList::init(void) { EMIT_CONSTRAINT_DIAGNOSTIC_FLAG, EMIT_CONSTRAINT_NOTPRODUCT_FLAG, IGNORE_RANGE, - EMIT_CONSTRAINT_CHECK)); + EMIT_CONSTRAINT_CHECK, + IGNORE_WRITEABLE)); #endif // COMPILER1 #ifdef COMPILER2 @@ -272,7 +275,8 @@ void CommandLineFlagConstraintList::init(void) { EMIT_CONSTRAINT_EXPERIMENTAL_FLAG, EMIT_CONSTRAINT_NOTPRODUCT_FLAG, IGNORE_RANGE, - EMIT_CONSTRAINT_CHECK)); + EMIT_CONSTRAINT_CHECK, + IGNORE_WRITEABLE)); #endif // COMPILER2 #if INCLUDE_ALL_GCS @@ -286,7 +290,8 @@ void CommandLineFlagConstraintList::init(void) { EMIT_CONSTRAINT_MANAGEABLE_FLAG, EMIT_CONSTRAINT_PRODUCT_RW_FLAG, IGNORE_RANGE, - EMIT_CONSTRAINT_CHECK)); + EMIT_CONSTRAINT_CHECK, + IGNORE_WRITEABLE)); #endif // INCLUDE_ALL_GCS } diff --git a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp index bfadc319516..f3ab445a2a8 100644 --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp @@ -90,16 +90,29 @@ Flag::Error CICompilerCountConstraintFunc(intx value, bool verbose) { } Flag::Error AllocatePrefetchDistanceConstraintFunc(intx value, bool verbose) { - if (value < 0) { + if (value < 0 || value > 512) { CommandLineError::print(verbose, - "Unable to determine system-specific value for AllocatePrefetchDistance. " - "Please provide appropriate value, if unsure, use 0 to disable prefetching\n"); + "AllocatePrefetchDistance (" INTX_FORMAT ") must be " + "between 0 and " INTX_FORMAT "\n", + AllocatePrefetchDistance, 512); return Flag::VIOLATES_CONSTRAINT; } return Flag::SUCCESS; } +Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) { + if (AllocatePrefetchStyle == 3) { + if (value % wordSize != 0) { + CommandLineError::print(verbose, + "AllocatePrefetchStepSize (" INTX_FORMAT ") must be multiple of %d\n", + value, wordSize); + return Flag::VIOLATES_CONSTRAINT; + } + } + return Flag::SUCCESS; +} + Flag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) { intx max_value = max_intx; #if defined(SPARC) @@ -117,49 +130,6 @@ Flag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) { return Flag::SUCCESS; } -Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) { - intx max_value = 512; - if (value < 1 || value > max_value) { - CommandLineError::print(verbose, - "AllocatePrefetchStepSize (" INTX_FORMAT ") " - "must be between 1 and %d\n", - AllocatePrefetchStepSize, - max_value); - return Flag::VIOLATES_CONSTRAINT; - } - - if (AllocatePrefetchDistance % AllocatePrefetchStepSize != 0) { - CommandLineError::print(verbose, - "AllocatePrefetchDistance (" INTX_FORMAT ") " - "%% AllocatePrefetchStepSize (" INTX_FORMAT ") " - "= " INTX_FORMAT " " - "must be 0\n", - AllocatePrefetchDistance, AllocatePrefetchStepSize, - AllocatePrefetchDistance % AllocatePrefetchStepSize); - return Flag::VIOLATES_CONSTRAINT; - } - - /* The limit of 64 for the quotient of AllocatePrefetchDistance and AllocatePrefetchSize - * originates from the limit of 64 for AllocatePrefetchLines/AllocateInstancePrefetchLines. - * If AllocatePrefetchStyle == 2, the quotient from above is used in PhaseMacroExpand::prefetch_allocation() - * to determine the number of lines to prefetch. For other values of AllocatePrefetchStyle, - * AllocatePrefetchDistance and AllocatePrefetchSize is used. For consistency, all these - * quantities must have the same limit (64 in this case). - */ - if (AllocatePrefetchDistance / AllocatePrefetchStepSize > 64) { - CommandLineError::print(verbose, - "AllocatePrefetchDistance (" INTX_FORMAT ") too large or " - "AllocatePrefetchStepSize (" INTX_FORMAT ") too small; " - "try decreasing/increasing values so that " - "AllocatePrefetchDistance / AllocatePrefetchStepSize <= 64\n", - AllocatePrefetchDistance, AllocatePrefetchStepSize, - AllocatePrefetchDistance % AllocatePrefetchStepSize); - return Flag::VIOLATES_CONSTRAINT; - } - - return Flag::SUCCESS; -} - Flag::Error CompileThresholdConstraintFunc(intx value, bool verbose) { if (value < 0 || value > INT_MAX >> InvocationCounter::count_shift) { CommandLineError::print(verbose, diff --git a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp index 5dce24113af..5d14ef7dab2 100644 --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp @@ -312,20 +312,6 @@ Flag::Error G1RSetSparseRegionEntriesConstraintFunc(intx value, bool verbose) { } } -Flag::Error G1YoungSurvRateNumRegionsSummaryConstraintFunc(intx value, bool verbose) { - if (!UseG1GC) return Flag::SUCCESS; - - if (value > (intx)HeapRegionBounds::target_number()) { - CommandLineError::print(verbose, - "G1YoungSurvRateNumRegionsSummary (" INTX_FORMAT ") must be " - "less than or equal to region count (" SIZE_FORMAT ")\n", - value, HeapRegionBounds::target_number()); - return Flag::VIOLATES_CONSTRAINT; - } else { - return Flag::SUCCESS; - } -} - Flag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose) { if (!UseG1GC) return Flag::SUCCESS; @@ -599,6 +585,14 @@ Flag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) { value); return Flag::VIOLATES_CONSTRAINT; } + + if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) { + CommandLineError::print(verbose, + "GCPauseIntervalMillis cannot be set " + "without setting MaxGCPauseMillis\n"); + return Flag::VIOLATES_CONSTRAINT; + } + if (value <= MaxGCPauseMillis) { CommandLineError::print(verbose, "GCPauseIntervalMillis (" UINTX_FORMAT ") must be " diff --git a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp index 9470a1c4ec4..1582ad0d55b 100644 --- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp +++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp @@ -49,7 +49,6 @@ Flag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose); #if INCLUDE_ALL_GCS Flag::Error G1RSetRegionEntriesConstraintFunc(intx value, bool verbose); Flag::Error G1RSetSparseRegionEntriesConstraintFunc(intx value, bool verbose); -Flag::Error G1YoungSurvRateNumRegionsSummaryConstraintFunc(intx value, bool verbose); Flag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose); Flag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose); Flag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose); diff --git a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp index 89acace33f7..ba9d8f11358 100644 --- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp +++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp @@ -305,7 +305,8 @@ void CommandLineFlagRangeList::init(void) { EMIT_RANGE_PRODUCT_RW_FLAG, EMIT_RANGE_LP64_PRODUCT_FLAG, EMIT_RANGE_CHECK, - IGNORE_CONSTRAINT) ); + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE)); EMIT_RANGES_FOR_GLOBALS_EXT @@ -315,7 +316,8 @@ void CommandLineFlagRangeList::init(void) { EMIT_RANGE_EXPERIMENTAL_FLAG, EMIT_RANGE_NOTPRODUCT_FLAG, EMIT_RANGE_CHECK, - IGNORE_CONSTRAINT)); + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE)); #if INCLUDE_JVMCI emit_range_no(NULL JVMCI_FLAGS(EMIT_RANGE_DEVELOPER_FLAG, @@ -326,7 +328,8 @@ void CommandLineFlagRangeList::init(void) { EMIT_RANGE_EXPERIMENTAL_FLAG, EMIT_RANGE_NOTPRODUCT_FLAG, EMIT_RANGE_CHECK, - IGNORE_CONSTRAINT)); + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE)); #endif // INCLUDE_JVMCI #ifdef COMPILER1 @@ -337,7 +340,8 @@ void CommandLineFlagRangeList::init(void) { EMIT_RANGE_DIAGNOSTIC_FLAG, EMIT_RANGE_NOTPRODUCT_FLAG, EMIT_RANGE_CHECK, - IGNORE_CONSTRAINT)); + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE)); #endif // COMPILER1 #ifdef COMPILER2 @@ -349,7 +353,8 @@ void CommandLineFlagRangeList::init(void) { EMIT_RANGE_EXPERIMENTAL_FLAG, EMIT_RANGE_NOTPRODUCT_FLAG, EMIT_RANGE_CHECK, - IGNORE_CONSTRAINT)); + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE)); #endif // COMPILER2 #if INCLUDE_ALL_GCS @@ -363,7 +368,8 @@ void CommandLineFlagRangeList::init(void) { EMIT_RANGE_MANAGEABLE_FLAG, EMIT_RANGE_PRODUCT_RW_FLAG, EMIT_RANGE_CHECK, - IGNORE_CONSTRAINT)); + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE)); #endif // INCLUDE_ALL_GCS } diff --git a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp index bc299d4f2a5..6531da66008 100644 --- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp +++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.hpp @@ -66,7 +66,6 @@ class CommandLineFlagRangeList : public AllStatic { static GrowableArray* _ranges; public: static void init(); - static void add_globals_ext(); static int length() { return (_ranges != NULL) ? _ranges->length() : 0; } static CommandLineFlagRange* at(int i) { return (_ranges != NULL) ? _ranges->at(i) : NULL; } static CommandLineFlagRange* find(const char* name); diff --git a/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.cpp b/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.cpp new file mode 100644 index 00000000000..51b0117d8d7 --- /dev/null +++ b/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.cpp @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2015, 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. + * + */ + +#include "precompiled.hpp" +#include "runtime/commandLineFlagWriteableList.hpp" +#include "runtime/os.hpp" +#if INCLUDE_ALL_GCS +#include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" +#include "gc/g1/g1_globals.hpp" +#include "gc/g1/heapRegionBounds.inline.hpp" +#include "gc/shared/plab.hpp" +#endif // INCLUDE_ALL_GCS +#ifdef COMPILER1 +#include "c1/c1_globals.hpp" +#endif // COMPILER1 +#ifdef COMPILER2 +#include "opto/c2_globals.hpp" +#endif // COMPILER2 +#if INCLUDE_JVMCI +#include "jvmci/jvmci_globals.hpp" +#endif + +bool CommandLineFlagWriteable::is_writeable(void) { + return _writeable; +} + +void CommandLineFlagWriteable::mark_once(void) { + if (_type == Once) { + _writeable = false; + } +} + +void CommandLineFlagWriteable::mark_startup(void) { + if (_type == CommandLineFlagWriteable::CommandLineOnly) { + _writeable = false; + } +} + +// No control emitting +void emit_writeable_no(...) { /* NOP */ } + +// No control emitting if type argument is NOT provided +void emit_writeable_bool(const char* /*name*/) { /* NOP */ } +void emit_writeable_ccstr(const char* /*name*/) { /* NOP */ } +void emit_writeable_ccstrlist(const char* /*name*/) { /* NOP */ } +void emit_writeable_int(const char* /*name*/) { /* NOP */ } +void emit_writeable_intx(const char* /*name*/) { /* NOP */ } +void emit_writeable_uint(const char* /*name*/) { /* NOP */ } +void emit_writeable_uintx(const char* /*name*/) { /* NOP */ } +void emit_writeable_uint64_t(const char* /*name*/) { /* NOP */ } +void emit_writeable_size_t(const char* /*name*/) { /* NOP */ } +void emit_writeable_double(const char* /*name*/) { /* NOP */ } + +// CommandLineFlagWriteable emitting code functions if range arguments are provided +void emit_writeable_bool(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} +void emit_writeable_int(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} +void emit_writeable_intx(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} +void emit_writeable_uint(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} +void emit_writeable_uintx(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} +void emit_writeable_uint64_t(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} +void emit_writeable_size_t(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} +void emit_writeable_double(const char* name, CommandLineFlagWriteable::WriteableType type) { + CommandLineFlagWriteableList::add(new CommandLineFlagWriteable(name, type)); +} + +// Generate code to call emit_writeable_xxx function +#define EMIT_WRITEABLE_PRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_COMMERCIAL_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_DIAGNOSTIC_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_EXPERIMENTAL_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_MANAGEABLE_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_PRODUCT_RW_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_PD_PRODUCT_FLAG(type, name, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_DEVELOPER_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_PD_DEVELOPER_FLAG(type, name, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_NOTPRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name +#define EMIT_WRITEABLE_LP64_PRODUCT_FLAG(type, name, value, doc) ); emit_writeable_##type(#name + +// Generate type argument to pass into emit_writeable_xxx functions +#define EMIT_WRITEABLE(a) , CommandLineFlagWriteable::a + +#define INITIAL_WRITEABLES_SIZE 2 +GrowableArray* CommandLineFlagWriteableList::_controls = NULL; + +void CommandLineFlagWriteableList::init(void) { + + _controls = new (ResourceObj::C_HEAP, mtArguments) GrowableArray(INITIAL_WRITEABLES_SIZE, true); + + emit_writeable_no(NULL RUNTIME_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, + EMIT_WRITEABLE_PD_DEVELOPER_FLAG, + EMIT_WRITEABLE_PRODUCT_FLAG, + EMIT_WRITEABLE_PD_PRODUCT_FLAG, + EMIT_WRITEABLE_DIAGNOSTIC_FLAG, + EMIT_WRITEABLE_EXPERIMENTAL_FLAG, + EMIT_WRITEABLE_NOTPRODUCT_FLAG, + EMIT_WRITEABLE_MANAGEABLE_FLAG, + EMIT_WRITEABLE_PRODUCT_RW_FLAG, + EMIT_WRITEABLE_LP64_PRODUCT_FLAG, + IGNORE_RANGE, + IGNORE_CONSTRAINT, + EMIT_WRITEABLE)); + + EMIT_WRITEABLES_FOR_GLOBALS_EXT + + emit_writeable_no(NULL ARCH_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, + EMIT_WRITEABLE_PRODUCT_FLAG, + EMIT_WRITEABLE_DIAGNOSTIC_FLAG, + EMIT_WRITEABLE_EXPERIMENTAL_FLAG, + EMIT_WRITEABLE_NOTPRODUCT_FLAG, + IGNORE_RANGE, + IGNORE_CONSTRAINT, + EMIT_WRITEABLE)); + +#if INCLUDE_JVMCI + emit_writeable_no(NULL JVMCI_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, + EMIT_WRITEABLE_PD_DEVELOPER_FLAG, + EMIT_WRITEABLE_PRODUCT_FLAG, + EMIT_WRITEABLE_PD_PRODUCT_FLAG, + EMIT_WRITEABLE_DIAGNOSTIC_FLAG, + EMIT_WRITEABLE_EXPERIMENTAL_FLAG, + EMIT_WRITEABLE_NOTPRODUCT_FLAG, + IGNORE_RANGE, + IGNORE_CONSTRAINT, + EMIT_WRITEABLE)); +#endif // INCLUDE_JVMCI + +#ifdef COMPILER1 + emit_writeable_no(NULL C1_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, + EMIT_WRITEABLE_PD_DEVELOPER_FLAG, + EMIT_WRITEABLE_PRODUCT_FLAG, + EMIT_WRITEABLE_PD_PRODUCT_FLAG, + EMIT_WRITEABLE_DIAGNOSTIC_FLAG, + EMIT_WRITEABLE_NOTPRODUCT_FLAG, + IGNORE_RANGE, + IGNORE_CONSTRAINT, + EMIT_WRITEABLE)); +#endif // COMPILER1 + +#ifdef COMPILER2 + emit_writeable_no(NULL C2_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, + EMIT_WRITEABLE_PD_DEVELOPER_FLAG, + EMIT_WRITEABLE_PRODUCT_FLAG, + EMIT_WRITEABLE_PD_PRODUCT_FLAG, + EMIT_WRITEABLE_DIAGNOSTIC_FLAG, + EMIT_WRITEABLE_EXPERIMENTAL_FLAG, + EMIT_WRITEABLE_NOTPRODUCT_FLAG, + IGNORE_RANGE, + IGNORE_CONSTRAINT, + EMIT_WRITEABLE)); +#endif // COMPILER2 + +#if INCLUDE_ALL_GCS + emit_writeable_no(NULL G1_FLAGS(EMIT_WRITEABLE_DEVELOPER_FLAG, + EMIT_WRITEABLE_PD_DEVELOPER_FLAG, + EMIT_WRITEABLE_PRODUCT_FLAG, + EMIT_WRITEABLE_PD_PRODUCT_FLAG, + EMIT_WRITEABLE_DIAGNOSTIC_FLAG, + EMIT_WRITEABLE_EXPERIMENTAL_FLAG, + EMIT_WRITEABLE_NOTPRODUCT_FLAG, + EMIT_WRITEABLE_MANAGEABLE_FLAG, + EMIT_WRITEABLE_PRODUCT_RW_FLAG, + IGNORE_RANGE, + IGNORE_CONSTRAINT, + EMIT_WRITEABLE)); +#endif // INCLUDE_ALL_GCS +} + +CommandLineFlagWriteable* CommandLineFlagWriteableList::find(const char* name) { + CommandLineFlagWriteable* found = NULL; + for (int i=0; iname(), name) == 0) { + found = writeable; + break; + } + } + return found; +} + +void CommandLineFlagWriteableList::mark_startup(void) { + for (int i=0; imark_startup(); + } +} diff --git a/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.hpp b/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.hpp new file mode 100644 index 00000000000..84220851fb2 --- /dev/null +++ b/hotspot/src/share/vm/runtime/commandLineFlagWriteableList.hpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2015, 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. + * + */ + +#ifndef SHARE_VM_RUNTIME_COMMANDLINEFLAGWRITEABLE_HPP +#define SHARE_VM_RUNTIME_COMMANDLINEFLAGWRITEABLE_HPP + +#include "runtime/globals.hpp" +#include "utilities/growableArray.hpp" + +class CommandLineFlagWriteable : public CHeapObj { +public: + enum WriteableType { + // can be set without any limits + Always = 0, + // can only be set once, either via command lines or during runtime + Once = 1, + // can only be set on command line (multiple times allowed) + CommandLineOnly = 2 + }; +private: + const char* _name; + WriteableType _type; + bool _writeable; + bool _startup_done; +public: + // the "name" argument must be a string literal + CommandLineFlagWriteable(const char* name, WriteableType type) { _name=name; _type=type; _writeable=true; _startup_done=false; } + ~CommandLineFlagWriteable() {} + const char* name() { return _name; } + const WriteableType type() { return _type; } + bool is_writeable(void); + void mark_once(void); + void mark_startup(void); +}; + +class CommandLineFlagWriteableList : public AllStatic { + static GrowableArray* _controls; +public: + static void init(); + static int length() { return (_controls != NULL) ? _controls->length() : 0; } + static CommandLineFlagWriteable* at(int i) { return (_controls != NULL) ? _controls->at(i) : NULL; } + static CommandLineFlagWriteable* find(const char* name); + static void add(CommandLineFlagWriteable* range) { _controls->append(range); } + static void mark_startup(void); +}; + +#endif // SHARE_VM_RUNTIME_COMMANDLINEFLAGWRITEABLE_HPP diff --git a/hotspot/src/share/vm/runtime/compilationPolicy.cpp b/hotspot/src/share/vm/runtime/compilationPolicy.cpp index 3538f3d17a1..7333d0d1327 100644 --- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp +++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp @@ -107,6 +107,33 @@ bool CompilationPolicy::must_be_compiled(methodHandle m, int comp_level) { (UseCompiler && AlwaysCompileLoopMethods && m->has_loops() && CompileBroker::should_compile_new_jobs()); // eagerly compile loop methods } +void CompilationPolicy::compile_if_required(methodHandle selected_method, TRAPS) { + if (must_be_compiled(selected_method)) { + // This path is unusual, mostly used by the '-Xcomp' stress test mode. + + // Note: with several active threads, the must_be_compiled may be true + // while can_be_compiled is false; remove assert + // assert(CompilationPolicy::can_be_compiled(selected_method), "cannot compile"); + if (!THREAD->can_call_java() || THREAD->is_Compiler_thread()) { + // don't force compilation, resolve was on behalf of compiler + return; + } + if (selected_method->method_holder()->is_not_initialized()) { + // 'is_not_initialized' means not only '!is_initialized', but also that + // initialization has not been started yet ('!being_initialized') + // Do not force compilation of methods in uninitialized classes. + // Note that doing this would throw an assert later, + // in CompileBroker::compile_method. + // We sometimes use the link resolver to do reflective lookups + // even before classes are initialized. + return; + } + CompileBroker::compile_method(selected_method, InvocationEntryBci, + CompilationPolicy::policy()->initial_compile_level(), + methodHandle(), 0, CompileTask::Reason_MustBeCompiled, CHECK); + } +} + // Returns true if m is allowed to be compiled bool CompilationPolicy::can_be_compiled(methodHandle m, int comp_level) { // allow any levels for WhiteBox @@ -379,7 +406,7 @@ bool NonTieredCompPolicy::is_mature(Method* method) { } nmethod* NonTieredCompPolicy::event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, - int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) { + int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread) { assert(comp_level == CompLevel_none, "This should be only called from the interpreter"); NOT_PRODUCT(trace_frequency_counter_overflow(method, branch_bci, bci)); if (JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) { @@ -481,12 +508,11 @@ void SimpleCompPolicy::method_invocation_event(const methodHandle& m, JavaThread const int comp_level = CompLevel_highest_tier; const int hot_count = m->invocation_count(); reset_counter_for_invocation_event(m); - const char* comment = "count"; if (is_compilation_enabled() && can_be_compiled(m, comp_level)) { - nmethod* nm = m->code(); + CompiledMethod* nm = m->code(); if (nm == NULL ) { - CompileBroker::compile_method(m, InvocationEntryBci, comp_level, m, hot_count, comment, thread); + CompileBroker::compile_method(m, InvocationEntryBci, comp_level, m, hot_count, CompileTask::Reason_InvocationCount, thread); } } } @@ -494,10 +520,9 @@ void SimpleCompPolicy::method_invocation_event(const methodHandle& m, JavaThread void SimpleCompPolicy::method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread) { const int comp_level = CompLevel_highest_tier; const int hot_count = m->backedge_count(); - const char* comment = "backedge_count"; if (is_compilation_enabled() && can_be_osr_compiled(m, comp_level)) { - CompileBroker::compile_method(m, bci, comp_level, m, hot_count, comment, thread); + CompileBroker::compile_method(m, bci, comp_level, m, hot_count, CompileTask::Reason_BackedgeCount, thread); NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, comp_level, true));) } } @@ -512,7 +537,6 @@ void StackWalkCompPolicy::method_invocation_event(const methodHandle& m, JavaThr const int comp_level = CompLevel_highest_tier; const int hot_count = m->invocation_count(); reset_counter_for_invocation_event(m); - const char* comment = "count"; if (is_compilation_enabled() && m->code() == NULL && can_be_compiled(m, comp_level)) { ResourceMark rm(thread); @@ -542,7 +566,7 @@ void StackWalkCompPolicy::method_invocation_event(const methodHandle& m, JavaThr assert(top != NULL, "findTopInlinableFrame returned null"); if (TraceCompilationPolicy) top->print(); CompileBroker::compile_method(top->top_method(), InvocationEntryBci, comp_level, - m, hot_count, comment, thread); + m, hot_count, CompileTask::Reason_InvocationCount, thread); } } } @@ -550,10 +574,9 @@ void StackWalkCompPolicy::method_invocation_event(const methodHandle& m, JavaThr void StackWalkCompPolicy::method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread) { const int comp_level = CompLevel_highest_tier; const int hot_count = m->backedge_count(); - const char* comment = "backedge_count"; if (is_compilation_enabled() && can_be_osr_compiled(m, comp_level)) { - CompileBroker::compile_method(m, bci, comp_level, m, hot_count, comment, thread); + CompileBroker::compile_method(m, bci, comp_level, m, hot_count, CompileTask::Reason_BackedgeCount, thread); NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, comp_level, true));) } } @@ -713,7 +736,7 @@ const char* StackWalkCompPolicy::shouldNotInline(const methodHandle& m) { // note: we allow ik->is_abstract() if (!m->method_holder()->is_initialized()) return (_msg = "method holder not initialized"); if (m->is_native()) return (_msg = "native method"); - nmethod* m_code = m->code(); + CompiledMethod* m_code = m->code(); if (m_code != NULL && m_code->code_size() > InlineSmallCode) return (_msg = "already compiled into a big method"); diff --git a/hotspot/src/share/vm/runtime/compilationPolicy.hpp b/hotspot/src/share/vm/runtime/compilationPolicy.hpp index ae2128adb30..84d7825e274 100644 --- a/hotspot/src/share/vm/runtime/compilationPolicy.hpp +++ b/hotspot/src/share/vm/runtime/compilationPolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -43,13 +43,19 @@ class CompilationPolicy : public CHeapObj { static elapsedTimer _accumulated_time; static bool _in_vm_startup; + + // m must be compiled before executing it + static bool must_be_compiled(methodHandle m, int comp_level = CompLevel_all); + public: static void set_in_vm_startup(bool in_vm_startup) { _in_vm_startup = in_vm_startup; } static void completed_vm_startup(); static bool delay_compilation_during_startup() { return _in_vm_startup; } - // m must be compiled before executing it - static bool must_be_compiled(methodHandle m, int comp_level = CompLevel_all); + // If m must_be_compiled then request a compilation from the CompileBroker. + // This supports the -Xcomp option. + static void compile_if_required(methodHandle m, TRAPS); + // m is allowed to be compiled static bool can_be_compiled(methodHandle m, int comp_level = CompLevel_all); // m is allowed to be osr compiled @@ -68,7 +74,7 @@ public: virtual int compiler_count(CompLevel comp_level) = 0; // main notification entry, return a pointer to an nmethod if the OSR is required, // returns NULL otherwise. - virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) = 0; + virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread) = 0; // safepoint() is called at the end of the safepoint virtual void do_safepoint_work() = 0; // reprofile request @@ -109,7 +115,7 @@ public: virtual bool is_mature(Method* method); virtual void initialize(); virtual CompileTask* select_task(CompileQueue* compile_queue); - virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread); + virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread); virtual void method_invocation_event(const methodHandle& m, JavaThread* thread) = 0; virtual void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread) = 0; }; diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp index d380bf6d518..f926b88eca8 100644 --- a/hotspot/src/share/vm/runtime/deoptimization.cpp +++ b/hotspot/src/share/vm/runtime/deoptimization.cpp @@ -168,9 +168,10 @@ Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread // Now get the deoptee with a valid map frame deoptee = stub_frame.sender(&map); // Set the deoptee nmethod - assert(thread->deopt_nmethod() == NULL, "Pending deopt!"); - thread->set_deopt_nmethod(deoptee.cb()->as_nmethod_or_null()); - bool skip_internal = thread->deopt_nmethod() != NULL && !thread->deopt_nmethod()->compiler()->is_jvmci(); + assert(thread->deopt_compiled_method() == NULL, "Pending deopt!"); + CompiledMethod* cm = deoptee.cb()->as_compiled_method_or_null(); + thread->set_deopt_compiled_method(cm); + bool skip_internal = (cm != NULL) && !cm->is_compiled_by_jvmci(); if (VerifyStack) { thread->validate_frame_layout(); @@ -548,7 +549,7 @@ void Deoptimization::cleanup_deopt_info(JavaThread *thread, delete thread->deopt_mark(); thread->set_deopt_mark(NULL); - thread->set_deopt_nmethod(NULL); + thread->set_deopt_compiled_method(NULL); if (JvmtiExport::can_pop_frame()) { @@ -762,7 +763,7 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m guarantee(false, "wrong number of expression stack elements during deopt"); } VerifyOopClosure verify; - iframe->oops_interpreted_do(&verify, NULL, &rm, false); + iframe->oops_interpreted_do(&verify, &rm, false); callee_size_of_parameters = mh->size_of_parameters(); callee_max_locals = mh->max_locals(); is_top_frame = false; @@ -1316,14 +1317,14 @@ void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr, Deopt gather_statistics(reason, Action_none, Bytecodes::_illegal); if (LogCompilation && xtty != NULL) { - nmethod* nm = fr.cb()->as_nmethod_or_null(); - assert(nm != NULL, "only compiled methods can deopt"); + CompiledMethod* cm = fr.cb()->as_compiled_method_or_null(); + assert(cm != NULL, "only compiled methods can deopt"); ttyLocker ttyl; - xtty->begin_head("deoptimized thread='" UINTX_FORMAT "'", (uintx)thread->osthread()->thread_id()); - nm->log_identity(xtty); + xtty->begin_head("deoptimized thread='" UINTX_FORMAT "' reason='%s' pc='" INTPTR_FORMAT "'",(uintx)thread->osthread()->thread_id(), trap_reason_name(reason), p2i(fr.pc())); + cm->log_identity(xtty); xtty->end_head(); - for (ScopeDesc* sd = nm->scope_desc_at(fr.pc()); ; sd = sd->sender()) { + for (ScopeDesc* sd = cm->scope_desc_at(fr.pc()); ; sd = sd->sender()) { xtty->begin_elem("jvms bci='%d'", sd->bci()); xtty->method(sd->method()); xtty->end_elem(); @@ -1504,7 +1505,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra vframe* vf = vframe::new_vframe(&fr, ®_map, thread); compiledVFrame* cvf = compiledVFrame::cast(vf); - nmethod* nm = cvf->code(); + CompiledMethod* nm = cvf->code(); ScopeDesc* trap_scope = cvf->scope(); @@ -1523,7 +1524,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra oop speculation = thread->pending_failed_speculation(); if (nm->is_compiled_by_jvmci()) { if (speculation != NULL) { - oop speculation_log = nm->speculation_log(); + oop speculation_log = nm->as_nmethod()->speculation_log(); if (speculation_log != NULL) { if (TraceDeoptimization || TraceUncollectedSpeculations) { if (HotSpotSpeculationLog::lastFailed(speculation_log) != NULL) { @@ -1639,19 +1640,21 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra nm->method()->print_short_name(tty); tty->print(" compiler=%s compile_id=%d", nm->compiler() == NULL ? "" : nm->compiler()->name(), nm->compile_id()); #if INCLUDE_JVMCI - oop installedCode = nm->jvmci_installed_code(); - if (installedCode != NULL) { - oop installedCodeName = NULL; - if (installedCode->is_a(InstalledCode::klass())) { - installedCodeName = InstalledCode::name(installedCode); + if (nm->is_nmethod()) { + oop installedCode = nm->as_nmethod()->jvmci_installed_code(); + if (installedCode != NULL) { + oop installedCodeName = NULL; + if (installedCode->is_a(InstalledCode::klass())) { + installedCodeName = InstalledCode::name(installedCode); + } + if (installedCodeName != NULL) { + tty->print(" (JVMCI: installedCodeName=%s) ", java_lang_String::as_utf8_string(installedCodeName)); + } else { + tty->print(" (JVMCI: installed code has no name) "); + } + } else if (nm->is_compiled_by_jvmci()) { + tty->print(" (JVMCI: no installed code) "); } - if (installedCodeName != NULL) { - tty->print(" (JVMCI: installedCodeName=%s) ", java_lang_String::as_utf8_string(installedCodeName)); - } else { - tty->print(" (JVMCI: installed code has no name) "); - } - } else if (nm->is_compiled_by_jvmci()) { - tty->print(" (JVMCI: no installed code) "); } #endif tty->print(" (@" INTPTR_FORMAT ") thread=" UINTX_FORMAT " reason=%s action=%s unloaded_class_index=%d" JVMCI_ONLY(" debug_id=%d"), @@ -1891,7 +1894,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint tra // Assume that in new recompiled code the statistic could be different, // for example, due to different inlining. if ((reason != Reason_rtm_state_change) && (trap_mdo != NULL) && - UseRTMDeopt && (nm->rtm_state() != ProfileRTM)) { + UseRTMDeopt && (nm->as_nmethod()->rtm_state() != ProfileRTM)) { trap_mdo->atomic_set_rtm_state(ProfileRTM); } #endif diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp index e5785c1f11e..fe19244d385 100644 --- a/hotspot/src/share/vm/runtime/fprofiler.cpp +++ b/hotspot/src/share/vm/runtime/fprofiler.cpp @@ -538,11 +538,12 @@ class adapterNode : public ProfilerNode { class runtimeStubNode : public ProfilerNode { private: - const CodeBlob* _stub; + const RuntimeStub* _stub; const char* _symbol; // The name of the nearest VM symbol when ProfileVM is on. Points to a unique string. public: - runtimeStubNode(const CodeBlob* stub, const char* name, TickPosition where) : ProfilerNode(), _stub(stub), _symbol(name) { + runtimeStubNode(const CodeBlob* stub, const char* name, TickPosition where) : ProfilerNode(), _stub(NULL), _symbol(name) { assert(stub->is_runtime_stub(), "wrong code blob"); + _stub = (RuntimeStub*) stub; update(where); } @@ -550,7 +551,7 @@ class runtimeStubNode : public ProfilerNode { bool runtimeStub_match(const CodeBlob* stub, const char* name) const { assert(stub->is_runtime_stub(), "wrong code blob"); - return ((RuntimeStub*)_stub)->entry_point() == ((RuntimeStub*)stub)->entry_point() && + return _stub->entry_point() == ((RuntimeStub*)stub)->entry_point() && (_symbol == name); } @@ -571,7 +572,7 @@ class runtimeStubNode : public ProfilerNode { } void print_method_on(outputStream* st) { - st->print("%s", ((RuntimeStub*)_stub)->name()); + st->print("%s", _stub->name()); print_symbol_on(st); } @@ -588,18 +589,18 @@ class unknown_compiledNode : public ProfilerNode { public: unknown_compiledNode(const CodeBlob* cb, TickPosition where) : ProfilerNode() { if ( cb->is_buffer_blob() ) - _name = ((BufferBlob*)cb)->name(); + _name = ((const BufferBlob*)cb)->name(); else - _name = ((SingletonBlob*)cb)->name(); + _name = ((const SingletonBlob*)cb)->name(); update(where); } bool is_compiled() const { return true; } bool unknown_compiled_match(const CodeBlob* cb) const { if ( cb->is_buffer_blob() ) - return !strcmp(((BufferBlob*)cb)->name(), _name); + return !strcmp(((const BufferBlob*)cb)->name(), _name); else - return !strcmp(((SingletonBlob*)cb)->name(), _name); + return !strcmp(((const SingletonBlob*)cb)->name(), _name); } Method* method() { return NULL; } @@ -993,16 +994,15 @@ void ThreadProfiler::record_compiled_tick(JavaThread* thread, frame fr, TickPosi CodeBlob* cb = fr.cb(); -// For runtime stubs, record as native rather than as compiled - if (cb->is_runtime_stub()) { - RegisterMap map(thread, false); - fr = fr.sender(&map); - cb = fr.cb(); - localwhere = tp_native; - } - Method* method = (cb->is_nmethod()) ? ((nmethod *)cb)->method() : - (Method*)NULL; + // For runtime stubs, record as native rather than as compiled + if (cb->is_runtime_stub()) { + RegisterMap map(thread, false); + fr = fr.sender(&map); + cb = fr.cb(); + localwhere = tp_native; + } + Method* method = cb->is_compiled() ? cb->as_compiled_method()->method() : (Method*) NULL; if (method == NULL) { if (cb->is_runtime_stub()) runtime_stub_update(cb, name, localwhere); diff --git a/hotspot/src/share/vm/runtime/frame.cpp b/hotspot/src/share/vm/runtime/frame.cpp index b2a321687b7..82f5ead336d 100644 --- a/hotspot/src/share/vm/runtime/frame.cpp +++ b/hotspot/src/share/vm/runtime/frame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -132,11 +132,11 @@ void RegisterMap::print() const { address frame::raw_pc() const { if (is_deoptimized_frame()) { - nmethod* nm = cb()->as_nmethod_or_null(); - if (nm->is_method_handle_return(pc())) - return nm->deopt_mh_handler_begin() - pc_return_offset; + CompiledMethod* cm = cb()->as_compiled_method_or_null(); + if (cm->is_method_handle_return(pc())) + return cm->deopt_mh_handler_begin() - pc_return_offset; else - return nm->deopt_handler_begin() - pc_return_offset; + return cm->deopt_handler_begin() - pc_return_offset; } else { return (pc() - pc_return_offset); } @@ -183,8 +183,8 @@ bool frame::is_java_frame() const { bool frame::is_compiled_frame() const { if (_cb != NULL && - _cb->is_nmethod() && - ((nmethod*)_cb)->is_java_method()) { + _cb->is_compiled() && + ((CompiledMethod*)_cb)->is_java_method()) { return true; } return false; @@ -228,8 +228,8 @@ JavaCallWrapper* frame::entry_frame_call_wrapper_if_safe(JavaThread* thread) con bool frame::should_be_deoptimized() const { if (_deopt_state == is_deoptimized || !is_compiled_frame() ) return false; - assert(_cb != NULL && _cb->is_nmethod(), "must be an nmethod"); - nmethod* nm = (nmethod *)_cb; + assert(_cb != NULL && _cb->is_compiled(), "must be an nmethod"); + CompiledMethod* nm = (CompiledMethod *)_cb; if (TraceDependencies) { tty->print("checking (%s) ", nm->is_marked_for_deoptimization() ? "true" : "false"); nm->print_value_on(tty); @@ -246,7 +246,7 @@ bool frame::should_be_deoptimized() const { bool frame::can_be_deoptimized() const { if (!is_compiled_frame()) return false; - nmethod* nm = (nmethod*)_cb; + CompiledMethod* nm = (CompiledMethod*)_cb; if( !nm->can_be_deoptimized() ) return false; @@ -256,8 +256,7 @@ bool frame::can_be_deoptimized() const { void frame::deoptimize(JavaThread* thread) { // Schedule deoptimization of an nmethod activation with this frame. - assert(_cb != NULL && _cb->is_nmethod(), "must be"); - nmethod* nm = (nmethod*)_cb; + assert(_cb != NULL && _cb->is_compiled(), "must be"); // This is a fix for register window patching race if (NeedsDeoptSuspend && Thread::current() != thread) { @@ -316,12 +315,13 @@ void frame::deoptimize(JavaThread* thread) { // If the call site is a MethodHandle call site use the MH deopt // handler. - address deopt = nm->is_method_handle_return(pc()) ? - nm->deopt_mh_handler_begin() : - nm->deopt_handler_begin(); + CompiledMethod* cm = (CompiledMethod*) _cb; + address deopt = cm->is_method_handle_return(pc()) ? + cm->deopt_mh_handler_begin() : + cm->deopt_handler_begin(); // Save the original pc before we patch in the new one - nm->set_original_pc(this, pc()); + cm->set_original_pc(this, pc()); patch_pc(thread, deopt); #ifdef ASSERT @@ -396,6 +396,11 @@ void frame::interpreter_frame_set_method(Method* method) { *interpreter_frame_method_addr() = method; } +void frame::interpreter_frame_set_mirror(oop mirror) { + assert(is_interpreted_frame(), "interpreted frame expected"); + *interpreter_frame_mirror_addr() = mirror; +} + jint frame::interpreter_frame_bci() const { assert(is_interpreted_frame(), "interpreted frame expected"); address bcp = interpreter_frame_bcp(); @@ -661,14 +666,19 @@ void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose } } else if (_cb->is_buffer_blob()) { st->print("v ~BufferBlob::%s", ((BufferBlob *)_cb)->name()); - } else if (_cb->is_nmethod()) { - nmethod* nm = (nmethod*)_cb; - Method* m = nm->method(); + } else if (_cb->is_compiled()) { + CompiledMethod* cm = (CompiledMethod*)_cb; + Method* m = cm->method(); if (m != NULL) { + if (cm->is_nmethod()) { + nmethod* nm = cm->as_nmethod(); + st->print("J %d%s", nm->compile_id(), (nm->is_osr_method() ? "%" : "")); + if (nm->compiler() != NULL) { + st->print(" %s", nm->compiler()->name()); + } + } m->name_and_sig_as_C_string(buf, buflen); - st->print("J %d%s %s ", - nm->compile_id(), (nm->is_osr_method() ? "%" : ""), - ((nm->compiler() != NULL) ? nm->compiler()->name() : "")); + st->print(" %s", buf); ModuleEntry* module = m->method_holder()->module(); if (module->is_named()) { module->name()->as_C_string(buf, buflen); @@ -676,12 +686,15 @@ void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose module->version()->as_C_string(buf, buflen); st->print("@%s", buf); } - st->print("%s (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" INTPTR_FORMAT "]", - buf, m->code_size(), p2i(_pc), p2i(_cb->code_begin()), _pc - _cb->code_begin()); + st->print(" (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" INTPTR_FORMAT "]", + m->code_size(), p2i(_pc), p2i(_cb->code_begin()), _pc - _cb->code_begin()); #if INCLUDE_JVMCI - char* jvmciName = nm->jvmci_installed_code_name(buf, buflen); - if (jvmciName != NULL) { - st->print(" (%s)", jvmciName); + if (cm->is_nmethod()) { + nmethod* nm = cm->as_nmethod(); + char* jvmciName = nm->jvmci_installed_code_name(buf, buflen); + if (jvmciName != NULL) { + st->print(" (%s)", jvmciName); + } } #endif } else { @@ -850,8 +863,7 @@ oop* frame::interpreter_callee_receiver_addr(Symbol* signature) { } -void frame::oops_interpreted_do(OopClosure* f, CLDClosure* cld_f, - const RegisterMap* map, bool query_oop_map_cache) { +void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) { assert(is_interpreted_frame(), "Not an interpreted frame"); assert(map != NULL, "map must be set"); Thread *thread = Thread::current(); @@ -877,21 +889,16 @@ void frame::oops_interpreted_do(OopClosure* f, CLDClosure* cld_f, current->oops_do(f); } - // process fixed part - if (cld_f != NULL) { - // The method pointer in the frame might be the only path to the method's - // klass, and the klass needs to be kept alive while executing. The GCs - // don't trace through method pointers, so typically in similar situations - // the mirror or the class loader of the klass are installed as a GC root. - // To minimize the overhead of doing that here, we ask the GC to pass down a - // closure that knows how to keep klasses alive given a ClassLoaderData. - cld_f->do_cld(m->method_holder()->class_loader_data()); - } - - if (m->is_native() PPC32_ONLY(&& m->is_static())) { + if (m->is_native()) { f->do_oop(interpreter_frame_temp_oop_addr()); } + // The method pointer in the frame might be the only path to the method's + // klass, and the klass needs to be kept alive while executing. The GCs + // don't trace through method pointers, so the mirror of the method's klass + // is installed as a GC root. + f->do_oop(interpreter_frame_mirror_addr()); + int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); Symbol* signature = NULL; @@ -1091,7 +1098,7 @@ void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) { } -void frame::oops_do_internal(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) { +void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) { #ifndef PRODUCT // simulate GC crash here to dump java thread in error report if (CrashGCForDumpingJavaThread) { @@ -1100,7 +1107,7 @@ void frame::oops_do_internal(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* } #endif if (is_interpreted_frame()) { - oops_interpreted_do(f, cld_f, map, use_interpreter_oop_map_cache); + oops_interpreted_do(f, map, use_interpreter_oop_map_cache); } else if (is_entry_frame()) { oops_entry_do(f, map); } else if (CodeCache::contains(pc())) { @@ -1145,7 +1152,7 @@ void frame::verify(const RegisterMap* map) { #if defined(COMPILER2) || INCLUDE_JVMCI assert(DerivedPointerTable::is_empty(), "must be empty before verify"); #endif - oops_do_internal(&VerifyOopClosure::verify_oop, NULL, NULL, (RegisterMap*)map, false); + oops_do_internal(&VerifyOopClosure::verify_oop, NULL, (RegisterMap*)map, false); } @@ -1242,10 +1249,10 @@ void frame::describe(FrameValues& values, int frame_no) { values.describe(-1, info_address, err_msg("#%d entry frame", frame_no), 2); } else if (is_compiled_frame()) { // For now just label the frame - nmethod* nm = cb()->as_nmethod_or_null(); + CompiledMethod* cm = (CompiledMethod*)cb(); values.describe(-1, info_address, FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no, - p2i(nm), nm->method()->name_and_sig_as_C_string(), + p2i(cm), cm->method()->name_and_sig_as_C_string(), (_deopt_state == is_deoptimized) ? " (deoptimized)" : ((_deopt_state == unknown) ? " (state unknown)" : "")), diff --git a/hotspot/src/share/vm/runtime/frame.hpp b/hotspot/src/share/vm/runtime/frame.hpp index 0bb1d875071..b71585a5049 100644 --- a/hotspot/src/share/vm/runtime/frame.hpp +++ b/hotspot/src/share/vm/runtime/frame.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -320,6 +320,9 @@ class frame VALUE_OBJ_CLASS_SPEC { void interpreter_frame_set_method(Method* method); Method** interpreter_frame_method_addr() const; ConstantPoolCache** interpreter_frame_cache_addr() const; + oop* interpreter_frame_mirror_addr() const; + + void interpreter_frame_set_mirror(oop mirror); public: // Entry frames @@ -386,19 +389,19 @@ class frame VALUE_OBJ_CLASS_SPEC { // Oops-do's void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f); - void oops_interpreted_do(OopClosure* f, CLDClosure* cld_f, const RegisterMap* map, bool query_oop_map_cache = true); + void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true); private: void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f); // Iteration of oops - void oops_do_internal(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache); + void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache); void oops_entry_do(OopClosure* f, const RegisterMap* map); void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map); int adjust_offset(Method* method, int index); // helper for above fn public: // Memory management - void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cld_f, cf, map, true); } + void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, map, true); } void nmethods_do(CodeBlobClosure* cf); // RedefineClasses support for finding live interpreted methods on the stack diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index ef98dd77f94..06742212f19 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -29,10 +29,12 @@ #include "runtime/globals.hpp" #include "runtime/globals_extension.hpp" #include "runtime/commandLineFlagConstraintList.hpp" +#include "runtime/commandLineFlagWriteableList.hpp" #include "runtime/commandLineFlagRangeList.hpp" #include "runtime/os.hpp" #include "runtime/sharedRuntime.hpp" #include "trace/tracing.hpp" +#include "utilities/defaultStream.hpp" #include "utilities/macros.hpp" #include "utilities/ostream.hpp" #if INCLUDE_ALL_GCS @@ -62,7 +64,8 @@ RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_PRODUCT_RW_FLAG, \ MATERIALIZE_LP64_PRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_PD_DEVELOPER_FLAG, \ @@ -71,7 +74,8 @@ RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_DIAGNOSTIC_FLAG, \ MATERIALIZE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) ARCH_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_PRODUCT_FLAG, \ @@ -79,7 +83,8 @@ ARCH_FLAGS(MATERIALIZE_DEVELOPER_FLAG, \ MATERIALIZE_EXPERIMENTAL_FLAG, \ MATERIALIZE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) MATERIALIZE_FLAGS_EXT @@ -141,10 +146,35 @@ static bool is_product_build() { #endif } -void Flag::check_writable() { +Flag::Error Flag::check_writable(bool changed) { if (is_constant_in_binary()) { fatal("flag is constant: %s", _name); } + + Flag::Error error = Flag::SUCCESS; + if (changed) { + CommandLineFlagWriteable* writeable = CommandLineFlagWriteableList::find(_name); + if (writeable) { + if (writeable->is_writeable() == false) { + switch (writeable->type()) + { + case CommandLineFlagWriteable::Once: + error = Flag::SET_ONLY_ONCE; + jio_fprintf(defaultStream::error_stream(), "Error: %s may not be set more than once\n", _name); + break; + case CommandLineFlagWriteable::CommandLineOnly: + error = Flag::COMMAND_LINE_ONLY; + jio_fprintf(defaultStream::error_stream(), "Error: %s may be modified only from commad line\n", _name); + break; + default: + ShouldNotReachHere(); + break; + } + } + writeable->mark_once(); + } + } + return error; } bool Flag::is_bool() const { @@ -155,9 +185,12 @@ bool Flag::get_bool() const { return *((bool*) _addr); } -void Flag::set_bool(bool value) { - check_writable(); - *((bool*) _addr) = value; +Flag::Error Flag::set_bool(bool value) { + Flag::Error error = check_writable(value!=get_bool()); + if (error == Flag::SUCCESS) { + *((bool*) _addr) = value; + } + return error; } bool Flag::is_int() const { @@ -168,9 +201,12 @@ int Flag::get_int() const { return *((int*) _addr); } -void Flag::set_int(int value) { - check_writable(); - *((int*) _addr) = value; +Flag::Error Flag::set_int(int value) { + Flag::Error error = check_writable(value!=get_int()); + if (error == Flag::SUCCESS) { + *((int*) _addr) = value; + } + return error; } bool Flag::is_uint() const { @@ -181,9 +217,12 @@ uint Flag::get_uint() const { return *((uint*) _addr); } -void Flag::set_uint(uint value) { - check_writable(); - *((uint*) _addr) = value; +Flag::Error Flag::set_uint(uint value) { + Flag::Error error = check_writable(value!=get_uint()); + if (error == Flag::SUCCESS) { + *((uint*) _addr) = value; + } + return error; } bool Flag::is_intx() const { @@ -194,9 +233,12 @@ intx Flag::get_intx() const { return *((intx*) _addr); } -void Flag::set_intx(intx value) { - check_writable(); - *((intx*) _addr) = value; +Flag::Error Flag::set_intx(intx value) { + Flag::Error error = check_writable(value!=get_intx()); + if (error == Flag::SUCCESS) { + *((intx*) _addr) = value; + } + return error; } bool Flag::is_uintx() const { @@ -207,9 +249,12 @@ uintx Flag::get_uintx() const { return *((uintx*) _addr); } -void Flag::set_uintx(uintx value) { - check_writable(); - *((uintx*) _addr) = value; +Flag::Error Flag::set_uintx(uintx value) { + Flag::Error error = check_writable(value!=get_uintx()); + if (error == Flag::SUCCESS) { + *((uintx*) _addr) = value; + } + return error; } bool Flag::is_uint64_t() const { @@ -220,9 +265,12 @@ uint64_t Flag::get_uint64_t() const { return *((uint64_t*) _addr); } -void Flag::set_uint64_t(uint64_t value) { - check_writable(); - *((uint64_t*) _addr) = value; +Flag::Error Flag::set_uint64_t(uint64_t value) { + Flag::Error error = check_writable(value!=get_uint64_t()); + if (error == Flag::SUCCESS) { + *((uint64_t*) _addr) = value; + } + return error; } bool Flag::is_size_t() const { @@ -233,9 +281,12 @@ size_t Flag::get_size_t() const { return *((size_t*) _addr); } -void Flag::set_size_t(size_t value) { - check_writable(); - *((size_t*) _addr) = value; +Flag::Error Flag::set_size_t(size_t value) { + Flag::Error error = check_writable(value!=get_size_t()); + if (error == Flag::SUCCESS) { + *((size_t*) _addr) = value; + } + return error; } bool Flag::is_double() const { @@ -246,9 +297,12 @@ double Flag::get_double() const { return *((double*) _addr); } -void Flag::set_double(double value) { - check_writable(); - *((double*) _addr) = value; +Flag::Error Flag::set_double(double value) { + Flag::Error error = check_writable(value!=get_double()); + if (error == Flag::SUCCESS) { + *((double*) _addr) = value; + } + return error; } bool Flag::is_ccstr() const { @@ -263,9 +317,12 @@ ccstr Flag::get_ccstr() const { return *((ccstr*) _addr); } -void Flag::set_ccstr(ccstr value) { - check_writable(); - *((ccstr*) _addr) = value; +Flag::Error Flag::set_ccstr(ccstr value) { + Flag::Error error = check_writable(value!=get_ccstr()); + if (error == Flag::SUCCESS) { + *((ccstr*) _addr) = value; + } + return error; } @@ -654,7 +711,8 @@ static Flag flagTable[] = { RUNTIME_PRODUCT_RW_FLAG_STRUCT, \ RUNTIME_LP64_PRODUCT_FLAG_STRUCT, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \ RUNTIME_PD_DEVELOP_FLAG_STRUCT, \ RUNTIME_PRODUCT_FLAG_STRUCT, \ @@ -662,7 +720,8 @@ static Flag flagTable[] = { RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \ RUNTIME_NOTPRODUCT_FLAG_STRUCT, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #if INCLUDE_ALL_GCS G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \ RUNTIME_PD_DEVELOP_FLAG_STRUCT, \ @@ -674,7 +733,8 @@ static Flag flagTable[] = { RUNTIME_MANAGEABLE_FLAG_STRUCT, \ RUNTIME_PRODUCT_RW_FLAG_STRUCT, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // INCLUDE_ALL_GCS #if INCLUDE_JVMCI JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_STRUCT, \ @@ -685,7 +745,8 @@ static Flag flagTable[] = { JVMCI_EXPERIMENTAL_FLAG_STRUCT, \ JVMCI_NOTPRODUCT_FLAG_STRUCT, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // INCLUDE_JVMCI #ifdef COMPILER1 C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, \ @@ -695,7 +756,8 @@ static Flag flagTable[] = { C1_DIAGNOSTIC_FLAG_STRUCT, \ C1_NOTPRODUCT_FLAG_STRUCT, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // COMPILER1 #ifdef COMPILER2 C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, \ @@ -706,7 +768,8 @@ static Flag flagTable[] = { C2_EXPERIMENTAL_FLAG_STRUCT, \ C2_NOTPRODUCT_FLAG_STRUCT, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // COMPILER2 #ifdef SHARK SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, \ @@ -714,7 +777,10 @@ static Flag flagTable[] = { SHARK_PRODUCT_FLAG_STRUCT, \ SHARK_PD_PRODUCT_FLAG_STRUCT, \ SHARK_DIAGNOSTIC_FLAG_STRUCT, \ - SHARK_NOTPRODUCT_FLAG_STRUCT) + SHARK_NOTPRODUCT_FLAG_STRUCT, \ + IGNORE_RANGE, \ + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // SHARK ARCH_FLAGS(ARCH_DEVELOP_FLAG_STRUCT, \ ARCH_PRODUCT_FLAG_STRUCT, \ @@ -722,7 +788,8 @@ static Flag flagTable[] = { ARCH_EXPERIMENTAL_FLAG_STRUCT, \ ARCH_NOTPRODUCT_FLAG_STRUCT, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) FLAGTABLE_EXT {0, NULL, NULL} }; @@ -873,10 +940,10 @@ Flag::Error CommandLineFlags::boolAtPut(Flag* flag, bool* value, Flag::Flags ori if (check != Flag::SUCCESS) return check; bool old_value = flag->get_bool(); trace_flag_changed(name, old_value, *value, origin); - flag->set_bool(*value); + check = flag->set_bool(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::boolAtPut(const char* name, size_t len, bool* value, Flag::Flags origin) { @@ -922,10 +989,10 @@ Flag::Error CommandLineFlags::intAtPut(Flag* flag, int* value, Flag::Flags origi if (check != Flag::SUCCESS) return check; int old_value = flag->get_int(); trace_flag_changed(name, old_value, *value, origin); - flag->set_int(*value); + check = flag->set_int(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::intAtPut(const char* name, size_t len, int* value, Flag::Flags origin) { @@ -971,10 +1038,10 @@ Flag::Error CommandLineFlags::uintAtPut(Flag* flag, uint* value, Flag::Flags ori if (check != Flag::SUCCESS) return check; uint old_value = flag->get_uint(); trace_flag_changed(name, old_value, *value, origin); - flag->set_uint(*value); + check = flag->set_uint(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::uintAtPut(const char* name, size_t len, uint* value, Flag::Flags origin) { @@ -1020,10 +1087,10 @@ Flag::Error CommandLineFlags::intxAtPut(Flag* flag, intx* value, Flag::Flags ori if (check != Flag::SUCCESS) return check; intx old_value = flag->get_intx(); trace_flag_changed(name, old_value, *value, origin); - flag->set_intx(*value); + check = flag->set_intx(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::intxAtPut(const char* name, size_t len, intx* value, Flag::Flags origin) { @@ -1069,10 +1136,10 @@ Flag::Error CommandLineFlags::uintxAtPut(Flag* flag, uintx* value, Flag::Flags o if (check != Flag::SUCCESS) return check; uintx old_value = flag->get_uintx(); trace_flag_changed(name, old_value, *value, origin); - flag->set_uintx(*value); + check = flag->set_uintx(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::uintxAtPut(const char* name, size_t len, uintx* value, Flag::Flags origin) { @@ -1118,10 +1185,10 @@ Flag::Error CommandLineFlags::uint64_tAtPut(Flag* flag, uint64_t* value, Flag::F if (check != Flag::SUCCESS) return check; uint64_t old_value = flag->get_uint64_t(); trace_flag_changed(name, old_value, *value, origin); - flag->set_uint64_t(*value); + check = flag->set_uint64_t(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::uint64_tAtPut(const char* name, size_t len, uint64_t* value, Flag::Flags origin) { @@ -1168,10 +1235,10 @@ Flag::Error CommandLineFlags::size_tAtPut(Flag* flag, size_t* value, Flag::Flags if (check != Flag::SUCCESS) return check; size_t old_value = flag->get_size_t(); trace_flag_changed(name, old_value, *value, origin); - flag->set_size_t(*value); + check = flag->set_size_t(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::size_tAtPut(const char* name, size_t len, size_t* value, Flag::Flags origin) { @@ -1217,10 +1284,10 @@ Flag::Error CommandLineFlags::doubleAtPut(Flag* flag, double* value, Flag::Flags if (check != Flag::SUCCESS) return check; double old_value = flag->get_double(); trace_flag_changed(name, old_value, *value, origin); - flag->set_double(*value); + check = flag->set_double(*value); *value = old_value; flag->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlags::doubleAtPut(const char* name, size_t len, double* value, Flag::Flags origin) { @@ -1252,14 +1319,14 @@ Flag::Error CommandLineFlags::ccstrAtPut(const char* name, size_t len, ccstr* va if (*value != NULL) { new_value = os::strdup_check_oom(*value); } - result->set_ccstr(new_value); + Flag::Error check = result->set_ccstr(new_value); if (result->is_default() && old_value != NULL) { // Prior value is NOT heap allocated, but was a literal constant. old_value = os::strdup_check_oom(old_value); } *value = old_value; result->set_origin(origin); - return Flag::SUCCESS; + return check; } Flag::Error CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, Flag::Flags origin) { @@ -1268,13 +1335,13 @@ Flag::Error CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr v ccstr old_value = faddr->get_ccstr(); trace_flag_changed(faddr->_name, old_value, value, origin); char* new_value = os::strdup_check_oom(value); - faddr->set_ccstr(new_value); + Flag::Error check = faddr->set_ccstr(new_value); if (!faddr->is_default() && old_value != NULL) { // Prior value is heap allocated so free it. FREE_C_HEAP_ARRAY(char, old_value); } faddr->set_origin(origin); - return Flag::SUCCESS; + return check; } extern "C" { diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index fe2d2e615f0..54cd9c01956 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -280,6 +280,12 @@ struct Flag { VIOLATES_CONSTRAINT, // there is no flag with the given name INVALID_FLAG, + // the flag can only be set only on command line during invocation of the VM + COMMAND_LINE_ONLY, + // the flag may only be set once + SET_ONLY_ONCE, + // the flag is not writable in this combination of product/debug build + CONSTANT, // other, unspecified error related to setting the flag ERR_OTHER }; @@ -316,44 +322,44 @@ struct Flag { static const char* get_size_t_default_range_str(); static const char* get_double_default_range_str(); - void check_writable(); + Flag::Error check_writable(bool changed); bool is_bool() const; bool get_bool() const; - void set_bool(bool value); + Flag::Error set_bool(bool value); bool is_int() const; int get_int() const; - void set_int(int value); + Flag::Error set_int(int value); bool is_uint() const; uint get_uint() const; - void set_uint(uint value); + Flag::Error set_uint(uint value); bool is_intx() const; intx get_intx() const; - void set_intx(intx value); + Flag::Error set_intx(intx value); bool is_uintx() const; uintx get_uintx() const; - void set_uintx(uintx value); + Flag::Error set_uintx(uintx value); bool is_uint64_t() const; uint64_t get_uint64_t() const; - void set_uint64_t(uint64_t value); + Flag::Error set_uint64_t(uint64_t value); bool is_size_t() const; size_t get_size_t() const; - void set_size_t(size_t value); + Flag::Error set_size_t(size_t value); bool is_double() const; double get_double() const; - void set_double(double value); + Flag::Error set_double(double value); bool is_ccstr() const; bool ccstr_accumulates() const; ccstr get_ccstr() const; - void set_ccstr(ccstr value); + Flag::Error set_ccstr(ccstr value); Flags get_origin(); void set_origin(Flags origin); @@ -621,8 +627,31 @@ public: // constraint is a macro that will expand to custom function call // for constraint checking if provided - see commandLineFlagConstraintList.hpp // +// writeable is a macro that controls if and how the value can change during the runtime +// +// writeable(Always) is optional and allows the flag to have its value changed +// without any limitations at any time +// +// writeable(Once) flag value's can be only set once during the lifetime of VM +// +// writeable(CommandLineOnly) flag value's can be only set from command line +// (multiple times allowed) +// -#define RUNTIME_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, manageable, product_rw, lp64_product, range, constraint) \ + +#define RUNTIME_FLAGS(develop, \ + develop_pd, \ + product, \ + product_pd, \ + diagnostic, \ + experimental, \ + notproduct, \ + manageable, \ + product_rw, \ + lp64_product, \ + range, \ + constraint, \ + writeable) \ \ lp64_product(bool, UseCompressedOops, false, \ "Use 32-bit object references in 64-bit VM. " \ @@ -732,7 +761,7 @@ public: "Control whether SHA instructions can be used " \ "on SPARC, on ARM and on x86") \ \ - product(bool, UseGHASHIntrinsics, false, \ + diagnostic(bool, UseGHASHIntrinsics, false, \ "Use intrinsics for GHASH versions of crypto") \ \ product(size_t, LargePageSizeInBytes, 0, \ @@ -802,27 +831,27 @@ public: product(bool, UseInlineCaches, true, \ "Use Inline Caches for virtual calls ") \ \ - develop(bool, InlineArrayCopy, true, \ + diagnostic(bool, InlineArrayCopy, true, \ "Inline arraycopy native that is known to be part of " \ "base library DLL") \ \ - develop(bool, InlineObjectHash, true, \ + diagnostic(bool, InlineObjectHash, true, \ "Inline Object::hashCode() native that is known to be part " \ "of base library DLL") \ \ - develop(bool, InlineNatives, true, \ + diagnostic(bool, InlineNatives, true, \ "Inline natives that are known to be part of base library DLL") \ \ - develop(bool, InlineMathNatives, true, \ + diagnostic(bool, InlineMathNatives, true, \ "Inline SinD, CosD, etc.") \ \ - develop(bool, InlineClassNatives, true, \ + diagnostic(bool, InlineClassNatives, true, \ "Inline Class.isInstance, etc") \ \ - develop(bool, InlineThreadNatives, true, \ + diagnostic(bool, InlineThreadNatives, true, \ "Inline Thread.currentThread, etc") \ \ - develop(bool, InlineUnsafeOps, true, \ + diagnostic(bool, InlineUnsafeOps, true, \ "Inline memory ops (native methods) from Unsafe") \ \ product(bool, CriticalJNINatives, true, \ @@ -831,34 +860,34 @@ public: notproduct(bool, StressCriticalJNINatives, false, \ "Exercise register saving code in critical natives") \ \ - product(bool, UseAESIntrinsics, false, \ + diagnostic(bool, UseAESIntrinsics, false, \ "Use intrinsics for AES versions of crypto") \ \ - product(bool, UseAESCTRIntrinsics, false, \ + diagnostic(bool, UseAESCTRIntrinsics, false, \ "Use intrinsics for the paralleled version of AES/CTR crypto") \ \ - product(bool, UseSHA1Intrinsics, false, \ + diagnostic(bool, UseSHA1Intrinsics, false, \ "Use intrinsics for SHA-1 crypto hash function. " \ "Requires that UseSHA is enabled.") \ \ - product(bool, UseSHA256Intrinsics, false, \ + diagnostic(bool, UseSHA256Intrinsics, false, \ "Use intrinsics for SHA-224 and SHA-256 crypto hash functions. " \ "Requires that UseSHA is enabled.") \ \ - product(bool, UseSHA512Intrinsics, false, \ + diagnostic(bool, UseSHA512Intrinsics, false, \ "Use intrinsics for SHA-384 and SHA-512 crypto hash functions. " \ "Requires that UseSHA is enabled.") \ \ - product(bool, UseCRC32Intrinsics, false, \ + diagnostic(bool, UseCRC32Intrinsics, false, \ "use intrinsics for java.util.zip.CRC32") \ \ - product(bool, UseCRC32CIntrinsics, false, \ + diagnostic(bool, UseCRC32CIntrinsics, false, \ "use intrinsics for java.util.zip.CRC32C") \ \ - product(bool, UseAdler32Intrinsics, false, \ + diagnostic(bool, UseAdler32Intrinsics, false, \ "use intrinsics for java.util.zip.Adler32") \ \ - product(bool, UseVectorizedMismatchIntrinsic, false, \ + diagnostic(bool, UseVectorizedMismatchIntrinsic, false, \ "Enables intrinsification of ArraysSupport.vectorizedMismatch()") \ \ diagnostic(ccstrlist, DisableIntrinsic, "", \ @@ -1253,7 +1282,7 @@ public: product(intx, MonitorBound, 0, "Bound Monitor population") \ range(0, max_jint) \ \ - product(bool, MonitorInUseLists, false, "Track Monitors for Deflation") \ + product(bool, MonitorInUseLists, true, "Track Monitors for Deflation") \ \ experimental(intx, SyncFlags, 0, "(Unsafe, Unstable) " \ "Experimental Sync flags") \ @@ -1418,10 +1447,6 @@ public: product(bool, StressLdcRewrite, false, \ "Force ldc -> ldc_w rewrite during RedefineClasses") \ \ - product(uintx, TraceRedefineClasses, 0, \ - "Trace level for JVMTI RedefineClasses") \ - range(0, 0xFFFFFFFF) \ - \ /* change to false by default sometime after Mustang */ \ product(bool, VerifyMergedCPBytecodes, true, \ "Verify bytecodes after RedefineClasses constant pool merging") \ @@ -2070,6 +2095,9 @@ public: notproduct(bool, VerboseInternalVMTests, false, \ "Turn on logging for internal VM tests.") \ \ + product(bool, ExecutingUnitTests, false, \ + "Whether the JVM is running unit tests or not") \ + \ product_pd(bool, UseTLAB, "Use thread-local object allocation") \ \ product_pd(bool, ResizeTLAB, \ @@ -2221,11 +2249,11 @@ public: "Adaptive size policy maximum GC pause time goal in millisecond, "\ "or (G1 Only) the maximum GC time per MMU time slice") \ range(1, max_uintx - 1) \ - constraint(MaxGCPauseMillisConstraintFunc,AfterMemoryInit) \ + constraint(MaxGCPauseMillisConstraintFunc,AfterErgo) \ \ product(uintx, GCPauseIntervalMillis, 0, \ "Time slice for MMU specification") \ - constraint(GCPauseIntervalMillisConstraintFunc,AfterMemoryInit) \ + constraint(GCPauseIntervalMillisConstraintFunc,AfterErgo) \ \ product(uintx, MaxGCMinorPauseMillis, max_uintx, \ "Adaptive size policy maximum GC minor pause time goal " \ @@ -2901,9 +2929,9 @@ public: \ product(intx, AllocatePrefetchStyle, 1, \ "0 = no prefetch, " \ - "1 = prefetch instructions for each allocation, " \ + "1 = generate prefetch instructions for each allocation, " \ "2 = use TLAB watermark to gate allocation prefetch, " \ - "3 = use BIS instruction on Sparc for allocation prefetch") \ + "3 = generate one prefetch instruction per cache line") \ range(0, 3) \ \ product(intx, AllocatePrefetchDistance, -1, \ @@ -2926,8 +2954,8 @@ public: constraint(AllocatePrefetchStepSizeConstraintFunc,AfterMemoryInit)\ \ product(intx, AllocatePrefetchInstr, 0, \ - "Prefetch instruction to prefetch ahead of allocation pointer") \ - constraint(AllocatePrefetchInstrConstraintFunc, AfterErgo) \ + "Select instruction to prefetch ahead of allocation pointer") \ + constraint(AllocatePrefetchInstrConstraintFunc, AfterMemoryInit) \ \ /* deoptimization */ \ develop(bool, TraceDeoptimization, false, \ @@ -3847,9 +3875,9 @@ public: \ /* Properties for Java libraries */ \ \ - product(size_t, MaxDirectMemorySize, 0, \ + product(uint64_t, MaxDirectMemorySize, 0, \ "Maximum total size of NIO direct-buffer allocations") \ - range(0, (size_t)SIZE_MAX) \ + range(0, max_jlong) \ \ /* Flags used for temporary code during development */ \ \ @@ -4186,6 +4214,8 @@ public: // Only materialize src code for contraint checking when required, ignore otherwise #define IGNORE_CONSTRAINT(func,type) +#define IGNORE_WRITEABLE(type) + RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_PD_DEVELOPER_FLAG, \ DECLARE_PRODUCT_FLAG, \ @@ -4197,7 +4227,8 @@ RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_PRODUCT_RW_FLAG, \ DECLARE_LP64_PRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_PD_DEVELOPER_FLAG, \ @@ -4206,7 +4237,8 @@ RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_DIAGNOSTIC_FLAG, \ DECLARE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) ARCH_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_PRODUCT_FLAG, \ @@ -4214,7 +4246,8 @@ ARCH_FLAGS(DECLARE_DEVELOPER_FLAG, \ DECLARE_EXPERIMENTAL_FLAG, \ DECLARE_NOTPRODUCT_FLAG, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) // Extensions diff --git a/hotspot/src/share/vm/runtime/globals_extension.hpp b/hotspot/src/share/vm/runtime/globals_extension.hpp index b550f236042..810fcd7a73f 100644 --- a/hotspot/src/share/vm/runtime/globals_extension.hpp +++ b/hotspot/src/share/vm/runtime/globals_extension.hpp @@ -103,7 +103,8 @@ typedef enum { RUNTIME_PRODUCT_RW_FLAG_MEMBER, \ RUNTIME_LP64_PRODUCT_FLAG_MEMBER, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, \ RUNTIME_PD_DEVELOP_FLAG_MEMBER, \ RUNTIME_PRODUCT_FLAG_MEMBER, \ @@ -111,7 +112,8 @@ typedef enum { RUNTIME_DIAGNOSTIC_FLAG_MEMBER, \ RUNTIME_NOTPRODUCT_FLAG_MEMBER, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #if INCLUDE_ALL_GCS G1_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, \ RUNTIME_PD_DEVELOP_FLAG_MEMBER, \ @@ -123,7 +125,8 @@ typedef enum { RUNTIME_MANAGEABLE_FLAG_MEMBER, \ RUNTIME_PRODUCT_RW_FLAG_MEMBER, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // INCLUDE_ALL_GCS #if INCLUDE_JVMCI JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_MEMBER, \ @@ -134,7 +137,8 @@ typedef enum { JVMCI_EXPERIMENTAL_FLAG_MEMBER, \ JVMCI_NOTPRODUCT_FLAG_MEMBER, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif // INCLUDE_JVMCI #ifdef COMPILER1 C1_FLAGS(C1_DEVELOP_FLAG_MEMBER, \ @@ -144,7 +148,8 @@ typedef enum { C1_DIAGNOSTIC_FLAG_MEMBER, \ C1_NOTPRODUCT_FLAG_MEMBER, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif #ifdef COMPILER2 C2_FLAGS(C2_DEVELOP_FLAG_MEMBER, \ @@ -155,7 +160,8 @@ typedef enum { C2_EXPERIMENTAL_FLAG_MEMBER, \ C2_NOTPRODUCT_FLAG_MEMBER, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) #endif ARCH_FLAGS(ARCH_DEVELOP_FLAG_MEMBER, \ ARCH_PRODUCT_FLAG_MEMBER, \ @@ -163,7 +169,8 @@ typedef enum { ARCH_EXPERIMENTAL_FLAG_MEMBER, \ ARCH_NOTPRODUCT_FLAG_MEMBER, \ IGNORE_RANGE, \ - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, \ + IGNORE_WRITEABLE) COMMANDLINEFLAG_EXT NUM_CommandLineFlag } CommandLineFlag; @@ -229,7 +236,8 @@ typedef enum { RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE, RUNTIME_LP64_PRODUCT_FLAG_MEMBER_WITH_TYPE, IGNORE_RANGE, - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE) RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, @@ -237,7 +245,8 @@ typedef enum { RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, IGNORE_RANGE, - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE) #if INCLUDE_ALL_GCS G1_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, @@ -249,7 +258,8 @@ typedef enum { RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE, RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE, IGNORE_RANGE, - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE) #endif // INCLUDE_ALL_GCS #if INCLUDE_JVMCI JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_MEMBER_WITH_TYPE, @@ -260,7 +270,8 @@ typedef enum { JVMCI_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE, JVMCI_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, IGNORE_RANGE, - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE) #endif // INCLUDE_JVMCI #ifdef COMPILER1 C1_FLAGS(C1_DEVELOP_FLAG_MEMBER_WITH_TYPE, @@ -270,7 +281,8 @@ typedef enum { C1_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, IGNORE_RANGE, - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE) #endif #ifdef COMPILER2 C2_FLAGS(C2_DEVELOP_FLAG_MEMBER_WITH_TYPE, @@ -281,7 +293,8 @@ typedef enum { C2_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE, C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, IGNORE_RANGE, - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE) #endif ARCH_FLAGS(ARCH_DEVELOP_FLAG_MEMBER_WITH_TYPE, ARCH_PRODUCT_FLAG_MEMBER_WITH_TYPE, @@ -289,7 +302,8 @@ typedef enum { ARCH_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE, ARCH_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, IGNORE_RANGE, - IGNORE_CONSTRAINT) + IGNORE_CONSTRAINT, + IGNORE_WRITEABLE) COMMANDLINEFLAGWITHTYPE_EXT NUM_CommandLineFlagWithType } CommandLineFlagWithType; diff --git a/hotspot/src/share/vm/runtime/javaCalls.cpp b/hotspot/src/share/vm/runtime/javaCalls.cpp index bf8aa7cefa7..686a2c566ab 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.cpp +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp @@ -343,13 +343,7 @@ void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaC } #endif - - assert(thread->can_call_java(), "cannot compile from the native compiler"); - if (CompilationPolicy::must_be_compiled(method)) { - CompileBroker::compile_method(method, InvocationEntryBci, - CompilationPolicy::policy()->initial_compile_level(), - methodHandle(), 0, "must_be_compiled", CHECK); - } + CompilationPolicy::compile_if_required(method, CHECK); // Since the call stub sets up like the interpreter we call the from_interpreted_entry // so we can go compiled via a i2c. Otherwise initial entry method will always diff --git a/hotspot/src/share/vm/runtime/mutex.cpp b/hotspot/src/share/vm/runtime/mutex.cpp index ef6ac43b5d6..a065fb13db2 100644 --- a/hotspot/src/share/vm/runtime/mutex.cpp +++ b/hotspot/src/share/vm/runtime/mutex.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "runtime/atomic.inline.hpp" +#include "runtime/interfaceSupport.hpp" #include "runtime/mutex.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/osThread.hpp" diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp index 1a3767c003c..219194a4b21 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.cpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp @@ -120,6 +120,7 @@ Monitor* GCTaskManager_lock = NULL; Mutex* Management_lock = NULL; Monitor* Service_lock = NULL; Monitor* PeriodicTask_lock = NULL; +Monitor* RedefineClasses_lock = NULL; #ifdef INCLUDE_TRACE Mutex* JfrStacktrace_lock = NULL; @@ -264,6 +265,7 @@ void mutex_init() { def(Debug3_lock , Mutex , nonleaf+4, true, Monitor::_safepoint_check_never); def(CompileThread_lock , Monitor, nonleaf+5, false, Monitor::_safepoint_check_always); def(PeriodicTask_lock , Monitor, nonleaf+5, true, Monitor::_safepoint_check_sometimes); + def(RedefineClasses_lock , Monitor, nonleaf+5, true, Monitor::_safepoint_check_always); if (WhiteBoxAPI) { def(Compilation_lock , Monitor, leaf, false, Monitor::_safepoint_check_never); } diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp index 014ffb28218..ae4c79954ea 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.hpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp @@ -121,6 +121,7 @@ extern Mutex* MMUTracker_lock; // protects the MMU extern Mutex* Management_lock; // a lock used to serialize JVM management extern Monitor* Service_lock; // a lock used for service thread operation extern Monitor* PeriodicTask_lock; // protects the periodic task structure +extern Monitor* RedefineClasses_lock; // locks classes from parallel redefinition #ifdef INCLUDE_TRACE extern Mutex* JfrStacktrace_lock; // used to guard access to the JFR stacktrace table diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index d1ac2b45870..4abbdbb0a52 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -520,7 +520,9 @@ class os: AllStatic { static int ftruncate(int fd, jlong length); static int fsync(int fd); static int available(int fd, jlong *bytes); - static int fileno(FILE* fp); + static int get_fileno(FILE* fp); + static void flockfile(FILE* fp); + static void funlockfile(FILE* fp); static int compare_file_modified_times(const char* file1, const char* file2); diff --git a/hotspot/src/share/vm/runtime/os_ext.hpp b/hotspot/src/share/vm/runtime/os_ext.hpp index 80b87f2dbbb..3aa733a322a 100644 --- a/hotspot/src/share/vm/runtime/os_ext.hpp +++ b/hotspot/src/share/vm/runtime/os_ext.hpp @@ -27,6 +27,7 @@ #define EMIT_RANGES_FOR_GLOBALS_EXT // NOP #define EMIT_CONSTRAINTS_FOR_GLOBALS_EXT // NOP +#define EMIT_WRITEABLES_FOR_GLOBALS_EXT // NOP public: static void init_globals_ext() {} // Run from init_globals(). diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp index 625d55830de..f81deb6a374 100644 --- a/hotspot/src/share/vm/runtime/reflection.cpp +++ b/hotspot/src/share/vm/runtime/reflection.cpp @@ -76,9 +76,9 @@ static void trace_class_resolution(const Klass* to_class) { const char * to = to_class->external_name(); // print in a single call to reduce interleaving between threads if (source_file != NULL) { - log_debug(classresolve)("%s %s %s:%d (reflection)", from, to, source_file, line_number); + log_debug(class, resolve)("%s %s %s:%d (reflection)", from, to, source_file, line_number); } else { - log_debug(classresolve)("%s %s (reflection)", from, to); + log_debug(class, resolve)("%s %s (reflection)", from, to); } } } @@ -502,17 +502,16 @@ Reflection::VerifyClassAccessResults Reflection::verify_class_access( } // Find the module entry for current_class, the accessor - ModuleEntry* module_from = InstanceKlass::cast(current_class)->module(); + ModuleEntry* module_from = current_class->module(); // Find the module entry for new_class, the accessee if (new_class->is_objArray_klass()) { new_class = ObjArrayKlass::cast(new_class)->bottom_klass(); } - if (!new_class->is_instance_klass()) { - // Everyone can read a typearray. - assert (new_class->is_typeArray_klass(), "Unexpected klass type"); + if (new_class->is_typeArray_klass()) { + // A TypeArray's defining module is java.base, access to the TypeArray is allowed return ACCESS_OK; } - ModuleEntry* module_to = InstanceKlass::cast(new_class)->module(); + ModuleEntry* module_to = new_class->module(); // both in same (possibly unnamed) module if (module_from == module_to) { @@ -532,7 +531,7 @@ Reflection::VerifyClassAccessResults Reflection::verify_class_access( return MODULE_NOT_READABLE; } - PackageEntry* package_to = InstanceKlass::cast(new_class)->package(); + PackageEntry* package_to = new_class->package(); assert(package_to != NULL, "can not obtain new_class' package"); // Once readability is established, if module_to exports T unqualifiedly, @@ -570,20 +569,13 @@ char* Reflection::verify_class_access_msg(const Klass* current_class, char * msg = NULL; if (result != OTHER_PROBLEM && new_class != NULL && current_class != NULL) { // Find the module entry for current_class, the accessor - ModuleEntry* module_from = InstanceKlass::cast(current_class)->module(); + ModuleEntry* module_from = current_class->module(); const char * module_from_name = module_from->is_named() ? module_from->name()->as_C_string() : UNNAMED_MODULE; const char * current_class_name = current_class->external_name(); // Find the module entry for new_class, the accessee ModuleEntry* module_to = NULL; - if (new_class->is_objArray_klass()) { - new_class = ObjArrayKlass::cast(new_class)->bottom_klass(); - } - if (new_class->is_instance_klass()) { - module_to = InstanceKlass::cast(new_class)->module(); - } else { - module_to = ModuleEntryTable::javabase_module(); - } + module_to = new_class->module(); const char * module_to_name = module_to->is_named() ? module_to->name()->as_C_string() : UNNAMED_MODULE; const char * new_class_name = new_class->external_name(); @@ -611,10 +603,10 @@ char* Reflection::verify_class_access_msg(const Klass* current_class, } } else if (result == TYPE_NOT_EXPORTED) { - assert(InstanceKlass::cast(new_class)->package() != NULL, + assert(new_class->package() != NULL, "Unnamed packages are always exported"); const char * package_name = - InstanceKlass::cast(new_class)->package()->name()->as_klass_external_name(); + new_class->package()->name()->as_klass_external_name(); assert(module_to->is_named(), "Unnamed modules export all packages"); if (module_from->is_named()) { size_t len = 118 + strlen(current_class_name) + 2*strlen(module_from_name) + @@ -769,7 +761,7 @@ static oop get_mirror_from_signature(methodHandle method, Handle(THREAD, protection_domain), true, CHECK_NULL); - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { trace_class_resolution(k); } return k->java_mirror(); @@ -824,7 +816,7 @@ static Handle new_type(Symbol* signature, KlassHandle k, TRAPS) { Handle(THREAD, k->protection_domain()), true, CHECK_(Handle())); - if (log_is_enabled(Debug, classresolve)) { + if (log_is_enabled(Debug, class, resolve)) { trace_class_resolution(result); } diff --git a/hotspot/src/share/vm/runtime/rframe.cpp b/hotspot/src/share/vm/runtime/rframe.cpp index dea7ef78696..40283896d85 100644 --- a/hotspot/src/share/vm/runtime/rframe.cpp +++ b/hotspot/src/share/vm/runtime/rframe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -127,7 +127,7 @@ int InterpretedRFrame::cost() const { } int CompiledRFrame::cost() const { - nmethod* nm = top_method()->code(); + CompiledMethod* nm = top_method()->code(); if (nm != NULL) { return nm->insts_size(); } else { @@ -139,7 +139,7 @@ void CompiledRFrame::init() { RegisterMap map(thread(), false); vframe* vf = vframe::new_vframe(&_fr, &map, thread()); assert(vf->is_compiled_frame(), "must be compiled"); - _nm = compiledVFrame::cast(vf)->code(); + _nm = compiledVFrame::cast(vf)->code()->as_nmethod(); vf = vf->top(); _vf = javaVFrame::cast(vf); _method = CodeCache::find_nmethod(_fr.pc())->method(); diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp index ceb934ac46d..28f00fdbe03 100644 --- a/hotspot/src/share/vm/runtime/safepoint.cpp +++ b/hotspot/src/share/vm/runtime/safepoint.cpp @@ -545,7 +545,7 @@ void SafepointSynchronize::do_cleanup_tasks() { { const char* name = "deflating idle monitors"; EventSafepointCleanupTask event; - TraceTime timer(name, TRACETIME_LOG(Info, safepointcleanup)); + TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup)); ObjectSynchronizer::deflate_idle_monitors(); event_safepoint_cleanup_task_commit(event, name); } @@ -553,14 +553,14 @@ void SafepointSynchronize::do_cleanup_tasks() { { const char* name = "updating inline caches"; EventSafepointCleanupTask event; - TraceTime timer(name, TRACETIME_LOG(Info, safepointcleanup)); + TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup)); InlineCacheBuffer::update_inline_caches(); event_safepoint_cleanup_task_commit(event, name); } { const char* name = "compilation policy safepoint handler"; EventSafepointCleanupTask event; - TraceTime timer("compilation policy safepoint handler", TRACETIME_LOG(Info, safepointcleanup)); + TraceTime timer("compilation policy safepoint handler", TRACETIME_LOG(Info, safepoint, cleanup)); CompilationPolicy::policy()->do_safepoint_work(); event_safepoint_cleanup_task_commit(event, name); } @@ -568,7 +568,7 @@ void SafepointSynchronize::do_cleanup_tasks() { { const char* name = "mark nmethods"; EventSafepointCleanupTask event; - TraceTime timer(name, TRACETIME_LOG(Info, safepointcleanup)); + TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup)); NMethodSweeper::mark_active_nmethods(); event_safepoint_cleanup_task_commit(event, name); } @@ -576,7 +576,7 @@ void SafepointSynchronize::do_cleanup_tasks() { if (SymbolTable::needs_rehashing()) { const char* name = "rehashing symbol table"; EventSafepointCleanupTask event; - TraceTime timer(name, TRACETIME_LOG(Info, safepointcleanup)); + TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup)); SymbolTable::rehash_table(); event_safepoint_cleanup_task_commit(event, name); } @@ -584,7 +584,7 @@ void SafepointSynchronize::do_cleanup_tasks() { if (StringTable::needs_rehashing()) { const char* name = "rehashing string table"; EventSafepointCleanupTask event; - TraceTime timer(name, TRACETIME_LOG(Info, safepointcleanup)); + TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup)); StringTable::rehash_table(); event_safepoint_cleanup_task_commit(event, name); } @@ -594,7 +594,7 @@ void SafepointSynchronize::do_cleanup_tasks() { // make sure concurrent sweep is done const char* name = "purging class loader data graph"; EventSafepointCleanupTask event; - TraceTime timer(name, TRACETIME_LOG(Info, safepointcleanup)); + TraceTime timer(name, TRACETIME_LOG(Info, safepoint, cleanup)); ClassLoaderDataGraph::purge_if_needed(); event_safepoint_cleanup_task_commit(event, name); } @@ -1010,8 +1010,8 @@ void ThreadSafepointState::handle_polling_page_exception() { address real_return_addr = thread()->saved_exception_pc(); CodeBlob *cb = CodeCache::find_blob(real_return_addr); - assert(cb != NULL && cb->is_nmethod(), "return address should be in nmethod"); - nmethod* nm = (nmethod*)cb; + assert(cb != NULL && cb->is_compiled(), "return address should be in nmethod"); + CompiledMethod* nm = (CompiledMethod*)cb; // Find frame of caller frame stub_fr = thread()->last_frame(); diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index d38d493f198..eba1d72ff3a 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -46,7 +46,6 @@ #include "oops/oop.inline.hpp" #include "prims/forte.hpp" #include "prims/jvmtiExport.hpp" -#include "prims/jvmtiRedefineClassesTrace.hpp" #include "prims/methodHandles.hpp" #include "prims/nativeLookup.hpp" #include "runtime/arguments.hpp" @@ -540,10 +539,10 @@ address SharedRuntime::get_poll_stub(address pc) { CodeBlob *cb = CodeCache::find_blob(pc); // Should be an nmethod - assert(cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod"); + assert(cb && cb->is_compiled(), "safepoint polling: pc must refer to an nmethod"); // Look up the relocation information - assert(((nmethod*)cb)->is_at_poll_or_poll_return(pc), + assert(((CompiledMethod*)cb)->is_at_poll_or_poll_return(pc), "safepoint polling: type must be poll"); #ifdef ASSERT @@ -554,8 +553,8 @@ address SharedRuntime::get_poll_stub(address pc) { } #endif - bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc); - bool has_wide_vectors = ((nmethod*)cb)->has_wide_vectors(); + bool at_poll_return = ((CompiledMethod*)cb)->is_at_poll_return(pc); + bool has_wide_vectors = ((CompiledMethod*)cb)->has_wide_vectors(); if (at_poll_return) { assert(SharedRuntime::polling_page_return_handler_blob() != NULL, "polling page return stub not created yet"); @@ -603,49 +602,40 @@ void SharedRuntime::throw_and_post_jvmti_exception(JavaThread *thread, Symbol* n } // The interpreter code to call this tracing function is only -// called/generated when TraceRedefineClasses has the right bits -// set. Since obsolete methods are never compiled, we don't have +// called/generated when UL is on for redefine, class and has the right level +// and tags. Since obsolete methods are never compiled, we don't have // to modify the compilers to generate calls to this function. // JRT_LEAF(int, SharedRuntime::rc_trace_method_entry( JavaThread* thread, Method* method)) - assert(RC_TRACE_IN_RANGE(0x00001000, 0x00002000), "wrong call"); - if (method->is_obsolete()) { // We are calling an obsolete method, but this is not necessarily // an error. Our method could have been redefined just after we // fetched the Method* from the constant pool. - - // RC_TRACE macro has an embedded ResourceMark - RC_TRACE_WITH_THREAD(0x00001000, thread, - ("calling obsolete method '%s'", - method->name_and_sig_as_C_string())); - if (RC_TRACE_ENABLED(0x00002000)) { - // this option is provided to debug calls to obsolete methods - guarantee(false, "faulting at call to an obsolete method."); - } + ResourceMark rm; + log_trace(redefine, class, obsolete)("calling obsolete method '%s'", method->name_and_sig_as_C_string()); } return 0; JRT_END // ret_pc points into caller; we are returning caller's exception handler // for given exception -address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception, +address SharedRuntime::compute_compiled_exc_handler(CompiledMethod* cm, address ret_pc, Handle& exception, bool force_unwind, bool top_frame_only) { - assert(nm != NULL, "must exist"); + assert(cm != NULL, "must exist"); ResourceMark rm; #if INCLUDE_JVMCI - if (nm->is_compiled_by_jvmci()) { + if (cm->is_compiled_by_jvmci()) { // lookup exception handler for this pc - int catch_pco = ret_pc - nm->code_begin(); - ExceptionHandlerTable table(nm); + int catch_pco = ret_pc - cm->code_begin(); + ExceptionHandlerTable table(cm); HandlerTableEntry *t = table.entry_for(catch_pco, -1, 0); if (t != NULL) { - return nm->code_begin() + t->pco(); + return cm->code_begin() + t->pco(); } else { // there is no exception handler for this pc => deoptimize - nm->make_not_entrant(); + cm->make_not_entrant(); // Use Deoptimization::deoptimize for all of its side-effects: // revoking biases of monitors, gathering traps statistics, logging... @@ -662,6 +652,7 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc, } #endif // INCLUDE_JVMCI + nmethod* nm = cm->as_nmethod(); ScopeDesc* sd = nm->scope_desc_at(ret_pc); // determine handler bci, if any EXCEPTION_MARK; @@ -797,7 +788,7 @@ void SharedRuntime::throw_StackOverflowError_common(JavaThread* thread, bool del } #if INCLUDE_JVMCI -address SharedRuntime::deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason) { +address SharedRuntime::deoptimize_for_implicit_exception(JavaThread* thread, address pc, CompiledMethod* nm, int deopt_reason) { assert(deopt_reason > Deoptimization::Reason_none && deopt_reason < Deoptimization::Reason_LIMIT, "invalid deopt reason"); thread->set_jvmci_implicit_exception_pc(pc); thread->set_pending_deoptimization(Deoptimization::make_trap_request((Deoptimization::DeoptReason)deopt_reason, Deoptimization::Action_reinterpret)); @@ -871,7 +862,7 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, // 2. Inline-cache check in nmethod, or // 3. Implicit null exception in nmethod - if (!cb->is_nmethod()) { + if (!cb->is_compiled()) { bool is_in_blob = cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(); if (!is_in_blob) { // Allow normal crash reporting to handle this @@ -882,9 +873,9 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, return StubRoutines::throw_NullPointerException_at_call_entry(); } - // Otherwise, it's an nmethod. Consult its exception handlers. - nmethod* nm = (nmethod*)cb; - if (nm->inlinecache_check_contains(pc)) { + // Otherwise, it's a compiled method. Consult its exception handlers. + CompiledMethod* cm = (CompiledMethod*)cb; + if (cm->inlinecache_check_contains(pc)) { // exception happened inside inline-cache check code // => the nmethod is not yet active (i.e., the frame // is not set up yet) => use return address pushed by @@ -893,7 +884,7 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, return StubRoutines::throw_NullPointerException_at_call_entry(); } - if (nm->method()->is_method_handle_intrinsic()) { + if (cm->method()->is_method_handle_intrinsic()) { // exception happened inside MH dispatch code, similar to a vtable stub Events::log_exception(thread, "NullPointerException in MH adapter " INTPTR_FORMAT, p2i(pc)); return StubRoutines::throw_NullPointerException_at_call_entry(); @@ -903,15 +894,15 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, _implicit_null_throws++; #endif #if INCLUDE_JVMCI - if (nm->is_compiled_by_jvmci() && nm->pc_desc_at(pc) != NULL) { + if (cm->is_compiled_by_jvmci() && cm->pc_desc_at(pc) != NULL) { // If there's no PcDesc then we'll die way down inside of // deopt instead of just getting normal error reporting, // so only go there if it will succeed. - return deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_null_check); + return deoptimize_for_implicit_exception(thread, pc, cm, Deoptimization::Reason_null_check); } else { #endif // INCLUDE_JVMCI - assert (nm->is_nmethod(), "Expect nmethod"); - target_pc = nm->continuation_for_implicit_exception(pc); + assert (cm->is_nmethod(), "Expect nmethod"); + target_pc = ((nmethod*)cm)->continuation_for_implicit_exception(pc); #if INCLUDE_JVMCI } #endif // INCLUDE_JVMCI @@ -925,17 +916,17 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, case IMPLICIT_DIVIDE_BY_ZERO: { - nmethod* nm = CodeCache::find_nmethod(pc); - guarantee(nm != NULL, "must have containing compiled method for implicit division-by-zero exceptions"); + CompiledMethod* cm = CodeCache::find_compiled(pc); + guarantee(cm != NULL, "must have containing compiled method for implicit division-by-zero exceptions"); #ifndef PRODUCT _implicit_div0_throws++; #endif #if INCLUDE_JVMCI - if (nm->is_compiled_by_jvmci() && nm->pc_desc_at(pc) != NULL) { - return deoptimize_for_implicit_exception(thread, pc, nm, Deoptimization::Reason_div0_check); + if (cm->is_compiled_by_jvmci() && cm->pc_desc_at(pc) != NULL) { + return deoptimize_for_implicit_exception(thread, pc, cm, Deoptimization::Reason_div0_check); } else { #endif // INCLUDE_JVMCI - target_pc = nm->continuation_for_implicit_exception(pc); + target_pc = cm->continuation_for_implicit_exception(pc); #if INCLUDE_JVMCI } #endif // INCLUDE_JVMCI @@ -1084,14 +1075,14 @@ Handle SharedRuntime::find_callee_info(JavaThread* thread, Bytecodes::Code& bc, } methodHandle SharedRuntime::extract_attached_method(vframeStream& vfst) { - nmethod* caller_nm = vfst.nm(); + CompiledMethod* caller = vfst.nm(); - nmethodLocker caller_lock(caller_nm); + nmethodLocker caller_lock(caller); address pc = vfst.frame_pc(); { // Get call instruction under lock because another thread may be busy patching it. MutexLockerEx ml_patch(Patching_lock, Mutex::_no_safepoint_check_flag); - return caller_nm->attached_method_before_pc(pc); + return caller->attached_method_before_pc(pc); } return NULL; } @@ -1283,8 +1274,8 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread, frame caller_frame = thread->last_frame().sender(&cbl_map); CodeBlob* caller_cb = caller_frame.cb(); - guarantee(caller_cb != NULL && caller_cb->is_nmethod(), "must be called from nmethod"); - nmethod* caller_nm = caller_cb->as_nmethod_or_null(); + guarantee(caller_cb != NULL && caller_cb->is_compiled(), "must be called from compiled method"); + CompiledMethod* caller_nm = caller_cb->as_compiled_method_or_null(); // make sure caller is not getting deoptimized // and removed before we are done with it. @@ -1347,14 +1338,19 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread, // Make sure the callee nmethod does not get deoptimized and removed before // we are done patching the code. - nmethod* callee_nm = callee_method->code(); - if (callee_nm != NULL && !callee_nm->is_in_use()) { - // Patch call site to C2I adapter if callee nmethod is deoptimized or unloaded. - callee_nm = NULL; + CompiledMethod* callee = callee_method->code(); + + if (callee != NULL) { + assert(callee->is_compiled(), "must be nmethod for patching"); } - nmethodLocker nl_callee(callee_nm); + + if (callee != NULL && !callee->is_in_use()) { + // Patch call site to C2I adapter if callee nmethod is deoptimized or unloaded. + callee = NULL; + } + nmethodLocker nl_callee(callee); #ifdef ASSERT - address dest_entry_point = callee_nm == NULL ? 0 : callee_nm->entry_point(); // used below + address dest_entry_point = callee == NULL ? 0 : callee->entry_point(); // used below #endif if (is_virtual) { @@ -1382,12 +1378,12 @@ methodHandle SharedRuntime::resolve_sub_helper(JavaThread *thread, // which may happen when multiply alive nmethod (tiered compilation) // will be supported. if (!callee_method->is_old() && - (callee_nm == NULL || callee_nm->is_in_use() && (callee_method->code() == callee_nm))) { + (callee == NULL || callee->is_in_use() && (callee_method->code() == callee))) { #ifdef ASSERT // We must not try to patch to jump to an already unloaded method. if (dest_entry_point != 0) { CodeBlob* cb = CodeCache::find_blob(dest_entry_point); - assert((cb != NULL) && cb->is_nmethod() && (((nmethod*)cb) == callee_nm), + assert((cb != NULL) && cb->is_compiled() && (((CompiledMethod*)cb) == callee), "should not call unloaded nmethod"); } #endif @@ -1582,8 +1578,9 @@ methodHandle SharedRuntime::handle_ic_miss_helper(JavaThread *thread, TRAPS) { RegisterMap reg_map(thread, false); frame caller_frame = thread->last_frame().sender(®_map); CodeBlob* cb = caller_frame.cb(); - if (cb->is_nmethod()) { - CompiledIC* inline_cache = CompiledIC_before(((nmethod*)cb), caller_frame.pc()); + CompiledMethod* caller_nm = cb->as_compiled_method_or_null(); + if (cb->is_compiled()) { + CompiledIC* inline_cache = CompiledIC_before(((CompiledMethod*)cb), caller_frame.pc()); bool should_be_mono = false; if (inline_cache->is_optimized()) { if (TraceCallFixup) { @@ -1667,7 +1664,7 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) { // Check for static or virtual call bool is_static_call = false; - nmethod* caller_nm = CodeCache::find_nmethod(pc); + CompiledMethod* caller_nm = CodeCache::find_compiled(pc); // Default call_addr is the location of the "basic" call. // Determine the address of the call we a reresolving. With @@ -1755,6 +1752,21 @@ methodHandle SharedRuntime::reresolve_call_site(JavaThread *thread, TRAPS) { return callee_method; } +address SharedRuntime::handle_unsafe_access(JavaThread* thread, address next_pc) { + // The faulting unsafe accesses should be changed to throw the error + // synchronously instead. Meanwhile the faulting instruction will be + // skipped over (effectively turning it into a no-op) and an + // asynchronous exception will be raised which the thread will + // handle at a later point. If the instruction is a load it will + // return garbage. + + // Request an async exception. + thread->set_pending_unsafe_access_error(); + + // Return address of next instruction to execute. + return next_pc; +} + #ifdef ASSERT void SharedRuntime::check_member_name_argument_is_last_argument(const methodHandle& method, const BasicType* sig_bt, @@ -1802,12 +1814,12 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal // ask me how I know this... CodeBlob* cb = CodeCache::find_blob(caller_pc); - if (!cb->is_nmethod() || entry_point == moop->get_c2i_entry()) { + if (!cb->is_compiled() || entry_point == moop->get_c2i_entry()) { return; } // The check above makes sure this is a nmethod. - nmethod* nm = cb->as_nmethod_or_null(); + CompiledMethod* nm = cb->as_compiled_method_or_null(); assert(nm, "must be"); // Get the return PC for the passed caller PC. diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp index 68baebc4686..eb9797f26f5 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp @@ -188,7 +188,7 @@ class SharedRuntime: AllStatic { #endif // INCLUDE_ALL_GCS // exception handling and implicit exceptions - static address compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception, + static address compute_compiled_exc_handler(CompiledMethod* nm, address ret_pc, Handle& exception, bool force_unwind, bool top_frame_only); enum ImplicitExceptionKind { IMPLICIT_NULL, @@ -207,7 +207,7 @@ class SharedRuntime: AllStatic { address faulting_pc, ImplicitExceptionKind exception_kind); #if INCLUDE_JVMCI - static address deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason); + static address deoptimize_for_implicit_exception(JavaThread* thread, address pc, CompiledMethod* nm, int deopt_reason); #endif static void enable_stack_reserved_zone(JavaThread* thread); @@ -522,6 +522,8 @@ class SharedRuntime: AllStatic { static address handle_wrong_method_abstract(JavaThread* thread); static address handle_wrong_method_ic_miss(JavaThread* thread); + static address handle_unsafe_access(JavaThread* thread, address next_pc); + #ifndef PRODUCT // Collect and print inline cache miss statistics diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp index 2a0138871fc..40f4d1aaeee 100644 --- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp +++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -192,7 +192,7 @@ void SimpleThresholdPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) { } nmethod* SimpleThresholdPolicy::event(const methodHandle& method, const methodHandle& inlinee, - int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) { + int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread) { if (comp_level == CompLevel_none && JvmtiExport::can_post_interpreter_events() && thread->is_interp_only_mode()) { @@ -265,7 +265,7 @@ void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel l // Tell the broker to compile the method void SimpleThresholdPolicy::submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) { int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count(); - CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread); + CompileBroker::compile_method(mh, bci, level, mh, hot_count, CompileTask::Reason_Tiered, thread); } // Call and loop predicates determine whether a transition to a higher @@ -392,7 +392,7 @@ CompLevel SimpleThresholdPolicy::loop_event(Method* method, CompLevel cur_level) // Handle the invocation event. void SimpleThresholdPolicy::method_invocation_event(const methodHandle& mh, const methodHandle& imh, - CompLevel level, nmethod* nm, JavaThread* thread) { + CompLevel level, CompiledMethod* nm, JavaThread* thread) { if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { CompLevel next_level = call_event(mh(), level); if (next_level != level) { @@ -404,7 +404,7 @@ void SimpleThresholdPolicy::method_invocation_event(const methodHandle& mh, cons // Handle the back branch event. Notice that we can compile the method // with a regular entry from here. void SimpleThresholdPolicy::method_back_branch_event(const methodHandle& mh, const methodHandle& imh, - int bci, CompLevel level, nmethod* nm, JavaThread* thread) { + int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread) { // If the method is already compiling, quickly bail out. if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) { // Use loop event as an opportunity to also check there's been diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp index 02a13cadc3c..d2dd9cc971c 100644 --- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp +++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -81,16 +81,16 @@ protected: // Get a compilation level for a given method. static CompLevel comp_level(Method* method) { - nmethod *nm = method->code(); + CompiledMethod *nm = method->code(); if (nm != NULL && nm->is_in_use()) { return (CompLevel)nm->comp_level(); } return CompLevel_none; } virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee, - CompLevel level, nmethod* nm, JavaThread* thread); + CompLevel level, CompiledMethod* nm, JavaThread* thread); virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee, - int bci, CompLevel level, nmethod* nm, JavaThread* thread); + int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread); public: SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { } virtual int compiler_count(CompLevel comp_level) { @@ -104,7 +104,7 @@ public: virtual void disable_compilation(Method* method) { } virtual void reprofile(ScopeDesc* trap_scope, bool is_osr); virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, - int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread); + int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread); // Select task is called by CompileBroker. We should return a task or NULL. virtual CompileTask* select_task(CompileQueue* compile_queue); // Tell the runtime if we think a given method is adequately profiled. diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp index ac98cd18ea6..12e0e3a5b82 100644 --- a/hotspot/src/share/vm/runtime/stubRoutines.cpp +++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp @@ -55,7 +55,6 @@ address StubRoutines::_throw_IncompatibleClassChangeError_entry = NULL; address StubRoutines::_throw_NullPointerException_at_call_entry = NULL; address StubRoutines::_throw_StackOverflowError_entry = NULL; address StubRoutines::_throw_delayed_StackOverflowError_entry = NULL; -address StubRoutines::_handler_for_unsafe_access_entry = NULL; jint StubRoutines::_verify_oop_count = 0; address StubRoutines::_verify_oop_subroutine_entry = NULL; address StubRoutines::_atomic_xchg_entry = NULL; @@ -154,11 +153,14 @@ address StubRoutines::_vectorizedMismatch = NULL; address StubRoutines::_dexp = NULL; address StubRoutines::_dlog = NULL; +address StubRoutines::_dlog10 = NULL; address StubRoutines::_dpow = NULL; address StubRoutines::_dsin = NULL; address StubRoutines::_dcos = NULL; address StubRoutines::_dlibm_sin_cos_huge = NULL; address StubRoutines::_dlibm_reduce_pi04l = NULL; +address StubRoutines::_dlibm_tan_cot_huge = NULL; +address StubRoutines::_dtan = NULL; double (* StubRoutines::_intrinsic_log10 )(double) = NULL; double (* StubRoutines::_intrinsic_sin )(double) = NULL; diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp index 55cd9934bd0..729886f04fd 100644 --- a/hotspot/src/share/vm/runtime/stubRoutines.hpp +++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -111,7 +111,6 @@ class StubRoutines: AllStatic { static address _throw_NullPointerException_at_call_entry; static address _throw_StackOverflowError_entry; static address _throw_delayed_StackOverflowError_entry; - static address _handler_for_unsafe_access_entry; static address _atomic_xchg_entry; static address _atomic_xchg_ptr_entry; @@ -212,11 +211,14 @@ class StubRoutines: AllStatic { static address _dexp; static address _dlog; + static address _dlog10; static address _dpow; static address _dsin; static address _dcos; static address _dlibm_sin_cos_huge; static address _dlibm_reduce_pi04l; + static address _dlibm_tan_cot_huge; + static address _dtan; // These are versions of the java.lang.Math methods which perform // the same operations as the intrinsic version. They are used for @@ -251,8 +253,8 @@ class StubRoutines: AllStatic { (_code2 != NULL && _code2->blob_contains(addr)) ; } - static CodeBlob* code1() { return _code1; } - static CodeBlob* code2() { return _code2; } + static RuntimeBlob* code1() { return _code1; } + static RuntimeBlob* code2() { return _code2; } // Debugging static jint verify_oop_count() { return _verify_oop_count; } @@ -285,10 +287,6 @@ class StubRoutines: AllStatic { static address throw_StackOverflowError_entry() { return _throw_StackOverflowError_entry; } static address throw_delayed_StackOverflowError_entry() { return _throw_delayed_StackOverflowError_entry; } - // Exceptions during unsafe access - should throw Java exception rather - // than crash. - static address handler_for_unsafe_access() { return _handler_for_unsafe_access_entry; } - static address atomic_xchg_entry() { return _atomic_xchg_entry; } static address atomic_xchg_ptr_entry() { return _atomic_xchg_ptr_entry; } static address atomic_store_entry() { return _atomic_store_entry; } @@ -390,11 +388,14 @@ class StubRoutines: AllStatic { static address dexp() { return _dexp; } static address dlog() { return _dlog; } + static address dlog10() { return _dlog10; } static address dpow() { return _dpow; } static address dsin() { return _dsin; } static address dcos() { return _dcos; } static address dlibm_reduce_pi04l() { return _dlibm_reduce_pi04l; } static address dlibm_sin_cos_huge() { return _dlibm_sin_cos_huge; } + static address dlibm_tan_cot_huge() { return _dlibm_tan_cot_huge; } + static address dtan() { return _dtan; } static address select_fill_function(BasicType t, bool aligned, const char* &name); diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp index 3bd5a0f1d29..16cf5cde781 100644 --- a/hotspot/src/share/vm/runtime/sweeper.cpp +++ b/hotspot/src/share/vm/runtime/sweeper.cpp @@ -109,13 +109,13 @@ void NMethodSweeper::report_events() { } } -void NMethodSweeper::record_sweep(nmethod* nm, int line) { +void NMethodSweeper::record_sweep(CompiledMethod* nm, int line) { if (_records != NULL) { _records[_sweep_index].traversal = _traversals; - _records[_sweep_index].traversal_mark = nm->_stack_traversal_mark; + _records[_sweep_index].traversal_mark = nm->is_nmethod() ? ((nmethod*)nm)->_stack_traversal_mark : 0; _records[_sweep_index].compile_id = nm->compile_id(); _records[_sweep_index].kind = nm->compile_kind(); - _records[_sweep_index].state = nm->_state; + _records[_sweep_index].state = nm->get_state(); _records[_sweep_index].vep = nm->verified_entry_point(); _records[_sweep_index].uep = nm->entry_point(); _records[_sweep_index].line = line; @@ -134,7 +134,7 @@ void NMethodSweeper::init_sweeper_log() { #define SWEEP(nm) #endif -NMethodIterator NMethodSweeper::_current; // Current nmethod +CompiledMethodIterator NMethodSweeper::_current; // Current compiled method long NMethodSweeper::_traversals = 0; // Stack scan count, also sweep ID. long NMethodSweeper::_total_nof_code_cache_sweeps = 0; // Total number of full sweeps of the code cache long NMethodSweeper::_time_counter = 0; // Virtual time used to periodically invoke sweeper @@ -210,10 +210,17 @@ void NMethodSweeper::mark_active_nmethods() { _time_counter++; // Check for restart - assert(CodeCache::find_blob_unsafe(_current.method()) == _current.method(), "Sweeper nmethod cached state invalid"); + if (_current.method() != NULL) { + if (_current.method()->is_nmethod()) { + assert(CodeCache::find_blob_unsafe(_current.method()) == _current.method(), "Sweeper nmethod cached state invalid"); + } else { + ShouldNotReachHere(); + } + } + if (wait_for_stack_scanning()) { _seen = 0; - _current = NMethodIterator(); + _current = CompiledMethodIterator(); // Initialize to first nmethod _current.next(); _traversals += 1; @@ -415,14 +422,15 @@ void NMethodSweeper::sweep_code_cache() { // Since we will give up the CodeCache_lock, always skip ahead // to the next nmethod. Other blobs can be deleted by other // threads but nmethods are only reclaimed by the sweeper. - nmethod* nm = _current.method(); + CompiledMethod* nm = _current.method(); _current.next(); // Now ready to process nmethod and give up CodeCache_lock { MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); // Save information before potentially flushing the nmethod - int size = nm->total_size(); + // Only flushing nmethods so size only matters for them. + int size = nm->is_nmethod() ? ((nmethod*)nm)->total_size() : 0; bool is_c2_method = nm->is_compiled_by_c2(); bool is_osr = nm->is_osr_method(); int compile_id = nm->compile_id(); @@ -430,7 +438,7 @@ void NMethodSweeper::sweep_code_cache() { const char* state_before = nm->state(); const char* state_after = ""; - MethodStateChange type = process_nmethod(nm); + MethodStateChange type = process_compiled_method(nm); switch (type) { case Flushed: state_after = "flushed"; @@ -532,28 +540,28 @@ void NMethodSweeper::possibly_enable_sweeper() { } } -class NMethodMarker: public StackObj { +class CompiledMethodMarker: public StackObj { private: CodeCacheSweeperThread* _thread; public: - NMethodMarker(nmethod* nm) { + CompiledMethodMarker(CompiledMethod* cm) { JavaThread* current = JavaThread::current(); assert (current->is_Code_cache_sweeper_thread(), "Must be"); _thread = (CodeCacheSweeperThread*)current; - if (!nm->is_zombie() && !nm->is_unloaded()) { + if (!cm->is_zombie() && !cm->is_unloaded()) { // Only expose live nmethods for scanning - _thread->set_scanned_nmethod(nm); + _thread->set_scanned_compiled_method(cm); } } - ~NMethodMarker() { - _thread->set_scanned_nmethod(NULL); + ~CompiledMethodMarker() { + _thread->set_scanned_compiled_method(NULL); } }; -void NMethodSweeper::release_nmethod(nmethod* nm) { +void NMethodSweeper::release_compiled_method(CompiledMethod* nm) { // Make sure the released nmethod is no longer referenced by the sweeper thread CodeCacheSweeperThread* thread = (CodeCacheSweeperThread*)JavaThread::current(); - thread->set_scanned_nmethod(NULL); + thread->set_scanned_compiled_method(NULL); // Clean up any CompiledICHolders { @@ -571,98 +579,100 @@ void NMethodSweeper::release_nmethod(nmethod* nm) { nm->flush(); } -NMethodSweeper::MethodStateChange NMethodSweeper::process_nmethod(nmethod* nm) { - assert(nm != NULL, "sanity"); +NMethodSweeper::MethodStateChange NMethodSweeper::process_compiled_method(CompiledMethod* cm) { + assert(cm != NULL, "sanity"); assert(!CodeCache_lock->owned_by_self(), "just checking"); MethodStateChange result = None; // Make sure this nmethod doesn't get unloaded during the scan, // since safepoints may happen during acquired below locks. - NMethodMarker nmm(nm); - SWEEP(nm); + CompiledMethodMarker nmm(cm); + SWEEP(cm); // Skip methods that are currently referenced by the VM - if (nm->is_locked_by_vm()) { + if (cm->is_locked_by_vm()) { // But still remember to clean-up inline caches for alive nmethods - if (nm->is_alive()) { + if (cm->is_alive()) { // Clean inline caches that point to zombie/non-entrant/unloaded nmethods MutexLocker cl(CompiledIC_lock); - nm->cleanup_inline_caches(); - SWEEP(nm); + cm->cleanup_inline_caches(); + SWEEP(cm); } return result; } - if (nm->is_zombie()) { + if (cm->is_zombie()) { // All inline caches that referred to this nmethod were cleaned in the // previous sweeper cycle. Now flush the nmethod from the code cache. - assert(!nm->is_locked_by_vm(), "must not flush locked nmethods"); - release_nmethod(nm); + assert(!cm->is_locked_by_vm(), "must not flush locked Compiled Methods"); + release_compiled_method(cm); assert(result == None, "sanity"); result = Flushed; - } else if (nm->is_not_entrant()) { + } else if (cm->is_not_entrant()) { // If there are no current activations of this method on the // stack we can safely convert it to a zombie method - if (nm->can_convert_to_zombie()) { + if (cm->can_convert_to_zombie()) { // Clear ICStubs to prevent back patching stubs of zombie or flushed // nmethods during the next safepoint (see ICStub::finalize). { MutexLocker cl(CompiledIC_lock); - nm->clear_ic_stubs(); + cm->clear_ic_stubs(); } // Code cache state change is tracked in make_zombie() - nm->make_zombie(); - SWEEP(nm); + cm->make_zombie(); + SWEEP(cm); // The nmethod may have been locked by JVMTI after being made zombie (see // JvmtiDeferredEvent::compiled_method_unload_event()). If so, we cannot // flush the osr nmethod directly but have to wait for a later sweeper cycle. - if (nm->is_osr_method() && !nm->is_locked_by_vm()) { + if (cm->is_osr_method() && !cm->is_locked_by_vm()) { // No inline caches will ever point to osr methods, so we can just remove it. // Make sure that we unregistered the nmethod with the heap and flushed all // dependencies before removing the nmethod (done in make_zombie()). - assert(nm->is_zombie(), "nmethod must be unregistered"); - release_nmethod(nm); + assert(cm->is_zombie(), "nmethod must be unregistered"); + release_compiled_method(cm); assert(result == None, "sanity"); result = Flushed; } else { assert(result == None, "sanity"); result = MadeZombie; - assert(nm->is_zombie(), "nmethod must be zombie"); + assert(cm->is_zombie(), "nmethod must be zombie"); } } else { // Still alive, clean up its inline caches MutexLocker cl(CompiledIC_lock); - nm->cleanup_inline_caches(); - SWEEP(nm); + cm->cleanup_inline_caches(); + SWEEP(cm); } - } else if (nm->is_unloaded()) { + } else if (cm->is_unloaded()) { // Code is unloaded, so there are no activations on the stack. // Convert the nmethod to zombie or flush it directly in the OSR case. { // Clean ICs of unloaded nmethods as well because they may reference other // unloaded nmethods that may be flushed earlier in the sweeper cycle. MutexLocker cl(CompiledIC_lock); - nm->cleanup_inline_caches(); + cm->cleanup_inline_caches(); } - if (nm->is_osr_method()) { - SWEEP(nm); + if (cm->is_osr_method()) { + SWEEP(cm); // No inline caches will ever point to osr methods, so we can just remove it - release_nmethod(nm); + release_compiled_method(cm); assert(result == None, "sanity"); result = Flushed; } else { // Code cache state change is tracked in make_zombie() - nm->make_zombie(); - SWEEP(nm); + cm->make_zombie(); + SWEEP(cm); assert(result == None, "sanity"); result = MadeZombie; } } else { - possibly_flush(nm); + if (cm->is_nmethod()) { + possibly_flush((nmethod*)cm); + } // Clean inline caches that point to zombie/non-entrant/unloaded nmethods MutexLocker cl(CompiledIC_lock); - nm->cleanup_inline_caches(); - SWEEP(nm); + cm->cleanup_inline_caches(); + SWEEP(cm); } return result; } diff --git a/hotspot/src/share/vm/runtime/sweeper.hpp b/hotspot/src/share/vm/runtime/sweeper.hpp index eb29e7de660..800e3811544 100644 --- a/hotspot/src/share/vm/runtime/sweeper.hpp +++ b/hotspot/src/share/vm/runtime/sweeper.hpp @@ -66,7 +66,7 @@ class NMethodSweeper : public AllStatic { static long _total_nof_code_cache_sweeps; // Total number of full sweeps of the code cache static long _time_counter; // Virtual time used to periodically invoke sweeper static long _last_sweep; // Value of _time_counter when the last sweep happened - static NMethodIterator _current; // Current nmethod + static CompiledMethodIterator _current; // Current compiled method static int _seen; // Nof. nmethod we have currently processed in current pass of CodeCache static volatile int _sweep_started; // Flag to control conc sweeper @@ -88,8 +88,8 @@ class NMethodSweeper : public AllStatic { static Monitor* _stat_lock; - static MethodStateChange process_nmethod(nmethod *nm); - static void release_nmethod(nmethod* nm); + static MethodStateChange process_compiled_method(CompiledMethod *nm); + static void release_compiled_method(CompiledMethod* nm); static void init_sweeper_log() NOT_DEBUG_RETURN; static bool wait_for_stack_scanning(); @@ -107,9 +107,8 @@ class NMethodSweeper : public AllStatic { #ifdef ASSERT - static bool is_sweeping(nmethod* which) { return _current.method() == which; } // Keep track of sweeper activity in the ring buffer - static void record_sweep(nmethod* nm, int line); + static void record_sweep(CompiledMethod* nm, int line); static void report_events(int id, address entry); static void report_events(); #endif diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 719eb74b018..6c6bb684638 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -60,6 +60,7 @@ #include "runtime/atomic.inline.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/commandLineFlagConstraintList.hpp" +#include "runtime/commandLineFlagWriteableList.hpp" #include "runtime/commandLineFlagRangeList.hpp" #include "runtime/deoptimization.hpp" #include "runtime/fprofiler.hpp" @@ -785,7 +786,7 @@ bool Thread::claim_oops_do_par_case(int strong_roots_parity) { return false; } -void Thread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { +void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) { active_handles()->oops_do(f); // Do oop for ThreadShadow f->do_oop((oop*)&_pending_exception); @@ -1432,7 +1433,7 @@ void JavaThread::initialize() { set_vframe_array_last(NULL); set_deferred_locals(NULL); set_deopt_mark(NULL); - set_deopt_nmethod(NULL); + set_deopt_compiled_method(NULL); clear_must_deopt_id(); set_monitor_chunks(NULL); set_next(NULL); @@ -2758,7 +2759,7 @@ class RememberProcessedThread: public StackObj { } }; -void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { +void JavaThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { // Verify that the deferred card marks have been flushed. assert(deferred_card_mark().is_empty(), "Should be empty during GC"); @@ -2766,7 +2767,7 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) // since there may be more than one thread using each ThreadProfiler. // Traverse the GCHandles - Thread::oops_do(f, cld_f, cf); + Thread::oops_do(f, cf); JVMCI_ONLY(f->do_oop((oop*)&_pending_failed_speculation);) @@ -2796,7 +2797,7 @@ void JavaThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) // Traverse the execution stack for (StackFrameStream fst(this); !fst.is_done(); fst.next()) { - fst.current()->oops_do(f, cld_f, cf, fst.register_map()); + fst.current()->oops_do(f, cf, fst.register_map()); } } @@ -2946,7 +2947,7 @@ static void frame_verify(frame* f, const RegisterMap *map) { f->verify(map); } void JavaThread::verify() { // Verify oops in the thread. - oops_do(&VerifyOopClosure::verify_oop, NULL, NULL); + oops_do(&VerifyOopClosure::verify_oop, NULL); // Verify the stack frames. frames_do(frame_verify); @@ -3186,7 +3187,7 @@ class PrintAndVerifyOopClosure: public OopClosure { static void oops_print(frame* f, const RegisterMap *map) { PrintAndVerifyOopClosure print; f->print_value(); - f->oops_do(&print, NULL, NULL, (RegisterMap*)map); + f->oops_do(&print, NULL, (RegisterMap*)map); } // Print our all the locations that contain oops and whether they are @@ -3300,26 +3301,26 @@ bool CompilerThread::can_call_java() const { // Create sweeper thread CodeCacheSweeperThread::CodeCacheSweeperThread() : JavaThread(&sweeper_thread_entry) { - _scanned_nmethod = NULL; + _scanned_compiled_method = NULL; } -void CodeCacheSweeperThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { - JavaThread::oops_do(f, cld_f, cf); - if (_scanned_nmethod != NULL && cf != NULL) { +void CodeCacheSweeperThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { + JavaThread::oops_do(f, cf); + if (_scanned_compiled_method != NULL && cf != NULL) { // Safepoints can occur when the sweeper is scanning an nmethod so // process it here to make sure it isn't unloaded in the middle of // a scan. - cf->do_code_blob(_scanned_nmethod); + cf->do_code_blob(_scanned_compiled_method); } } void CodeCacheSweeperThread::nmethods_do(CodeBlobClosure* cf) { JavaThread::nmethods_do(cf); - if (_scanned_nmethod != NULL && cf != NULL) { + if (_scanned_compiled_method != NULL && cf != NULL) { // Safepoints can occur when the sweeper is scanning an nmethod so // process it here to make sure it isn't unloaded in the middle of // a scan. - cf->do_code_blob(_scanned_nmethod); + cf->do_code_blob(_scanned_compiled_method); } } @@ -3544,6 +3545,8 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { return JNI_EINVAL; } + CommandLineFlagWriteableList::mark_startup(); + if (PauseAtStartup) { os::pause(); } @@ -4291,11 +4294,11 @@ bool Threads::includes(JavaThread* p) { // uses the Threads_lock to guarantee this property. It also makes sure that // all threads gets blocked when exiting or starting). -void Threads::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { +void Threads::oops_do(OopClosure* f, CodeBlobClosure* cf) { ALL_JAVA_THREADS(p) { - p->oops_do(f, cld_f, cf); + p->oops_do(f, cf); } - VMThread::vm_thread()->oops_do(f, cld_f, cf); + VMThread::vm_thread()->oops_do(f, cf); } void Threads::change_thread_claim_parity() { @@ -4318,16 +4321,16 @@ void Threads::assert_all_threads_claimed() { } #endif // ASSERT -void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { +void Threads::possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf) { int cp = Threads::thread_claim_parity(); ALL_JAVA_THREADS(p) { if (p->claim_oops_do(is_par, cp)) { - p->oops_do(f, cld_f, cf); + p->oops_do(f, cf); } } VMThread* vmt = VMThread::vm_thread(); if (vmt->claim_oops_do(is_par, cp)) { - vmt->oops_do(f, cld_f, cf); + vmt->oops_do(f, cf); } } @@ -4353,7 +4356,7 @@ void Threads::nmethods_do(CodeBlobClosure* cf) { ALL_JAVA_THREADS(p) { // This is used by the code cache sweeper to mark nmethods that are active // on the stack of a Java thread. Ignore the sweeper thread itself to avoid - // marking CodeCacheSweeperThread::_scanned_nmethod as active. + // marking CodeCacheSweeperThread::_scanned_compiled_method as active. if(!p->is_Code_cache_sweeper_thread()) { p->nmethods_do(cf); } diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index f5d7ac5b74d..2b81b3131c2 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -96,6 +96,7 @@ class WorkerThread; // - GangWorker // - GCTaskThread // - JavaThread +// - various subclasses eg CompilerThread, ServiceThread // - WatcherThread class Thread: public ThreadShadow { @@ -314,8 +315,7 @@ class Thread: public ThreadShadow { // Manage Thread::current() void initialize_thread_current(); - private: - void clear_thread_current(); // needed for detaching JNI threads + void clear_thread_current(); // TLS cleanup needed before threads terminate public: // thread entry point @@ -482,10 +482,9 @@ class Thread: public ThreadShadow { // GC support // Apply "f->do_oop" to all root oops in "this". - // Apply "cld_f->do_cld" to CLDs that are otherwise not kept alive. // Used by JavaThread::oops_do. // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames - virtual void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); + virtual void oops_do(OopClosure* f, CodeBlobClosure* cf); // Handles the parallel case for the method below. private: @@ -744,6 +743,11 @@ class WatcherThread: public Thread { // Constructor WatcherThread(); + // No destruction allowed + ~WatcherThread() { + guarantee(false, "WatcherThread deletion must fix the race with VM termination"); + } + // Tester bool is_Watcher_thread() const { return true; } @@ -820,7 +824,7 @@ class JavaThread: public Thread { intptr_t* _must_deopt_id; // id of frame that needs to be deopted once we // transition out of native - nmethod* _deopt_nmethod; // nmethod that is currently being deoptimized + CompiledMethod* _deopt_nmethod; // CompiledMethod that is currently being deoptimized vframeArray* _vframe_array_head; // Holds the heap of the active vframeArrays vframeArray* _vframe_array_last; // Holds last vFrameArray we popped // Because deoptimization is lazy we must save jvmti requests to set locals @@ -1298,8 +1302,8 @@ class JavaThread: public Thread { void set_must_deopt_id(intptr_t* id) { _must_deopt_id = id; } void clear_must_deopt_id() { _must_deopt_id = NULL; } - void set_deopt_nmethod(nmethod* nm) { _deopt_nmethod = nm; } - nmethod* deopt_nmethod() { return _deopt_nmethod; } + void set_deopt_compiled_method(CompiledMethod* nm) { _deopt_nmethod = nm; } + CompiledMethod* deopt_compiled_method() { return _deopt_nmethod; } Method* callee_target() const { return _callee_target; } void set_callee_target (Method* x) { _callee_target = x; } @@ -1642,7 +1646,7 @@ class JavaThread: public Thread { void frames_do(void f(frame*, const RegisterMap*)); // Memory operations - void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); + void oops_do(OopClosure* f, CodeBlobClosure* cf); // Sweeper operations virtual void nmethods_do(CodeBlobClosure* cf); @@ -1980,13 +1984,13 @@ inline CompilerThread* JavaThread::as_CompilerThread() { // Dedicated thread to sweep the code cache class CodeCacheSweeperThread : public JavaThread { - nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper + CompiledMethod* _scanned_compiled_method; // nmethod being scanned by the sweeper public: CodeCacheSweeperThread(); // Track the nmethod currently being scanned by the sweeper - void set_scanned_nmethod(nmethod* nm) { - assert(_scanned_nmethod == NULL || nm == NULL, "should reset to NULL before writing a new value"); - _scanned_nmethod = nm; + void set_scanned_compiled_method(CompiledMethod* cm) { + assert(_scanned_compiled_method == NULL || cm == NULL, "should reset to NULL before writing a new value"); + _scanned_compiled_method = cm; } // Hide sweeper thread from external view. @@ -1994,8 +1998,8 @@ class CodeCacheSweeperThread : public JavaThread { bool is_Code_cache_sweeper_thread() const { return true; } - // Prevent GC from unloading _scanned_nmethod - void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); + // Prevent GC from unloading _scanned_compiled_method + void oops_do(OopClosure* f, CodeBlobClosure* cf); void nmethods_do(CodeBlobClosure* cf); }; @@ -2122,9 +2126,9 @@ class Threads: AllStatic { // Apply "f->do_oop" to all root oops in all threads. // This version may only be called by sequential code. - static void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); + static void oops_do(OopClosure* f, CodeBlobClosure* cf); // This version may be called by sequential or parallel code. - static void possibly_parallel_oops_do(bool is_par, OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); + static void possibly_parallel_oops_do(bool is_par, OopClosure* f, CodeBlobClosure* cf); // This creates a list of GCTasks, one per thread. static void create_thread_roots_tasks(GCTaskQueue* q); // This creates a list of GCTasks, one per thread, for marking objects. diff --git a/hotspot/src/share/vm/runtime/vframe.cpp b/hotspot/src/share/vm/runtime/vframe.cpp index 2716deb1987..7d9a7b39e6e 100644 --- a/hotspot/src/share/vm/runtime/vframe.cpp +++ b/hotspot/src/share/vm/runtime/vframe.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -67,8 +67,8 @@ vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThrea // Compiled frame CodeBlob* cb = f->cb(); if (cb != NULL) { - if (cb->is_nmethod()) { - nmethod* nm = (nmethod*)cb; + if (cb->is_compiled()) { + CompiledMethod* nm = (CompiledMethod*)cb; return new compiledVFrame(f, reg_map, thread, nm); } diff --git a/hotspot/src/share/vm/runtime/vframe.hpp b/hotspot/src/share/vm/runtime/vframe.hpp index dde2f246812..de7d510fc2d 100644 --- a/hotspot/src/share/vm/runtime/vframe.hpp +++ b/hotspot/src/share/vm/runtime/vframe.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -66,9 +66,9 @@ class vframe: public ResourceObj { // Accessors frame fr() const { return _fr; } CodeBlob* cb() const { return _fr.cb(); } - nmethod* nm() const { - assert( cb() != NULL && cb()->is_nmethod(), "usage"); - return (nmethod*) cb(); + CompiledMethod* nm() const { + assert( cb() != NULL && cb()->is_compiled(), "usage"); + return (CompiledMethod*) cb(); } // ???? Does this need to be a copy? @@ -317,18 +317,10 @@ class vframeStreamCommon : StackObj { intptr_t* frame_id() const { return _frame.id(); } address frame_pc() const { return _frame.pc(); } - javaVFrame* java_frame() { - vframe* vf = vframe::new_vframe(&_frame, &_reg_map, _thread); - if (vf->is_java_frame()) { - return (javaVFrame*)vf; - } - return NULL; - } - CodeBlob* cb() const { return _frame.cb(); } - nmethod* nm() const { - assert( cb() != NULL && cb()->is_nmethod(), "usage"); - return (nmethod*) cb(); + CompiledMethod* nm() const { + assert( cb() != NULL && cb()->is_compiled(), "usage"); + return (CompiledMethod*) cb(); } // Frame type @@ -449,7 +441,7 @@ inline bool vframeStreamCommon::fill_from_frame() { // Compiled frame - if (cb() != NULL && cb()->is_nmethod()) { + if (cb() != NULL && cb()->is_compiled()) { if (nm()->is_native_method()) { // Do not rely on scopeDesc since the pc might be unprecise due to the _last_native_pc trick. fill_from_compiled_native_frame(); diff --git a/hotspot/src/share/vm/runtime/vframeArray.cpp b/hotspot/src/share/vm/runtime/vframeArray.cpp index 29be4e4e4bd..483473244eb 100644 --- a/hotspot/src/share/vm/runtime/vframeArray.cpp +++ b/hotspot/src/share/vm/runtime/vframeArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -206,8 +206,8 @@ void vframeArrayElement::unpack_on_stack(int caller_actual_parameters, // in which case bcp should point to the monitorenter since it is within the exception's range. assert(*bcp != Bytecodes::_monitorenter || is_top_frame, "a _monitorenter must be a top frame"); - assert(thread->deopt_nmethod() != NULL, "nmethod should be known"); - guarantee(!(thread->deopt_nmethod()->is_compiled_by_c2() && + assert(thread->deopt_compiled_method() != NULL, "compiled method should be known"); + guarantee(!(thread->deopt_compiled_method()->is_compiled_by_c2() && *bcp == Bytecodes::_monitorenter && exec_mode == Deoptimization::Unpack_exception), "shouldn't get exception during monitorenter"); diff --git a/hotspot/src/share/vm/runtime/vframe_hp.cpp b/hotspot/src/share/vm/runtime/vframe_hp.cpp index 45617d03427..168deb03aef 100644 --- a/hotspot/src/share/vm/runtime/vframe_hp.cpp +++ b/hotspot/src/share/vm/runtime/vframe_hp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -196,7 +196,7 @@ BasicLock* compiledVFrame::resolve_monitor_lock(Location location) const { GrowableArray* compiledVFrame::monitors() const { // Natives has no scope if (scope() == NULL) { - nmethod* nm = code(); + CompiledMethod* nm = code(); Method* method = nm->method(); assert(method->is_native(), ""); if (!method->is_synchronized()) { @@ -240,13 +240,13 @@ GrowableArray* compiledVFrame::monitors() const { } -compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm) +compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, CompiledMethod* nm) : javaVFrame(fr, reg_map, thread) { _scope = NULL; // Compiled method (native stub or Java code) // native wrappers have no scope data, it is implied - if (!nm->is_native_method()) { - _scope = nm->scope_desc_at(_fr.pc()); + if (!nm->is_compiled() || !nm->as_compiled_method()->is_native_method()) { + _scope = nm->scope_desc_at(_fr.pc()); } } @@ -264,15 +264,15 @@ bool compiledVFrame::is_top() const { } -nmethod* compiledVFrame::code() const { - return CodeCache::find_nmethod(_fr.pc()); +CompiledMethod* compiledVFrame::code() const { + return CodeCache::find_compiled(_fr.pc()); } Method* compiledVFrame::method() const { if (scope() == NULL) { // native nmethods have no scope the method is implied - nmethod* nm = code(); + nmethod* nm = code()->as_nmethod(); assert(nm->is_native_method(), "must be native"); return nm->method(); } @@ -289,7 +289,7 @@ int compiledVFrame::bci() const { int compiledVFrame::raw_bci() const { if (scope() == NULL) { // native nmethods have no scope the method/bci is implied - nmethod* nm = code(); + nmethod* nm = code()->as_nmethod(); assert(nm->is_native_method(), "must be native"); return 0; } @@ -299,7 +299,7 @@ int compiledVFrame::raw_bci() const { bool compiledVFrame::should_reexecute() const { if (scope() == NULL) { // native nmethods have no scope the method/bci is implied - nmethod* nm = code(); + nmethod* nm = code()->as_nmethod(); assert(nm->is_native_method(), "must be native"); return false; } @@ -310,7 +310,7 @@ vframe* compiledVFrame::sender() const { const frame f = fr(); if (scope() == NULL) { // native nmethods have no scope the method/bci is implied - nmethod* nm = code(); + nmethod* nm = code()->as_nmethod(); assert(nm->is_native_method(), "must be native"); return vframe::sender(); } else { diff --git a/hotspot/src/share/vm/runtime/vframe_hp.hpp b/hotspot/src/share/vm/runtime/vframe_hp.hpp index 21ec69efbfc..c3be6c2e1eb 100644 --- a/hotspot/src/share/vm/runtime/vframe_hp.hpp +++ b/hotspot/src/share/vm/runtime/vframe_hp.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -52,13 +52,13 @@ class compiledVFrame: public javaVFrame { public: // Constructors - compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm); + compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, CompiledMethod* nm); // Update a local in a compiled frame. Update happens when deopt occurs void update_local(BasicType type, int index, jvalue value); // Returns the active nmethod - nmethod* code() const; + CompiledMethod* code() const; // Returns the scopeDesc ScopeDesc* scope() const { return _scope; } diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 3cd5d1687cb..dab3dbbd629 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -337,7 +337,7 @@ typedef CompactHashtable SymbolCompactHashTable; volatile_nonstatic_field(InstanceKlass, _oop_map_cache, OopMapCache*) \ nonstatic_field(InstanceKlass, _jni_ids, JNIid*) \ nonstatic_field(InstanceKlass, _osr_nmethods_head, nmethod*) \ - nonstatic_field(InstanceKlass, _breakpoints, BreakpointInfo*) \ + JVMTI_ONLY(nonstatic_field(InstanceKlass, _breakpoints, BreakpointInfo*)) \ nonstatic_field(InstanceKlass, _generic_signature_index, u2) \ nonstatic_field(InstanceKlass, _methods_jmethod_ids, jmethodID*) \ volatile_nonstatic_field(InstanceKlass, _idnum_allocated_count, u2) \ @@ -387,7 +387,7 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(MethodCounters, _backedge_mask, int) \ COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(MethodCounters, _interpreter_invocation_count, int)) \ COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(MethodCounters, _interpreter_throwout_count, u2)) \ - nonstatic_field(MethodCounters, _number_of_breakpoints, u2) \ + JVMTI_ONLY(nonstatic_field(MethodCounters, _number_of_breakpoints, u2)) \ nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \ nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \ nonstatic_field(Method, _constMethod, ConstMethod*) \ @@ -398,7 +398,7 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(Method, _intrinsic_id, u2) \ nonstatic_field(Method, _flags, u2) \ nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \ - volatile_nonstatic_field(Method, _code, nmethod*) \ + volatile_nonstatic_field(Method, _code, CompiledMethod*) \ nonstatic_field(Method, _i2i_entry, address) \ volatile_nonstatic_field(Method, _from_compiled_entry, address) \ volatile_nonstatic_field(Method, _from_interpreted_entry, address) \ @@ -447,11 +447,11 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(ExceptionTableElement, end_pc, u2) \ nonstatic_field(ExceptionTableElement, handler_pc, u2) \ nonstatic_field(ExceptionTableElement, catch_type_index, u2) \ - nonstatic_field(BreakpointInfo, _orig_bytecode, Bytecodes::Code) \ - nonstatic_field(BreakpointInfo, _bci, int) \ - nonstatic_field(BreakpointInfo, _name_index, u2) \ - nonstatic_field(BreakpointInfo, _signature_index, u2) \ - nonstatic_field(BreakpointInfo, _next, BreakpointInfo*) \ + JVMTI_ONLY(nonstatic_field(BreakpointInfo, _orig_bytecode, Bytecodes::Code)) \ + JVMTI_ONLY(nonstatic_field(BreakpointInfo, _bci, int)) \ + JVMTI_ONLY(nonstatic_field(BreakpointInfo, _name_index, u2)) \ + JVMTI_ONLY(nonstatic_field(BreakpointInfo, _signature_index, u2)) \ + JVMTI_ONLY(nonstatic_field(BreakpointInfo, _next, BreakpointInfo*)) \ /***********/ \ /* JNI IDs */ \ /***********/ \ @@ -600,6 +600,7 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(ThreadLocalAllocBuffer, _pf_top, HeapWord*) \ nonstatic_field(ThreadLocalAllocBuffer, _desired_size, size_t) \ nonstatic_field(ThreadLocalAllocBuffer, _refill_waste_limit, size_t) \ + static_field(ThreadLocalAllocBuffer, _reserve_for_allocation_prefetch, int) \ static_field(ThreadLocalAllocBuffer, _target_refills, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _number_of_refills, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _fast_refill_waste, unsigned) \ @@ -662,11 +663,11 @@ typedef CompactHashtable SymbolCompactHashTable; /* CompactHashTable */ \ /********************/ \ \ - nonstatic_field(SymbolCompactHashTable, _base_address, uintx) \ - nonstatic_field(SymbolCompactHashTable, _entry_count, juint) \ - nonstatic_field(SymbolCompactHashTable, _bucket_count, juint) \ - nonstatic_field(SymbolCompactHashTable, _table_end_offset, juint) \ - nonstatic_field(SymbolCompactHashTable, _buckets, juint*) \ + nonstatic_field(SymbolCompactHashTable, _base_address, address) \ + nonstatic_field(SymbolCompactHashTable, _entry_count, u4) \ + nonstatic_field(SymbolCompactHashTable, _bucket_count, u4) \ + nonstatic_field(SymbolCompactHashTable, _buckets, u4*) \ + nonstatic_field(SymbolCompactHashTable, _entries, u4*) \ \ /********************/ \ /* SystemDictionary */ \ @@ -859,9 +860,11 @@ typedef CompactHashtable SymbolCompactHashTable; static_field(StubRoutines, _mulAdd, address) \ static_field(StubRoutines, _dexp, address) \ static_field(StubRoutines, _dlog, address) \ + static_field(StubRoutines, _dlog10, address) \ static_field(StubRoutines, _dpow, address) \ static_field(StubRoutines, _dsin, address) \ static_field(StubRoutines, _dcos, address) \ + static_field(StubRoutines, _dtan, address) \ static_field(StubRoutines, _vectorizedMismatch, address) \ static_field(StubRoutines, _jbyte_arraycopy, address) \ static_field(StubRoutines, _jshort_arraycopy, address) \ @@ -913,40 +916,47 @@ typedef CompactHashtable SymbolCompactHashTable; /* CodeBlobs (NOTE: incomplete, but only a little) */ \ /***************************************************/ \ \ - nonstatic_field(CodeBlob, _name, const char*) \ - nonstatic_field(CodeBlob, _size, int) \ - nonstatic_field(CodeBlob, _header_size, int) \ - nonstatic_field(CodeBlob, _relocation_size, int) \ - nonstatic_field(CodeBlob, _content_offset, int) \ - nonstatic_field(CodeBlob, _code_offset, int) \ - nonstatic_field(CodeBlob, _frame_complete_offset, int) \ - nonstatic_field(CodeBlob, _data_offset, int) \ - nonstatic_field(CodeBlob, _frame_size, int) \ - nonstatic_field(CodeBlob, _oop_maps, ImmutableOopMapSet*) \ + nonstatic_field(CodeBlob, _name, const char*) \ + nonstatic_field(CodeBlob, _size, int) \ + nonstatic_field(CodeBlob, _header_size, int) \ + nonstatic_field(CodeBlob, _frame_complete_offset, int) \ + nonstatic_field(CodeBlob, _data_offset, int) \ + nonstatic_field(CodeBlob, _frame_size, int) \ + nonstatic_field(CodeBlob, _oop_maps, ImmutableOopMapSet*) \ + nonstatic_field(CodeBlob, _code_begin, address) \ + nonstatic_field(CodeBlob, _code_end, address) \ + nonstatic_field(CodeBlob, _content_begin, address) \ + nonstatic_field(CodeBlob, _data_end, address) \ \ nonstatic_field(DeoptimizationBlob, _unpack_offset, int) \ \ nonstatic_field(RuntimeStub, _caller_must_gc_arguments, bool) \ \ + /********************************************************/ \ + /* CompiledMethod (NOTE: incomplete, but only a little) */ \ + /********************************************************/ \ + \ + nonstatic_field(CompiledMethod, _method, Method*) \ + volatile_nonstatic_field(CompiledMethod, _exception_cache, ExceptionCache*) \ + nonstatic_field(CompiledMethod, _scopes_data_begin, address) \ + nonstatic_field(CompiledMethod, _deopt_handler_begin, address) \ + nonstatic_field(CompiledMethod, _deopt_mh_handler_begin, address) \ + \ /**************************************************/ \ /* NMethods (NOTE: incomplete, but only a little) */ \ /**************************************************/ \ \ - nonstatic_field(nmethod, _method, Method*) \ nonstatic_field(nmethod, _entry_bci, int) \ nonstatic_field(nmethod, _osr_link, nmethod*) \ nonstatic_field(nmethod, _scavenge_root_link, nmethod*) \ nonstatic_field(nmethod, _scavenge_root_state, jbyte) \ nonstatic_field(nmethod, _state, volatile unsigned char) \ nonstatic_field(nmethod, _exception_offset, int) \ - nonstatic_field(nmethod, _deoptimize_offset, int) \ - nonstatic_field(nmethod, _deoptimize_mh_offset, int) \ nonstatic_field(nmethod, _orig_pc_offset, int) \ nonstatic_field(nmethod, _stub_offset, int) \ nonstatic_field(nmethod, _consts_offset, int) \ nonstatic_field(nmethod, _oops_offset, int) \ nonstatic_field(nmethod, _metadata_offset, int) \ - nonstatic_field(nmethod, _scopes_data_offset, int) \ nonstatic_field(nmethod, _scopes_pcs_offset, int) \ nonstatic_field(nmethod, _dependencies_offset, int) \ nonstatic_field(nmethod, _handler_table_offset, int) \ @@ -959,7 +969,6 @@ typedef CompactHashtable SymbolCompactHashTable; nonstatic_field(nmethod, _stack_traversal_mark, long) \ nonstatic_field(nmethod, _compile_id, int) \ nonstatic_field(nmethod, _comp_level, int) \ - nonstatic_field(nmethod, _exception_cache, ExceptionCache*) \ \ unchecked_c2_static_field(Deoptimization, _trap_reason_name, void*) \ \ @@ -1316,7 +1325,6 @@ typedef CompactHashtable SymbolCompactHashTable; static_field(Abstract_VM_Version, _vm_minor_version, int) \ static_field(Abstract_VM_Version, _vm_security_version, int) \ static_field(Abstract_VM_Version, _vm_build_number, int) \ - static_field(Abstract_VM_Version, _reserve_for_allocation_prefetch, int) \ \ static_field(JDK_Version, _current, JDK_Version) \ nonstatic_field(JDK_Version, _major, unsigned char) \ @@ -1357,6 +1365,12 @@ typedef CompactHashtable SymbolCompactHashTable; static_field(java_lang_Class, _oop_size_offset, int) \ static_field(java_lang_Class, _static_oop_field_count_offset, int) \ \ + /******************/ \ + /* VMError fields */ \ + /******************/ \ + \ + static_field(VMError, _thread, Thread*) \ + \ /************************/ \ /* Miscellaneous fields */ \ /************************/ \ @@ -1586,7 +1600,6 @@ typedef CompactHashtable SymbolCompactHashTable; declare_type(TenuredGeneration, CardGeneration) \ declare_toplevel_type(GenCollectorPolicy) \ declare_toplevel_type(Space) \ - declare_toplevel_type(BitMap) \ declare_type(CompactibleSpace, Space) \ declare_type(ContiguousSpace, CompactibleSpace) \ declare_type(OffsetTableContigSpace, ContiguousSpace) \ @@ -1742,16 +1755,18 @@ typedef CompactHashtable SymbolCompactHashTable; declare_toplevel_type(SharedRuntime) \ \ declare_toplevel_type(CodeBlob) \ - declare_type(BufferBlob, CodeBlob) \ + declare_type(RuntimeBlob, CodeBlob) \ + declare_type(BufferBlob, RuntimeBlob) \ declare_type(AdapterBlob, BufferBlob) \ declare_type(MethodHandlesAdapterBlob, BufferBlob) \ - declare_type(nmethod, CodeBlob) \ - declare_type(RuntimeStub, CodeBlob) \ - declare_type(SingletonBlob, CodeBlob) \ + declare_type(CompiledMethod, CodeBlob) \ + declare_type(nmethod, CompiledMethod) \ + declare_type(RuntimeStub, RuntimeBlob) \ + declare_type(SingletonBlob, RuntimeBlob) \ declare_type(SafepointBlob, SingletonBlob) \ declare_type(DeoptimizationBlob, SingletonBlob) \ declare_c2_type(ExceptionBlob, SingletonBlob) \ - declare_c2_type(UncommonTrapBlob, CodeBlob) \ + declare_c2_type(UncommonTrapBlob, RuntimeBlob) \ \ /***************************************/ \ /* PcDesc and other compiled code info */ \ @@ -1920,6 +1935,7 @@ typedef CompactHashtable SymbolCompactHashTable; declare_c2_type(ConvL2INode, Node) \ declare_c2_type(CastX2PNode, Node) \ declare_c2_type(CastP2XNode, Node) \ + declare_c2_type(SetVectMaskINode, Node) \ declare_c2_type(MemBarNode, MultiNode) \ declare_c2_type(MemBarAcquireNode, MemBarNode) \ declare_c2_type(MemBarReleaseNode, MemBarNode) \ @@ -1927,6 +1943,7 @@ typedef CompactHashtable SymbolCompactHashTable; declare_c2_type(StoreFenceNode, MemBarNode) \ declare_c2_type(MemBarVolatileNode, MemBarNode) \ declare_c2_type(MemBarCPUOrderNode, MemBarNode) \ + declare_c2_type(OnSpinWaitNode, MemBarNode) \ declare_c2_type(InitializeNode, MemBarNode) \ declare_c2_type(ThreadLocalNode, Node) \ declare_c2_type(Opaque1Node, Node) \ @@ -2066,10 +2083,8 @@ typedef CompactHashtable SymbolCompactHashTable; declare_c2_type(NegNode, Node) \ declare_c2_type(NegFNode, NegNode) \ declare_c2_type(NegDNode, NegNode) \ - declare_c2_type(TanDNode, Node) \ declare_c2_type(AtanDNode, Node) \ declare_c2_type(SqrtDNode, Node) \ - declare_c2_type(Log10DNode, Node) \ declare_c2_type(ReverseBytesINode, Node) \ declare_c2_type(ReverseBytesLNode, Node) \ declare_c2_type(ReductionNode, Node) \ @@ -2206,6 +2221,12 @@ typedef CompactHashtable SymbolCompactHashTable; \ declare_toplevel_type(Arguments) \ \ + /***********/ \ + /* VMError */ \ + /***********/ \ + \ + declare_toplevel_type(VMError) \ + \ /***************/ \ /* Other types */ \ /***************/ \ @@ -2228,12 +2249,16 @@ typedef CompactHashtable SymbolCompactHashTable; declare_type(Array, MetaspaceObj) \ declare_type(Array, MetaspaceObj) \ \ + declare_toplevel_type(BitMap) \ + declare_type(BitMapView, BitMap) \ + \ declare_integer_type(AccessFlags) /* FIXME: wrong type (not integer) */\ declare_toplevel_type(address) /* FIXME: should this be an integer type? */\ declare_integer_type(BasicType) /* FIXME: wrong type (not integer) */\ declare_toplevel_type(BreakpointInfo) \ declare_toplevel_type(BreakpointInfo*) \ declare_toplevel_type(CodeBlob*) \ + declare_toplevel_type(RuntimeBlob*) \ declare_toplevel_type(CompressedWriteStream*) \ declare_toplevel_type(ConstantPoolCacheEntry) \ declare_toplevel_type(elapsedTimer) \ diff --git a/hotspot/src/share/vm/runtime/vmThread.cpp b/hotspot/src/share/vm/runtime/vmThread.cpp index 138431a1475..d7c0137a1f4 100644 --- a/hotspot/src/share/vm/runtime/vmThread.cpp +++ b/hotspot/src/share/vm/runtime/vmThread.cpp @@ -226,16 +226,12 @@ void VMThread::create() { } } - VMThread::VMThread() : NamedThread() { set_name("VM Thread"); } void VMThread::destroy() { - if (_vm_thread != NULL) { - delete _vm_thread; - _vm_thread = NULL; // VM thread is gone - } + _vm_thread = NULL; // VM thread is gone } void VMThread::run() { @@ -308,9 +304,9 @@ void VMThread::run() { _terminate_lock->notify(); } - // Deletion must be done synchronously by the JNI DestroyJavaVM thread - // so that the VMThread deletion completes before the main thread frees - // up the CodeHeap. + // We are now racing with the VM termination being carried out in + // another thread, so we don't "delete this". Numerous threads don't + // get deleted when the VM terminates } @@ -655,8 +651,8 @@ void VMThread::execute(VM_Operation* op) { } -void VMThread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { - Thread::oops_do(f, cld_f, cf); +void VMThread::oops_do(OopClosure* f, CodeBlobClosure* cf) { + Thread::oops_do(f, cf); _vm_queue->oops_do(f); } @@ -688,5 +684,5 @@ void VMOperationQueue::verify_queue(int prio) { #endif void VMThread::verify() { - oops_do(&VerifyOopClosure::verify_oop, NULL, NULL); + oops_do(&VerifyOopClosure::verify_oop, NULL); } diff --git a/hotspot/src/share/vm/runtime/vmThread.hpp b/hotspot/src/share/vm/runtime/vmThread.hpp index 692fbdd164d..85c52cb4d0f 100644 --- a/hotspot/src/share/vm/runtime/vmThread.hpp +++ b/hotspot/src/share/vm/runtime/vmThread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, 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 @@ -104,6 +104,12 @@ class VMThread: public NamedThread { // Constructor VMThread(); + // No destruction allowed + ~VMThread() { + guarantee(false, "VMThread deletion must fix the race with VM termination"); + } + + // Tester bool is_VM_thread() const { return true; } bool is_GC_thread() const { return true; } @@ -126,7 +132,7 @@ class VMThread: public NamedThread { static VMThread* vm_thread() { return _vm_thread; } // GC support - void oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf); + void oops_do(OopClosure* f, CodeBlobClosure* cf); void verify(); diff --git a/hotspot/src/share/vm/runtime/vm_version.cpp b/hotspot/src/share/vm/runtime/vm_version.cpp index c36098a31f7..98e90d5ecb2 100644 --- a/hotspot/src/share/vm/runtime/vm_version.cpp +++ b/hotspot/src/share/vm/runtime/vm_version.cpp @@ -43,7 +43,6 @@ bool Abstract_VM_Version::_supports_atomic_getadd4 = false; bool Abstract_VM_Version::_supports_atomic_getadd8 = false; unsigned int Abstract_VM_Version::_logical_processors_per_package = 1U; unsigned int Abstract_VM_Version::_L1_data_cache_line_size = 0; -int Abstract_VM_Version::_reserve_for_allocation_prefetch = 0; #ifndef HOTSPOT_VERSION_STRING #error HOTSPOT_VERSION_STRING must be defined @@ -289,6 +288,7 @@ unsigned int Abstract_VM_Version::nof_parallel_worker_threads( unsigned int switch_pt) { if (FLAG_IS_DEFAULT(ParallelGCThreads)) { assert(ParallelGCThreads == 0, "Default ParallelGCThreads is not 0"); + unsigned int threads; // For very large machines, there are diminishing returns // for large numbers of worker threads. Instead of // hogging the whole system, use a fraction of the workers for every @@ -296,9 +296,20 @@ unsigned int Abstract_VM_Version::nof_parallel_worker_threads( // and a chosen fraction of 5/8 // use 8 + (72 - 8) * (5/8) == 48 worker threads. unsigned int ncpus = (unsigned int) os::active_processor_count(); - return (ncpus <= switch_pt) ? - ncpus : - (switch_pt + ((ncpus - switch_pt) * num) / den); + threads = (ncpus <= switch_pt) ? + ncpus : + (switch_pt + ((ncpus - switch_pt) * num) / den); +#ifndef _LP64 + // On 32-bit binaries the virtual address space available to the JVM + // is usually limited to 2-3 GB (depends on the platform). + // Do not use up address space with too many threads (stacks and per-thread + // data). Note that x86 apps running on Win64 have 2 stacks per thread. + // GC may more generally scale down threads by max heap size (etc), but the + // consequences of over-provisioning threads are higher on 32-bit JVMS, + // so add hard limit here: + threads = MIN2(threads, (2*switch_pt)); +#endif + return threads; } else { return ParallelGCThreads; } diff --git a/hotspot/src/share/vm/runtime/vm_version.hpp b/hotspot/src/share/vm/runtime/vm_version.hpp index 5d07fc703b7..a9e57338af5 100644 --- a/hotspot/src/share/vm/runtime/vm_version.hpp +++ b/hotspot/src/share/vm/runtime/vm_version.hpp @@ -57,7 +57,6 @@ class Abstract_VM_Version: AllStatic { static int _vm_build_number; static unsigned int _parallel_worker_threads; static bool _parallel_worker_threads_initialized; - static int _reserve_for_allocation_prefetch; static unsigned int nof_parallel_worker_threads(unsigned int num, unsigned int dem, @@ -139,12 +138,6 @@ class Abstract_VM_Version: AllStatic { return _L1_data_cache_line_size; } - // Need a space at the end of TLAB for prefetch instructions - // which may fault when accessing memory outside of heap. - static int reserve_for_allocation_prefetch() { - return _reserve_for_allocation_prefetch; - } - // ARCH specific policy for the BiasedLocking static bool use_biased_locking() { return true; } @@ -162,6 +155,9 @@ class Abstract_VM_Version: AllStatic { // Calculates and returns the number of parallel threads. May // be VM version specific. static unsigned int calc_parallel_worker_threads(); + + // Does this CPU support spin wait instruction? + static bool supports_on_spin_wait() { return false; } }; #ifdef TARGET_ARCH_x86 diff --git a/hotspot/src/share/vm/services/classLoadingService.cpp b/hotspot/src/share/vm/services/classLoadingService.cpp index 67bdb223653..6d1f0cdb36f 100644 --- a/hotspot/src/share/vm/services/classLoadingService.cpp +++ b/hotspot/src/share/vm/services/classLoadingService.cpp @@ -138,9 +138,9 @@ void ClassLoadingService::notify_class_unloaded(InstanceKlass* k) { } } - if (log_is_enabled(Info, classunload)) { + if (log_is_enabled(Info, class, unload)) { ResourceMark rm; - log_info(classunload)("unloading class %s " INTPTR_FORMAT , k->external_name(), p2i(k)); + log_info(class, unload)("unloading class %s " INTPTR_FORMAT , k->external_name(), p2i(k)); } } @@ -184,9 +184,9 @@ bool ClassLoadingService::set_verbose(bool verbose) { MutexLocker m(Management_lock); // verbose will be set to the previous value if (verbose) { - LogConfiguration::parse_log_arguments("stdout", "classload=info", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+load=info", NULL, NULL, NULL); } else { - LogConfiguration::parse_log_arguments("stdout", "classload=off", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+load=off", NULL, NULL, NULL); } reset_trace_class_unloading(); return verbose; @@ -197,9 +197,9 @@ void ClassLoadingService::reset_trace_class_unloading() { assert(Management_lock->owned_by_self(), "Must own the Management_lock"); bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose(); if (value) { - LogConfiguration::parse_log_arguments("stdout", "classunload=info", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+unload=info", NULL, NULL, NULL); } else { - LogConfiguration::parse_log_arguments("stdout", "classunload=off", NULL, NULL, NULL); + LogConfiguration::parse_log_arguments("stdout", "class+unload=off", NULL, NULL, NULL); } } diff --git a/hotspot/src/share/vm/services/classLoadingService.hpp b/hotspot/src/share/vm/services/classLoadingService.hpp index 16ff40fd4be..763abcc1656 100644 --- a/hotspot/src/share/vm/services/classLoadingService.hpp +++ b/hotspot/src/share/vm/services/classLoadingService.hpp @@ -55,7 +55,7 @@ private: public: static void init(); - static bool get_verbose() { return log_is_enabled(Info, classload); } + static bool get_verbose() { return log_is_enabled(Info, class, load); } static bool set_verbose(bool verbose); static void reset_trace_class_unloading() NOT_MANAGEMENT_RETURN; diff --git a/hotspot/src/share/vm/services/g1MemoryPool.cpp b/hotspot/src/share/vm/services/g1MemoryPool.cpp index 49328908920..92daa7b726d 100644 --- a/hotspot/src/share/vm/services/g1MemoryPool.cpp +++ b/hotspot/src/share/vm/services/g1MemoryPool.cpp @@ -24,8 +24,6 @@ #include "precompiled.hpp" #include "gc/g1/g1CollectedHeap.hpp" -#include "gc/g1/g1CollectedHeap.inline.hpp" -#include "gc/g1/g1CollectorPolicy.hpp" #include "gc/g1/heapRegion.hpp" #include "services/g1MemoryPool.hpp" diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp index 6de924a21ab..ff4da35c88b 100644 --- a/hotspot/src/share/vm/services/management.cpp +++ b/hotspot/src/share/vm/services/management.cpp @@ -1609,8 +1609,8 @@ JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value } char* name = java_lang_String::as_utf8_string(fn); - FormatBuffer<80> err_msg("%s", ""); - int succeed = WriteableFlags::set_flag(name, new_value, Flag::MANAGEMENT, err_msg); + FormatBuffer<80> error_msg("%s", ""); + int succeed = WriteableFlags::set_flag(name, new_value, Flag::MANAGEMENT, error_msg); if (succeed != Flag::SUCCESS) { if (succeed == Flag::MISSING_VALUE) { @@ -1619,7 +1619,7 @@ JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value } else { // all the other errors are reported as IAE with the appropriate error message THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), - err_msg.buffer()); + error_msg.buffer()); } } assert(succeed == Flag::SUCCESS, "Setting flag should succeed"); diff --git a/hotspot/src/share/vm/trace/trace.dtd b/hotspot/src/share/vm/trace/trace.dtd index 155bea64c22..3c40dc9ac60 100644 --- a/hotspot/src/share/vm/trace/trace.dtd +++ b/hotspot/src/share/vm/trace/trace.dtd @@ -64,23 +64,28 @@ has_stacktrace CDATA "false" is_instant CDATA "false" is_constant CDATA "false" - is_requestable CDATA "false"> + is_requestable CDATA "false" + experimental CDATA "false"> + transition CDATA "NONE" + experimental CDATA "false"> + description CDATA #IMPLIED + experimental CDATA "false"> + description CDATA #IMPLIED + experimental CDATA "false"> + description CDATA #IMPLIED + experimental CDATA "false"> diff --git a/hotspot/src/share/vm/utilities/array.cpp b/hotspot/src/share/vm/utilities/array.cpp deleted file mode 100644 index 746f2a5e498..00000000000 --- a/hotspot/src/share/vm/utilities/array.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2000, 2014, 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. - * - */ - -#include "precompiled.hpp" -#include "memory/resourceArea.hpp" -#include "runtime/thread.inline.hpp" -#include "utilities/array.hpp" - - -#ifdef ASSERT -void ResourceArray::init_nesting() { - _nesting = Thread::current()->resource_area()->nesting(); -} -#endif - - -void ResourceArray::sort(size_t esize, ftype f) { - if (!is_empty()) qsort(_data, length(), esize, f); -} -template void CHeapArray::sort(size_t esize, ftype f) { - if (!is_empty()) qsort(_data, length(), esize, f); -} - - -void ResourceArray::expand(size_t esize, int i, int& size) { - // make sure we are expanding within the original resource mark - assert( - _nesting == Thread::current()->resource_area()->nesting(), - "allocating outside original resource mark" - ); - // determine new size - if (size == 0) size = 4; // prevent endless loop - while (i >= size) size *= 2; - // allocate and initialize new data section - void* data = resource_allocate_bytes(esize * size); - memcpy(data, _data, esize * length()); - _data = data; -} - - -template void CHeapArray::expand(size_t esize, int i, int& size) { - // determine new size - if (size == 0) size = 4; // prevent endless loop - while (i >= size) size *= 2; - // allocate and initialize new data section - void* data = NEW_C_HEAP_ARRAY(char*, esize * size, F); - memcpy(data, _data, esize * length()); - FREE_C_HEAP_ARRAY(char*, _data); - _data = data; -} - - -void ResourceArray::remove_at(size_t esize, int i) { - assert(0 <= i && i < length(), "index out of bounds"); - _length--; - void* dst = (char*)_data + i*esize; - void* src = (char*)dst + esize; - size_t cnt = (length() - i)*esize; - memmove(dst, src, cnt); -} - -template void CHeapArray::remove_at(size_t esize, int i) { - assert(0 <= i && i < length(), "index out of bounds"); - _length--; - void* dst = (char*)_data + i*esize; - void* src = (char*)dst + esize; - size_t cnt = (length() - i)*esize; - memmove(dst, src, cnt); -} diff --git a/hotspot/src/share/vm/utilities/array.hpp b/hotspot/src/share/vm/utilities/array.hpp index f759fe1c03f..d174bee19aa 100644 --- a/hotspot/src/share/vm/utilities/array.hpp +++ b/hotspot/src/share/vm/utilities/array.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -30,273 +30,11 @@ #include "memory/metaspace.hpp" #include "runtime/orderAccess.hpp" -// correct linkage required to compile w/o warnings -// (must be on file level - cannot be local) -extern "C" { typedef int (*ftype)(const void*, const void*); } - - -class ResourceArray: public ResourceObj { - protected: - int _length; // the number of array elements - void* _data; // the array memory -#ifdef ASSERT - int _nesting; // the resource area nesting level -#endif - - // creation - ResourceArray() { - _length = 0; - _data = NULL; - DEBUG_ONLY(init_nesting();) - // client may call initialize, at most once - } - - - ResourceArray(size_t esize, int length) { - DEBUG_ONLY(_data = NULL); - initialize(esize, length); - } - - void initialize(size_t esize, int length) { - assert(length >= 0, "illegal length"); - assert(StressRewriter || _data == NULL, "must be new object"); - _length = length; - _data = resource_allocate_bytes(esize * length); - DEBUG_ONLY(init_nesting();) - } - -#ifdef ASSERT - void init_nesting(); -#endif - - // helper functions - void sort (size_t esize, ftype f); // sort the array - void expand (size_t esize, int i, int& size);// expand the array to include slot i - void remove_at(size_t esize, int i); // remove the element in slot i - - public: - // standard operations - int length() const { return _length; } - bool is_empty() const { return length() == 0; } -}; - - -template class CHeapArray: public CHeapObj { - protected: - int _length; // the number of array elements - void* _data; // the array memory - - // creation - CHeapArray() { - _length = 0; - _data = NULL; - } - - - CHeapArray(size_t esize, int length) { - assert(length >= 0, "illegal length"); - _length = length; - _data = (void*) NEW_C_HEAP_ARRAY(char *, esize * length, F); - } - - void initialize(size_t esize, int length) { - // In debug set array to 0? - } - -#ifdef ASSERT - void init_nesting(); -#endif - - // helper functions - void sort (size_t esize, ftype f); // sort the array - void expand (size_t esize, int i, int& size);// expand the array to include slot i - void remove_at(size_t esize, int i); // remove the element in slot i - - public: - // standard operations - int length() const { return _length; } - bool is_empty() const { return length() == 0; } -}; - -#define define_generic_array(array_name,element_type, base_class) \ - class array_name: public base_class { \ - protected: \ - typedef element_type etype; \ - enum { esize = sizeof(etype) }; \ - \ - void base_remove_at(size_t size, int i) { base_class::remove_at(size, i); } \ - \ - public: \ - /* creation */ \ - array_name() : base_class() {} \ - explicit array_name(const int length) : base_class(esize, length) {} \ - array_name(const int length, const etype fx) { initialize(length, fx); } \ - void initialize(const int length) { base_class::initialize(esize, length); } \ - void initialize(const int length, const etype fx) { \ - initialize(length); \ - for (int i = 0; i < length; i++) ((etype*)_data)[i] = fx; \ - } \ - \ - /* standard operations */ \ - etype& operator [] (const int i) const { \ - assert(0 <= i && i < length(), "index out of bounds"); \ - return ((etype*)_data)[i]; \ - } \ - \ - int index_of(const etype x) const { \ - int i = length(); \ - while (i-- > 0 && ((etype*)_data)[i] != x) ; \ - /* i < 0 || ((etype*)_data)_data[i] == x */ \ - return i; \ - } \ - \ - void sort(int f(etype*, etype*)) { base_class::sort(esize, (ftype)f); } \ - bool contains(const etype x) const { return index_of(x) >= 0; } \ - \ - /* deprecated operations - for compatibility with GrowableArray only */ \ - etype at(const int i) const { return (*this)[i]; } \ - void at_put(const int i, const etype x) { (*this)[i] = x; } \ - etype* adr_at(const int i) { return &(*this)[i]; } \ - int find(const etype x) { return index_of(x); } \ - }; \ - - -#define define_array(array_name,element_type) \ - define_generic_array(array_name, element_type, ResourceArray) - - -#define define_stack(stack_name,array_name) \ - class stack_name: public array_name { \ - protected: \ - int _size; \ - \ - void grow(const int i, const etype fx) { \ - assert(i >= length(), "index too small"); \ - if (i >= size()) expand(esize, i, _size); \ - for (int j = length(); j <= i; j++) ((etype*)_data)[j] = fx; \ - _length = i+1; \ - } \ - \ - public: \ - /* creation */ \ - stack_name() : array_name() { _size = 0; } \ - stack_name(const int size) { initialize(size); } \ - stack_name(const int size, const etype fx) { initialize(size, fx); } \ - void initialize(const int size, const etype fx) { \ - _size = size; \ - array_name::initialize(size, fx); \ - /* _length == size, allocation and size are the same */ \ - } \ - void initialize(const int size) { \ - _size = size; \ - array_name::initialize(size); \ - _length = 0; /* reset length to zero; _size records the allocation */ \ - } \ - \ - /* standard operations */ \ - int size() const { return _size; } \ - \ - int push(const etype x) { \ - int len = length(); \ - if (len >= size()) expand(esize, len, _size); \ - ((etype*)_data)[len] = x; \ - _length = len+1; \ - return len; \ - } \ - \ - etype pop() { \ - assert(!is_empty(), "stack is empty"); \ - return ((etype*)_data)[--_length]; \ - } \ - \ - etype top() const { \ - assert(!is_empty(), "stack is empty"); \ - return ((etype*)_data)[length() - 1]; \ - } \ - \ - void push_all(const stack_name* stack) { \ - const int l = stack->length(); \ - for (int i = 0; i < l; i++) push(((etype*)(stack->_data))[i]); \ - } \ - \ - etype at_grow(const int i, const etype fx) { \ - if (i >= length()) grow(i, fx); \ - return ((etype*)_data)[i]; \ - } \ - \ - void at_put_grow(const int i, const etype x, const etype fx) { \ - if (i >= length()) grow(i, fx); \ - ((etype*)_data)[i] = x; \ - } \ - \ - void truncate(const int length) { \ - assert(0 <= length && length <= this->length(), "illegal length"); \ - _length = length; \ - } \ - \ - void remove_at(int i) { base_remove_at(esize, i); } \ - void remove(etype x) { remove_at(index_of(x)); } \ - \ - /* inserts the given element before the element at index i */ \ - void insert_before(const int i, const etype el) { \ - int len = length(); \ - int new_length = len + 1; \ - if (new_length >= size()) expand(esize, new_length, _size); \ - for (int j = len - 1; j >= i; j--) { \ - ((etype*)_data)[j + 1] = ((etype*)_data)[j]; \ - } \ - _length = new_length; \ - at_put(i, el); \ - } \ - \ - /* inserts contents of the given stack before the element at index i */ \ - void insert_before(const int i, const stack_name *st) { \ - if (st->length() == 0) return; \ - int len = length(); \ - int st_len = st->length(); \ - int new_length = len + st_len; \ - if (new_length >= size()) expand(esize, new_length, _size); \ - int j; \ - for (j = len - 1; j >= i; j--) { \ - ((etype*)_data)[j + st_len] = ((etype*)_data)[j]; \ - } \ - for (j = 0; j < st_len; j++) { \ - ((etype*)_data)[i + j] = ((etype*)st->_data)[j]; \ - } \ - _length = new_length; \ - } \ - \ - /* deprecated operations - for compatibility with GrowableArray only */ \ - int capacity() const { return size(); } \ - void clear() { truncate(0); } \ - void trunc_to(const int length) { truncate(length); } \ - int append(const etype x) { return push(x); } \ - void appendAll(const stack_name* stack) { push_all(stack); } \ - etype last() const { return top(); } \ - }; \ - - -#define define_resource_list(element_type) \ - define_generic_array(element_type##Array, element_type, ResourceArray) \ - define_stack(element_type##List, element_type##Array) - -#define define_resource_pointer_list(element_type) \ - define_generic_array(element_type##Array, element_type *, ResourceArray) \ - define_stack(element_type##List, element_type##Array) - -#define define_c_heap_list(element_type) \ - define_generic_array(element_type##Array, element_type, CHeapArray) \ - define_stack(element_type##List, element_type##Array) - -#define define_c_heap_pointer_list(element_type) \ - define_generic_array(element_type##Array, element_type *, CHeapArray) \ - define_stack(element_type##List, element_type##Array) - - // Arrays for basic types - -define_array(boolArray, bool) define_stack(boolStack, boolArray) -define_array(intArray , int ) define_stack(intStack , intArray ) +typedef GrowableArray intArray; +typedef GrowableArray intStack; +typedef GrowableArray boolArray; +typedef GrowableArray boolStack; // Array for metadata allocation diff --git a/hotspot/src/share/vm/utilities/bitMap.cpp b/hotspot/src/share/vm/utilities/bitMap.cpp index bb7ae8ede14..12758ab02e4 100644 --- a/hotspot/src/share/vm/utilities/bitMap.cpp +++ b/hotspot/src/share/vm/utilities/bitMap.cpp @@ -28,13 +28,144 @@ #include "runtime/atomic.inline.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/copy.hpp" +#include "utilities/debug.hpp" STATIC_ASSERT(sizeof(BitMap::bm_word_t) == BytesPerWord); // "Implementation assumption." -BitMap::BitMap(idx_t size_in_bits, bool in_resource_area) : - _map(NULL), _size(0) -{ - resize(size_in_bits, in_resource_area); +typedef BitMap::bm_word_t bm_word_t; +typedef BitMap::idx_t idx_t; + +class ResourceBitMapAllocator : StackObj { + public: + bm_word_t* allocate(idx_t size_in_words) const { + return NEW_RESOURCE_ARRAY(bm_word_t, size_in_words); + } + void free(bm_word_t* map, idx_t size_in_words) const { + // Don't free resource allocated arrays. + } +}; + +class CHeapBitMapAllocator : StackObj { + public: + bm_word_t* allocate(size_t size_in_words) const { + return ArrayAllocator::allocate(size_in_words); + } + void free(bm_word_t* map, idx_t size_in_words) const { + ArrayAllocator::free(map, size_in_words); + } +}; + +class ArenaBitMapAllocator : StackObj { + Arena* _arena; + + public: + ArenaBitMapAllocator(Arena* arena) : _arena(arena) {} + bm_word_t* allocate(idx_t size_in_words) const { + return (bm_word_t*)_arena->Amalloc(size_in_words * BytesPerWord); + } + void free(bm_word_t* map, idx_t size_in_words) const { + // ArenaBitMaps currently don't free memory. + } +}; + +template +BitMap::bm_word_t* BitMap::reallocate(const Allocator& allocator, bm_word_t* old_map, idx_t old_size_in_bits, idx_t new_size_in_bits) { + size_t old_size_in_words = calc_size_in_words(old_size_in_bits); + size_t new_size_in_words = calc_size_in_words(new_size_in_bits); + + bm_word_t* map = NULL; + + if (new_size_in_words > 0) { + map = allocator.allocate(new_size_in_words); + + Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) map, + MIN2(old_size_in_words, new_size_in_words)); + + if (new_size_in_words > old_size_in_words) { + clear_range_of_words(map, old_size_in_words, new_size_in_words); + } + } + + if (old_map != NULL) { + allocator.free(old_map, old_size_in_words); + } + + return map; +} + +template +bm_word_t* BitMap::allocate(const Allocator& allocator, idx_t size_in_bits) { + // Reuse reallocate to ensure that the new memory is cleared. + return reallocate(allocator, NULL, 0, size_in_bits); +} + +template +void BitMap::free(const Allocator& allocator, bm_word_t* map, idx_t size_in_bits) { + bm_word_t* ret = reallocate(allocator, map, size_in_bits, 0); + assert(ret == NULL, "Reallocate shouldn't have allocated"); +} + +template +void BitMap::resize(const Allocator& allocator, idx_t new_size_in_bits) { + bm_word_t* new_map = reallocate(allocator, map(), size(), new_size_in_bits); + + update(new_map, new_size_in_bits); +} + +template +void BitMap::initialize(const Allocator& allocator, idx_t size_in_bits) { + assert(map() == NULL, "precondition"); + assert(size() == 0, "precondition"); + + resize(allocator, size_in_bits); +} + +template +void BitMap::reinitialize(const Allocator& allocator, idx_t new_size_in_bits) { + // Remove previous bits. + resize(allocator, 0); + + initialize(allocator, new_size_in_bits); +} + +ResourceBitMap::ResourceBitMap(idx_t size_in_bits) + : BitMap(allocate(ResourceBitMapAllocator(), size_in_bits), size_in_bits) { +} + +void ResourceBitMap::resize(idx_t new_size_in_bits) { + BitMap::resize(ResourceBitMapAllocator(), new_size_in_bits); +} + +void ResourceBitMap::initialize(idx_t size_in_bits) { + BitMap::initialize(ResourceBitMapAllocator(), size_in_bits); +} + +void ResourceBitMap::reinitialize(idx_t size_in_bits) { + BitMap::reinitialize(ResourceBitMapAllocator(), size_in_bits); +} + +ArenaBitMap::ArenaBitMap(Arena* arena, idx_t size_in_bits) + : BitMap(allocate(ArenaBitMapAllocator(arena), size_in_bits), size_in_bits) { +} + +CHeapBitMap::CHeapBitMap(idx_t size_in_bits) + : BitMap(allocate(CHeapBitMapAllocator(), size_in_bits), size_in_bits) { +} + +CHeapBitMap::~CHeapBitMap() { + free(CHeapBitMapAllocator(), map(), size()); +} + +void CHeapBitMap::resize(idx_t new_size_in_bits) { + BitMap::resize(CHeapBitMapAllocator(), new_size_in_bits); +} + +void CHeapBitMap::initialize(idx_t size_in_bits) { + BitMap::initialize(CHeapBitMapAllocator(), size_in_bits); +} + +void CHeapBitMap::reinitialize(idx_t size_in_bits) { + BitMap::reinitialize(CHeapBitMapAllocator(), size_in_bits); } #ifdef ASSERT @@ -49,25 +180,6 @@ void BitMap::verify_range(idx_t beg_index, idx_t end_index) const { } #endif // #ifdef ASSERT -void BitMap::resize(idx_t size_in_bits, bool in_resource_area) { - idx_t old_size_in_words = size_in_words(); - bm_word_t* old_map = map(); - - _size = size_in_bits; - idx_t new_size_in_words = size_in_words(); - if (in_resource_area) { - _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); - Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, - MIN2(old_size_in_words, new_size_in_words)); - } else { - _map = ArrayAllocator::reallocate(old_map, old_size_in_words, new_size_in_words); - } - - if (new_size_in_words > old_size_in_words) { - clear_range_of_words(old_size_in_words, new_size_in_words); - } -} - void BitMap::pretouch() { os::pretouch_memory(word_addr(0), word_addr(size())); } @@ -205,13 +317,6 @@ bool BitMap::par_at_put(idx_t bit, bool value) { return value ? par_set_bit(bit) : par_clear_bit(bit); } -void BitMap::at_put_grow(idx_t offset, bool value) { - if (offset >= size()) { - resize(2 * MAX2(size(), offset)); - } - at_put(offset, value); -} - void BitMap::at_put_range(idx_t start_offset, idx_t end_offset, bool value) { if (value) { set_range(start_offset, end_offset); @@ -271,10 +376,10 @@ void BitMap::par_at_put_large_range(idx_t beg, idx_t end, bool value) { par_put_range_within_word(bit_index(end_full_word), end, value); } -bool BitMap::contains(const BitMap other) const { +bool BitMap::contains(const BitMap& other) const { assert(size() == other.size(), "must have same size"); - bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* dest_map = map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { bm_word_t word_union = dest_map[index] | other_map[index]; @@ -285,10 +390,10 @@ bool BitMap::contains(const BitMap other) const { return true; } -bool BitMap::intersects(const BitMap other) const { +bool BitMap::intersects(const BitMap& other) const { assert(size() == other.size(), "must have same size"); - bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* dest_map = map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { if ((dest_map[index] & other_map[index]) != 0) return true; @@ -297,10 +402,10 @@ bool BitMap::intersects(const BitMap other) const { return false; } -void BitMap::set_union(BitMap other) { +void BitMap::set_union(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { dest_map[index] = dest_map[index] | other_map[index]; @@ -308,10 +413,10 @@ void BitMap::set_union(BitMap other) { } -void BitMap::set_difference(BitMap other) { +void BitMap::set_difference(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { dest_map[index] = dest_map[index] & ~(other_map[index]); @@ -319,10 +424,10 @@ void BitMap::set_difference(BitMap other) { } -void BitMap::set_intersection(BitMap other) { +void BitMap::set_intersection(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { dest_map[index] = dest_map[index] & other_map[index]; @@ -330,14 +435,14 @@ void BitMap::set_intersection(BitMap other) { } -void BitMap::set_intersection_at_offset(BitMap other, idx_t offset) { +void BitMap::set_intersection_at_offset(const BitMap& other, idx_t offset) { assert(other.size() >= offset, "offset not in range"); assert(other.size() - offset >= size(), "other not large enough"); // XXX Ideally, we would remove this restriction. guarantee((offset % (sizeof(bm_word_t) * BitsPerByte)) == 0, "Only handle aligned cases so far."); bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t offset_word_ind = word_index(offset); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { @@ -345,11 +450,11 @@ void BitMap::set_intersection_at_offset(BitMap other, idx_t offset) { } } -bool BitMap::set_union_with_result(BitMap other) { +bool BitMap::set_union_with_result(const BitMap& other) { assert(size() == other.size(), "must have same size"); bool changed = false; bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { idx_t temp = dest_map[index] | other_map[index]; @@ -360,11 +465,11 @@ bool BitMap::set_union_with_result(BitMap other) { } -bool BitMap::set_difference_with_result(BitMap other) { +bool BitMap::set_difference_with_result(const BitMap& other) { assert(size() == other.size(), "must have same size"); bool changed = false; bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { bm_word_t temp = dest_map[index] & ~(other_map[index]); @@ -375,11 +480,11 @@ bool BitMap::set_difference_with_result(BitMap other) { } -bool BitMap::set_intersection_with_result(BitMap other) { +bool BitMap::set_intersection_with_result(const BitMap& other) { assert(size() == other.size(), "must have same size"); bool changed = false; bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { bm_word_t orig = dest_map[index]; @@ -391,10 +496,10 @@ bool BitMap::set_intersection_with_result(BitMap other) { } -void BitMap::set_from(BitMap other) { +void BitMap::set_from(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { dest_map[index] = other_map[index]; @@ -402,10 +507,10 @@ void BitMap::set_from(BitMap other) { } -bool BitMap::is_same(BitMap other) { +bool BitMap::is_same(const BitMap& other) { assert(size() == other.size(), "must have same size"); bm_word_t* dest_map = map(); - bm_word_t* other_map = other.map(); + const bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { if (dest_map[index] != other_map[index]) return false; @@ -414,7 +519,7 @@ bool BitMap::is_same(BitMap other) { } bool BitMap::is_full() const { - bm_word_t* word = map(); + const bm_word_t* word = map(); idx_t rest = size(); for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { if (*word != ~(bm_word_t)0) return false; @@ -425,7 +530,7 @@ bool BitMap::is_full() const { bool BitMap::is_empty() const { - bm_word_t* word = map(); + const bm_word_t* word = map(); idx_t rest = size(); for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { if (*word != 0) return false; @@ -532,93 +637,116 @@ void BitMap::print_on(outputStream* st) const { class TestBitMap : public AllStatic { const static BitMap::idx_t BITMAP_SIZE = 1024; - static void fillBitMap(BitMap& map) { + + template + static void fillBitMap(ResizableBitMapClass& map) { map.set_bit(1); map.set_bit(3); map.set_bit(17); map.set_bit(512); } - static void testResize(bool in_resource_area) { - { - BitMap map(0, in_resource_area); - map.resize(BITMAP_SIZE, in_resource_area); - fillBitMap(map); - - BitMap map2(BITMAP_SIZE, in_resource_area); - fillBitMap(map2); - assert(map.is_same(map2), "could be"); - } - - { - BitMap map(128, in_resource_area); - map.resize(BITMAP_SIZE, in_resource_area); - fillBitMap(map); - - BitMap map2(BITMAP_SIZE, in_resource_area); - fillBitMap(map2); - assert(map.is_same(map2), "could be"); - } - - { - BitMap map(BITMAP_SIZE, in_resource_area); - map.resize(BITMAP_SIZE, in_resource_area); - fillBitMap(map); - - BitMap map2(BITMAP_SIZE, in_resource_area); - fillBitMap(map2); - assert(map.is_same(map2), "could be"); - } - } - - static void testResizeResource() { + template + static void testResize(BitMap::idx_t start_size) { ResourceMark rm; - testResize(true); + + ResizableBitMapClass map(start_size); + map.resize(BITMAP_SIZE); + fillBitMap(map); + + ResizableBitMapClass map2(BITMAP_SIZE); + fillBitMap(map2); + assert(map.is_same(map2), "could be"); } - static void testResizeNonResource() { - const size_t bitmap_bytes = BITMAP_SIZE / BitsPerByte; + template + static void testResizeGrow() { + testResize(0); + testResize(128); + } - // Test the default behavior - testResize(false); + template + static void testResizeSame() { + testResize(BITMAP_SIZE); + } - { - // Make sure that AllocatorMallocLimit is larger than our allocation request - // forcing it to call standard malloc() - SizeTFlagSetting fs(ArrayAllocatorMallocLimit, bitmap_bytes * 4); - testResize(false); - } - { - // Make sure that AllocatorMallocLimit is smaller than our allocation request - // forcing it to call mmap() (or equivalent) - SizeTFlagSetting fs(ArrayAllocatorMallocLimit, bitmap_bytes / 4); - testResize(false); - } + template + static void testResizeShrink() { + testResize(BITMAP_SIZE * 2); + } + + static void testResizeGrow() { + testResizeGrow(); + testResizeGrow(); + } + + static void testResizeSame() { + testResizeSame(); + testResizeSame(); + } + + static void testResizeShrink() { + testResizeShrink(); + testResizeShrink(); + } + + static void testResize() { + testResizeGrow(); + testResizeSame(); + testResizeShrink(); + } + + template + static void testInitialize() { + ResourceMark rm; + + InitializableBitMapClass map; + map.initialize(BITMAP_SIZE); + fillBitMap(map); + + InitializableBitMapClass map2(BITMAP_SIZE); + fillBitMap(map2); + assert(map.is_same(map2), "could be"); + } + + static void testInitialize() { + testInitialize(); + testInitialize(); + } + + template + static void testReinitialize(BitMap::idx_t init_size) { + ResourceMark rm; + + ReinitializableBitMapClass map(init_size); + map.reinitialize(BITMAP_SIZE); + fillBitMap(map); + + ReinitializableBitMapClass map2(BITMAP_SIZE); + fillBitMap(map2); + assert(map.is_same(map2), "could be"); + } + + template + static void testReinitialize() { + testReinitialize(0); + testReinitialize(128); + testReinitialize(BITMAP_SIZE); + } + + static void testReinitialize() { + testReinitialize(); } public: static void test() { - testResizeResource(); - testResizeNonResource(); + testResize(); + testInitialize(); + testReinitialize(); } - }; void TestBitMap_test() { TestBitMap::test(); } #endif - - -BitMap2D::BitMap2D(bm_word_t* map, idx_t size_in_slots, idx_t bits_per_slot) - : _bits_per_slot(bits_per_slot) - , _map(map, size_in_slots * bits_per_slot) -{ -} - - -BitMap2D::BitMap2D(idx_t size_in_slots, idx_t bits_per_slot) - : _bits_per_slot(bits_per_slot) - , _map(size_in_slots * bits_per_slot) -{ -} diff --git a/hotspot/src/share/vm/utilities/bitMap.hpp b/hotspot/src/share/vm/utilities/bitMap.hpp index b41cc12062e..bc5cb589929 100644 --- a/hotspot/src/share/vm/utilities/bitMap.hpp +++ b/hotspot/src/share/vm/utilities/bitMap.hpp @@ -33,6 +33,16 @@ class BitMapClosure; // Operations for bitmaps represented as arrays of unsigned integers. // Bit offsets are numbered from 0 to size-1. +// The "abstract" base BitMap class. +// +// The constructor and destructor are protected to prevent +// creation of BitMap instances outside of the BitMap class. +// +// The BitMap class doesn't use virtual calls on purpose, +// this ensures that we don't get a vtable unnecessarily. +// +// The allocation of the backing storage for the BitMap are handled by +// the subclasses. BitMap doesn't allocate or delete backing storage. class BitMap VALUE_OBJ_CLASS_SPEC { friend class BitMap2D; @@ -50,10 +60,6 @@ class BitMap VALUE_OBJ_CLASS_SPEC { bm_word_t* _map; // First word in bitmap idx_t _size; // Size of bitmap (in bits) - // Puts the given value at the given offset, using resize() to size - // the bitmap appropriately if needed using factor-of-two expansion. - void at_put_grow(idx_t index, bool value); - protected: // Return the position of bit within the word that contains it (e.g., if // bitmap words are 32 bits, return a number 0 <= n <= 31). @@ -70,11 +76,13 @@ class BitMap VALUE_OBJ_CLASS_SPEC { static idx_t bit_index(idx_t word) { return word << LogBitsPerWord; } // Return the array of bitmap words, or a specific word from it. - bm_word_t* map() const { return _map; } + bm_word_t* map() { return _map; } + const bm_word_t* map() const { return _map; } bm_word_t map(idx_t word) const { return _map[word]; } // Return a pointer to the word containing the specified bit. - bm_word_t* word_addr(idx_t bit) const { return map() + word_index(bit); } + bm_word_t* word_addr(idx_t bit) { return map() + word_index(bit); } + const bm_word_t* word_addr(idx_t bit) const { return map() + word_index(bit); } // Set a word to a specified value or to all ones; clear a word. void set_word (idx_t word, bm_word_t val) { _map[word] = val; } @@ -95,6 +103,8 @@ class BitMap VALUE_OBJ_CLASS_SPEC { void set_large_range_of_words (idx_t beg, idx_t end); void clear_large_range_of_words (idx_t beg, idx_t end); + static void clear_range_of_words(bm_word_t* map, idx_t beg, idx_t end); + // The index of the first full word in a range. idx_t word_index_round_up(idx_t bit) const; @@ -108,46 +118,69 @@ class BitMap VALUE_OBJ_CLASS_SPEC { static idx_t num_set_bits(bm_word_t w); static idx_t num_set_bits_from_table(unsigned char c); - public: + // Allocation Helpers. - // Constructs a bitmap with no map, and size 0. - BitMap() : _map(NULL), _size(0) {} + // Allocates and clears the bitmap memory. + template + static bm_word_t* allocate(const Allocator&, idx_t size_in_bits); - // Constructs a bitmap with the given map and size. - BitMap(bm_word_t* map, idx_t size_in_bits) :_map(map), _size(size_in_bits) {} + // Reallocates and clears the new bitmap memory. + template + static bm_word_t* reallocate(const Allocator&, bm_word_t* map, idx_t old_size_in_bits, idx_t new_size_in_bits); - // Constructs an empty bitmap of the given size (that is, this clears the - // new bitmap). Allocates the map array in resource area if - // "in_resource_area" is true, else in the C heap. - BitMap(idx_t size_in_bits, bool in_resource_area = true); + // Free the bitmap memory. + template + static void free(const Allocator&, bm_word_t* map, idx_t size_in_bits); + + // Protected functions, that are used by BitMap sub-classes that support them. + + // Resize the backing bitmap memory. + // + // Old bits are transfered to the new memory + // and the extended memory is cleared. + template + void resize(const Allocator& allocator, idx_t new_size_in_bits); + + // Set up and clear the bitmap memory. + // + // Precondition: The bitmap was default constructed and has + // not yet had memory allocated via resize or (re)initialize. + template + void initialize(const Allocator& allocator, idx_t size_in_bits); + + // Set up and clear the bitmap memory. + // + // Can be called on previously initialized bitmaps. + template + void reinitialize(const Allocator& allocator, idx_t new_size_in_bits); // Set the map and size. - void set_map(bm_word_t* map) { _map = map; } - void set_size(idx_t size_in_bits) { _size = size_in_bits; } + void update(bm_word_t* map, idx_t size) { + _map = map; + _size = size; + } - // Allocates necessary data structure, either in the resource area - // or in the C heap, as indicated by "in_resource_area." - // Preserves state currently in bit map by copying data. - // Zeros any newly-addressable bits. - // If "in_resource_area" is false, frees the current map. - // (Note that this assumes that all calls to "resize" on the same BitMap - // use the same value for "in_resource_area".) - void resize(idx_t size_in_bits, bool in_resource_area = true); + // Protected constructor and destructor. + BitMap(bm_word_t* map, idx_t size_in_bits) : _map(map), _size(size_in_bits) {} + ~BitMap() {} + public: // Pretouch the entire range of memory this BitMap covers. void pretouch(); // Accessing - idx_t size() const { return _size; } - idx_t size_in_bytes() const { return size_in_words() * BytesPerWord; } - idx_t size_in_words() const { - return calc_size_in_words(size()); - } - static idx_t calc_size_in_words(size_t size_in_bits) { return word_index(size_in_bits + BitsPerWord - 1); } + static idx_t calc_size_in_bytes(size_t size_in_bits) { + return calc_size_in_words(size_in_bits) * BytesPerWord; + } + + idx_t size() const { return _size; } + idx_t size_in_words() const { return calc_size_in_words(size()); } + idx_t size_in_bytes() const { return calc_size_in_bytes(size()); } + bool at(idx_t index) const { verify_index(index); return (*word_addr(index) & bit_mask(index)) != 0; @@ -237,19 +270,19 @@ class BitMap VALUE_OBJ_CLASS_SPEC { idx_t count_one_bits() const; // Set operations. - void set_union(BitMap bits); - void set_difference(BitMap bits); - void set_intersection(BitMap bits); + void set_union(const BitMap& bits); + void set_difference(const BitMap& bits); + void set_intersection(const BitMap& bits); // Returns true iff "this" is a superset of "bits". - bool contains(const BitMap bits) const; + bool contains(const BitMap& bits) const; // Returns true iff "this and "bits" have a non-empty intersection. - bool intersects(const BitMap bits) const; + bool intersects(const BitMap& bits) const; // Returns result of whether this map changed // during the operation - bool set_union_with_result(BitMap bits); - bool set_difference_with_result(BitMap bits); - bool set_intersection_with_result(BitMap bits); + bool set_union_with_result(const BitMap& bits); + bool set_difference_with_result(const BitMap& bits); + bool set_intersection_with_result(const BitMap& bits); // Requires the submap of "bits" starting at offset to be at least as // large as "this". Modifies "this" to be the intersection of its @@ -258,11 +291,11 @@ class BitMap VALUE_OBJ_CLASS_SPEC { // (For expedience, currently requires the offset to be aligned to the // bitsize of a uintptr_t. This should go away in the future though it // will probably remain a good case to optimize.) - void set_intersection_at_offset(BitMap bits, idx_t offset); + void set_intersection_at_offset(const BitMap& bits, idx_t offset); - void set_from(BitMap bits); + void set_from(const BitMap& bits); - bool is_same(BitMap bits); + bool is_same(const BitMap& bits); // Test if all bits are set or cleared bool is_full() const; @@ -277,6 +310,88 @@ class BitMap VALUE_OBJ_CLASS_SPEC { #endif }; +// A concrete implementation of the the "abstract" BitMap class. +// +// The BitMapView is used when the backing storage is managed externally. +class BitMapView : public BitMap { + public: + BitMapView() : BitMap(NULL, 0) {} + BitMapView(bm_word_t* map, idx_t size_in_bits) : BitMap(map, size_in_bits) {} +}; + +// A BitMap with storage in a ResourceArea. +class ResourceBitMap : public BitMap { + friend class TestBitMap; + + public: + ResourceBitMap() : BitMap(NULL, 0) {} + // Clears the bitmap memory. + ResourceBitMap(idx_t size_in_bits); + + // Resize the backing bitmap memory. + // + // Old bits are transfered to the new memory + // and the extended memory is cleared. + void resize(idx_t new_size_in_bits); + + // Set up and clear the bitmap memory. + // + // Precondition: The bitmap was default constructed and has + // not yet had memory allocated via resize or initialize. + void initialize(idx_t size_in_bits); + + // Set up and clear the bitmap memory. + // + // Can be called on previously initialized bitmaps. + void reinitialize(idx_t size_in_bits); +}; + +// A BitMap with storage in a specific Arena. +class ArenaBitMap : public BitMap { + public: + // Clears the bitmap memory. + ArenaBitMap(Arena* arena, idx_t size_in_bits); + + private: + // Don't allow copy or assignment. + ArenaBitMap(const ArenaBitMap&); + ArenaBitMap& operator=(const ArenaBitMap&); +}; + +// A BitMap with storage in the CHeap. +class CHeapBitMap : public BitMap { + friend class TestBitMap; + + private: + // Don't allow copy or assignment, to prevent the + // allocated memory from leaking out to other instances. + CHeapBitMap(const CHeapBitMap&); + CHeapBitMap& operator=(const CHeapBitMap&); + + public: + CHeapBitMap() : BitMap(NULL, 0) {} + // Clears the bitmap memory. + CHeapBitMap(idx_t size_in_bits); + ~CHeapBitMap(); + + // Resize the backing bitmap memory. + // + // Old bits are transfered to the new memory + // and the extended memory is cleared. + void resize(idx_t new_size_in_bits); + + // Set up and clear the bitmap memory. + // + // Precondition: The bitmap was default constructed and has + // not yet had memory allocated via resize or initialize. + void initialize(idx_t size_in_bits); + + // Set up and clear the bitmap memory. + // + // Can be called on previously initialized bitmaps. + void reinitialize(idx_t size_in_bits); +}; + // Convenience class wrapping BitMap which provides multiple bits per slot. class BitMap2D VALUE_OBJ_CLASS_SPEC { public: @@ -284,8 +399,8 @@ class BitMap2D VALUE_OBJ_CLASS_SPEC { typedef BitMap::bm_word_t bm_word_t; // Element type of array that // represents the bitmap. private: - BitMap _map; - idx_t _bits_per_slot; + ResourceBitMap _map; + idx_t _bits_per_slot; idx_t bit_index(idx_t slot_index, idx_t bit_within_slot_index) const { return slot_index * _bits_per_slot + bit_within_slot_index; @@ -297,10 +412,12 @@ class BitMap2D VALUE_OBJ_CLASS_SPEC { public: // Construction. bits_per_slot must be greater than 0. - BitMap2D(bm_word_t* map, idx_t size_in_slots, idx_t bits_per_slot); + BitMap2D(idx_t bits_per_slot) : + _map(), _bits_per_slot(bits_per_slot) {} // Allocates necessary data structure in resource area. bits_per_slot must be greater than 0. - BitMap2D(idx_t size_in_slots, idx_t bits_per_slot); + BitMap2D(idx_t size_in_slots, idx_t bits_per_slot) : + _map(size_in_slots * bits_per_slot), _bits_per_slot(bits_per_slot) {} idx_t size_in_bits() { return _map.size(); diff --git a/hotspot/src/share/vm/utilities/bitMap.inline.hpp b/hotspot/src/share/vm/utilities/bitMap.inline.hpp index 57cb847ae63..49521d8b149 100644 --- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp +++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp @@ -121,18 +121,18 @@ inline void BitMap::set_range_of_words(idx_t beg, idx_t end) { for (idx_t i = beg; i < end; ++i) map[i] = ~(bm_word_t)0; } - -inline void BitMap::clear_range_of_words(idx_t beg, idx_t end) { - bm_word_t* map = _map; +inline void BitMap::clear_range_of_words(bm_word_t* map, idx_t beg, idx_t end) { for (idx_t i = beg; i < end; ++i) map[i] = 0; } +inline void BitMap::clear_range_of_words(idx_t beg, idx_t end) { + clear_range_of_words(_map, beg, end); +} inline void BitMap::clear() { clear_range_of_words(0, size_in_words()); } - inline void BitMap::par_clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { if (hint == small_range && end - beg == 1) { par_at_put(beg, false); @@ -359,7 +359,12 @@ inline void BitMap2D::at_put(idx_t slot_index, idx_t bit_within_slot_index, bool inline void BitMap2D::at_put_grow(idx_t slot_index, idx_t bit_within_slot_index, bool value) { verify_bit_within_slot_index(bit_within_slot_index); - _map.at_put_grow(bit_index(slot_index, bit_within_slot_index), value); + + idx_t bit = bit_index(slot_index, bit_within_slot_index); + if (bit >= _map.size()) { + _map.resize(2 * MAX2(_map.size(), bit)); + } + _map.at_put(bit, value); } inline void BitMap2D::clear() { diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index ad1e9e43a78..b2844487530 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -58,6 +58,8 @@ #include "trace/tracing.hpp" #endif +#include + #ifndef ASSERT # ifdef _DEBUG // NOTE: don't turn the lines below into a comment -- if you're getting @@ -187,7 +189,7 @@ bool error_is_suppressed(const char* file_name, int line_no) { return true; } - if (!is_error_reported()) { + if (!is_error_reported() && !SuppressFatalErrorMessage) { // print a friendly hint: fdStream out(defaultStream::output_fd()); out.print_raw_cr("# To suppress the following error report, specify this argument"); @@ -262,6 +264,21 @@ void report_unimplemented(const char* file, int line) { report_vm_error(file, line, "Unimplemented()"); } +#ifdef ASSERT +bool is_executing_unit_tests() { + return ExecutingUnitTests; +} + +void report_assert_msg(const char* msg, ...) { + va_list ap; + va_start(ap, msg); + + fprintf(stderr, "assert failed: %s\n", err_msg(FormatBufferDummy(), msg, ap).buffer()); + + va_end(ap); +} +#endif // ASSERT + void report_untested(const char* file, int line, const char* message) { #ifndef PRODUCT warning("Untested: %s in %s: %d\n", message, file, line); diff --git a/hotspot/src/share/vm/utilities/debug.hpp b/hotspot/src/share/vm/utilities/debug.hpp index 398e38b6f84..d5da6db4cab 100644 --- a/hotspot/src/share/vm/utilities/debug.hpp +++ b/hotspot/src/share/vm/utilities/debug.hpp @@ -46,11 +46,15 @@ class FormatBufferResource : public FormatBufferBase { FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3); }; +class FormatBufferDummy {}; + // Use stack for buffer template class FormatBuffer : public FormatBufferBase { public: inline FormatBuffer(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); + // since va_list is unspecified type (can be char*), we use FormatBufferDummy to disambiguate these constructors + inline FormatBuffer(FormatBufferDummy dummy, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0); inline void append(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); inline void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0); @@ -74,6 +78,11 @@ FormatBuffer::FormatBuffer(const char * format, ...) : FormatBufferBase(_ va_end(argp); } +template +FormatBuffer::FormatBuffer(FormatBufferDummy dummy, const char * format, va_list ap) : FormatBufferBase(_buffer) { + jio_vsnprintf(_buf, bufsz, format, ap); +} + template FormatBuffer::FormatBuffer() : FormatBufferBase(_buffer) { _buf[0] = '\0'; @@ -119,11 +128,13 @@ typedef FormatBuffer<> err_msg; #define vmassert(p, ...) \ do { \ if (!(p)) { \ + if (is_executing_unit_tests()) { \ + report_assert_msg(__VA_ARGS__); \ + } \ report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \ BREAKPOINT; \ } \ } while (0) - #endif // For backward compatibility. @@ -210,10 +221,16 @@ void report_vm_error(const char* file, int line, const char* error_msg); // ATTRIBUTE_PRINTF works with gcc >= 4.8 and any other compiler. void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5); +#ifdef ASSERT +void report_assert_msg(const char* msg, ...) ATTRIBUTE_PRINTF(1, 2); +#endif // ASSERT #else // GCC < 4.8 warns because of empty format string. Warning can not be switched off selectively. void report_vm_error(const char* file, int line, const char* error_msg, const char* detail_fmt, ...); +#ifdef ASSERT +void report_assert_msg(const char* msg, ...); +#endif // ASSERT #endif void report_vm_status_error(const char* file, int line, const char* error_msg, int status, const char* detail); @@ -225,6 +242,11 @@ void report_should_not_reach_here(const char* file, int line); void report_unimplemented(const char* file, int line); void report_untested(const char* file, int line, const char* message); +#ifdef ASSERT +// unit test support +bool is_executing_unit_tests(); +#endif // ASSERT + void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2); // Compile-time asserts. Cond must be a compile-time constant expression that diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 36846d92f0c..4c9e513c65a 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -1004,7 +1004,9 @@ class VM_Operation; class VMOperationQueue; class CodeBlob; -class nmethod; +class CompiledMethod; +class nmethod; +class RuntimeBlob; class OSRAdapter; class I2CAdapter; class C2IAdapter; diff --git a/hotspot/src/share/vm/utilities/growableArray.hpp b/hotspot/src/share/vm/utilities/growableArray.hpp index fccbad3645f..abe5ace96a3 100644 --- a/hotspot/src/share/vm/utilities/growableArray.hpp +++ b/hotspot/src/share/vm/utilities/growableArray.hpp @@ -249,6 +249,10 @@ template class GrowableArray : public GenericGrowableArray { return _data[_len-1]; } + E last() const { + return top(); + } + GrowableArrayIterator begin() const { return GrowableArrayIterator(this, 0); } @@ -362,6 +366,24 @@ template class GrowableArray : public GenericGrowableArray { _data[idx] = elem; } + void insert_before(const int idx, const GrowableArray* array) { + assert(0 <= idx && idx <= _len, "illegal index"); + check_nesting(); + int array_len = array->length(); + int new_len = _len + array_len; + if (new_len >= _max) grow(new_len); + + for (int j = _len - 1; j >= idx; j--) { + _data[j + array_len] = _data[j]; + } + + for (int j = 0; j < array_len; j++) { + _data[idx + j] = array->_data[j]; + } + + _len += array_len; + } + void appendAll(const GrowableArray* l) { for (int i = 0; i < l->_len; i++) { raw_at_put_grow(_len, l->_data[i], E()); diff --git a/hotspot/src/share/vm/utilities/internalVMTests.cpp b/hotspot/src/share/vm/utilities/internalVMTests.cpp index 985885c2edd..c6543b71cab 100644 --- a/hotspot/src/share/vm/utilities/internalVMTests.cpp +++ b/hotspot/src/share/vm/utilities/internalVMTests.cpp @@ -78,9 +78,11 @@ void InternalVMTests::run() { run_unit_test(Test_log_prefix); run_unit_test(Test_log_big); run_unit_test(Test_logtagset_duplicates); + run_unit_test(Test_logtagset_descriptions); run_unit_test(Test_log_file_startup_rotation); run_unit_test(Test_log_file_startup_truncation); run_unit_test(Test_invalid_log_file); + run_unit_test(Test_multiline_logging); run_unit_test(DirectivesParser_test); run_unit_test(Test_TempNewSymbol); #if INCLUDE_VM_STRUCTS @@ -98,6 +100,7 @@ void InternalVMTests::run() { run_unit_test(test_memset_with_concurrent_readers); run_unit_test(TestPredictions_test); run_unit_test(WorkerDataArray_test); + run_unit_test(ParallelCompact_test); #endif tty->print_cr("All internal VM tests passed"); } diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp index 4ca94f391a4..095cc8bbb26 100644 --- a/hotspot/src/share/vm/utilities/vmError.cpp +++ b/hotspot/src/share/vm/utilities/vmError.cpp @@ -28,6 +28,7 @@ #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" #include "gc/shared/collectedHeap.hpp" +#include "logging/logConfiguration.hpp" #include "prims/whitebox.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.inline.hpp" @@ -289,8 +290,8 @@ const char* VMError::_current_step_info; void VMError::report(outputStream* st, bool _verbose) { -# define BEGIN if (_current_step == 0) { _current_step = 1; -# define STEP(n, s) } if (_current_step < n) { _current_step = n; _current_step_info = s; +# define BEGIN if (_current_step == 0) { _current_step = __LINE__; +# define STEP(s) } if (_current_step < __LINE__) { _current_step = __LINE__; _current_step_info = s; # define END } // don't allocate large buffer on stack @@ -298,7 +299,7 @@ void VMError::report(outputStream* st, bool _verbose) { BEGIN - STEP(10, "(printing fatal error message)") + STEP("printing fatal error message") st->print_cr("#"); if (should_report_bug(_id)) { @@ -313,21 +314,21 @@ void VMError::report(outputStream* st, bool _verbose) { // test secondary error handling. Test it twice, to test that resetting // error handler after a secondary crash works. - STEP(20, "(test secondary crash 1)") + STEP("test secondary crash 1") if (_verbose && TestCrashInErrorHandler != 0) { st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", TestCrashInErrorHandler); controlled_crash(TestCrashInErrorHandler); } - STEP(30, "(test secondary crash 2)") + STEP("test secondary crash 2") if (_verbose && TestCrashInErrorHandler != 0) { st->print_cr("Will crash now (TestCrashInErrorHandler=" UINTX_FORMAT ")...", TestCrashInErrorHandler); controlled_crash(TestCrashInErrorHandler); } - STEP(40, "(test safefetch in error handler)") + STEP("test safefetch in error handler") // test whether it is safe to use SafeFetch32 in Crash Handler. Test twice // to test that resetting the signal handler works correctly. if (_verbose && TestSafeFetchInErrorHandler) { @@ -348,7 +349,7 @@ void VMError::report(outputStream* st, bool _verbose) { } #endif // PRODUCT - STEP(50, "(printing type of error)") + STEP("printing type of error") switch(_id) { case OOM_MALLOC_ERROR: @@ -383,7 +384,7 @@ void VMError::report(outputStream* st, bool _verbose) { break; } - STEP(60, "(printing exception/signal name)") + STEP("printing exception/signal name") st->print_cr("#"); st->print("# "); @@ -413,14 +414,14 @@ void VMError::report(outputStream* st, bool _verbose) { } } - STEP(70, "(printing current thread and pid)") + STEP("printing current thread and pid") // process id, thread id st->print(", pid=%d", os::current_process_id()); st->print(", tid=" UINTX_FORMAT, os::current_thread_id()); st->cr(); - STEP(80, "(printing error message)") + STEP("printing error message") if (should_report_bug(_id)) { // already printed the message. // error message @@ -431,11 +432,11 @@ void VMError::report(outputStream* st, bool _verbose) { } } - STEP(90, "(printing Java version string)") + STEP("printing Java version string") report_vm_version(st, buf, sizeof(buf)); - STEP(100, "(printing problematic frame)") + STEP("printing problematic frame") // Print current frame if we have a context (i.e. it's a crash) if (_context) { @@ -447,7 +448,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->print_cr("#"); } - STEP(110, "(printing core file information)") + STEP("printing core file information") st->print("# "); if (CreateCoredumpOnCrash) { if (coredump_status) { @@ -461,13 +462,13 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); st->print_cr("#"); - STEP(120, "(printing bug submit message)") + STEP("printing bug submit message") if (should_report_bug(_id) && _verbose) { print_bug_submit_message(st, _thread); } - STEP(130, "(printing summary)" ) + STEP("printing summary") if (_verbose) { st->cr(); @@ -475,7 +476,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(140, "(printing VM option summary)" ) + STEP("printing VM option summary") if (_verbose) { // VM options @@ -483,20 +484,20 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(150, "(printing summary machine and OS info)") + STEP("printing summary machine and OS info") if (_verbose) { os::print_summary_info(st, buf, sizeof(buf)); } - STEP(160, "(printing date and time)" ) + STEP("printing date and time") if (_verbose) { os::print_date_and_time(st, buf, sizeof(buf)); } - STEP(170, "(printing thread)" ) + STEP("printing thread") if (_verbose) { st->cr(); @@ -504,7 +505,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(180, "(printing current thread)" ) + STEP("printing current thread") // current thread if (_verbose) { @@ -518,7 +519,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(190, "(printing current compile task)" ) + STEP("printing current compile task") if (_verbose && _thread && _thread->is_Compiler_thread()) { CompilerThread* t = (CompilerThread*)_thread; @@ -531,7 +532,7 @@ void VMError::report(outputStream* st, bool _verbose) { } - STEP(200, "(printing stack bounds)" ) + STEP("printing stack bounds") if (_verbose) { st->print("Stack: "); @@ -562,7 +563,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(210, "(printing native stack)" ) + STEP("printing native stack") if (_verbose) { if (os::platform_print_native_stack(st, _context, buf, sizeof(buf))) { @@ -576,13 +577,13 @@ void VMError::report(outputStream* st, bool _verbose) { } } - STEP(220, "(printing Java stack)" ) + STEP("printing Java stack") if (_verbose && _thread && _thread->is_Java_thread()) { print_stack_trace(st, (JavaThread*)_thread, buf, sizeof(buf)); } - STEP(230, "(printing target Java thread stack)" ) + STEP("printing target Java thread stack") // printing Java thread stack trace if it is involved in GC crash if (_verbose && _thread && (_thread->is_Named_thread())) { @@ -593,7 +594,7 @@ void VMError::report(outputStream* st, bool _verbose) { } } - STEP(240, "(printing siginfo)" ) + STEP("printing siginfo") // signal no, signal code, address that caused the fault if (_verbose && _siginfo) { @@ -602,7 +603,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(245, "(CDS archive access warning)" ) + STEP("CDS archive access warning") // Print an explicit hint if we crashed on access to the CDS archive. if (_verbose && _siginfo) { @@ -610,7 +611,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(250, "(printing register info)") + STEP("printing register info") // decode register contents if possible if (_verbose && _context && Universe::is_fully_initialized()) { @@ -618,7 +619,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(260, "(printing registers, top of stack, instructions near pc)") + STEP("printing registers, top of stack, instructions near pc") // registers, top of stack, instructions near pc if (_verbose && _context) { @@ -626,7 +627,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(265, "(printing code blob if possible)") + STEP("printing code blob if possible") if (_verbose && _context) { CodeBlob* cb = CodeCache::find_blob(_pc); @@ -651,7 +652,7 @@ void VMError::report(outputStream* st, bool _verbose) { } } - STEP(270, "(printing VM operation)" ) + STEP("printing VM operation") if (_verbose && _thread && _thread->is_VM_thread()) { VMThread* t = (VMThread*)_thread; @@ -663,7 +664,7 @@ void VMError::report(outputStream* st, bool _verbose) { } } - STEP(280, "(printing process)" ) + STEP("printing process") if (_verbose) { st->cr(); @@ -671,7 +672,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(290, "(printing all threads)" ) + STEP("printing all threads") // all threads if (_verbose && _thread) { @@ -679,7 +680,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(300, "(printing VM state)" ) + STEP("printing VM state") if (_verbose) { // Safepoint state @@ -701,7 +702,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(310, "(printing owned locks on error)" ) + STEP("printing owned locks on error") // mutexes/monitors that currently have an owner if (_verbose) { @@ -709,7 +710,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(320, "(printing number of OutOfMemoryError and StackOverflow exceptions)") + STEP("printing number of OutOfMemoryError and StackOverflow exceptions") if (_verbose && Exceptions::has_exception_counts()) { st->print_cr("OutOfMemory and StackOverflow Exception counts:"); @@ -717,7 +718,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(330, "(printing compressed oops mode") + STEP("printing compressed oops mode") if (_verbose && UseCompressedOops) { Universe::print_compressed_oops_mode(st); @@ -727,7 +728,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(340, "(printing heap information)" ) + STEP("printing heap information") if (_verbose && Universe::is_fully_initialized()) { Universe::heap()->print_on_error(st); @@ -736,7 +737,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(350, "(printing code cache information)" ) + STEP("printing code cache information") if (_verbose && Universe::is_fully_initialized()) { // print code cache information before vm abort @@ -744,14 +745,14 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(360, "(printing ring buffers)" ) + STEP("printing ring buffers") if (_verbose) { Events::print_all(st); st->cr(); } - STEP(370, "(printing dynamic libraries)" ) + STEP("printing dynamic libraries") if (_verbose) { // dynamic libraries, or memory map @@ -759,7 +760,7 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(380, "(printing VM options)" ) + STEP("printing VM options") if (_verbose) { // VM options @@ -767,33 +768,40 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(390, "(printing warning if internal testing API used)" ) + STEP("printing warning if internal testing API used") if (WhiteBox::used()) { st->print_cr("Unsupported internal testing APIs have been used."); st->cr(); } - STEP(400, "(printing all environment variables)" ) + STEP("printing log configuration") + if (_verbose){ + st->print_cr("Logging:"); + LogConfiguration::describe_current_configuration(st); + st->cr(); + } + + STEP("printing all environment variables") if (_verbose) { os::print_environment_variables(st, env_list); st->cr(); } - STEP(410, "(printing signal handlers)" ) + STEP("printing signal handlers") if (_verbose) { os::print_signal_handlers(st, buf, sizeof(buf)); st->cr(); } - STEP(420, "(Native Memory Tracking)" ) + STEP("Native Memory Tracking") if (_verbose) { MemTracker::error_report(st); } - STEP(430, "(printing system)" ) + STEP("printing system") if (_verbose) { st->cr(); @@ -801,27 +809,27 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); } - STEP(440, "(printing OS information)" ) + STEP("printing OS information") if (_verbose) { os::print_os_info(st); st->cr(); } - STEP(450, "(printing CPU info)" ) + STEP("printing CPU info") if (_verbose) { os::print_cpu_info(st, buf, sizeof(buf)); st->cr(); } - STEP(460, "(printing memory info)" ) + STEP("printing memory info") if (_verbose) { os::print_memory_info(st); st->cr(); } - STEP(470, "(printing internal vm info)" ) + STEP("printing internal vm info") if (_verbose) { st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); @@ -829,7 +837,7 @@ void VMError::report(outputStream* st, bool _verbose) { } // print a defined marker to show that error handling finished correctly. - STEP(480, "(printing end marker)" ) + STEP("printing end marker") if (_verbose) { st->print_cr("END."); @@ -850,35 +858,35 @@ void VMError::print_vm_info(outputStream* st) { char buf[O_BUFLEN]; report_vm_version(st, buf, sizeof(buf)); - // STEP("(printing summary)") + // STEP("printing summary") st->cr(); st->print_cr("--------------- S U M M A R Y ------------"); st->cr(); - // STEP("(printing VM option summary)") + // STEP("printing VM option summary") // VM options Arguments::print_summary_on(st); st->cr(); - // STEP("(printing summary machine and OS info)") + // STEP("printing summary machine and OS info") os::print_summary_info(st, buf, sizeof(buf)); - // STEP("(printing date and time)") + // STEP("printing date and time") os::print_date_and_time(st, buf, sizeof(buf)); - // Skip: STEP("(printing thread)") + // Skip: STEP("printing thread") - // STEP("(printing process)") + // STEP("printing process") st->cr(); st->print_cr("--------------- P R O C E S S ---------------"); st->cr(); - // STEP("(printing number of OutOfMemoryError and StackOverflow exceptions)") + // STEP("printing number of OutOfMemoryError and StackOverflow exceptions") if (Exceptions::has_exception_counts()) { st->print_cr("OutOfMemory and StackOverflow Exception counts:"); @@ -886,7 +894,7 @@ void VMError::print_vm_info(outputStream* st) { st->cr(); } - // STEP("(printing compressed oops mode") + // STEP("printing compressed oops mode") if (UseCompressedOops) { Universe::print_compressed_oops_mode(st); @@ -896,7 +904,7 @@ void VMError::print_vm_info(outputStream* st) { st->cr(); } - // STEP("(printing heap information)") + // STEP("printing heap information") if (Universe::is_fully_initialized()) { Universe::heap()->print_on_error(st); @@ -905,7 +913,7 @@ void VMError::print_vm_info(outputStream* st) { st->cr(); } - // STEP("(printing code cache information)") + // STEP("printing code cache information") if (Universe::is_fully_initialized()) { // print code cache information before vm abort @@ -913,72 +921,77 @@ void VMError::print_vm_info(outputStream* st) { st->cr(); } - // STEP("(printing ring buffers)") + // STEP("printing ring buffers") Events::print_all(st); st->cr(); - // STEP("(printing dynamic libraries)") + // STEP("printing dynamic libraries") // dynamic libraries, or memory map os::print_dll_info(st); st->cr(); - // STEP("(printing VM options)") + // STEP("printing VM options") // VM options Arguments::print_on(st); st->cr(); - // STEP("(printing warning if internal testing API used)") + // STEP("printing warning if internal testing API used") if (WhiteBox::used()) { st->print_cr("Unsupported internal testing APIs have been used."); st->cr(); } - // STEP("(printing all environment variables)") + // STEP("printing log configuration") + st->print_cr("Logging:"); + LogConfiguration::describe(st); + st->cr(); + + // STEP("printing all environment variables") os::print_environment_variables(st, env_list); st->cr(); - // STEP("(printing signal handlers)") + // STEP("printing signal handlers") os::print_signal_handlers(st, buf, sizeof(buf)); st->cr(); - // STEP("(Native Memory Tracking)") + // STEP("Native Memory Tracking") MemTracker::error_report(st); - // STEP("(printing system)") + // STEP("printing system") st->cr(); st->print_cr("--------------- S Y S T E M ---------------"); st->cr(); - // STEP("(printing OS information)") + // STEP("printing OS information") os::print_os_info(st); st->cr(); - // STEP("(printing CPU info)") + // STEP("printing CPU info") os::print_cpu_info(st, buf, sizeof(buf)); st->cr(); - // STEP("(printing memory info)") + // STEP("printing memory info") os::print_memory_info(st); st->cr(); - // STEP("(printing internal vm info)") + // STEP("printing internal vm info") st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); st->cr(); // print a defined marker to show that error handling finished correctly. - // STEP("(printing end marker)") + // STEP("printing end marker") st->print_cr("END."); } @@ -1177,7 +1190,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt } jio_snprintf(buffer, sizeof(buffer), - "[error occurred during error reporting %s, id 0x%x]", + "[error occurred during error reporting (%s), id 0x%x]", _current_step_info, _id); if (log.is_open()) { log.cr(); diff --git a/hotspot/src/share/vm/utilities/vmError.hpp b/hotspot/src/share/vm/utilities/vmError.hpp index 62ce62e3e30..23f973b27fb 100644 --- a/hotspot/src/share/vm/utilities/vmError.hpp +++ b/hotspot/src/share/vm/utilities/vmError.hpp @@ -33,6 +33,7 @@ class VM_ReportJavaOutOfMemory; class VMError : public AllStatic { friend class VM_ReportJavaOutOfMemory; friend class Decoder; + friend class VMStructs; static int _id; // Solaris/Linux signals: 0 - SIGRTMAX // Windows exceptions: 0xCxxxxxxx system errors diff --git a/hotspot/test/Makefile b/hotspot/test/Makefile index 1dfecd6bce1..2f2f810f37b 100644 --- a/hotspot/test/Makefile +++ b/hotspot/test/Makefile @@ -52,6 +52,11 @@ UNIQ = uniq WC = wc ZIP = zip +define NEWLINE + + +endef + # Get OS name from uname (Cygwin inexplicably adds _NT-5.1) UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_) ifeq ($(UNAME_S), SunOS) @@ -301,7 +306,10 @@ ifdef TESTDIRS endif ifdef CONCURRENCY - EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY) + JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY) +endif +ifdef EXTRA_JTREG_OPTIONS + JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) endif # Default JTREG to run @@ -321,8 +329,6 @@ JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) # Multiply by 4 the timeout factor JTREG_TIMEOUT_OPTION = -timeoutFactor:4 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION) -# Add any extra options -JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) # Set other vm and test options JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_OPTIONS:%=-vmoption:%) $(JAVA_VM_ARGS:%=-vmoption:%) @@ -436,6 +442,20 @@ PHONY_LIST += hotspot_servertest servertest ################################################################ +# Run the native gtest tests from the test image + +hotspot_gtest: + $(foreach v, $(JVM_VARIANTS), \ + $(MAKE) hotspot_gtest$v $(NEWLINE) ) + +hotspot_gtestserver hotspot_gtestclient hotspot_gtestminimal: hotspot_gtest%: + $(TESTNATIVE_DIR)/hotspot/gtest/$*/gtestLauncher \ + -jdk $(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") + +PHONY_LIST += hotspot_gtest hotspot_gtestserver hotspot_gtestclient \ + hotspot_gtestminimal + +################################################################ # Phony targets (e.g. these are not filenames) .PHONY: all clean prep $(PHONY_LIST) diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups index 18dc949a024..262232e706c 100644 --- a/hotspot/test/TEST.groups +++ b/hotspot/test/TEST.groups @@ -338,6 +338,7 @@ hotspot_fast_gc_2 = \ sanity/ExecuteInternalVMTests.java \ gc/ \ -gc/g1/ \ + -gc/logging/TestUnifiedLoggingSwitchStress.java \ -gc/stress \ -gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java \ -gc/cms/TestMBeanCMS.java \ @@ -353,7 +354,7 @@ hotspot_fast_runtime = \ runtime/ \ -runtime/ErrorHandling/ErrorHandler.java \ -runtime/RedefineObject/TestRedefineObject.java \ - -runtime/8003720/Test8003720.java \ + -runtime/MirrorFrame/Test8003720.java \ -runtime/Metaspace/FragmentMetaspace.java \ -runtime/Metaspace/FragmentMetaspaceSimple.java \ -runtime/Thread/TestThreadDumpMonitorContention.java \ diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginContextImpl.java b/hotspot/test/compiler/arguments/TestUseCompiler.java similarity index 66% rename from jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginContextImpl.java rename to hotspot/test/compiler/arguments/TestUseCompiler.java index 7fe7dcea36e..edf3540398c 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginContextImpl.java +++ b/hotspot/test/compiler/arguments/TestUseCompiler.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -22,16 +20,19 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.tools.jlink.internal; -import java.util.Properties; +/** + * @test TestUseCompiler + * @bug 8086068 + * @summary Tests execution with inconsistent UseCompiler flag combination. + * @run main/othervm -Xint -XX:+UseCompiler TestUseCompiler + * @run main/othervm -XX:+UseCompiler -Xint TestUseCompiler + */ -import jdk.tools.jlink.plugin.PluginContext; +public class TestUseCompiler { -public final class PluginContextImpl implements PluginContext { - private final Properties releaseProps = new Properties(); - - public Properties getReleaseProperties() { - return releaseProps; + public static void main(String args[]) { + System.out.println("Passed"); } } + diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java index a2430dcf478..ccd2cfe1028 100644 --- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java +++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java @@ -72,6 +72,7 @@ public class TestArrayCopyNoInitDeopt { } private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final int TIERED_STOP_AT_LEVEL = WHITE_BOX.getIntxVMFlag("TieredStopAtLevel").intValue(); static boolean deoptimize(Method method, Object src_obj) throws Exception { for (int i = 0; i < 10; i++) { @@ -84,7 +85,9 @@ public class TestArrayCopyNoInitDeopt { } static public void main(String[] args) throws Exception { - if (Platform.isServer()) { + // Only execute if C2 is available + if (Platform.isServer() && + TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) { int[] src = new int[10]; Object src_obj = new Object(); Method method_m1 = TestArrayCopyNoInitDeopt.class.getMethod("m1", Object.class); diff --git a/hotspot/test/compiler/c2/5057225/Test5057225.java b/hotspot/test/compiler/c2/5057225/Test5057225.java index 106d390b850..7cf64f90005 100644 --- a/hotspot/test/compiler/c2/5057225/Test5057225.java +++ b/hotspot/test/compiler/c2/5057225/Test5057225.java @@ -25,6 +25,7 @@ * @test * @bug 5057225 * @summary Remove useless I2L conversions + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -Xcomp -XX:CompileOnly=Test5057225.doload Test5057225 */ diff --git a/hotspot/test/compiler/c2/6603011/Test.java b/hotspot/test/compiler/c2/6603011/Test.java index bc457073517..39c041935c6 100644 --- a/hotspot/test/compiler/c2/6603011/Test.java +++ b/hotspot/test/compiler/c2/6603011/Test.java @@ -25,6 +25,7 @@ * @test * @bug 6603011 * @summary long/int division by constant + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -Xcomp -Xbatch -XX:-Inline Test */ diff --git a/hotspot/test/compiler/c2/6800154/Test6800154.java b/hotspot/test/compiler/c2/6800154/Test6800154.java index 05ad662d69d..b43c1556156 100644 --- a/hotspot/test/compiler/c2/6800154/Test6800154.java +++ b/hotspot/test/compiler/c2/6800154/Test6800154.java @@ -25,6 +25,7 @@ * @test * @bug 6800154 * @summary Add comments to long_by_long_mulhi() for better understandability + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -Xcomp -XX:CompileOnly=Test6800154.divcomp Test6800154 */ diff --git a/hotspot/test/compiler/c2/6805724/Test6805724.java b/hotspot/test/compiler/c2/6805724/Test6805724.java index 922b297dbd8..afa20d278cc 100644 --- a/hotspot/test/compiler/c2/6805724/Test6805724.java +++ b/hotspot/test/compiler/c2/6805724/Test6805724.java @@ -26,6 +26,7 @@ * @bug 6805724 * @summary ModLNode::Ideal() generates functionally incorrect graph * when divisor is any (2^k-1) constant. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -Xcomp -XX:CompileOnly=Test6805724.fcomp Test6805724 */ diff --git a/hotspot/test/compiler/c2/6968348/Test6968348.java b/hotspot/test/compiler/c2/6968348/Test6968348.java index b13b7e638cd..432f45fad3e 100644 --- a/hotspot/test/compiler/c2/6968348/Test6968348.java +++ b/hotspot/test/compiler/c2/6968348/Test6968348.java @@ -31,7 +31,7 @@ * @run main Test6968348 */ -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.*; public class Test6968348 { @@ -40,7 +40,7 @@ public class Test6968348 { static int array_long_base_offset; public static void main(String[] args) throws Exception { - Class c = Test6968348.class.getClassLoader().loadClass("sun.misc.Unsafe"); + Class c = Test6968348.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); Field f = c.getDeclaredField("theUnsafe"); f.setAccessible(true); unsafe = (Unsafe)f.get(c); diff --git a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java index 08d6848df4d..de48a6e4627 100644 --- a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java +++ b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java @@ -32,7 +32,7 @@ import java.lang.ref.*; import java.lang.reflect.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class Test7190310_unsafe { @@ -48,7 +48,7 @@ public class Test7190310_unsafe { private TestObject obj; public static void main(String[] args) throws Exception { - Class c = Test7190310_unsafe.class.getClassLoader().loadClass("sun.misc.Unsafe"); + Class c = Test7190310_unsafe.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); Field f = c.getDeclaredField("theUnsafe"); f.setAccessible(true); Unsafe unsafe = (Unsafe)f.get(c); diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java index fc8ab3bbdaa..a405f5608cf 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java +++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java @@ -32,7 +32,7 @@ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeCAS */ -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.*; public class TestIntUnsafeCAS { @@ -47,7 +47,7 @@ public class TestIntUnsafeCAS { private static final int BASE; static { try { - Class c = TestIntUnsafeCAS.class.getClassLoader().loadClass("sun.misc.Unsafe"); + Class c = TestIntUnsafeCAS.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); Field f = c.getDeclaredField("theUnsafe"); f.setAccessible(true); unsafe = (Unsafe)f.get(c); diff --git a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java index 3c8ddf37046..6cbab7a42c3 100644 --- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java +++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java @@ -32,7 +32,7 @@ * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeVolatile */ -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.*; public class TestIntUnsafeVolatile { @@ -47,7 +47,7 @@ public class TestIntUnsafeVolatile { private static final int BASE; static { try { - Class c = TestIntUnsafeVolatile.class.getClassLoader().loadClass("sun.misc.Unsafe"); + Class c = TestIntUnsafeVolatile.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); Field f = c.getDeclaredField("theUnsafe"); f.setAccessible(true); unsafe = (Unsafe)f.get(c); diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java index 12c14cb2ee5..3124d3deb4a 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2CompiledTest.java @@ -24,6 +24,7 @@ /* * @test * @library /test/lib /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * @build compiler.calls.common.InvokeDynamic * @build compiler.calls.common.InvokeDynamicPatcher diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java index 097cf9d9349..49162205a31 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2InterpretedTest.java @@ -24,6 +24,7 @@ /* * @test * @library /test/lib /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * @build compiler.calls.common.InvokeDynamic * @build compiler.calls.common.InvokeDynamicPatcher diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java index 98baacb6c86..37216320574 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeDynamic2NativeTest.java @@ -24,6 +24,7 @@ /* * @test * @library /test/lib /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * @build compiler.calls.common.InvokeDynamic * @build compiler.calls.common.InvokeDynamicPatcher diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java index fec0fda8aee..34f86cda1af 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java index 2baf4e7caa8..fb3021022de 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java index ec394a10f93..a930528651b 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeInterface2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java index 5d659f5bbef..39648e75aad 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java index 1a6c6c9ec17..25cac6bb36c 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java index e1b64749d22..e30115a36e8 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeSpecial2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java index f31ef6ba9ff..8cda5e0af26 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java index 8a8b8565a05..1d998e09274 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java index 955a727f00b..a0c8009b637 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeStatic2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java index 53fb39ac117..6ac0e2ba09f 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java index d875be780df..9f03a2c62f8 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java index 0f69bb50cf4..93643d6974b 100644 --- a/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromCompiled/CompiledInvokeVirtual2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java index ffc4fa94e0e..17d151253a6 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2CompiledTest.java @@ -24,6 +24,7 @@ /* * @test * @library /test/lib /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * @build compiler.calls.common.InvokeDynamic * @build compiler.calls.common.InvokeDynamicPatcher diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java index 9579fc2e1ce..5988ac62599 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2InterpretedTest.java @@ -24,6 +24,7 @@ /* * @test * @library /test/lib /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * @build compiler.calls.common.InvokeDynamic * @build compiler.calls.common.InvokeDynamicPatcher diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java index 78f2f556fa4..7f0015a4e9d 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeDynamic2NativeTest.java @@ -24,6 +24,7 @@ /* * @test * @library /test/lib /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * @build compiler.calls.common.InvokeDynamic * @build compiler.calls.common.InvokeDynamicPatcher diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java index 84b4e5016ca..ea458db3a97 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java index a4f204f1d34..ed150e4f9f2 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java index ca0044524e0..8adc7a6c306 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeInterface2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeInterface * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java index d47585abf29..ad0b12f1d7f 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java index 9c047fa9502..324ad867ad3 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java index 768d5eb9dae..e34cca01ab3 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeSpecial2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java index de4f6c2b995..96501a1ed15 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java index 06339099281..8efd93d874b 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java index 2a7deda7655..0bcbb379842 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeStatic2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java index fb7a645ec8d..eefe4e6debe 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java index c4eecef1d80..d44e140f8e5 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java index 2ac9911b4d3..201199341e1 100644 --- a/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromInterpreted/InterpretedInvokeVirtual2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java index 1a303bdf088..86a0784af56 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java index 517422adf6e..83520cef1c7 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java index 9b3d7ad166a..f9b3ce5b8b4 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeSpecial2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeSpecial * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java index 546ed827801..71335713aaa 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java index 5e480d82f36..541b3645a1c 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java index 9ace6ea67b5..34ad481e521 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeStatic2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeStatic * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java index 56059718e81..4f86421b607 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2CompiledTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java index 09777265bc3..c0d3b77110e 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2InterpretedTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java index d4ddd119fc3..b83b9330e5e 100644 --- a/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java +++ b/hotspot/test/compiler/calls/fromNative/NativeInvokeVirtual2NativeTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary / * @build compiler.calls.common.InvokeVirtual * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java index 3745d73a008..65b3d5879e9 100644 --- a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java +++ b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java @@ -22,7 +22,7 @@ */ import sun.hotspot.WhiteBox; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.io.IOException; import java.lang.reflect.Method; diff --git a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java index a824ec2bdb2..d1415465b1a 100644 --- a/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java +++ b/hotspot/test/compiler/classUnloading/methodUnloading/TestMethodUnloading.java @@ -31,6 +31,7 @@ import java.net.URLClassLoader; * @test MethodUnloadingTest * @bug 8029443 * @summary "Tests the unloading of methods to to class unloading" + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build TestMethodUnloading * @build WorkerClass diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java index 85537e8d783..31e8d2bcc30 100644 --- a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java +++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java @@ -35,6 +35,7 @@ import jdk.test.lib.Asserts; * @test OverflowCodeCacheTest * @bug 8059550 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management * @build OverflowCodeCacheTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java index b8408ea3f8e..57fc8e0f292 100644 --- a/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java +++ b/hotspot/test/compiler/codecache/dtrace/SegmentedCodeCacheDtraceTest.java @@ -48,6 +48,7 @@ import java.util.stream.Collectors; * @test SegmentedCodeCacheDtraceTest * @bug 8015774 * @requires os.family=="solaris" + * @modules java.base/jdk.internal.misc * @library /testlibrary / /test/lib * @build SegmentedCodeCacheDtraceTestWorker * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java index bea23c6a52a..f7838e50851 100644 --- a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java +++ b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java @@ -28,6 +28,7 @@ import sun.hotspot.code.BlobType; /** * @test BeanTypeTest * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management * @build BeanTypeTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java index faef9a2ead7..6f99c25f952 100644 --- a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java @@ -28,6 +28,7 @@ import sun.hotspot.code.BlobType; /** * @test CodeHeapBeanPresenceTest * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management * @build CodeHeapBeanPresenceTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java index a67812fc683..f695234cb00 100644 --- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java +++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -84,7 +84,7 @@ public class InitialAndMaxUsageTest { Asserts.assertEQ(initialUsage, 0L, "Unexpected initial usage"); } ArrayList blobs = new ArrayList<>(); - long minAllocationUnit = CodeCacheUtils.MIN_ALLOCATION - headerSize; + long minAllocationUnit = Math.max(0, CodeCacheUtils.MIN_ALLOCATION - headerSize); /* now filling code cache with large-sized allocation first, since lots of small allocations takes too much time, so, just a small optimization */ diff --git a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java index 4b3b597ec06..45107f050b9 100644 --- a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java +++ b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java @@ -28,6 +28,7 @@ import sun.hotspot.code.BlobType; /** * @test ManagerNamesTest * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management * @build ManagerNamesTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java index 22eecc8adc6..a3a0308bd9a 100644 --- a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java @@ -33,6 +33,7 @@ import sun.hotspot.code.BlobType; /** * @test MemoryPoolsPresenceTest * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management * @build MemoryPoolsPresenceTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java index 69f10212a71..97b21431caf 100644 --- a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java +++ b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java @@ -37,6 +37,7 @@ import sun.hotspot.code.BlobType; /* * @test PoolsIndependenceTest + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build PoolsIndependenceTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java index 765eede8938..8f2e6f10269 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -67,7 +67,7 @@ public class UsageThresholdIncreasedTest { protected void runTest() { long headerSize = CodeCacheUtils.getHeaderSize(btype); - long allocationUnit = CodeCacheUtils.MIN_ALLOCATION - headerSize; + long allocationUnit = Math.max(0, CodeCacheUtils.MIN_ALLOCATION - headerSize); MemoryPoolMXBean bean = btype.getMemoryPool(); long initialCount = bean.getUsageThresholdCount(); long initialSize = bean.getUsage().getUsed(); diff --git a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java index 29b5263bdad..1838226fae4 100644 --- a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java +++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -58,9 +58,12 @@ public class UsageThresholdNotExceededTest { MemoryPoolMXBean bean = btype.getMemoryPool(); long initialThresholdCount = bean.getUsageThresholdCount(); long initialUsage = bean.getUsage().getUsed(); + bean.setUsageThreshold(initialUsage + 1 + CodeCacheUtils.MIN_ALLOCATION); - CodeCacheUtils.WB.allocateCodeBlob(CodeCacheUtils.MIN_ALLOCATION - - CodeCacheUtils.getHeaderSize(btype), btype.id); + long size = CodeCacheUtils.getHeaderSize(btype); + + CodeCacheUtils.WB.allocateCodeBlob(Math.max(0, CodeCacheUtils.MIN_ALLOCATION + - size), btype.id); // a gc cycle triggers usage threshold recalculation CodeCacheUtils.WB.fullGC(); CodeCacheUtils.assertEQorGTE(btype, bean.getUsageThresholdCount(), initialThresholdCount, diff --git a/hotspot/test/compiler/codegen/6823354/Test6823354.java b/hotspot/test/compiler/codegen/6823354/Test6823354.java index 6f9bc0203be..1ba60e1a3b6 100644 --- a/hotspot/test/compiler/codegen/6823354/Test6823354.java +++ b/hotspot/test/compiler/codegen/6823354/Test6823354.java @@ -25,6 +25,7 @@ * @test * @bug 6823354 * @summary These methods can be instrinsified by using bit scan, bit test, and population count instructions. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -Xcomp -XX:CompileOnly=Test6823354.lzcomp,Test6823354.tzcomp,.dolzcomp,.dotzcomp Test6823354 */ diff --git a/hotspot/test/compiler/codegen/IntRotateWithImmediate.java b/hotspot/test/compiler/codegen/IntRotateWithImmediate.java index e174de699e8..3da2aec0afa 100644 --- a/hotspot/test/compiler/codegen/IntRotateWithImmediate.java +++ b/hotspot/test/compiler/codegen/IntRotateWithImmediate.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2015 SAP SE. All rights reserved. + * Copyright (c) 2016, Red Hat, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +25,7 @@ /* * @test * @bug 8080190 + * @bug 8154537 * @key regression * @summary Test that the rotate distance used in the rotate instruction is properly masked with 0x1f * @run main/othervm -Xbatch -XX:-UseOnStackReplacement IntRotateWithImmediate @@ -33,7 +35,7 @@ public class IntRotateWithImmediate { // This is currently the same as Integer.rotateRight() - static int rotateRight(int i, int distance) { + static int rotateRight1(int i, int distance) { // On some architectures (i.e. x86_64 and ppc64) the following computation is // matched in the .ad file into a single MachNode which emmits a single rotate // machine instruction. It is important that the shift amount is masked to match @@ -43,17 +45,29 @@ public class IntRotateWithImmediate { return ((i >>> distance) | (i << -distance)); } - static int compute(int x) { - return rotateRight(x, 3); + static int rotateRight2(int i, int distance) { + return ((i >>> distance) | (i << (32-distance))); + } + + static int compute1(int x) { + return rotateRight1(x, 3); + } + + static int compute2(int x) { + return rotateRight2(x, 3); } public static void main(String args[]) { int val = 4096; - int firstResult = compute(val); + int firstResult = compute1(val); for (int i = 0; i < 100000; i++) { - int newResult = compute(val); + int newResult = compute1(val); + if (firstResult != newResult) { + throw new InternalError(firstResult + " != " + newResult); + } + newResult = compute2(val); if (firstResult != newResult) { throw new InternalError(firstResult + " != " + newResult); } diff --git a/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java b/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java index 3dc057c448d..afba82b1d7f 100644 --- a/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java +++ b/hotspot/test/compiler/compilercontrol/InlineMatcherTest.java @@ -24,6 +24,7 @@ /* * @test InlineMatcherTest * @bug 8074095 + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java index 2541d9d0b83..925c1c7ef5c 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=compileonly + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.commandfile.CompileOnlyTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java index 77c2a2e0748..98b3c715276 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=exclude + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.commandfile.ExcludeTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java index ce45d52b11c..18dd2a7dbdd 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=log + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.commandfile.LogTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java index 5e90521eabf..f47b9a43bae 100644 --- a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java +++ b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java @@ -25,8 +25,8 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=print + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / - * @ignore 8140354 * @build compiler.compilercontrol.commandfile.PrintTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox * compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.* diff --git a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java index 7a1b0c1da40..d4e57e94e40 100644 --- a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=compileonly + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.commands.CompileOnlyTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java index b84befca8c2..f8311e77c70 100644 --- a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=exclude + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.commands.ExcludeTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/commands/LogTest.java b/hotspot/test/compiler/compilercontrol/commands/LogTest.java index 4ffebe41a32..7f9db796be6 100644 --- a/hotspot/test/compiler/compilercontrol/commands/LogTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/LogTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=log + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.commands.LogTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java index d9ac685ca8f..bbe9efec173 100644 --- a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java +++ b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java @@ -25,8 +25,8 @@ * @test * @bug 8137167 * @summary Tests CompileCommand=print + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / - * @ignore 8140354 * @build compiler.compilercontrol.commands.PrintTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox * compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.* diff --git a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java index 439e5e9505d..e351c42fd07 100644 --- a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests directives to be able to compile only specified methods + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.directives.CompileOnlyTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java index 0569cdfe323..5799fe20e0e 100644 --- a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests directives to be able to exclude methods from compilation + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.directives.ExcludeTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/directives/LogTest.java b/hotspot/test/compiler/compilercontrol/directives/LogTest.java index 1f84d4aea5e..0d5f9cc5dd1 100644 --- a/hotspot/test/compiler/compilercontrol/directives/LogTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/LogTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests directives to be able to turn on LogCompilation + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.directives.LogTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java index bbd92c1704b..ac45d43a768 100644 --- a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java +++ b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java @@ -25,8 +25,8 @@ * @test * @bug 8137167 * @summary Tests directives to be able to turn on print_assembly + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / - * @ignore 8140354 * @build compiler.compilercontrol.directives.PrintTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox * compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.* diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java index 372b50a72b6..ec296cea78a 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests directives to be able to add and remove directives + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.AddAndRemoveTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java index 5b2a9e26843..70963733f45 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests jcmd to be able to add a directive to compile only specified methods + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.AddCompileOnlyTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java index a06c32616d8..38125fb6bac 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests jcmd to be able to add a directive to exclude only specified methods + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.AddExcludeTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java index 266cf3c5dda..7c14e41cf3c 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests jcmd to be able to add a directive to log only specified methods + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.AddLogTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java index 9697711c294..ea8bd585769 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java @@ -26,6 +26,7 @@ * @bug 8137167 * @summary Tests jcmd to be able to add a directive to print assembly * only for specified methods + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.AddPrintAssemblyTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java index da1fef49141..4635a7f91f3 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java @@ -26,6 +26,7 @@ * @bug 8137167 * @ignore 8140405 * @summary Tests jcmd to be able to clear directives added via options + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java index c9d9f8dcfd0..20d7a7a3441 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests clear JCMD command + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.ClearDirectivesStackTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java index 7afd4d6f8b3..74bc4eef3ae 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java @@ -25,8 +25,8 @@ * @test * @bug 8137167 * @summary Tests jcmd to be able to add a directive to compile only specified methods + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / - * @ignore 8140354 * @build compiler.compilercontrol.jcmd.PrintDirectivesTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox * compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.* diff --git a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java index 26c225380ac..4cf2945108d 100644 --- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java +++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java @@ -26,6 +26,7 @@ * @bug 8137167 * @summary Tests jcmd to be able to add a lot of huge directive files with * parallel executed jcmds until timeout has reached + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.jcmd.StressAddMultiThreadedTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java new file mode 100644 index 00000000000..001251c4315 --- /dev/null +++ b/hotspot/test/compiler/compilercontrol/logcompilation/LogTest.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8137167 + * @summary Tests LogCompilation executed standalone without log commands or directives + * @modules java.base/jdk.internal.misc + * @library /testlibrary /test/lib /compiler/testlibrary ../share / + * @build compiler.compilercontrol.logcompilation.LogTest + * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox + * compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.* + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:+UnlockDiagnosticVMOptions compiler.compilercontrol.logcompilation.LogTest + */ + +package compiler.compilercontrol.logcompilation; + +import compiler.compilercontrol.share.processors.LogProcessor; +import compiler.compilercontrol.share.scenario.Scenario; + +public class LogTest { + public static void main(String[] args) { + Scenario.Builder builder = Scenario.getBuilder(); + builder.addFlag("-XX:+UnlockDiagnosticVMOptions"); + builder.addFlag("-XX:+LogCompilation"); + builder.addFlag("-XX:LogFile=" + LogProcessor.LOG_FILE); + Scenario scenario = builder.build(); + scenario.execute(); + } +} diff --git a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java index 87cd26a8958..9ec1eccf6e1 100644 --- a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java +++ b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java @@ -40,6 +40,7 @@ import java.util.regex.Pattern; * @test * @bug 8135068 * @summary Tests CompilerCommand's method matcher + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox ../share / * @build compiler.compilercontrol.matcher.MethodMatcherTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java index c954dba9011..11d38586a96 100644 --- a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java +++ b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Randomly generates commands with random types + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / * @build compiler.compilercontrol.mixed.RandomCommandsTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java index e8739e8abde..46c795205a6 100644 --- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java +++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java @@ -25,8 +25,8 @@ * @test * @bug 8137167 * @summary Randomly generates valid commands with random types + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/testlibrary ../share / - * @ignore 8140354 * @build compiler.compilercontrol.mixed.RandomValidCommandsTest * pool.sub.* pool.subpack.* sun.hotspot.WhiteBox * compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.* diff --git a/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java b/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java index f0fc0bfe632..e4fda4a87f9 100644 --- a/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java +++ b/hotspot/test/compiler/compilercontrol/parser/DirectiveParserTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Tests directive json parser + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib ../share / * @run driver compiler.compilercontrol.parser.DirectiveParserTest */ diff --git a/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java b/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java index ef1a311beca..c99b531f531 100644 --- a/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java +++ b/hotspot/test/compiler/compilercontrol/parser/DirectiveStressTest.java @@ -25,6 +25,7 @@ * @test * @bug 8137167 * @summary Stress directive json parser + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib ../share / * @run driver compiler.compilercontrol.parser.DirectiveStressTest */ diff --git a/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java b/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java index 15cb5604fb5..3a882865676 100644 --- a/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java +++ b/hotspot/test/compiler/compilercontrol/share/actions/BaseAction.java @@ -77,7 +77,7 @@ public class BaseAction { throw new Error("TESTBUG: incorrect argument: "+ args[1]); } } - int pid; + long pid; try { pid = ProcessTools.getProcessId(); } catch (Exception e) { diff --git a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java index a1acd0d907c..d921d1d2304 100644 --- a/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java +++ b/hotspot/test/compiler/compilercontrol/share/processors/LogProcessor.java @@ -28,7 +28,6 @@ import compiler.compilercontrol.share.method.MethodGenerator; import compiler.compilercontrol.share.scenario.State; import jdk.test.lib.Asserts; import jdk.test.lib.OutputAnalyzer; -import jdk.test.lib.Pair; import pool.PoolHelper; import java.io.File; @@ -55,18 +54,17 @@ public class LogProcessor implements Consumer { "method='([^']+)'"); private final List loggedMethods; private final List testMethods; - private Scanner scanner = null; public LogProcessor(Map states) { loggedMethods = states.keySet().stream() .filter(x -> states.get(x).isLog()) - .map(MethodGenerator::logDescriptor) + .map(MethodGenerator::commandDescriptor) .map(MethodDescriptor::getString) .collect(Collectors.toList()); testMethods = new PoolHelper().getAllMethods() .stream() .map(pair -> pair.first) - .map(MethodGenerator::logDescriptor) + .map(MethodGenerator::commandDescriptor) .map(MethodDescriptor::getString) .collect(Collectors.toList()); } @@ -76,8 +74,7 @@ public class LogProcessor implements Consumer { if (loggedMethods.isEmpty()) { return; } - getScanner(); - matchTasks(); + matchTasks(getScanner()); } /* @@ -85,6 +82,7 @@ public class LogProcessor implements Consumer { */ private Scanner getScanner() { File logFile = new File(LOG_FILE); + Scanner scanner; try { scanner = new Scanner(logFile); } catch (FileNotFoundException e) { @@ -97,29 +95,35 @@ public class LogProcessor implements Consumer { * Parses for <task method='java.lang.String indexOf (I)I' > * and finds if there is a compilation log for this task */ - private void matchTasks() { + private void matchTasks(Scanner scanner) { String task = scanner.findWithinHorizon(TASK_ELEMENT, 0); while (task != null) { String element = scanner.findWithinHorizon(ANY_ELEMENT, 0); if (Pattern.matches(TASK_DONE_ELEMENT, element) || Pattern.matches(TASK_END_ELEMENT, element)) { /* If there is nothing between and - except then compilation log is empty */ - Asserts.assertTrue(matchMethod(task), "Compilation log " + except then compilation log is empty. + Check the method in this task should not be logged */ + Asserts.assertFalse(matchMethod(task), "Compilation log " + "expected. Met: " + element); } task = scanner.findWithinHorizon(TASK_ELEMENT, 0); } } - // Matches given string to regular expression + // Check that input method should be logged private boolean matchMethod(String input) { Matcher matcher = METHOD_PATTERN.matcher(input); Asserts.assertTrue(matcher.find(), "Wrong matcher or input"); // Get method and normalize it String method = normalize(matcher.group(1)); - // Check that this method matches regexp - return loggedMethods.contains(method) || !testMethods.contains(method); + if (loggedMethods.contains(method)) { + return true; + } + if (!testMethods.contains(method)) { + return false; + } + return false; } // Normalize given signature to conform regular expression used in tests diff --git a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java index 505f36e7272..a0fefabac60 100644 --- a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java +++ b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java @@ -198,6 +198,7 @@ public final class Scenario { = new HashMap<>(); private final JcmdStateBuilder jcmdStateBuilder; private final List jcmdCommands = new ArrayList<>(); + private boolean logCommandMet = false; public Builder() { addFlag("-Xmixed"); @@ -215,6 +216,9 @@ public final class Scenario { public void add(CompileCommand compileCommand) { String[] vmOptions = compileCommand.command.vmOpts; Collections.addAll(vmopts, vmOptions); + if (compileCommand.command == Command.LOG) { + logCommandMet = true; + } if (compileCommand.type == Type.JCMD) { jcmdStateBuilder.add((JcmdCommand) compileCommand); jcmdCommands.add((JcmdCommand) compileCommand); @@ -294,6 +298,18 @@ public final class Scenario { isValid &= builder.isValid(); } options.addAll(jcmdStateBuilder.getOptions()); + + /* + * Update final states if LogCompilation is enabled and + * there is no any log command, then all methods should be logged + */ + boolean isLogComp = vmopts.stream() + .anyMatch(opt -> opt.contains("-XX:+LogCompilation")); + if (isLogComp && !logCommandMet) { + finalStates.entrySet() + .forEach(entry -> entry.getValue().setLog(true)); + } + return new Scenario(isValid, options, finalStates, ccList, jcmdCommands, directives); } diff --git a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java index 8e8deda71bd..7be9e436ad9 100644 --- a/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java +++ b/hotspot/test/compiler/cpuflags/AESIntrinsicsBase.java @@ -40,10 +40,11 @@ public abstract class AESIntrinsicsBase extends CommandLineOptionTest { public static final String USE_AES_INTRINSICS = "UseAESIntrinsics"; public static final String USE_SSE = "UseSSE"; public static final String USE_VIS = "UseVIS"; + public static final String[] USE_DIAGNOSTIC_CMD + = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintIntrinsics"}; public static final String[] TEST_AES_CMD = {"-XX:+IgnoreUnrecognizedVMOptions", "-XX:+PrintFlagsFinal", - "-Xbatch","-XX:+UnlockDiagnosticVMOptions", - "-XX:+PrintIntrinsics", "-DcheckOutput=true", "-Dmode=CBC", + "-Xbatch", "-DcheckOutput=true", "-Dmode=CBC", "TestAESMain"}; protected AESIntrinsicsBase(BooleanSupplier predicate) { @@ -52,14 +53,18 @@ public abstract class AESIntrinsicsBase extends CommandLineOptionTest { /** * Prepares command for TestAESMain execution. + * Intrinsics flags are of diagnostic type + * and must be preceded by UnlockDiagnosticVMOptions. * @param args flags that must be added to command * @return command for TestAESMain execution */ public static String[] prepareArguments(String... args) { - String[] command = Arrays.copyOf(args, TEST_AES_CMD.length - + args.length); - System.arraycopy(TEST_AES_CMD, 0, command, args.length, - TEST_AES_CMD.length); + String[] command = Arrays.copyOf(USE_DIAGNOSTIC_CMD, args.length + + USE_DIAGNOSTIC_CMD.length + TEST_AES_CMD.length); + System.arraycopy(args, 0, command, USE_DIAGNOSTIC_CMD.length, + args.length); + System.arraycopy(TEST_AES_CMD, 0, command, args.length + + USE_DIAGNOSTIC_CMD.length, TEST_AES_CMD.length); return command; } } diff --git a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java index cdea3b311e8..440a4b665e0 100644 --- a/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java +++ b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java @@ -25,6 +25,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox * -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort diff --git a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java index 3f38678351d..73ca08fa6cd 100644 --- a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java +++ b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java @@ -31,7 +31,7 @@ */ import java.lang.reflect.Field; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class TestUnsafePutAddressNullObjMustNotEscape { @@ -43,7 +43,7 @@ public class TestUnsafePutAddressNullObjMustNotEscape { System.out.println("EXECUTING test."); { - System.out.println("Acquiring sun.misc.Unsafe.theUnsafe using reflection."); + System.out.println("Acquiring jdk.internal.misc.Unsafe.theUnsafe using reflection."); getUnsafe(); System.out.println("Allocating raw memory."); mem = (usafe.allocateMemory(1024) + 8L) & ~7L; @@ -78,8 +78,8 @@ public class TestUnsafePutAddressNullObjMustNotEscape { } private static void getUnsafe() throws Exception { - Field field = sun.misc.Unsafe.class.getDeclaredField("theUnsafe"); + Field field = jdk.internal.misc.Unsafe.class.getDeclaredField("theUnsafe"); field.setAccessible(true); - usafe = (sun.misc.Unsafe) field.get(null); + usafe = (jdk.internal.misc.Unsafe) field.get(null); } } diff --git a/hotspot/test/compiler/floatingpoint/TestPow2.java b/hotspot/test/compiler/floatingpoint/TestPow2.java index a443062b9b4..d3893e9863c 100644 --- a/hotspot/test/compiler/floatingpoint/TestPow2.java +++ b/hotspot/test/compiler/floatingpoint/TestPow2.java @@ -26,6 +26,7 @@ * @bug 8063086 * @summary X^2 special case for C2 yields different result than interpreter * @library /testlibrary /test/lib /compiler/whitebox / + * @modules java.base/jdk.internal.misc * @modules java.management * @build TestPow2 * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/inlining/InlineAccessors.java b/hotspot/test/compiler/inlining/InlineAccessors.java index 60f8986a829..387a513f148 100644 --- a/hotspot/test/compiler/inlining/InlineAccessors.java +++ b/hotspot/test/compiler/inlining/InlineAccessors.java @@ -25,6 +25,7 @@ * @test * @bug 8140650 * @summary Method::is_accessor should cover getters and setters for all types + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm InlineAccessors */ diff --git a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java index ff2c7e366df..ab582f94b18 100644 --- a/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java +++ b/hotspot/test/compiler/intrinsics/IntrinsicAvailableTest.java @@ -29,6 +29,7 @@ import compiler.whitebox.CompilerWhiteBoxTest; /* * @test * @bug 8130832 + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox /compiler/testlibrary / * @build IntrinsicAvailableTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java index 1fdaf805f9a..638301a54e7 100644 --- a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java +++ b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java @@ -24,6 +24,7 @@ /* * @test * @bug 8138651 + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build IntrinsicDisabledTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java index f70f40503d7..15380e8cd5f 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java @@ -31,7 +31,7 @@ * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI */ import java.lang.reflect.Method; diff --git a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java index 32b43afc038..e0b9ecda1ea 100644 --- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java +++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java @@ -31,7 +31,7 @@ * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL */ import java.lang.reflect.Method; diff --git a/hotspot/test/compiler/intrinsics/clone/TestObjectClone.java b/hotspot/test/compiler/intrinsics/clone/TestObjectClone.java index 2dde3fc9dc8..1e40e8442e1 100644 --- a/hotspot/test/compiler/intrinsics/clone/TestObjectClone.java +++ b/hotspot/test/compiler/intrinsics/clone/TestObjectClone.java @@ -26,6 +26,7 @@ * @test * @bug 8033626 * @summary assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -XX:-TieredCompilation -Xbatch -XX:CompileOnly=TestObjectClone::f TestObjectClone */ diff --git a/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java b/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java index 5a6f91c0636..cd8445bf8cf 100644 --- a/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java +++ b/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java @@ -42,6 +42,7 @@ import jdk.test.lib.Platform; * @test * @bug 8130150 8131779 8139907 * @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @library /testlibrary * @build MontgomeryMultiplyTest diff --git a/hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java b/hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java index 4d7b274c284..4b310e9069e 100644 --- a/hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java +++ b/hotspot/test/compiler/intrinsics/muladd/TestMulAdd.java @@ -28,7 +28,7 @@ * @summary Add C2 x86 intrinsic for BigInteger::mulAdd() method * * @run main/othervm/timeout=600 -XX:-TieredCompilation -Xbatch - * -XX:+IgnoreUnrecognizedVMOptions -XX:-UseSquareToLenIntrinsic -XX:-UseMultiplyToLenIntrinsic + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-UseSquareToLenIntrinsic -XX:-UseMultiplyToLenIntrinsic * -XX:CompileCommand=dontinline,TestMulAdd::main * -XX:CompileCommand=option,TestMulAdd::base_multiply,ccstr,DisableIntrinsic,_mulAdd * -XX:CompileCommand=option,java.math.BigInteger::multiply,ccstr,DisableIntrinsic,_mulAdd diff --git a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java index 5c801cb6d1e..febf666aeb7 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java @@ -42,6 +42,11 @@ public class SHAOptionsBase extends CommandLineOptionTest { protected static final String USE_SHA512_INTRINSICS_OPTION = "UseSHA512Intrinsics"; + // Intrinsics flags are of diagnostic type + // and must be preceded by UnlockDiagnosticVMOptions. + protected static final String UNLOCK_DIAGNOSTIC_VM_OPTIONS + = "-XX:+UnlockDiagnosticVMOptions"; + // Note that strings below will be passed to // CommandLineOptionTest.verifySameJVMStartup and thus are regular // expressions, not just a plain strings. diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java index ca11075c37d..09dc581e7fb 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java @@ -50,11 +50,13 @@ public class GenericTestCaseForOtherCPU extends CommandLineOptionTest.verifySameJVMStartup(null, new String[] { ".*" + optionName + ".*" }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); CommandLineOptionTest.verifySameJVMStartup(null, new String[] { ".*" + optionName + ".*" }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, false)); } @@ -63,13 +65,15 @@ public class GenericTestCaseForOtherCPU extends // Verify that option is disabled by default. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be disabled by default", - optionName)); + optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS); // Verify that option is disabled even if it was explicitly enabled // using CLI options. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be off on unsupported " + "CPU even if set to true directly", optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); // Verify that option is disabled when it explicitly disabled @@ -79,6 +83,7 @@ public class GenericTestCaseForOtherCPU extends + " even if '%s' flag set to JVM", optionName, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, false)); } } diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java index 69be4343825..553cfafa128 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java @@ -49,6 +49,7 @@ public class GenericTestCaseForSupportedCPU extends CommandLineOptionTest.verifySameJVMStartup(null, new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); // Verify that option could be disabled even if +UseSHA was passed to @@ -60,6 +61,7 @@ public class GenericTestCaseForSupportedCPU extends optionName, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)), ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true), CommandLineOptionTest.prepareBooleanFlag(optionName, false)); @@ -75,6 +77,7 @@ public class GenericTestCaseForSupportedCPU extends optionName, CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false)), ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false), CommandLineOptionTest.prepareBooleanFlag(optionName, true)); } @@ -86,18 +89,21 @@ public class GenericTestCaseForSupportedCPU extends CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true", String.format("Option '%s' should be enabled by default", - optionName)); + optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS); // Verify that it is possible to explicitly enable the option. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true", String.format("Option '%s' was set to have value 'true'", optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); // Verify that it is possible to explicitly disable the option. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' was set to have value 'false'", optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, false)); // verify that option is disabled when -UseSHA was passed to JVM. @@ -106,6 +112,7 @@ public class GenericTestCaseForSupportedCPU extends + " flag set to JVM", optionName, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, false)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true), CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, false)); @@ -117,6 +124,7 @@ public class GenericTestCaseForSupportedCPU extends + " even if %s flag set to JVM", optionName, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true), CommandLineOptionTest.prepareBooleanFlag(optionName, false)); diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java index 6730b9e9594..8fabc79bfaa 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java @@ -47,6 +47,7 @@ public class GenericTestCaseForUnsupportedAArch64CPU extends CommandLineOptionTest.verifySameJVMStartup(null, new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, false)); shouldPassMessage = String.format("If JVM is started with '-XX:-" @@ -62,6 +63,7 @@ public class GenericTestCaseForUnsupportedAArch64CPU extends shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false), CommandLineOptionTest.prepareBooleanFlag(optionName, true)); } @@ -72,13 +74,15 @@ public class GenericTestCaseForUnsupportedAArch64CPU extends // Verify that option is disabled by default. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be disabled by default", - optionName)); + optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS); // Verify that option is disabled even if it was explicitly enabled // using CLI options. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be off on unsupported " + "AArch64CPU even if set to true directly", optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); // Verify that option is disabled when +UseSHA was passed to JVM. @@ -87,6 +91,7 @@ public class GenericTestCaseForUnsupportedAArch64CPU extends + "AArch64CPU even if %s flag set to JVM", optionName, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)); } diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java index 58dde555551..1254b8a0649 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedSparcCPU.java @@ -47,6 +47,7 @@ public class GenericTestCaseForUnsupportedSparcCPU extends CommandLineOptionTest.verifySameJVMStartup(null, new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, false)); // Verify that when the tested option is enabled, then @@ -58,6 +59,7 @@ public class GenericTestCaseForUnsupportedSparcCPU extends shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false), CommandLineOptionTest.prepareBooleanFlag(optionName, true)); } @@ -68,13 +70,15 @@ public class GenericTestCaseForUnsupportedSparcCPU extends // Verify that option is disabled by default. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be disabled by default", - optionName)); + optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS); // Verify that option is disabled even if it was explicitly enabled // using CLI options. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be off on unsupported " + "SparcCPU even if set to true directly", optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); // Verify that option is disabled when +UseSHA was passed to JVM. @@ -83,6 +87,7 @@ public class GenericTestCaseForUnsupportedSparcCPU extends + "SparcCPU even if %s flag set to JVM", optionName, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)); } diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java index 2014ab5c2e1..599be2c8061 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedX86CPU.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -24,7 +24,9 @@ import jdk.test.lib.ExitCode; import jdk.test.lib.Platform; import jdk.test.lib.cli.CommandLineOptionTest; +import jdk.test.lib.cli.predicate.AndPredicate; import jdk.test.lib.cli.predicate.OrPredicate; +import jdk.test.lib.cli.predicate.NotPredicate; /** * Generic test case for SHA-related options targeted to X86 CPUs that don't @@ -33,28 +35,36 @@ import jdk.test.lib.cli.predicate.OrPredicate; public class GenericTestCaseForUnsupportedX86CPU extends SHAOptionsBase.TestCase { public GenericTestCaseForUnsupportedX86CPU(String optionName) { - super(optionName, new OrPredicate(Platform::isX64, Platform::isX86)); + super(optionName, new AndPredicate(new OrPredicate(Platform::isX64, Platform::isX86), + new NotPredicate(SHAOptionsBase.getPredicateForOption( + optionName)))); } @Override protected void verifyWarnings() throws Throwable { - String shouldPassMessage = String.format("JVM should start with '-XX:+" - + "%s' flag, but output should contain warning.", optionName); - // Verify that when the tested option is explicitly enabled, then - // a warning will occur in VM output. - CommandLineOptionTest.verifySameJVMStartup(new String[] { - SHAOptionsBase.getWarningForUnsupportedCPU(optionName) - }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK, - CommandLineOptionTest.prepareBooleanFlag(optionName, true)); - - shouldPassMessage = String.format("JVM should start with '-XX:-%s' " + String shouldPassMessage = String.format("JVM should start with '-XX:-%s' " + "flag without any warnings", optionName); // Verify that the tested option could be explicitly disabled without // a warning. CommandLineOptionTest.verifySameJVMStartup(null, new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, false)); + + // Verify that when the tested option is enabled, then + // a warning will occur in VM output if UseSHA is disabled. + if (!optionName.equals(SHAOptionsBase.USE_SHA_OPTION)) { + CommandLineOptionTest.verifySameJVMStartup( + new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) }, + null, + shouldPassMessage, + shouldPassMessage, + ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, + CommandLineOptionTest.prepareBooleanFlag(SHAOptionsBase.USE_SHA_OPTION, false), + CommandLineOptionTest.prepareBooleanFlag(optionName, true)); + } } @Override @@ -62,12 +72,14 @@ public class GenericTestCaseForUnsupportedX86CPU // Verify that the tested option is disabled by default. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be disabled by default", - optionName)); + optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS); // Verify that it is not possible to explicitly enable the option. CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false", String.format("Option '%s' should be off on unsupported " + "X86CPU even if set to true directly", optionName), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); // Verify that the tested option is disabled even if +UseSHA was passed @@ -77,6 +89,7 @@ public class GenericTestCaseForUnsupportedX86CPU + "X86CPU even if %s flag set to JVM", optionName, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)); } diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java index 6ba51bb98ae..c75a66795b8 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java @@ -59,6 +59,7 @@ public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU CommandLineOptionTest.verifySameJVMStartup(new String[] { SHAOptionsBase.getWarningForUnsupportedCPU(optionName) }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag(optionName, true)); } } diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java index 9349a3330bd..3c1d208790e 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java @@ -57,6 +57,7 @@ public class UseSHASpecificTestCaseForSupportedCPU CommandLineOptionTest.verifySameJVMStartup( null, new String[] { ".*UseSHA.*" }, shouldPassMessage, shouldPassMessage, ExitCode.OK, + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true), CommandLineOptionTest.prepareBooleanFlag( @@ -75,6 +76,7 @@ public class UseSHASpecificTestCaseForSupportedCPU SHAOptionsBase.USE_SHA_OPTION, "false", String.format( "'%s' option should be disabled when all UseSHA*Intrinsics are" + " disabled", SHAOptionsBase.USE_SHA_OPTION), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, false), CommandLineOptionTest.prepareBooleanFlag( @@ -91,6 +93,7 @@ public class UseSHASpecificTestCaseForSupportedCPU + "to JVM", SHAOptionsBase.USE_SHA_OPTION, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true), CommandLineOptionTest.prepareBooleanFlag( @@ -109,6 +112,7 @@ public class UseSHASpecificTestCaseForSupportedCPU SHAOptionsBase.USE_SHA_OPTION, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, false)), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, false), CommandLineOptionTest.prepareBooleanFlag( diff --git a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java index d325ddaf113..22f133deaa9 100644 --- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java +++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java @@ -68,6 +68,7 @@ public class UseSHASpecificTestCaseForUnsupportedCPU "%s option should be disabled on unsupported CPU" + " even if all UseSHA*Intrinsics options were enabled.", SHAOptionsBase.USE_SHA_OPTION), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true), CommandLineOptionTest.prepareBooleanFlag( @@ -84,6 +85,7 @@ public class UseSHASpecificTestCaseForUnsupportedCPU + " and %s was enabled as well", SHAOptionsBase.USE_SHA_OPTION, SHAOptionsBase.USE_SHA_OPTION), + SHAOptionsBase.UNLOCK_DIAGNOSTIC_VM_OPTIONS, CommandLineOptionTest.prepareBooleanFlag( SHAOptionsBase.USE_SHA_OPTION, true), CommandLineOptionTest.prepareBooleanFlag( diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java index 86d7b309179..f3cb5168901 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsicMemoryFlow.java @@ -27,6 +27,7 @@ import jdk.test.lib.Asserts; * @test * @bug 8144212 * @summary Check for correct memory flow with the String compress/inflate intrinsics. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main TestStringIntrinsicMemoryFlow */ diff --git a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java index 7bba5308971..ca8ca1ceebd 100644 --- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java +++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java @@ -26,6 +26,7 @@ * @test * @bug 8145336 * @summary PPC64: fix string intrinsics after CompactStrings change + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java index c9c0fc7506f..7c46ab1d555 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/HeapByteBufferTest.java @@ -36,6 +36,7 @@ import jdk.test.lib.Utils; /** * @test * @bug 8026049 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:-UseUnalignedAccesses -Djdk.test.lib.random.seed=0 HeapByteBufferTest * @run main/othervm -Djdk.test.lib.random.seed=0 HeapByteBufferTest diff --git a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java index 2c60a719827..78ef24a9338 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java +++ b/hotspot/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java @@ -25,6 +25,7 @@ /** * @test * @bug 8142386 + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @summary Unsafe access to an array is wrongly marked as mismatched * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:-TieredCompilation TestUnsafeMismatchedArrayFieldAccess @@ -33,7 +34,7 @@ import java.lang.reflect.*; import jdk.test.lib.Utils; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class TestUnsafeMismatchedArrayFieldAccess { diff --git a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java index 5ed225fd871..75997811d5d 100644 --- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java +++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java @@ -30,21 +30,21 @@ * */ -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.*; public class UnsafeGetAddressTest { private static Unsafe unsafe; public static void main(String[] args) throws Exception { - Class c = UnsafeGetAddressTest.class.getClassLoader().loadClass("sun.misc.Unsafe"); + Class c = UnsafeGetAddressTest.class.getClassLoader().loadClass("jdk.internal.misc.Unsafe"); Field f = c.getDeclaredField("theUnsafe"); f.setAccessible(true); unsafe = (Unsafe)f.get(c); long address = unsafe.allocateMemory(unsafe.addressSize()); unsafe.putAddress(address, 0x0000000080000000L); - // from sun.misc.Unsafe.getAddress' documentation: + // from jdk.internal.misc.Unsafe.getAddress' documentation: // "If the native pointer is less than 64 bits wide, it is // extended as an unsigned number to a Java long." result = unsafe.getAddress(address); diff --git a/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java b/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java index c19705f3a44..152b28dd2f1 100644 --- a/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java +++ b/hotspot/test/compiler/jsr292/CallSiteDepContextTest.java @@ -24,12 +24,13 @@ /** * @test * @bug 8057967 + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * @library patches * @build java.base/java.lang.invoke.MethodHandleHelper - * @run main/bootclasspath/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -Xlog:classunload - * -XX:+PrintCompilation -XX:+TraceDependencies -XX:+TraceReferenceGC - * -verbose:gc compiler.jsr292.CallSiteDepContextTest + * @run main/bootclasspath/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -Xlog:class+unload + * -XX:+PrintCompilation -XX:+TraceDependencies -XX:+TraceReferenceGC + * -verbose:gc compiler.jsr292.CallSiteDepContextTest */ package compiler.jsr292; @@ -46,7 +47,7 @@ import java.lang.ref.ReferenceQueue; import java.lang.reflect.Field; import jdk.internal.org.objectweb.asm.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.internal.org.objectweb.asm.Opcodes.*; diff --git a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java index a59f962fd22..3b009e9c0d0 100644 --- a/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java +++ b/hotspot/test/compiler/jsr292/ContinuousCallSiteTargetChange.java @@ -23,6 +23,7 @@ /** * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main ContinuousCallSiteTargetChange */ diff --git a/hotspot/test/compiler/jsr292/InvokerGC.java b/hotspot/test/compiler/jsr292/InvokerGC.java index 35884f431f5..98c69b1a0b6 100644 --- a/hotspot/test/compiler/jsr292/InvokerGC.java +++ b/hotspot/test/compiler/jsr292/InvokerGC.java @@ -24,6 +24,7 @@ /* * @test * @bug 8067247 + * @modules java.base/jdk.internal.misc * @library /test/lib /compiler/whitebox / * @run main/bootclasspath/othervm -Xcomp -Xbatch * -XX:CompileCommand=compileonly,InvokerGC::test diff --git a/hotspot/test/compiler/jsr292/MHInlineTest.java b/hotspot/test/compiler/jsr292/MHInlineTest.java index 552b12209cf..915c8f1362d 100644 --- a/hotspot/test/compiler/jsr292/MHInlineTest.java +++ b/hotspot/test/compiler/jsr292/MHInlineTest.java @@ -25,6 +25,7 @@ * @test * @bug 8062280 * @summary C2: inlining failure due to access checks being too strict + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm MHInlineTest */ diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java index 8cf3c14ff69..3a93fe7d96e 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/GCTest.java @@ -25,14 +25,15 @@ * @test * @bug 8072008 * @library /testlibrary /test/lib ../patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build java.base/java.lang.invoke.MethodHandleHelper * @build sun.hotspot.WhiteBox * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 - * -XX:+FoldStableValues - * compiler.jsr292.NonInlinedCall.GCTest + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 + * -XX:+FoldStableValues + * compiler.jsr292.NonInlinedCall.GCTest */ package compiler.jsr292.NonInlinedCall; diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java index fbd57cd4b96..d413d382eef 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/InvokeTest.java @@ -25,14 +25,15 @@ * @test * @bug 8072008 * @library /testlibrary /test/lib / ../patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build java.base/java.lang.invoke.MethodHandleHelper * @build sun.hotspot.WhiteBox * @build compiler.jsr292.NonInlinedCall.InvokeTest * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 - * compiler.jsr292.NonInlinedCall.InvokeTest + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 + * compiler.jsr292.NonInlinedCall.InvokeTest */ package compiler.jsr292.NonInlinedCall; diff --git a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java index 27bc5c9a238..1a77363f833 100644 --- a/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java +++ b/hotspot/test/compiler/jsr292/NonInlinedCall/RedefineTest.java @@ -36,10 +36,10 @@ * sun.hotspot.WhiteBox$WhiteBoxPermission * compiler.jsr292.NonInlinedCall.RedefineTest * @run main/bootclasspath/othervm -javaagent:agent.jar - * -XX:+IgnoreUnrecognizedVMOptions - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 - * compiler.jsr292.NonInlinedCall.RedefineTest + * -XX:+IgnoreUnrecognizedVMOptions + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -Xbatch -XX:-TieredCompilation -XX:CICompilerCount=1 + * compiler.jsr292.NonInlinedCall.RedefineTest */ package compiler.jsr292.NonInlinedCall; diff --git a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java index 7aecdae9f5e..b368b2f7c77 100644 --- a/hotspot/test/compiler/jsr292/PollutedTrapCounts.java +++ b/hotspot/test/compiler/jsr292/PollutedTrapCounts.java @@ -24,6 +24,7 @@ /** * @test * @bug 8074551 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main PollutedTrapCounts */ diff --git a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java index 953deafe871..abb9b5dc591 100644 --- a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java +++ b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java @@ -32,7 +32,7 @@ import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.MethodVisitor; import jdk.internal.org.objectweb.asm.Opcodes; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.invoke.ConstantCallSite; import java.lang.invoke.MethodHandle; diff --git a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java index 0504798c50a..13849452847 100644 --- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java +++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java @@ -27,6 +27,7 @@ * @bug 8136421 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary / + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.runtime * @run main/othervm -XX:+UnlockExperimentalVMOptions * -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=true diff --git a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java index 993cbba8a18..48c406a4adc 100644 --- a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java +++ b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @run main/othervm -XX:+UnlockExperimentalVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java index 3902acf2388..148402ee786 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java index b24d25ca005..4500a83ac56 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java index 81b7bd47d7b..dc905f3a2ae 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib/ * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.CollectCountersTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java index fe251871e07..ffe0a899cba 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.DebugOutputTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java index bd39a56e2e5..d8eedaad0c2 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java index 747a9cf6123..db741621e2a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java index fb89c4e5428..399ff0cca73 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java @@ -25,6 +25,7 @@ import java.util.Map; * @library /testlibrary /test/lib / * @library ../common/patches * @ignore 8139383 + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java index 0cca017515d..cc5ff3d9e2d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java index 472bc379cb5..7bfd132a5e9 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java index 1b0eacdf3c6..3f2c80f1642 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.GetClassInitializerTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java index 3e14a684644..28463d71e75 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper @@ -51,7 +52,7 @@ import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Tests for jdk.vm.ci.hotspot.CompilerToVM::getConstantPool method diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java index 63f44334e4e..536972d755a 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java index 1b03ef2e79e..894791f1006 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib/ * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.GetImplementorTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java index 99fcd9fae21..c1bfbba85ff 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java @@ -29,6 +29,7 @@ * @library /testlibrary /test/lib / * @library ../common/patches * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java index 958b2e48fe4..d6f6725f723 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java index c180d41d548..93653fd57a0 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib/ * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.GetMaxCallTargetOffsetTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java index 44fbb4cdaef..afca9ec85fb 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java index 87afff2df3b..d23aad95fb6 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java index 4735af3ee3e..6e0fea30328 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject @@ -48,7 +49,7 @@ import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java index 0ddc246aec3..1dde0850aad 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper @@ -59,7 +60,7 @@ import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class GetResolvedJavaTypeTest { private static enum TestCase { diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java index a6feb931eb0..970e8cbfb58 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java index 9e1f82998ca..7e10c95e0b8 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java index 49fd32128df..66a0bd94f7d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java index e45940e3e6a..9cb947eb7e1 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java index 066e78448de..d972a22dc36 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.HasFinalizableSubclassTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java index 3de8ec56166..9087b52baf1 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.InitializeConfigurationTest @@ -46,7 +47,7 @@ import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class InitializeConfigurationTest { private static final Unsafe UNSAFE = Utils.getUnsafe(); diff --git a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java index b7a0cfd0c19..369be8612d1 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java index f6ebb8303a6..fe2f0259844 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.IsMatureTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java index ac42d62f543..56a43432040 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java @@ -27,6 +27,7 @@ * @bug 8136421 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary / + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.runtime * @run main/othervm -XX:+UnlockExperimentalVMOptions diff --git a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java index 269c5a7d39c..712d5d8b2cf 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.LookupTypeTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java index e28174905a2..43a7631617b 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java index 812c2586165..d78672acfaf 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.reflect * java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java index 4ec17c2e71a..14e53044357 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReadUncompressedOopTest.java @@ -24,9 +24,11 @@ /* * @test * @bug 8136421 + * @ignore 8155216 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib/ * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.ReadUncompressedOopTest @@ -52,7 +54,7 @@ import jdk.vm.ci.hotspot.CompilerToVMHelper; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; import sun.hotspot.WhiteBox; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.Field; diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java index 1e8cb12dd89..371af37813d 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java index 3c004ce0c09..8151340f9f8 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java @@ -60,7 +60,7 @@ import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.vm.ci.meta.ConstantPool; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolveFieldInPool} method diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java index ff08b7e53bf..98b56f8cc3c 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot @@ -56,7 +57,7 @@ import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; import jdk.test.lib.Asserts; import jdk.test.lib.Utils; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class ResolveMethodTest { private static final Unsafe UNSAFE = Utils.getUnsafe(); @@ -137,8 +138,14 @@ public class ResolveMethodTest { HotSpotResolvedObjectType callerMetaspace = CompilerToVMHelper .lookupType(Utils.toJVMTypeSignature(tcase.caller), getClass(), /* resolve = */ true); + HotSpotResolvedObjectType receiverMetaspace = CompilerToVMHelper + .lookupType(Utils.toJVMTypeSignature(tcase.receiver), + getClass(), /* resolve = */ true); + + // Can only resolve methods on a linked class so force initialization + receiverMetaspace.initialize(); HotSpotResolvedJavaMethod resolvedMetaspaceMethod - = CompilerToVMHelper.resolveMethod(holderMetaspace, + = CompilerToVMHelper.resolveMethod(receiverMetaspace, metaspaceMethod, callerMetaspace); if (tcase.isPositive) { Asserts.assertNotNull(resolvedMetaspaceMethod, diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java index 69ceeffdf7d..a6dd4cfe8a3 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary /test/lib/ * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper * @build compiler.jvmci.compilerToVM.ShouldDebugNonSafepointsTest diff --git a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java index 615b5859df6..bef796ab825 100644 --- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java +++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java @@ -28,6 +28,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/events/JvmciCreateMetaAccessContextTest.java b/hotspot/test/compiler/jvmci/events/JvmciCreateMetaAccessContextTest.java index c8bfbff88d1..c86938943c5 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciCreateMetaAccessContextTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciCreateMetaAccessContextTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta diff --git a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java index 1110b1eac31..e045775c7ee 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java @@ -27,6 +27,7 @@ * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library / /testlibrary * @library ../common/patches + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.org.objectweb.asm.tree * jdk.vm.ci/jdk.vm.ci.hotspot diff --git a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java index 7dbbf8e35fa..2c2493221ad 100644 --- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java +++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java @@ -26,6 +26,7 @@ * @bug 8136421 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary / + * @modules java.base/jdk.internal.misc * @modules jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.code * jdk.vm.ci/jdk.vm.ci.meta diff --git a/hotspot/test/compiler/jvmci/code/CodeInstallationTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java similarity index 96% rename from hotspot/test/compiler/jvmci/code/CodeInstallationTest.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java index 550665cf342..67a66660ca1 100644 --- a/hotspot/test/compiler/jvmci/code/CodeInstallationTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/CodeInstallationTest.java @@ -20,15 +20,19 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package compiler.jvmci.code; +package jdk.vm.ci.code.test; import java.lang.reflect.Method; +import org.junit.Assert; + import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.code.Architecture; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.InstalledCode; import jdk.vm.ci.code.TargetDescription; +import jdk.vm.ci.code.test.amd64.AMD64TestAssembler; +import jdk.vm.ci.code.test.sparc.SPARCTestAssembler; import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; import jdk.vm.ci.meta.ConstantReflectionProvider; @@ -37,11 +41,6 @@ import jdk.vm.ci.runtime.JVMCI; import jdk.vm.ci.runtime.JVMCIBackend; import jdk.vm.ci.sparc.SPARC; -import org.junit.Assert; - -import compiler.jvmci.code.amd64.AMD64TestAssembler; -import compiler.jvmci.code.sparc.SPARCTestAssembler; - /** * Base class for code installation tests. */ diff --git a/hotspot/test/compiler/jvmci/code/DataPatchTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java similarity index 97% rename from hotspot/test/compiler/jvmci/code/DataPatchTest.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java index 294d21e571d..3b7c421b2c5 100644 --- a/hotspot/test/compiler/jvmci/code/DataPatchTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java @@ -32,10 +32,11 @@ * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.sparc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.DataPatchTest + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.DataPatchTest */ -package compiler.jvmci.code; +package jdk.vm.ci.code.test; import jdk.vm.ci.code.Register; import jdk.vm.ci.code.site.DataSectionReference; @@ -158,7 +159,6 @@ public class DataPatchTest extends CodeInstallationTest { }); } - public static long getConstSymbol(HotSpotMetaAccessProvider meta) { HotSpotSymbol symbol = meta.lookupSymbol("java/lang/Object"); return symbol.getMetaspacePointer(); diff --git a/hotspot/test/compiler/jvmci/code/DebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java similarity index 95% rename from hotspot/test/compiler/jvmci/code/DebugInfoTest.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java index 3b3c33a1c02..c1bdc039196 100644 --- a/hotspot/test/compiler/jvmci/code/DebugInfoTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DebugInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package compiler.jvmci.code; +package jdk.vm.ci.code.test; import java.lang.reflect.Method; diff --git a/hotspot/test/compiler/jvmci/code/InterpreterFrameSizeTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java similarity index 92% rename from hotspot/test/compiler/jvmci/code/InterpreterFrameSizeTest.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java index 59c3e228c7a..098871da3b1 100644 --- a/hotspot/test/compiler/jvmci/code/InterpreterFrameSizeTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java @@ -33,23 +33,20 @@ * jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.sparc * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.InterpreterFrameSizeTest + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.InterpreterFrameSizeTest */ -package compiler.jvmci.code; - -import java.lang.reflect.Method; - -import jdk.vm.ci.code.BytecodeFrame; -import jdk.vm.ci.meta.JavaKind; -import jdk.vm.ci.meta.JavaValue; -import jdk.vm.ci.meta.ResolvedJavaMethod; - -import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; +package jdk.vm.ci.code.test; import org.junit.Assert; import org.junit.Test; +import jdk.vm.ci.code.BytecodeFrame; +import jdk.vm.ci.hotspot.HotSpotCodeCacheProvider; +import jdk.vm.ci.meta.JavaKind; +import jdk.vm.ci.meta.JavaValue; +import jdk.vm.ci.meta.ResolvedJavaMethod; + public class InterpreterFrameSizeTest extends CodeInstallationTest { HotSpotCodeCacheProvider hotspotCodeCache() { @@ -61,7 +58,7 @@ public class InterpreterFrameSizeTest extends CodeInstallationTest { try { hotspotCodeCache().interpreterFrameSize(null); } catch (NullPointerException npe) { - System.out.println("threw NPE as expected"); + // Threw NPE as expected. return; } Assert.fail("expected NullPointerException"); @@ -78,7 +75,6 @@ public class InterpreterFrameSizeTest extends CodeInstallationTest { JavaKind[] slotKinds = new JavaKind[numLocals]; BytecodeFrame frame = new BytecodeFrame(null, resolvedMethod, bci, false, false, values, slotKinds, numLocals, numStack, 0); int size = hotspotCodeCache().interpreterFrameSize(frame); - System.out.println("Frame size is " + size + " bytes"); if (size <= 0) { Assert.fail("expected non-zero result"); } diff --git a/hotspot/test/compiler/jvmci/code/SimpleCodeInstallationTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java similarity index 87% rename from hotspot/test/compiler/jvmci/code/SimpleCodeInstallationTest.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java index 6c1377c8935..0b8ca5c19f7 100644 --- a/hotspot/test/compiler/jvmci/code/SimpleCodeInstallationTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -32,15 +32,16 @@ * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.sparc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.SimpleCodeInstallationTest + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleCodeInstallationTest */ -package compiler.jvmci.code; - -import jdk.vm.ci.code.Register; +package jdk.vm.ci.code.test; import org.junit.Test; +import jdk.vm.ci.code.Register; + /** * Test simple code installation. */ diff --git a/hotspot/test/compiler/jvmci/code/SimpleDebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java similarity index 96% rename from hotspot/test/compiler/jvmci/code/SimpleDebugInfoTest.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java index b27802ce47a..5b00cb75a3c 100644 --- a/hotspot/test/compiler/jvmci/code/SimpleDebugInfoTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -32,10 +32,14 @@ * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.sparc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.SimpleDebugInfoTest + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.SimpleDebugInfoTest */ -package compiler.jvmci.code; +package jdk.vm.ci.code.test; + +import org.junit.Assume; +import org.junit.Test; import jdk.vm.ci.code.Register; import jdk.vm.ci.hotspot.HotSpotConstant; @@ -45,9 +49,6 @@ import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.Value; -import org.junit.Assume; -import org.junit.Test; - public class SimpleDebugInfoTest extends DebugInfoTest { public static int intOnStack() { @@ -99,7 +100,6 @@ public class SimpleDebugInfoTest extends DebugInfoTest { testIntInLocal(compiler); } - public static float floatOnStack() { return 42.0f; } @@ -149,7 +149,6 @@ public class SimpleDebugInfoTest extends DebugInfoTest { testFloatInLocal(compiler); } - public static long longOnStack() { return 42; } @@ -202,7 +201,6 @@ public class SimpleDebugInfoTest extends DebugInfoTest { testLongInLocal(compiler); } - public static Class objectOnStack() { return SimpleDebugInfoTest.class; } diff --git a/hotspot/test/compiler/jvmci/code/TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java similarity index 99% rename from hotspot/test/compiler/jvmci/code/TestAssembler.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java index 5034027a762..9e10e46ae80 100644 --- a/hotspot/test/compiler/jvmci/code/TestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/TestAssembler.java @@ -21,7 +21,7 @@ * questions. */ -package compiler.jvmci.code; +package jdk.vm.ci.code.test; import java.nio.ByteBuffer; import java.nio.ByteOrder; diff --git a/hotspot/test/compiler/jvmci/code/VirtualObjectDebugInfoTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java similarity index 89% rename from hotspot/test/compiler/jvmci/code/VirtualObjectDebugInfoTest.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java index c06c5076eae..04dd67ccf0d 100644 --- a/hotspot/test/compiler/jvmci/code/VirtualObjectDebugInfoTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -32,14 +32,18 @@ * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.amd64 * jdk.vm.ci/jdk.vm.ci.sparc - * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI compiler.jvmci.code.VirtualObjectDebugInfoTest + * @compile CodeInstallationTest.java DebugInfoTest.java TestAssembler.java amd64/AMD64TestAssembler.java sparc/SPARCTestAssembler.java + * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.code.test.VirtualObjectDebugInfoTest */ -package compiler.jvmci.code; +package jdk.vm.ci.code.test; import java.util.ArrayList; import java.util.Objects; +import org.junit.Assert; +import org.junit.Test; + import jdk.vm.ci.code.Register; import jdk.vm.ci.code.VirtualObject; import jdk.vm.ci.hotspot.HotSpotConstant; @@ -49,9 +53,6 @@ import jdk.vm.ci.meta.JavaValue; import jdk.vm.ci.meta.ResolvedJavaField; import jdk.vm.ci.meta.ResolvedJavaType; -import org.junit.Assert; -import org.junit.Test; - public class VirtualObjectDebugInfoTest extends DebugInfoTest { private static class TestClass { @@ -61,11 +62,11 @@ public class VirtualObjectDebugInfoTest extends DebugInfoTest { private float floatField; private Object[] arrayField; - public TestClass() { + TestClass() { this.longField = 8472; this.intField = 42; this.floatField = 3.14f; - this.arrayField = new Object[] { Integer.valueOf(58), this, null, Integer.valueOf(17), "Hello, World!" }; + this.arrayField = new Object[]{Integer.valueOf(58), this, null, Integer.valueOf(17), "Hello, World!"}; } @Override @@ -75,10 +76,7 @@ public class VirtualObjectDebugInfoTest extends DebugInfoTest { } TestClass other = (TestClass) o; - if (this.longField != other.longField - || this.intField != other.intField - || this.floatField != other.floatField - || this.arrayField.length != other.arrayField.length) { + if (this.longField != other.longField || this.intField != other.intField || this.floatField != other.floatField || this.arrayField.length != other.arrayField.length) { return false; } @@ -95,6 +93,11 @@ public class VirtualObjectDebugInfoTest extends DebugInfoTest { return true; } + + @Override + public int hashCode() { + return super.hashCode(); + } } public static TestClass buildObject() { diff --git a/hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java similarity index 96% rename from hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java index 4ed0625932b..7d249d67b37 100644 --- a/hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/amd64/AMD64TestAssembler.java @@ -21,7 +21,7 @@ * questions. */ -package compiler.jvmci.code.amd64; +package jdk.vm.ci.code.test.amd64; import jdk.vm.ci.amd64.AMD64; import jdk.vm.ci.amd64.AMD64Kind; @@ -31,6 +31,7 @@ import jdk.vm.ci.code.Register; import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.DataSectionReference; +import jdk.vm.ci.code.test.TestAssembler; import jdk.vm.ci.hotspot.HotSpotCallingConventionType; import jdk.vm.ci.hotspot.HotSpotConstant; import jdk.vm.ci.hotspot.HotSpotForeignCallTarget; @@ -39,8 +40,6 @@ import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.LIRKind; import jdk.vm.ci.meta.VMConstant; -import compiler.jvmci.code.TestAssembler; - public class AMD64TestAssembler extends TestAssembler { public AMD64TestAssembler(CodeCacheProvider codeCache) { @@ -161,7 +160,7 @@ public class AMD64TestAssembler extends TestAssembler { code.emitInt(0xDEADDEAD); return ret; } else { - return emitLoadLong(0xDEADDEADDEADDEADl); + return emitLoadLong(0xDEADDEADDEADDEADL); } } @@ -195,14 +194,16 @@ public class AMD64TestAssembler extends TestAssembler { @Override public StackSlot emitIntToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.value(AMD64Kind.DWORD)); - emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m32,r32 + // MOV r/m32,r32 + emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); return ret; } @Override public StackSlot emitLongToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.value(AMD64Kind.QWORD)); - emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m64,r64 + // MOV r/m64,r64 + emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); return ret; } @@ -221,14 +222,16 @@ public class AMD64TestAssembler extends TestAssembler { @Override public StackSlot emitPointerToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.reference(AMD64Kind.QWORD)); - emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m64,r64 + // MOV r/m64,r64 + emitModRMMemory(true, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); return ret; } @Override public StackSlot emitNarrowPointerToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.reference(AMD64Kind.DWORD)); - emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); // MOV r/m32,r32 + // MOV r/m32,r32 + emitModRMMemory(false, 0x89, a.encoding, AMD64.rbp.encoding, ret.getRawOffset() + 16); return ret; } diff --git a/hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java similarity index 96% rename from hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java rename to hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java index 5b2cd7f1453..7c7aa7bab92 100644 --- a/hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/sparc/SPARCTestAssembler.java @@ -21,7 +21,7 @@ * questions. */ -package compiler.jvmci.code.sparc; +package jdk.vm.ci.code.test.sparc; import jdk.vm.ci.code.CodeCacheProvider; import jdk.vm.ci.code.DebugInfo; @@ -29,6 +29,7 @@ import jdk.vm.ci.code.Register; import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.site.ConstantReference; import jdk.vm.ci.code.site.DataSectionReference; +import jdk.vm.ci.code.test.TestAssembler; import jdk.vm.ci.hotspot.HotSpotCallingConventionType; import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotConstant; @@ -41,8 +42,6 @@ import jdk.vm.ci.meta.VMConstant; import jdk.vm.ci.sparc.SPARC; import jdk.vm.ci.sparc.SPARCKind; -import compiler.jvmci.code.TestAssembler; - public class SPARCTestAssembler extends TestAssembler { private static final int MASK13 = (1 << 13) - 1; @@ -69,7 +68,8 @@ public class SPARCTestAssembler extends TestAssembler { @Override public void emitPrologue() { - emitOp3(0b10, SPARC.sp, 0b111100, SPARC.sp, -SPARC.REGISTER_SAFE_AREA_SIZE); // SAVE sp, -128, sp + // SAVE sp, -128, sp + emitOp3(0b10, SPARC.sp, 0b111100, SPARC.sp, -SPARC.REGISTER_SAFE_AREA_SIZE); setDeoptRescueSlot(newStackSlot(LIRKind.value(SPARCKind.XWORD))); } @@ -195,35 +195,40 @@ public class SPARCTestAssembler extends TestAssembler { @Override public StackSlot emitIntToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.WORD)); - emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STW a, [fp+offset] + // STW a, [fp+offset] + emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); return ret; } @Override public StackSlot emitLongToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.XWORD)); - emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STX a, [fp+offset] + // STX a, [fp+offset] + emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); return ret; } @Override public StackSlot emitFloatToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.value(SPARCKind.SINGLE)); - emitOp3(0b11, a, 0b100100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STF a, [fp+offset] + // STF a, [fp+offset] + emitOp3(0b11, a, 0b100100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); return ret; } @Override public StackSlot emitPointerToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.reference(SPARCKind.XWORD)); - emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STX a, [fp+offset] + // STX a, [fp+offset] + emitOp3(0b11, a, 0b001110, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); return ret; } @Override public StackSlot emitNarrowPointerToStack(Register a) { StackSlot ret = newStackSlot(LIRKind.reference(SPARCKind.WORD)); - emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); // STW a, [fp+offset] + // STW a, [fp+offset] + emitOp3(0b11, a, 0b000100, SPARC.fp, ret.getRawOffset() + SPARC.STACK_BIAS); return ret; } diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java index 761db0e7a06..dfa217abf84 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.ConstantTest * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ConstantTest */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java index 038efdcb2d2..604d671513b 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.RedefineClassTest * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.RedefineClassTest */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java index 6f1f1759e8e..b253a38f30b 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java @@ -105,7 +105,7 @@ public class ResolvedJavaTypeResolveConcreteMethodTest { ResolvedJavaMethod di = getMethod(i, "d"); ResolvedJavaMethod dc = getMethod(c, "d"); - assertEquals(di, i.resolveConcreteMethod(di, c)); + assertEquals(null, i.resolveConcreteMethod(di, c)); assertEquals(di, b.resolveConcreteMethod(di, c)); assertEquals(dc, c.resolveConcreteMethod(di, c)); } diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java index ba62291d47c..0d8121b3ee7 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java @@ -105,7 +105,7 @@ public class ResolvedJavaTypeResolveMethodTest { ResolvedJavaMethod di = getMethod(i, "d"); ResolvedJavaMethod dc = getMethod(c, "d"); - assertEquals(di, i.resolveMethod(di, c)); + assertEquals(null, i.resolveMethod(di, c)); assertEquals(di, b.resolveMethod(di, c)); assertEquals(dc, c.resolveMethod(di, c)); } diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java index fe31f5907be..824a1532c62 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestConstantReflectionProvider * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestConstantReflectionProvider */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java index 46f4e80ac89..4537b386de5 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestJavaField * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaField */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java index 460abd992af..faa96b898a6 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestJavaMethod * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaMethod */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java index 72506cf0933..23959e2059f 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestJavaType * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestJavaType */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java index 10b2e70c334..904aada9059 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestMetaAccessProvider * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestMetaAccessProvider */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java index 71e9f188c43..defa1997026 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestResolvedJavaField * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaField */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java index c60a7d45e42..d96560ce11f 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java @@ -27,6 +27,7 @@ * @library ../../../../../ * @modules jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestResolvedJavaMethod * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaMethod */ diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java index 9c904502ef9..48946aa9904 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java @@ -29,6 +29,7 @@ * jdk.vm.ci/jdk.vm.ci.meta * jdk.vm.ci/jdk.vm.ci.runtime * jdk.vm.ci/jdk.vm.ci.common + * java.base/jdk.internal.misc * @build jdk.vm.ci.runtime.test.TestResolvedJavaType * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.TestResolvedJavaType */ @@ -584,29 +585,20 @@ public class TestResolvedJavaType extends TypeUniverse { return declarations; } - private static void checkResolveMethod(ResolvedJavaType type, ResolvedJavaType context, ResolvedJavaMethod decl, ResolvedJavaMethod expected) { - ResolvedJavaMethod impl = type.resolveConcreteMethod(decl, context); - assertEquals(expected, impl); - } - @Test public void resolveMethodTest() { ResolvedJavaType context = metaAccess.lookupJavaType(TestResolvedJavaType.class); for (Class c : classes) { - if (c.isInterface() || c.isPrimitive()) { - ResolvedJavaType type = metaAccess.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); + if (c.isInterface()) { for (Method m : c.getDeclaredMethods()) { - if (JAVA_VERSION <= 1.7D || (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers()))) { - ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m); - ResolvedJavaMethod impl = type.resolveMethod(resolved, context); - ResolvedJavaMethod expected = resolved.isDefault() || resolved.isAbstract() ? resolved : null; - assertEquals(m.toString(), expected, impl); - } else { - // As of JDK 8, interfaces can have static and private methods - } + ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m); + ResolvedJavaMethod impl = type.resolveMethod(resolved, context); + assertEquals(m.toString(), null, impl); } + } else if (c.isPrimitive()) { + assertEquals("No methods expected", c.getDeclaredMethods().length, 0); } else { - ResolvedJavaType type = metaAccess.lookupJavaType(c); VTable vtable = getVTable(c); for (Method impl : vtable.methods.values()) { Set decls = findDeclarations(impl, c); @@ -614,7 +606,7 @@ public class TestResolvedJavaType extends TypeUniverse { ResolvedJavaMethod m = metaAccess.lookupJavaMethod(decl); if (m.isPublic()) { ResolvedJavaMethod i = metaAccess.lookupJavaMethod(impl); - checkResolveMethod(type, context, m, i); + assertEquals(m.toString(), i, type.resolveMethod(m, context)); } } } @@ -626,20 +618,16 @@ public class TestResolvedJavaType extends TypeUniverse { public void resolveConcreteMethodTest() { ResolvedJavaType context = metaAccess.lookupJavaType(TestResolvedJavaType.class); for (Class c : classes) { - if (c.isInterface() || c.isPrimitive()) { - ResolvedJavaType type = metaAccess.lookupJavaType(c); + ResolvedJavaType type = metaAccess.lookupJavaType(c); + if (c.isInterface()) { for (Method m : c.getDeclaredMethods()) { - if (JAVA_VERSION <= 1.7D || (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers()))) { - ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m); - ResolvedJavaMethod impl = type.resolveConcreteMethod(resolved, context); - ResolvedJavaMethod expected = resolved.isDefault() ? resolved : null; - assertEquals(m.toString(), expected, impl); - } else { - // As of JDK 8, interfaces can have static and private methods - } + ResolvedJavaMethod resolved = metaAccess.lookupJavaMethod(m); + ResolvedJavaMethod impl = type.resolveConcreteMethod(resolved, context); + assertEquals(m.toString(), null, impl); } + } else if (c.isPrimitive()) { + assertEquals("No methods expected", c.getDeclaredMethods().length, 0); } else { - ResolvedJavaType type = metaAccess.lookupJavaType(c); VTable vtable = getVTable(c); for (Method impl : vtable.methods.values()) { Set decls = findDeclarations(impl, c); @@ -647,7 +635,7 @@ public class TestResolvedJavaType extends TypeUniverse { ResolvedJavaMethod m = metaAccess.lookupJavaMethod(decl); if (m.isPublic()) { ResolvedJavaMethod i = metaAccess.lookupJavaMethod(impl); - checkResolveMethod(type, context, m, i); + assertEquals(i, type.resolveConcreteMethod(m, context)); } } } @@ -880,6 +868,31 @@ public class TestResolvedJavaType extends TypeUniverse { } } + static class TrivialCloneable implements Cloneable { + @Override + protected Object clone() { + return new TrivialCloneable(); + } + } + + @Test + public void isCloneableWithAllocationTest() { + ResolvedJavaType cloneable = metaAccess.lookupJavaType(Cloneable.class); + for (Class c : classes) { + ResolvedJavaType type = metaAccess.lookupJavaType(c); + if (type.isCloneableWithAllocation()) { + // Only Cloneable types should be allocation cloneable + assertTrue(c.toString(), cloneable.isAssignableFrom(type)); + } + } + /* + * We can't know for sure which types should be allocation cloneable on a particular + * platform but assume that at least totally trivial objects should be. + */ + ResolvedJavaType trivialCloneable = metaAccess.lookupJavaType(TrivialCloneable.class); + assertTrue(trivialCloneable.toString(), trivialCloneable.isCloneableWithAllocation()); + } + @Test public void findMethodTest() { try { diff --git a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java index c66068988da..59969f846e3 100644 --- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java +++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java @@ -57,7 +57,7 @@ import jdk.vm.ci.runtime.JVMCI; import org.junit.Test; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; //JaCoCo Exclude diff --git a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java index 82a3b989286..5c2bd0d9e2b 100644 --- a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java +++ b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java @@ -26,6 +26,7 @@ * @bug 8151664 * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64") * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * jdk.vm.ci/jdk.vm.ci.hotspot * jdk.vm.ci/jdk.vm.ci.meta diff --git a/hotspot/test/compiler/linkage/CallSites.jasm b/hotspot/test/compiler/linkage/CallSites.jasm new file mode 100644 index 00000000000..813a9df40c7 --- /dev/null +++ b/hotspot/test/compiler/linkage/CallSites.jasm @@ -0,0 +1,91 @@ +/* + * 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. + * + */ +super class I +version 52:0 +{ + +} + + +super class CallSites +version 52:0 +{ + + // Non-existent methods. + + // I.m1()V vs I.m1(I)V + public static Method testI1:"(LI;)V" + stack 1 locals 1 + { + aload_0; + invokeinterface InterfaceMethod I."m1":"()V", 1; // throws NSME + return; + } + + // X.m1()V vs X.m1(I)V + public static Method testX1:"(LX;)V" + stack 1 locals 1 + { + aload_0; + invokevirtual Method X."m1":"()V"; // throws NSME + return; + } + + // invokestatic of instance methods. + + public static Method testI2:"()V" + stack 1 locals 0 + { + iconst_0; + invokestatic InterfaceMethod I."m1":"(I)V"; // throws ICCE + return; + } + + public static Method testX2:"()V" + stack 1 locals 0 + { + iconst_0; + invokestatic Method X."m1":"(I)V"; // throws ICCE + return; + } + + // Virtual invocation of static methods. + + public static Method testI3:"(LI;)V" + stack 1 locals 1 + { + aload_0; + invokeinterface InterfaceMethod I."s1":"()V", 1; // throws ICCE + return; + } + + public static Method testX3:"(LX;)V" + stack 1 locals 1 + { + aload_0; + invokevirtual Method X."s1":"()V"; // throws ICCE + return; + } + +} // end Class CallSites diff --git a/hotspot/test/compiler/linkage/LinkageErrors.java b/hotspot/test/compiler/linkage/LinkageErrors.java new file mode 100644 index 00000000000..0a1b2a8b954 --- /dev/null +++ b/hotspot/test/compiler/linkage/LinkageErrors.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ +/* + * @test + * @bug 8132879 + * @compile CallSites.jasm + * @run main/othervm -Xverify:all -Xbatch -XX:CompileCommand=dontinline,Test::test* LinkageErrors + */ + +import java.lang.invoke.*; + +interface I { + void m1(int i); + static void s1() {} +} + +class A implements I { + public void m1(int i) {} +} + +class X { + public void m1(int i) {} + public final void f1(int i) {} + public static void s1(int i) {} +} + +public class LinkageErrors { + final static MethodHandles.Lookup L = MethodHandles.lookup(); + + static void test(MethodHandle mh) { + try { + mh.invokeExact(); + throw new AssertionError("No exception thrown"); + } catch (LinkageError e) { + return; // expected + } catch (AssertionError e) { + throw e; // rethrow + } catch (Throwable e) { + throw new AssertionError("Unexpected exception", e); + } + } + + public static void main(String args[]) throws Throwable { + Class test = Class.forName("CallSites"); + + // Non-existent method lookups. + MethodHandle testI1 = L.findStatic(test, "testI1", MethodType.methodType(void.class, I.class)); + MethodHandle testX1 = L.findStatic(test, "testX1", MethodType.methodType(void.class, X.class)); + + MethodHandle testI1_A = testI1.bindTo(new A()); + MethodHandle testI1_null = testI1.bindTo(null); + MethodHandle testX1_X = testX1.bindTo(new X()); + MethodHandle testX1_null = testX1.bindTo(null); + + // invokestatic of instance methods. + MethodHandle testI2 = L.findStatic(test, "testI2", MethodType.methodType(void.class)); + MethodHandle testX2 = L.findStatic(test, "testX2", MethodType.methodType(void.class)); + + MethodHandle testI3 = L.findStatic(test, "testI3", MethodType.methodType(void.class, I.class)); + MethodHandle testX3 = L.findStatic(test, "testX3", MethodType.methodType(void.class, X.class)); + + // Virtual invocation of static methods. + MethodHandle testI3_A = testI3.bindTo(new A()); + MethodHandle testI3_null = testI3.bindTo(null); + MethodHandle testX3_X = testX3.bindTo(new X()); + MethodHandle testX3_null = testX3.bindTo(null); + + for (int i = 0; i < 20_000; i++) { + test(testI1_A); + test(testI1_null); + test(testX1_X); + test(testX1_null); + + test(testI2); + test(testX2); + + test(testI3_A); + test(testI3_null); + test(testX3_X); + test(testX3_null); + } + + System.out.println("TEST PASSED"); + } +} diff --git a/jdk/src/jdk.jcmd/share/classes/jdk/internal/vm/agent/spi/ToolProvider.java b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java similarity index 63% rename from jdk/src/jdk.jcmd/share/classes/jdk/internal/vm/agent/spi/ToolProvider.java rename to hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java index 55be308348a..63745f7f348 100644 --- a/jdk/src/jdk.jcmd/share/classes/jdk/internal/vm/agent/spi/ToolProvider.java +++ b/hotspot/test/compiler/loopopts/TestSplitIfBlocksDisabled.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -21,22 +19,19 @@ * 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.internal.vm.agent.spi; - /** - * Service interface for jdk.hotspot.agent to provide the tools that - * jstack, jmap, jinfo will invoke, if present. + * @test TestSplitIfBlocksDisabled + * @bug 8086057 + * @summary Verifies that loop optimizations work if SplitIfBlocks is disabled. + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-SplitIfBlocks TestSplitIfBlocksDisabled */ -public interface ToolProvider { - /** - * Returns the name of the tool provider - */ - String getName(); +public class TestSplitIfBlocksDisabled { - /** - * Invoke the tool provider with the given arguments - */ - void run(String... arguments); + public static void main(String[] args) { + System.out.println("Passed"); + } } + diff --git a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java index 689b7f40be7..67cd3c91b06 100644 --- a/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java +++ b/hotspot/test/compiler/loopopts/UseCountedLoopSafepoints.java @@ -27,6 +27,7 @@ * @bug 6869327 * @summary Test that C2 flag UseCountedLoopSafepoints ensures a safepoint is kept in a CountedLoop * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.base * @ignore 8146096 * @run main UseCountedLoopSafepoints diff --git a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java index 60c47e32384..41e7769b815 100644 --- a/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java +++ b/hotspot/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java @@ -23,12 +23,13 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * @test * @bug 8078497 * @summary Tests correct alignment of vectors with loop invariant offset. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main TestVectorizationWithInvariant */ diff --git a/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java new file mode 100644 index 00000000000..6a3fa0d449b --- /dev/null +++ b/hotspot/test/compiler/onSpinWait/TestOnSpinWait.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright 2016 Azul Systems, Inc. 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 TestOnSpinWait + * @summary (x86 only) checks that java.lang.Thread.onSpinWait is intrinsified + * @bug 8147844 + * @modules java.base/jdk.internal.misc + * @library /testlibrary + * @requires os.arch=="x86" | os.arch=="amd64" | os.arch=="x86_64" + * @run main TestOnSpinWait + */ + +import java.lang.invoke.*; +import jdk.test.lib.*; +import static jdk.test.lib.Asserts.*; + +public class TestOnSpinWait { + + public static void main(String[] args) throws Exception { + + // Test C1 compiler + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", + "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch", + "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", + "-XX:+PrintInlining", "TestOnSpinWait$Launcher"); + + OutputAnalyzer analyzer = new OutputAnalyzer(pb.start()); + + analyzer.shouldHaveExitValue(0); + + // The test is applicable only to C1 (present in Server VM). + analyzer.shouldContain("java.lang.Thread::onSpinWait (1 bytes) intrinsic"); + + // Test C2 compiler + pb = ProcessTools.createJavaProcessBuilder( + "-XX:+IgnoreUnrecognizedVMOptions", "-showversion", + "-XX:-TieredCompilation", "-Xbatch", + "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", + "-XX:+PrintInlining", "TestOnSpinWait$Launcher"); + + analyzer = new OutputAnalyzer(pb.start()); + + analyzer.shouldHaveExitValue(0); + + // The test is applicable only to C2 (present in Server VM). + if (analyzer.getStderr().contains("Server VM")) { + analyzer.shouldContain("java.lang.Thread::onSpinWait (1 bytes) (intrinsic)"); + } + } + + static class Launcher { + + public static void main(final String[] args) throws Exception { + int end = 20_000; + + for (int i=0; i < end; i++) { + test(); + } + } + static void test() { + java.lang.Thread.onSpinWait(); + } + } +} diff --git a/hotspot/test/compiler/oracle/GetMethodOptionTest.java b/hotspot/test/compiler/oracle/GetMethodOptionTest.java index a6b92b2c632..ed295f417b7 100644 --- a/hotspot/test/compiler/oracle/GetMethodOptionTest.java +++ b/hotspot/test/compiler/oracle/GetMethodOptionTest.java @@ -30,6 +30,7 @@ import sun.hotspot.WhiteBox; /* * @test * @bug 8074980 + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build sun.hotspot.WhiteBox jdk.test.lib.Asserts GetMethodOptionTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/oracle/MethodMatcherTest.java b/hotspot/test/compiler/oracle/MethodMatcherTest.java index 386f24406c8..1f158276055 100644 --- a/hotspot/test/compiler/oracle/MethodMatcherTest.java +++ b/hotspot/test/compiler/oracle/MethodMatcherTest.java @@ -23,6 +23,7 @@ /* * @test MethodMatcherTest + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/profiling/UnsafeAccess.java b/hotspot/test/compiler/profiling/UnsafeAccess.java new file mode 100644 index 00000000000..28abc34b19a --- /dev/null +++ b/hotspot/test/compiler/profiling/UnsafeAccess.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +/* + * @test + * @bug 8134918 + * @modules java.base/jdk.internal.misc + * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TypeProfileLevel=222 -XX:+UseTypeSpeculation -Xbatch + * -XX:CompileCommand=dontinline,UnsafeAccess::test* + * UnsafeAccess + */ +import jdk.internal.misc.Unsafe; + +public class UnsafeAccess { + private static final Unsafe U = Unsafe.getUnsafe(); + + static Class cls = Object.class; + static long off = U.ARRAY_OBJECT_BASE_OFFSET; + + static Object testUnsafeAccess(Object o, boolean isObjArray) { + if (o != null && cls.isInstance(o)) { // speculates "o" type to int[] + return helperUnsafeAccess(o, isObjArray); + } + return null; + } + + static Object helperUnsafeAccess(Object o, boolean isObjArray) { + if (isObjArray) { + U.putObject(o, off, new Object()); + } + return o; + } + + static Object testUnsafeLoadStore(Object o, boolean isObjArray) { + if (o != null && cls.isInstance(o)) { // speculates "o" type to int[] + return helperUnsafeLoadStore(o, isObjArray); + } + return null; + } + + static Object helperUnsafeLoadStore(Object o, boolean isObjArray) { + if (isObjArray) { + Object o1 = U.getObject(o, off); + U.compareAndSwapObject(o, off, o1, new Object()); + } + return o; + } + + public static void main(String[] args) { + Object[] objArray = new Object[10]; + int[] intArray = new int[10]; + + for (int i = 0; i < 20_000; i++) { + helperUnsafeAccess(objArray, true); + } + for (int i = 0; i < 20_000; i++) { + testUnsafeAccess(intArray, false); + } + + for (int i = 0; i < 20_000; i++) { + helperUnsafeLoadStore(objArray, true); + } + for (int i = 0; i < 20_000; i++) { + testUnsafeLoadStore(intArray, false); + } + + System.out.println("TEST PASSED"); + } +} diff --git a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java index 0053ffac156..c4c97f98038 100644 --- a/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java +++ b/hotspot/test/compiler/rangechecks/TestExplicitRangeChecks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -25,8 +25,9 @@ * @test * @bug 8073480 * @summary explicit range checks should be recognized by C2 + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox / - * @build TestExplicitRangeChecks + * @build TestExplicitRangeChecks * @run main ClassFileInstaller sun.hotspot.WhiteBox * @run main ClassFileInstaller jdk.test.lib.Platform * @run main/othervm -ea -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI @@ -40,12 +41,14 @@ import java.util.*; import sun.hotspot.WhiteBox; import sun.hotspot.code.NMethod; import jdk.test.lib.Platform; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import compiler.whitebox.CompilerWhiteBoxTest; public class TestExplicitRangeChecks { - - static int[] array = new int[10]; + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + private static final int TIERED_STOP_AT_LEVEL = WHITE_BOX.getIntxVMFlag("TieredStopAtLevel").intValue(); + private static int[] array = new int[10]; + private static boolean success = true; @Retention(RetentionPolicy.RUNTIME) @interface Args { @@ -366,10 +369,6 @@ public class TestExplicitRangeChecks { return true; } - static boolean success = true; - - private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); - final HashMap tests = new HashMap<>(); { for (Method m : this.getClass().getDeclaredMethods()) { @@ -439,7 +438,9 @@ public class TestExplicitRangeChecks { System.out.println(name + " bad result for bad input " + bad[i]); success = false; } - if (Platform.isServer()) { + // Only perform these additional checks if C2 is available + if (Platform.isServer() && + TIERED_STOP_AT_LEVEL == CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) { if (deoptimize && WHITE_BOX.isMethodCompiled(m)) { System.out.println(name + " not deoptimized on invalid access"); success = false; diff --git a/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java new file mode 100644 index 00000000000..288af4ddca1 --- /dev/null +++ b/hotspot/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/** + * @test TestRangeCheckEliminationDisabled + * @bug 8154763 + * @summary Tests PostLoopMultiversioning with RangeCheckElimination disabled. + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination TestRangeCheckEliminationDisabled + */ +public class TestRangeCheckEliminationDisabled { + + public static void main(String[] args) { + System.out.println("Passed"); + } +} + diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java index 90a9f14cc3a..574b7cc74fd 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java @@ -44,7 +44,7 @@ import jdk.test.lib.cli.predicate.AndPredicate; import rtm.*; import rtm.predicate.SupportedCPU; import rtm.predicate.SupportedVM; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Test verifies that method will be deoptimized on high abort ratio diff --git a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java index 605f7953ff7..e4623c2c077 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java @@ -46,7 +46,7 @@ import jdk.test.lib.cli.predicate.AndPredicate; import rtm.*; import rtm.predicate.SupportedCPU; import rtm.predicate.SupportedVM; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * To verify that with +UseRTMDeopt method's RTM state will be diff --git a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java index b531aac5946..de8e8a3519f 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java @@ -43,7 +43,7 @@ import jdk.test.lib.cli.predicate.AndPredicate; import rtm.*; import rtm.predicate.SupportedCPU; import rtm.predicate.SupportedVM; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Test verifies that low abort ratio method will be deoptimized with diff --git a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java index 8b1ee985095..7280fc21b81 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java @@ -44,7 +44,7 @@ import jdk.test.lib.cli.predicate.AndPredicate; import rtm.*; import rtm.predicate.SupportedCPU; import rtm.predicate.SupportedVM; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Test verifies that RTMLockingThreshold option actually affects how soon diff --git a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java index 4056dc9a50c..37920da4c1d 100644 --- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java +++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java @@ -37,7 +37,7 @@ * -XX:+WhiteBoxAPI TestRTMTotalCountIncrRate */ -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.util.List; import jdk.test.lib.*; diff --git a/hotspot/test/compiler/runtime/6859338/Test6859338.java b/hotspot/test/compiler/runtime/6859338/Test6859338.java index 03d68126f66..73576840db1 100644 --- a/hotspot/test/compiler/runtime/6859338/Test6859338.java +++ b/hotspot/test/compiler/runtime/6859338/Test6859338.java @@ -27,7 +27,7 @@ * @bug 6859338 * @summary Assertion failure in sharedRuntime.cpp * - * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:-InlineObjectHash -Xbatch -XX:-ProfileInterpreter Test6859338 + * @run main/othervm -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-InlineObjectHash -Xbatch -XX:-ProfileInterpreter Test6859338 */ public class Test6859338 { diff --git a/hotspot/test/compiler/runtime/8010927/Test8010927.java b/hotspot/test/compiler/runtime/8010927/Test8010927.java index 127e80b9a5f..9453878cfe0 100644 --- a/hotspot/test/compiler/runtime/8010927/Test8010927.java +++ b/hotspot/test/compiler/runtime/8010927/Test8010927.java @@ -35,7 +35,7 @@ import sun.hotspot.WhiteBox; import java.lang.reflect.Field; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * The test creates uncommitted space between oldgen and young gen diff --git a/hotspot/test/compiler/stable/TestStableBoolean.java b/hotspot/test/compiler/stable/TestStableBoolean.java index 5dbcef7f87a..0be8173a8ef 100644 --- a/hotspot/test/compiler/stable/TestStableBoolean.java +++ b/hotspot/test/compiler/stable/TestStableBoolean.java @@ -27,31 +27,32 @@ * @test TestStableBoolean * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableBoolean * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableBoolean + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableBoolean * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:-FoldStableValues - * compiler.stable.TestStableBoolean + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:-FoldStableValues + * compiler.stable.TestStableBoolean * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 - * -XX:+FoldStableValues - * compiler.stable.TestStableBoolean + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * compiler.stable.TestStableBoolean * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 - * -XX:-FoldStableValues - * compiler.stable.TestStableBoolean + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues + * compiler.stable.TestStableBoolean */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableByte.java b/hotspot/test/compiler/stable/TestStableByte.java index 0a5d46b4092..a983cfa814f 100644 --- a/hotspot/test/compiler/stable/TestStableByte.java +++ b/hotspot/test/compiler/stable/TestStableByte.java @@ -27,31 +27,32 @@ * @test TestStableByte * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableByte * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableByte + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableByte * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableByte + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableByte * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableByte + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableByte * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableByte + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableByte */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableChar.java b/hotspot/test/compiler/stable/TestStableChar.java index 7aeb1725767..6fcc407a7ac 100644 --- a/hotspot/test/compiler/stable/TestStableChar.java +++ b/hotspot/test/compiler/stable/TestStableChar.java @@ -27,31 +27,32 @@ * @test TestStableChar * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableChar * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableChar + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableChar * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableChar + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableChar * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableChar + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableChar * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableChar + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableChar */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableDouble.java b/hotspot/test/compiler/stable/TestStableDouble.java index 30617b9f2c4..09a388a99a8 100644 --- a/hotspot/test/compiler/stable/TestStableDouble.java +++ b/hotspot/test/compiler/stable/TestStableDouble.java @@ -27,31 +27,32 @@ * @test TestStableDouble * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableDouble * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableDouble + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableDouble * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableDouble + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableDouble * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableDouble + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableDouble * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableDouble + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableDouble */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableFloat.java b/hotspot/test/compiler/stable/TestStableFloat.java index d17ee9b2bb2..7053e671c85 100644 --- a/hotspot/test/compiler/stable/TestStableFloat.java +++ b/hotspot/test/compiler/stable/TestStableFloat.java @@ -27,31 +27,32 @@ * @test TestStableFloat * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableFloat * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableFloat + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableFloat * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableFloat + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableFloat * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableFloat + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableFloat * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableFloat + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableFloat */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableInt.java b/hotspot/test/compiler/stable/TestStableInt.java index 24f6a5613ee..1ebe5295592 100644 --- a/hotspot/test/compiler/stable/TestStableInt.java +++ b/hotspot/test/compiler/stable/TestStableInt.java @@ -27,31 +27,32 @@ * @test TestStableInt * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableInt * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableInt + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableInt * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableInt + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableInt * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableInt + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableInt * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableInt + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableInt */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableLong.java b/hotspot/test/compiler/stable/TestStableLong.java index 4f4f210ce31..b70ea910d51 100644 --- a/hotspot/test/compiler/stable/TestStableLong.java +++ b/hotspot/test/compiler/stable/TestStableLong.java @@ -27,31 +27,32 @@ * @test TestStableLong * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableLong * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableLong + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableLong * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableLong + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableLong * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableLong + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableLong * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableLong + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableLong */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableMemoryBarrier.java b/hotspot/test/compiler/stable/TestStableMemoryBarrier.java index 313dac28308..4a421c61e33 100644 --- a/hotspot/test/compiler/stable/TestStableMemoryBarrier.java +++ b/hotspot/test/compiler/stable/TestStableMemoryBarrier.java @@ -28,10 +28,11 @@ * @bug 8139758 * @summary tests memory barrier correctly inserted for stable fields * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * * @run main/bootclasspath/othervm -Xcomp -XX:CompileOnly=::testCompile - * compiler.stable.TestStableMemoryBarrier + * compiler.stable.TestStableMemoryBarrier * * @author hui.shi@linaro.org */ diff --git a/hotspot/test/compiler/stable/TestStableObject.java b/hotspot/test/compiler/stable/TestStableObject.java index c08afa8b943..cc0f89b4e06 100644 --- a/hotspot/test/compiler/stable/TestStableObject.java +++ b/hotspot/test/compiler/stable/TestStableObject.java @@ -27,31 +27,32 @@ * @test TestStableObject * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableObject * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableObject + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableObject * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableObject + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableObject * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableObject + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableObject * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableObject + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableObject */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableShort.java b/hotspot/test/compiler/stable/TestStableShort.java index bab170a1c46..15c71b4c0c8 100644 --- a/hotspot/test/compiler/stable/TestStableShort.java +++ b/hotspot/test/compiler/stable/TestStableShort.java @@ -27,31 +27,32 @@ * @test TestStableShort * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableShort * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableShort + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableShort * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableShort + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableShort * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableShort + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableShort * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * compiler.stable.TestStableShort + * -XX:CompileOnly=::get,::get1,::get2,::get3,::get4 + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * compiler.stable.TestStableShort */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableUByte.java b/hotspot/test/compiler/stable/TestStableUByte.java index b1c68daaf05..788fecacde5 100644 --- a/hotspot/test/compiler/stable/TestStableUByte.java +++ b/hotspot/test/compiler/stable/TestStableUByte.java @@ -27,35 +27,36 @@ * @test TestStableUByte * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableUByte * * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUByte + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUByte * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:-TieredCompilation - * -XX:-FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUByte + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:-TieredCompilation + * -XX:-FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUByte * * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 - * -XX:+FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUByte + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUByte * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 - * -XX:-FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUByte + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUByte * */ package compiler.stable; diff --git a/hotspot/test/compiler/stable/TestStableUShort.java b/hotspot/test/compiler/stable/TestStableUShort.java index 2f9d44a0396..43ebf3c6383 100644 --- a/hotspot/test/compiler/stable/TestStableUShort.java +++ b/hotspot/test/compiler/stable/TestStableUShort.java @@ -27,35 +27,36 @@ * @test TestStableUShort * @summary tests on stable fields and arrays * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build sun.hotspot.WhiteBox * @build compiler.stable.TestStableUShort * * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:-TieredCompilation - * -XX:+FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUShort + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUShort * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:-TieredCompilation - * -XX:-FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUShort + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:-TieredCompilation + * -XX:-FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUShort * * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 - * -XX:+FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUShort + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:+FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUShort * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+AlwaysIncrementalInline - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp - * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 - * -XX:-FoldStableValues - * -XX:CompileOnly=::get,::get1 - * compiler.stable.TestStableUShort + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp + * -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-FoldStableValues + * -XX:CompileOnly=::get,::get1 + * compiler.stable.TestStableUShort * */ package compiler.stable; diff --git a/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java b/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java new file mode 100644 index 00000000000..a7dbf2badc0 --- /dev/null +++ b/hotspot/test/compiler/startup/TieredStopAtLevel0SanityTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8154151 + * @summary Sanity test flag combo that force compiles on level 0 + * @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:TieredStopAtLevel=0 TieredStopAtLevel0SanityTest + */ + +public class TieredStopAtLevel0SanityTest { + public static void main(String[] args) throws Exception { + System.out.println("Hello world!"); + } +} diff --git a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java index 19e3bf8c751..39916c516d8 100644 --- a/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java +++ b/hotspot/test/compiler/testlibrary/rtm/XAbortProvoker.java @@ -25,7 +25,7 @@ package rtm; import jdk.test.lib.Utils; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Current RTM locking implementation force transaction abort diff --git a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java index 5f423d38a2c..8d33ad65e45 100644 --- a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java +++ b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java @@ -59,14 +59,23 @@ public class IntrinsicPredicates { }; public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE - = new OrPredicate( - new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },null), - new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" },null)); + = new OrPredicate(new CPUSpecificPredicate("x86.*", new String[] { "sha" },null), + new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "sha" },null), + new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] { "sha" },null), + new OrPredicate( + new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },null), + new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" },null))))); public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE - = new OrPredicate( - new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },null), - new CPUSpecificPredicate("aarch64.*", new String[] { "sha256" },null)); + = new OrPredicate(new CPUSpecificPredicate("x86.*", new String[] { "sha" },null), + new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "sha" },null), + new OrPredicate(new CPUSpecificPredicate("i386.*", new String[] { +"sha" },null), + new OrPredicate(new CPUSpecificPredicate("x86_64", new String[] { "avx2", "bmi2" }, null), + new OrPredicate(new CPUSpecificPredicate("amd64.*", new String[] { "avx2", "bmi2" }, null), + new OrPredicate( + new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },null), + new CPUSpecificPredicate("aarch64.*", new String[] { "sha256" },null))))))); public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE = new OrPredicate( diff --git a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java index 4eb086aef3c..d0cbbad9cf9 100644 --- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java +++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java @@ -31,9 +31,9 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @modules java.base/jdk.internal.misc * java.management * @build TransitionsTestExecutor ConstantGettersTransitionsTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -XX:+TieredCompilation + * -XX:+WhiteBoxAPI -XX:+TieredCompilation -XX:-UseCounterDecay * -XX:CompileCommand=compileonly,ConstantGettersTestCase$TrivialMethods::* * TransitionsTestExecutor ConstantGettersTransitionsTest * @summary Test the correctness of compilation level transitions for constant getters methods diff --git a/hotspot/test/compiler/tiered/LevelTransitionTest.java b/hotspot/test/compiler/tiered/LevelTransitionTest.java index c011ba414ba..62f1fc65e04 100644 --- a/hotspot/test/compiler/tiered/LevelTransitionTest.java +++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java @@ -38,7 +38,7 @@ import compiler.whitebox.SimpleTestCase; * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:+WhiteBoxAPI -XX:+TieredCompilation - * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* * -XX:CompileCommand=compileonly,ExtendedTestCase$CompileMethodHolder::* * TransitionsTestExecutor LevelTransitionTest * @summary Test the correctness of compilation level transitions for different methods @@ -80,7 +80,7 @@ public class LevelTransitionTest extends TieredLevelsTest { /** * Makes and verifies transitions between compilation levels */ - protected void checkTransitions() { + protected void checkTransitions() throws Exception { checkNotCompiled(); boolean finish = false; while (!finish) { diff --git a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java index 4a1a52e7219..98fad1ee0b4 100644 --- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java @@ -27,13 +27,14 @@ import compiler.whitebox.CompilerWhiteBoxTest; /** * @test NonTieredLevelsTest * @library /testlibrary /test/lib /compiler/whitebox / + * @modules java.base/jdk.internal.misc * @modules java.management * @build NonTieredLevelsTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* * NonTieredLevelsTest * @summary Verify that only one level can be used * @author igor.ignatyev@oracle.com diff --git a/hotspot/test/compiler/tiered/TieredLevelsTest.java b/hotspot/test/compiler/tiered/TieredLevelsTest.java index 0790b195134..bf1812128fc 100644 --- a/hotspot/test/compiler/tiered/TieredLevelsTest.java +++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java @@ -26,13 +26,14 @@ import compiler.whitebox.CompilerWhiteBoxTest; /** * @test TieredLevelsTest * @library /testlibrary /test/lib /compiler/whitebox / + * @modules java.base/jdk.internal.misc * @modules java.management * @build TieredLevelsTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation - * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* + * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* * TieredLevelsTest * @summary Verify that all levels < 'TieredStopAtLevel' can be used * @author igor.ignatyev@oracle.com diff --git a/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java b/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java index 50979d260c6..7295581bf2a 100644 --- a/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java +++ b/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java @@ -27,6 +27,7 @@ import java.lang.reflect.Method; /* * @test * @bug 8009761 + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @summary Deoptimization on sparc doesn't set Llast_SP correctly in the interpreter frames it creates * @build Test8009761 diff --git a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java index c7dc5cabab8..a6707d536f9 100644 --- a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java +++ b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java @@ -31,7 +31,7 @@ import java.lang.reflect.Field; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class GetUnsafeObjectG1PreBarrier { private static final Unsafe unsafe; diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java index 58fe9296be8..96c1a82b971 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestBoolean.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestBoolean { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -148,4 +149,3 @@ public class JdkInternalMiscUnsafeAccessTestBoolean { } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java index 12ae3c31a4e..2b5438e7c30 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestByte.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestByte { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -185,4 +186,3 @@ public class JdkInternalMiscUnsafeAccessTestByte { } } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java index f912b7fd86d..67f425826d3 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestChar.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestChar { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -203,4 +204,3 @@ public class JdkInternalMiscUnsafeAccessTestChar { } } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java index adbe249bafc..5304bc2c900 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestDouble.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestDouble { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -185,4 +186,3 @@ public class JdkInternalMiscUnsafeAccessTestDouble { } } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java index 6e08a213f7f..f7c542ebd6f 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestFloat.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestFloat { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -185,4 +186,3 @@ public class JdkInternalMiscUnsafeAccessTestFloat { } } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java index 47bfd7da01f..817e78da0bd 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestInt.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestInt { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -251,26 +252,47 @@ public class JdkInternalMiscUnsafeAccessTestInt { } { - boolean r = UNSAFE.weakCompareAndSwapInt(base, offset, 1, 2); - assertEquals(r, true, "weakCompareAndSwap int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapInt(base, offset, 1, 2); + } + assertEquals(success, true, "weakCompareAndSwap int"); int x = UNSAFE.getInt(base, offset); assertEquals(x, 2, "weakCompareAndSwap int value"); } { - boolean r = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 2, 1); - assertEquals(r, true, "weakCompareAndSwapAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 2, 1); + } + assertEquals(success, true, "weakCompareAndSwapAcquire int"); int x = UNSAFE.getInt(base, offset); assertEquals(x, 1, "weakCompareAndSwapAcquire int"); } { - boolean r = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 1, 2); - assertEquals(r, true, "weakCompareAndSwapRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 1, 2); + } + assertEquals(success, true, "weakCompareAndSwapRelease int"); int x = UNSAFE.getInt(base, offset); assertEquals(x, 2, "weakCompareAndSwapRelease int"); } + { + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapIntVolatile(base, offset, 2, 1); + } + assertEquals(success, true, "weakCompareAndSwapVolatile int"); + int x = UNSAFE.getInt(base, offset); + assertEquals(x, 1, "weakCompareAndSwapVolatile int"); + } + + UNSAFE.putInt(base, offset, 2); + // Compare set and get { int o = UNSAFE.getAndSetInt(base, offset, 1); @@ -286,7 +308,7 @@ public class JdkInternalMiscUnsafeAccessTestInt { int o = UNSAFE.getAndAddInt(base, offset, 2); assertEquals(o, 1, "getAndAdd int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 1 + 2, "weakCompareAndSwapRelease int"); + assertEquals(x, 1 + 2, "getAndAdd int"); } } @@ -300,4 +322,3 @@ public class JdkInternalMiscUnsafeAccessTestInt { } } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java index 9ed8b8710bc..d4b88370a65 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestLong.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestLong { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -251,26 +252,47 @@ public class JdkInternalMiscUnsafeAccessTestLong { } { - boolean r = UNSAFE.weakCompareAndSwapLong(base, offset, 1L, 2L); - assertEquals(r, true, "weakCompareAndSwap long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapLong(base, offset, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSwap long"); long x = UNSAFE.getLong(base, offset); assertEquals(x, 2L, "weakCompareAndSwap long value"); } { - boolean r = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 2L, 1L); - assertEquals(r, true, "weakCompareAndSwapAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSwapAcquire long"); long x = UNSAFE.getLong(base, offset); assertEquals(x, 1L, "weakCompareAndSwapAcquire long"); } { - boolean r = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 1L, 2L); - assertEquals(r, true, "weakCompareAndSwapRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSwapRelease long"); long x = UNSAFE.getLong(base, offset); assertEquals(x, 2L, "weakCompareAndSwapRelease long"); } + { + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSwapVolatile long"); + long x = UNSAFE.getLong(base, offset); + assertEquals(x, 1L, "weakCompareAndSwapVolatile long"); + } + + UNSAFE.putLong(base, offset, 2L); + // Compare set and get { long o = UNSAFE.getAndSetLong(base, offset, 1L); @@ -286,7 +308,7 @@ public class JdkInternalMiscUnsafeAccessTestLong { long o = UNSAFE.getAndAddLong(base, offset, 2L); assertEquals(o, 1L, "getAndAdd long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 1L + 2L, "weakCompareAndSwapRelease long"); + assertEquals(x, 1L + 2L, "getAndAdd long"); } } @@ -300,4 +322,3 @@ public class JdkInternalMiscUnsafeAccessTestLong { } } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java index 2db2efa9932..7fc59cd929c 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestObject.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestObject { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -204,26 +205,47 @@ public class JdkInternalMiscUnsafeAccessTestObject { } { - boolean r = UNSAFE.weakCompareAndSwapObject(base, offset, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSwap Object"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapObject(base, offset, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSwap Object"); Object x = UNSAFE.getObject(base, offset); assertEquals(x, "bar", "weakCompareAndSwap Object value"); } { - boolean r = UNSAFE.weakCompareAndSwapObjectAcquire(base, offset, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSwapAcquire Object"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapObjectAcquire(base, offset, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSwapAcquire Object"); Object x = UNSAFE.getObject(base, offset); assertEquals(x, "foo", "weakCompareAndSwapAcquire Object"); } { - boolean r = UNSAFE.weakCompareAndSwapObjectRelease(base, offset, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSwapRelease Object"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapObjectRelease(base, offset, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSwapRelease Object"); Object x = UNSAFE.getObject(base, offset); assertEquals(x, "bar", "weakCompareAndSwapRelease Object"); } + { + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwapObjectVolatile(base, offset, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSwapVolatile Object"); + Object x = UNSAFE.getObject(base, offset); + assertEquals(x, "foo", "weakCompareAndSwapVolatile Object"); + } + + UNSAFE.putObject(base, offset, "bar"); + // Compare set and get { Object o = UNSAFE.getAndSetObject(base, offset, "foo"); @@ -236,4 +258,3 @@ public class JdkInternalMiscUnsafeAccessTestObject { } - diff --git a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java index 814e0367bf0..a9fab93740b 100644 --- a/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java +++ b/hotspot/test/compiler/unsafe/JdkInternalMiscUnsafeAccessTestShort.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class JdkInternalMiscUnsafeAccessTestShort { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final jdk.internal.misc.Unsafe UNSAFE; @@ -203,4 +204,3 @@ public class JdkInternalMiscUnsafeAccessTestShort { } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java index 7288954612b..c5349ff404c 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestBoolean.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestBoolean { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -131,9 +132,7 @@ public class SunMiscUnsafeAccessTestBoolean { - } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java index 928f51790e6..24ab3f86ff9 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestByte.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestByte { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -160,7 +161,6 @@ public class SunMiscUnsafeAccessTestByte { - } static void testAccess(long address) { @@ -173,4 +173,3 @@ public class SunMiscUnsafeAccessTestByte { } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java index 48aa82f9a53..70004792886 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestChar.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestChar { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -160,7 +161,6 @@ public class SunMiscUnsafeAccessTestChar { - } static void testAccess(long address) { @@ -173,4 +173,3 @@ public class SunMiscUnsafeAccessTestChar { } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java index 0902911046d..9300fc0c17d 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestDouble.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestDouble { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -160,7 +161,6 @@ public class SunMiscUnsafeAccessTestDouble { - } static void testAccess(long address) { @@ -173,4 +173,3 @@ public class SunMiscUnsafeAccessTestDouble { } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java index 41056dc3b2e..39a3f51b497 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestFloat.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestFloat { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -160,7 +161,6 @@ public class SunMiscUnsafeAccessTestFloat { - } static void testAccess(long address) { @@ -173,4 +173,3 @@ public class SunMiscUnsafeAccessTestFloat { } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java index ecf79ee392e..4310a6e49ec 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestInt.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestInt { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -165,7 +166,6 @@ public class SunMiscUnsafeAccessTestInt { - UNSAFE.putInt(base, offset, 1); // Compare @@ -183,7 +183,7 @@ public class SunMiscUnsafeAccessTestInt { assertEquals(x, 2, "failing compareAndSwap int value"); } - + UNSAFE.putInt(base, offset, 2); // Compare set and get { @@ -200,7 +200,7 @@ public class SunMiscUnsafeAccessTestInt { int o = UNSAFE.getAndAddInt(base, offset, 2); assertEquals(o, 1, "getAndAdd int"); int x = UNSAFE.getInt(base, offset); - assertEquals(x, 1 + 2, "weakCompareAndSwapRelease int"); + assertEquals(x, 1 + 2, "getAndAdd int"); } } @@ -214,4 +214,3 @@ public class SunMiscUnsafeAccessTestInt { } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java index 4a9b4805fc7..6dd6434c774 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestLong.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestLong { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -165,7 +166,6 @@ public class SunMiscUnsafeAccessTestLong { - UNSAFE.putLong(base, offset, 1L); // Compare @@ -183,7 +183,7 @@ public class SunMiscUnsafeAccessTestLong { assertEquals(x, 2L, "failing compareAndSwap long value"); } - + UNSAFE.putLong(base, offset, 2L); // Compare set and get { @@ -200,7 +200,7 @@ public class SunMiscUnsafeAccessTestLong { long o = UNSAFE.getAndAddLong(base, offset, 2L); assertEquals(o, 1L, "getAndAdd long"); long x = UNSAFE.getLong(base, offset); - assertEquals(x, 1L + 2L, "weakCompareAndSwapRelease long"); + assertEquals(x, 1L + 2L, "getAndAdd long"); } } @@ -214,4 +214,3 @@ public class SunMiscUnsafeAccessTestLong { } } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java index efb15090f0e..b56cc413504 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestObject.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestObject { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -136,7 +137,6 @@ public class SunMiscUnsafeAccessTestObject { - UNSAFE.putObject(base, offset, "foo"); // Compare @@ -154,7 +154,7 @@ public class SunMiscUnsafeAccessTestObject { assertEquals(x, "bar", "failing compareAndSwap Object value"); } - + UNSAFE.putObject(base, offset, "bar"); // Compare set and get { @@ -168,4 +168,3 @@ public class SunMiscUnsafeAccessTestObject { } - diff --git a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java index 4e4cda0458c..c8c7284e905 100644 --- a/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java +++ b/hotspot/test/compiler/unsafe/SunMiscUnsafeAccessTestShort.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class SunMiscUnsafeAccessTestShort { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final sun.misc.Unsafe UNSAFE; @@ -160,7 +161,6 @@ public class SunMiscUnsafeAccessTestShort { - } static void testAccess(long address) { @@ -173,4 +173,3 @@ public class SunMiscUnsafeAccessTestShort { } } - diff --git a/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java b/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java index edd55975378..3fc0e821a68 100644 --- a/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java +++ b/hotspot/test/compiler/unsafe/TestUnsafeLoadControl.java @@ -25,12 +25,13 @@ * @test * @bug 8077504 * @summary Unsafe load can loose control dependency and cause crash + * @modules java.base/jdk.internal.misc * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestUnsafeLoadControl * */ import java.lang.reflect.Field; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class TestUnsafeLoadControl { diff --git a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java index 2ffc5ec51e6..77014439673 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetConstantField.java @@ -33,24 +33,25 @@ * @modules java.base/jdk.internal.org.objectweb.asm * java.base/jdk.internal.vm.annotation * java.base/jdk.internal.misc - * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions - * -Xbatch -XX:-TieredCompilation - * -XX:+FoldStableValues - * -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress() - * -XX:CompileCommand=dontinline,*.test* - * -XX:+UseUnalignedAccesses - * -XaddReads:java.base=ALL-UNNAMED - * compiler.unsafe.UnsafeGetConstantField * * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions - * -Xbatch -XX:-TieredCompilation - * -XX:+FoldStableValues - * -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress() - * -XX:CompileCommand=dontinline,*.test* - * -XX:CompileCommand=inline,*Unsafe.get* - * -XX:-UseUnalignedAccesses + * -Xbatch -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress() + * -XX:CompileCommand=dontinline,*.test* + * -XX:+UseUnalignedAccesses * -XaddReads:java.base=ALL-UNNAMED - * compiler.unsafe.UnsafeGetConstantField + * compiler.unsafe.UnsafeGetConstantField + * + * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions + * -Xbatch -XX:-TieredCompilation + * -XX:+FoldStableValues + * -XX:CompileCommand=dontinline,UnsafeGetConstantField.checkGetAddress() + * -XX:CompileCommand=dontinline,*.test* + * -XX:CompileCommand=inline,*Unsafe.get* + * -XX:-UseUnalignedAccesses + * -XaddReads:java.base=ALL-UNNAMED + * compiler.unsafe.UnsafeGetConstantField */ package compiler.unsafe; @@ -65,7 +66,6 @@ import jdk.test.lib.Platform; import jdk.internal.misc.Unsafe; import java.io.IOException; -import java.lang.reflect.Field; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -149,10 +149,7 @@ public class UnsafeGetConstantField { if (!hasDefaultValue && (stable || g.isFinal())) { Asserts.assertEQ(t.value, test.testDirect(), "direct read doesn't return prev value"); - // fails for getCharUnaligned due to JDK-8148518 - if (!(t == JavaType.C && "Unaligned".equals(postfix))) { - Asserts.assertEQ(test.testDirect(), test.testUnsafe()); - } + Asserts.assertEQ(test.testDirect(), test.testUnsafe()); } else { Asserts.assertEQ(t.defaultValue, test.testDirect(), "direct read doesn't return default value"); diff --git a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java index 08bdb491466..c4d56725765 100644 --- a/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java +++ b/hotspot/test/compiler/unsafe/UnsafeGetStableArrayElement.java @@ -26,24 +26,28 @@ /* * @test * @summary tests on constant folding of unsafe get operations from stable arrays - * @library /testlibrary /test/lib - * @ignore 8151137 + * @library /testlibrary * * @requires vm.flavor != "client" * - * @run main/bootclasspath -XX:+UnlockDiagnosticVMOptions + * @modules java.base/jdk.internal.vm.annotation + * java.base/jdk.internal.misc + + * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions * -Xbatch -XX:-TieredCompilation * -XX:+FoldStableValues * -XX:CompileCommand=dontinline,*Test::test* - * UnsafeGetStableArrayElement + * compiler.unsafe.UnsafeGetStableArrayElement */ +package compiler.unsafe; + import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.Stable; import java.util.concurrent.Callable; +import jdk.test.lib.Platform; import static jdk.internal.misc.Unsafe.*; import static jdk.test.lib.Asserts.*; -import static jdk.test.lib.Platform; public class UnsafeGetStableArrayElement { @Stable static final boolean[] STABLE_BOOLEAN_ARRAY = new boolean[16]; @@ -219,13 +223,7 @@ public class UnsafeGetStableArrayElement { Setter.reset(); } - public static void main(String[] args) throws Exception { - if (Platform.isServer()) { - test(); - } - } - - static void test() throws Exception { + static void testUnsafeAccess() throws Exception { // boolean[], aligned accesses testMatched( Test::testZ_Z, Test::changeZ); testMismatched(Test::testZ_B, Test::changeZ); @@ -329,4 +327,11 @@ public class UnsafeGetStableArrayElement { run(Test::testL_I); run(Test::testL_F); } + + public static void main(String[] args) throws Exception { + if (Platform.isServer()) { + testUnsafeAccess(); + } + System.out.println("TEST PASSED"); + } } diff --git a/hotspot/test/compiler/unsafe/UnsafeRaw.java b/hotspot/test/compiler/unsafe/UnsafeRaw.java index 80ffd837c73..bb2e9a1aeca 100644 --- a/hotspot/test/compiler/unsafe/UnsafeRaw.java +++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java @@ -33,51 +33,52 @@ import jdk.test.lib.Utils; import java.util.Random; +import jdk.internal.misc.Unsafe; public class UnsafeRaw { public static class Tests { - public static int int_index(sun.misc.Unsafe unsafe, long base, int index) throws Exception { + public static int int_index(Unsafe unsafe, long base, int index) throws Exception { return unsafe.getInt(base + (index << 2)); } - public static int long_index(sun.misc.Unsafe unsafe, long base, long index) throws Exception { + public static int long_index(Unsafe unsafe, long base, long index) throws Exception { return unsafe.getInt(base + (index << 2)); } - public static int int_index_back_ashift(sun.misc.Unsafe unsafe, long base, int index) throws Exception { + public static int int_index_back_ashift(Unsafe unsafe, long base, int index) throws Exception { return unsafe.getInt(base + (index >> 2)); } - public static int int_index_back_lshift(sun.misc.Unsafe unsafe, long base, int index) throws Exception { + public static int int_index_back_lshift(Unsafe unsafe, long base, int index) throws Exception { return unsafe.getInt(base + (index >>> 2)); } - public static int long_index_back_ashift(sun.misc.Unsafe unsafe, long base, long index) throws Exception { + public static int long_index_back_ashift(Unsafe unsafe, long base, long index) throws Exception { return unsafe.getInt(base + (index >> 2)); } - public static int long_index_back_lshift(sun.misc.Unsafe unsafe, long base, long index) throws Exception { + public static int long_index_back_lshift(Unsafe unsafe, long base, long index) throws Exception { return unsafe.getInt(base + (index >>> 2)); } - public static int int_const_12345678_index(sun.misc.Unsafe unsafe, long base) throws Exception { + public static int int_const_12345678_index(Unsafe unsafe, long base) throws Exception { int idx4 = 0x12345678; return unsafe.getInt(base + idx4); } - public static int long_const_1234567890abcdef_index(sun.misc.Unsafe unsafe, long base) throws Exception { + public static int long_const_1234567890abcdef_index(Unsafe unsafe, long base) throws Exception { long idx5 = 0x1234567890abcdefL; return unsafe.getInt(base + idx5); } - public static int int_index_mul(sun.misc.Unsafe unsafe, long base, int index) throws Exception { + public static int int_index_mul(Unsafe unsafe, long base, int index) throws Exception { return unsafe.getInt(base + (index * 4)); } - public static int long_index_mul(sun.misc.Unsafe unsafe, long base, long index) throws Exception { + public static int long_index_mul(Unsafe unsafe, long base, long index) throws Exception { return unsafe.getInt(base + (index * 4)); } - public static int int_index_mul_scale_16(sun.misc.Unsafe unsafe, long base, int index) throws Exception { + public static int int_index_mul_scale_16(Unsafe unsafe, long base, int index) throws Exception { return unsafe.getInt(base + (index * 16)); } - public static int long_index_mul_scale_16(sun.misc.Unsafe unsafe, long base, long index) throws Exception { + public static int long_index_mul_scale_16(Unsafe unsafe, long base, long index) throws Exception { return unsafe.getInt(base + (index * 16)); } } public static void main(String[] args) throws Exception { - sun.misc.Unsafe unsafe = Utils.getUnsafe(); + Unsafe unsafe = Utils.getUnsafe(); final int array_size = 128; final int element_size = 4; final int magic = 0x12345678; diff --git a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template index e1957e00a83..19c3bfa7ef0 100644 --- a/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template +++ b/hotspot/test/compiler/unsafe/X-UnsafeAccessTest.java.template @@ -40,6 +40,7 @@ import static org.testng.Assert.*; public class $Qualifier$UnsafeAccessTest$Type$ { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); static final $package$.Unsafe UNSAFE; @@ -273,26 +274,47 @@ public class $Qualifier$UnsafeAccessTest$Type$ { } { - boolean r = UNSAFE.weakCompareAndSwap$Type$(base, offset, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSwap $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwap$Type$(base, offset, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSwap $type$"); $type$ x = UNSAFE.get$Type$(base, offset); assertEquals(x, $value2$, "weakCompareAndSwap $type$ value"); } { - boolean r = UNSAFE.weakCompareAndSwap$Type$Acquire(base, offset, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSwapAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwap$Type$Acquire(base, offset, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSwapAcquire $type$"); $type$ x = UNSAFE.get$Type$(base, offset); assertEquals(x, $value1$, "weakCompareAndSwapAcquire $type$"); } { - boolean r = UNSAFE.weakCompareAndSwap$Type$Release(base, offset, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSwapRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwap$Type$Release(base, offset, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSwapRelease $type$"); $type$ x = UNSAFE.get$Type$(base, offset); assertEquals(x, $value2$, "weakCompareAndSwapRelease $type$"); } + + { + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = UNSAFE.weakCompareAndSwap$Type$Volatile(base, offset, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSwapVolatile $type$"); + $type$ x = UNSAFE.get$Type$(base, offset); + assertEquals(x, $value1$, "weakCompareAndSwapVolatile $type$"); + } + #end[JdkInternalMisc] + UNSAFE.put$Type$(base, offset, $value2$); // Compare set and get { @@ -311,7 +333,7 @@ public class $Qualifier$UnsafeAccessTest$Type$ { $type$ o = UNSAFE.getAndAdd$Type$(base, offset, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); $type$ x = UNSAFE.get$Type$(base, offset); - assertEquals(x, $value1$ + $value2$, "weakCompareAndSwapRelease $type$"); + assertEquals(x, $value1$ + $value2$, "getAndAdd $type$"); } #end[AtomicAdd] } diff --git a/hotspot/test/compiler/unsafe/generate-unsafe-tests.sh b/hotspot/test/compiler/unsafe/generate-unsafe-tests.sh deleted file mode 100644 index a20c45afa86..00000000000 --- a/hotspot/test/compiler/unsafe/generate-unsafe-tests.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash - -javac -d . ../../../../jdk/make/src/classes/build/tools/spp/Spp.java - -SPP=build.tools.spp.Spp - -# Generates unsafe access tests for objects and all primitive types -# $1 = package name to Unsafe, sun.misc | jdk.internal.misc -# $2 = test class qualifier name, SunMisc | JdkInternalMisc -function generate { - package=$1 - Qualifier=$2 - - for type in boolean byte short char int long float double Object - do - Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}" - args="-K$type -Dtype=$type -DType=$Type" - - case $type in - Object|int|long) - args="$args -KCAS -KOrdered" - ;; - esac - - case $type in - int|long) - args="$args -KAtomicAdd" - ;; - esac - - case $type in - short|char|int|long) - args="$args -KUnaligned" - ;; - esac - - case $type in - boolean) - value1=true - value2=false - value3=false - ;; - byte) - value1=(byte)1 - value2=(byte)2 - value3=(byte)3 - ;; - short) - value1=(short)1 - value2=(short)2 - value3=(short)3 - ;; - char) - value1=\'a\' - value2=\'b\' - value3=\'c\' - ;; - int) - value1=1 - value2=2 - value3=3 - ;; - long) - value1=1L - value2=2L - value3=3L - ;; - float) - value1=1.0f - value2=2.0f - value3=3.0f - ;; - double) - value1=1.0d - value2=2.0d - value3=3.0d - ;; - Object) - value1=\"foo\" - value2=\"bar\" - value3=\"baz\" - ;; - esac - - args="$args -Dvalue1=$value1 -Dvalue2=$value2 -Dvalue3=$value3" - - echo $args - - java $SPP -nel -K$Qualifier -Dpackage=$package -DQualifier=$Qualifier \ - $args < X-UnsafeAccessTest.java.template > ${Qualifier}UnsafeAccessTest${Type}.java - done -} - -generate sun.misc SunMisc -generate jdk.internal.misc JdkInternalMisc - -rm -fr build \ No newline at end of file diff --git a/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java b/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java new file mode 100644 index 00000000000..081a6d9f8b8 --- /dev/null +++ b/hotspot/test/compiler/vectorization/TestVectorUnalignedOffset.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016, Red Hat, Inc. 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 8155612 + * @summary Aarch64: vector nodes need to support misaligned offset + * @run main/othervm -XX:-BackgroundCompilation TestVectorUnalignedOffset + * + */ + + +public class TestVectorUnalignedOffset { + + static void test1(int[] src_array, int[] dst_array, int l) { + for (int i = 0; i < l; i++) { + dst_array[i + 250] = src_array[i + 250]; + } + } + + static void test2(byte[] src_array, byte[] dst_array, int l) { + for (int i = 0; i < l; i++) { + dst_array[i + 250] = src_array[i + 250]; + } + } + + static public void main(String[] args) { + int[] int_array = new int[1000]; + byte[] byte_array = new byte[1000]; + for (int i = 0; i < 20000; i++) { + test1(int_array, int_array, int_array.length - 250); + test2(byte_array, byte_array, byte_array.length - 250); + } + } +} diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java index 8968d3f2645..db371183ddb 100644 --- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java +++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java @@ -35,6 +35,7 @@ import jdk.test.lib.InfiniteLoop; * @test AllocationCodeBlobTest * @bug 8059624 8064669 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management * @build AllocationCodeBlobTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/whitebox/BlockingCompilation.java b/hotspot/test/compiler/whitebox/BlockingCompilation.java index d960ff4264a..927cfea9ab4 100644 --- a/hotspot/test/compiler/whitebox/BlockingCompilation.java +++ b/hotspot/test/compiler/whitebox/BlockingCompilation.java @@ -23,14 +23,14 @@ /* * @test - * @bug 8150646 + * @bug 8150646 8153013 * @summary Add support for blocking compiles through whitebox API + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib / * @build sun.hotspot.WhiteBox * compiler.testlibrary.CompilerUtils - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm/timeout=60 * -Xbootclasspath/a:. * -Xmixed @@ -40,11 +40,10 @@ * BlockingCompilation */ +import compiler.testlibrary.CompilerUtils; import java.lang.reflect.Method; import java.util.Random; - import sun.hotspot.WhiteBox; -import compiler.testlibrary.CompilerUtils; public class BlockingCompilation { private static final WhiteBox WB = WhiteBox.getWhiteBox(); @@ -77,7 +76,13 @@ public class BlockingCompilation { // If the compiles are blocking, this call will block until the test time out, // Progress == success // (Don't run with -Xcomp since that can cause long timeouts due to many compiles) - WB.enqueueMethodForCompilation(m, highest_level); + if (!WB.enqueueMethodForCompilation(m, highest_level)) { + throw new Exception("Failed to enqueue method on level: " + highest_level); + } + + if (!WB.isMethodQueuedForCompilation(m)) { + throw new Exception("Must be enqueued because of locked compilation"); + } // restore state WB.unlockCompilation(); diff --git a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java index dfc630155fe..38eb99a672e 100644 --- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java +++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java @@ -29,11 +29,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test ClearMethodStateTest * @bug 8006683 8007288 8022832 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build ClearMethodStateTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay ClearMethodStateTest * @summary testing of WB::clearMethodState() * @author igor.ignatyev@oracle.com */ @@ -41,8 +42,8 @@ public class ClearMethodStateTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { String directive = - "[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " + - " { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]"; + "[{ match:\"*SimpleTestCaseHelper.*\", BackgroundCompilation: false }, " + + " { match:\"*.*\", inline:\"-*SimpleTestCaseHelper.*\"}]"; if (WHITE_BOX.addCompilerDirective(directive) != 2) { throw new RuntimeException("Could not add directive"); } diff --git a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java index 5bec2eabd84..e83cd1e96c7 100644 --- a/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java +++ b/hotspot/test/compiler/whitebox/CompilerWhiteBoxTest.java @@ -24,6 +24,7 @@ package compiler.whitebox; import sun.hotspot.WhiteBox; import sun.hotspot.code.NMethod; + import java.lang.reflect.Executable; import java.util.Objects; import java.util.concurrent.Callable; @@ -58,6 +59,8 @@ public abstract class CompilerWhiteBoxTest { /** Value of {@code -XX:BackgroundCompilation} */ protected static final boolean BACKGROUND_COMPILATION = Boolean.valueOf(getVMOption("BackgroundCompilation", "true")); + protected static final boolean USE_COUNTER_DECAY + = Boolean.valueOf(getVMOption("UseCounterDecay", "true")); /** Value of {@code -XX:TieredCompilation} */ protected static final boolean TIERED_COMPILATION = Boolean.valueOf(getVMOption("TieredCompilation", "false")); @@ -370,7 +373,10 @@ public abstract class CompilerWhiteBoxTest { * @return accumulated result * @see #compile(int) */ - protected final int compile() { + protected final int compile() throws Exception { + if (USE_COUNTER_DECAY) { + throw new Exception("Tests using compile method must turn off counter decay for reliability"); + } if (testCase.isOsr()) { return compile(1); } else { diff --git a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java index b5ecf979e54..e47914968d9 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java @@ -27,11 +27,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test DeoptimizeAllTest * @bug 8006683 8007288 8022832 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build DeoptimizeAllTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* DeoptimizeAllTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeAllTest * @summary testing of WB::deoptimizeAll() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java index 75ac8cdc1ea..ce210944ad8 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java @@ -27,17 +27,18 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test DeoptimizeFramesTest * @bug 8028595 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build DeoptimizeFramesTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -Xmixed + * -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay * -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot * DeoptimizeFramesTest true * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions - * -XX:+WhiteBoxAPI -Xmixed + * -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay * -XX:CompileCommand=compileonly,DeoptimizeFramesTest$TestCaseImpl::method * -XX:+IgnoreUnrecognizedVMOptions -XX:-DeoptimizeRandom -XX:-DeoptimizeALot * DeoptimizeFramesTest false diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java index 473f56ce178..71ef586df6f 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java @@ -27,11 +27,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test DeoptimizeMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build DeoptimizeMethodTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* DeoptimizeMethodTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* DeoptimizeMethodTest * @summary testing of WB::deoptimizeMethod() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java index dfd5dd2a10a..82397fe18b5 100644 --- a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java +++ b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java @@ -30,6 +30,7 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test DeoptimizeMultipleOSRTest * @bug 8061817 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build DeoptimizeMultipleOSRTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java index cde67e20f60..3bf0a1de446 100644 --- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java +++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java @@ -27,11 +27,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test EnqueueMethodForCompilationTest * @bug 8006683 8007288 8022832 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build EnqueueMethodForCompilationTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation -XX:-UseCounterDecay EnqueueMethodForCompilationTest * @summary testing of WB::enqueueMethodForCompilation() * @author igor.ignatyev@oracle.com */ @@ -39,8 +40,8 @@ public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest { public static void main(String[] args) throws Exception { String directive = - "[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " + - " { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]"; + "[{ match:\"*SimpleTestCaseHelper.*\", BackgroundCompilation: false }, " + + " { match:\"*.*\", inline:\"-*SimpleTestCaseHelper.*\"}]"; if (WHITE_BOX.addCompilerDirective(directive) != 2) { throw new RuntimeException("Could not add directive"); } @@ -86,7 +87,10 @@ public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest { checkNotCompiled(); WHITE_BOX.clearMethodState(method); - WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci); + if (!WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci)) { + throw new RuntimeException(method + + " could not be enqueued for compilation"); + } checkCompiled(); deoptimize(); checkNotCompiled(); diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java index 8661b32126f..ea22e257c83 100644 --- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java +++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java @@ -34,16 +34,17 @@ import compiler.whitebox.CompilerWhiteBoxTest; /* * @test - * @bug 8059624 8064669 + * @bug 8059624 8064669 8153265 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build ForceNMethodSweepTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions * -XX:-TieredCompilation -XX:+WhiteBoxAPI - * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* - * -XX:-BackgroundCompilation ForceNMethodSweepTest + * -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* + * -XX:-BackgroundCompilation -XX:-UseCounterDecay ForceNMethodSweepTest * @summary testing of WB::forceNMethodSweep */ public class ForceNMethodSweepTest extends CompilerWhiteBoxTest { @@ -60,6 +61,12 @@ public class ForceNMethodSweepTest extends CompilerWhiteBoxTest { @Override protected void test() throws Exception { + // prime the asserts: get their bytecodes loaded, any lazy computation + // resolved, and executed once + Asserts.assertGT(1, 0, "message"); + Asserts.assertLTE(0, 0, "message"); + Asserts.assertLT(-1, 0, "message"); + checkNotCompiled(); guaranteedSweep(); int usage = getTotalUsage(); diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java index 963258545bc..8b2acf48e28 100644 --- a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java +++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java @@ -34,6 +34,7 @@ import jdk.test.lib.Asserts; * @test GetCodeHeapEntriesTest * @bug 8059624 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management * @build GetCodeHeapEntriesTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java index 285a300c43b..bb9f9fc08f6 100644 --- a/hotspot/test/compiler/whitebox/GetNMethodTest.java +++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java @@ -31,11 +31,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test GetNMethodTest * @bug 8038240 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build GetNMethodTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* GetNMethodTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* GetNMethodTest * @summary testing of WB::getNMethod() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java index a733bc96392..ff34c2ae3c6 100644 --- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java +++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java @@ -27,12 +27,13 @@ * @library /testlibrary /test/lib / * @modules java.base/jdk.internal.misc * java.management - * @build jdk.test.lib.* sun.hotspot.WhiteBox + * @build jdk.test.lib.* + * sun.hotspot.WhiteBox * @build IsMethodCompilableTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main ClassFileInstaller jdk.test.lib.Platform - * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* IsMethodCompilableTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * jdk.test.lib.Platform + * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:-UseCounterDecay -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* IsMethodCompilableTest * @summary testing of WB::isMethodCompilable() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java index 4ba039699e4..eb04651588f 100644 --- a/hotspot/test/compiler/whitebox/LockCompilationTest.java +++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java @@ -25,11 +25,12 @@ * @test LockCompilationTest * @bug 8059624 8152169 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build LockCompilationTest * @run driver ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest + * @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay LockCompilationTest * @summary testing of WB::lock/unlockCompilation() */ @@ -47,10 +48,10 @@ public class LockCompilationTest extends CompilerWhiteBoxTest { // This case waits for 5 seconds and verifies that the method hasn't been // compiled during that time. Only do that for one of the test cases. - // Only compile SimpleTestCase$Helper.method and exclude all other to ensure no + // Only compile SimpleTestCaseHelper.method and exclude all other to ensure no // contention on the compile queue causes problems. String directive = - "[{ match:\"*SimpleTestCase$Helper.method\", Exclude:false}, " + + "[{ match:\"*SimpleTestCaseHelper.method\", Exclude:false}, " + " { match:\"*.*\", Exclude:true}]"; if (WHITE_BOX.addCompilerDirective(directive) != 2) { throw new RuntimeException("Could not add directive"); diff --git a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java index 1e86bfb5594..ba06694bd2a 100644 --- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java +++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java @@ -27,11 +27,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test MakeMethodNotCompilableTest * @bug 8012322 8006683 8007288 8022832 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build MakeMethodNotCompilableTest - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed MakeMethodNotCompilableTest + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed -XX:-UseCounterDecay MakeMethodNotCompilableTest * @summary testing of WB::makeMethodNotCompilable() * @author igor.ignatyev@oracle.com */ @@ -39,8 +40,8 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { private int bci; public static void main(String[] args) throws Exception { String directive = - "[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " + - " { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]"; + "[{ match:\"*SimpleTestCaseHelper.*\", BackgroundCompilation: false }, " + + " { match:\"*.*\", inline:\"-*SimpleTestCaseHelper.*\"}]"; if (WHITE_BOX.addCompilerDirective(directive) != 2) { throw new RuntimeException("Could not add directive"); } @@ -227,7 +228,7 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest { return false; } - private int getBci() { + private int getBci() throws Exception { compile(); checkCompiled(); int result = WHITE_BOX.getMethodEntryBci(method); diff --git a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java index 94846dec932..3ba7b7797b8 100644 --- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java @@ -27,11 +27,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test SetDontInlineMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build SetDontInlineMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* SetDontInlineMethodTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* SetDontInlineMethodTest * @summary testing of WB::testSetDontInlineMethod() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java index 497e8948e91..c04f234dea2 100644 --- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java +++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java @@ -27,11 +27,12 @@ import compiler.whitebox.CompilerWhiteBoxTest; * @test SetForceInlineMethodTest * @bug 8006683 8007288 8022832 * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build SetForceInlineMethodTest * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* SetForceInlineMethodTest + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCaseHelper::* SetForceInlineMethodTest * @summary testing of WB::testSetForceInlineMethod() * @author igor.ignatyev@oracle.com */ diff --git a/hotspot/test/compiler/whitebox/SimpleTestCase.java b/hotspot/test/compiler/whitebox/SimpleTestCase.java index 76954acf20d..2de860e4fe9 100644 --- a/hotspot/test/compiler/whitebox/SimpleTestCase.java +++ b/hotspot/test/compiler/whitebox/SimpleTestCase.java @@ -31,18 +31,17 @@ import sun.hotspot.WhiteBox; public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { /** constructor test case */ - CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE, false), + CONSTRUCTOR_TEST(SimpleTestCaseHelper.CONSTRUCTOR, SimpleTestCaseHelper.CONSTRUCTOR_CALLABLE, false), /** method test case */ - METHOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE, false), + METHOD_TEST(SimpleTestCaseHelper.METHOD, SimpleTestCaseHelper.METHOD_CALLABLE, false), /** static method test case */ - STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE, false), + STATIC_TEST(SimpleTestCaseHelper.STATIC, SimpleTestCaseHelper.STATIC_CALLABLE, false), /** OSR constructor test case */ - OSR_CONSTRUCTOR_TEST(Helper.OSR_CONSTRUCTOR, - Helper.OSR_CONSTRUCTOR_CALLABLE, true), + OSR_CONSTRUCTOR_TEST(SimpleTestCaseHelper.OSR_CONSTRUCTOR, SimpleTestCaseHelper.OSR_CONSTRUCTOR_CALLABLE, true), /** OSR method test case */ - OSR_METHOD_TEST(Helper.OSR_METHOD, Helper.OSR_METHOD_CALLABLE, true), + OSR_METHOD_TEST(SimpleTestCaseHelper.OSR_METHOD, SimpleTestCaseHelper.OSR_METHOD_CALLABLE, true), /** OSR static method test case */ - OSR_STATIC_TEST(Helper.OSR_STATIC, Helper.OSR_STATIC_CALLABLE, true); + OSR_STATIC_TEST(SimpleTestCaseHelper.OSR_STATIC, SimpleTestCaseHelper.OSR_STATIC_CALLABLE, true); private final Executable executable; private final Callable callable; @@ -69,20 +68,21 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { public boolean isOsr() { return isOsr; } +} - private static class Helper { + class SimpleTestCaseHelper { - private static final Callable CONSTRUCTOR_CALLABLE + public static final Callable CONSTRUCTOR_CALLABLE = new Callable() { @Override public Integer call() throws Exception { - return new Helper(1337).hashCode(); + return new SimpleTestCaseHelper(1337).hashCode(); } }; - private static final Callable METHOD_CALLABLE + public static final Callable METHOD_CALLABLE = new Callable() { - private final Helper helper = new Helper(); + private final SimpleTestCaseHelper helper = new SimpleTestCaseHelper(); @Override public Integer call() throws Exception { @@ -90,7 +90,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { } }; - private static final Callable STATIC_CALLABLE + public static final Callable STATIC_CALLABLE = new Callable() { @Override public Integer call() throws Exception { @@ -98,17 +98,17 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { } }; - private static final Callable OSR_CONSTRUCTOR_CALLABLE + public static final Callable OSR_CONSTRUCTOR_CALLABLE = new Callable() { @Override public Integer call() throws Exception { - return new Helper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode(); + return new SimpleTestCaseHelper(null, CompilerWhiteBoxTest.BACKEDGE_THRESHOLD).hashCode(); } }; - private static final Callable OSR_METHOD_CALLABLE + public static final Callable OSR_METHOD_CALLABLE = new Callable() { - private final Helper helper = new Helper(); + private final SimpleTestCaseHelper helper = new SimpleTestCaseHelper(); @Override public Integer call() throws Exception { @@ -116,7 +116,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { } }; - private static final Callable OSR_STATIC_CALLABLE + public static final Callable OSR_STATIC_CALLABLE = new Callable() { @Override public Integer call() throws Exception { @@ -124,22 +124,22 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { } }; - private static final Constructor CONSTRUCTOR; - private static final Constructor OSR_CONSTRUCTOR; - private static final Method METHOD; - private static final Method STATIC; - private static final Method OSR_METHOD; - private static final Method OSR_STATIC; + public static final Constructor CONSTRUCTOR; + public static final Constructor OSR_CONSTRUCTOR; + public static final Method METHOD; + public static final Method STATIC; + public static final Method OSR_METHOD; + public static final Method OSR_STATIC; static { try { - CONSTRUCTOR = Helper.class.getDeclaredConstructor(int.class); + CONSTRUCTOR = SimpleTestCaseHelper.class.getDeclaredConstructor(int.class); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException( "exception on getting method Helper.(int)", e); } try { - OSR_CONSTRUCTOR = Helper.class.getDeclaredConstructor( + OSR_CONSTRUCTOR = SimpleTestCaseHelper.class.getDeclaredConstructor( Object.class, long.class); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException( @@ -153,7 +153,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { private static Method getMethod(String name, Class... parameterTypes) { try { - return Helper.class.getDeclaredMethod(name, parameterTypes); + return SimpleTestCaseHelper.class.getDeclaredMethod(name, parameterTypes); } catch (NoSuchMethodException | SecurityException e) { throw new RuntimeException( "exception on getting method Helper." + name, e); @@ -195,7 +195,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { */ private static int warmup(Method m) throws Exception { waitAndDeoptimize(m); - Helper helper = new Helper(); + SimpleTestCaseHelper helper = new SimpleTestCaseHelper(); int result = 0; for (long i = 0; i < CompilerWhiteBoxTest.THRESHOLD; ++i) { result += (int)m.invoke(helper, 1); @@ -254,12 +254,12 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { private final int x; // for method and OSR method test case - public Helper() { + public SimpleTestCaseHelper() { x = 0; } // for OSR constructor test case - private Helper(Object o, long limit) throws Exception { + private SimpleTestCaseHelper(Object o, long limit) throws Exception { int result = 0; if (limit != 1) { result = warmup(OSR_CONSTRUCTOR); @@ -272,7 +272,7 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { } // for constructor test case - private Helper(int x) { + private SimpleTestCaseHelper(int x) { this.x = x; } @@ -281,4 +281,4 @@ public enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase { return x; } } -} + diff --git a/hotspot/test/gc/CondCardMark/Basic.java b/hotspot/test/gc/CondCardMark/Basic.java index f936ce88210..a6cc3a02cbf 100644 --- a/hotspot/test/gc/CondCardMark/Basic.java +++ b/hotspot/test/gc/CondCardMark/Basic.java @@ -26,6 +26,7 @@ * @bug 8076987 * @bug 8078438 * @summary Verify UseCondCardMark works + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build Basic * @run main/othervm -Xint Basic diff --git a/hotspot/test/gc/TestDisableExplicitGC.java b/hotspot/test/gc/TestDisableExplicitGC.java index 10199fd0bb0..316f50c4314 100644 --- a/hotspot/test/gc/TestDisableExplicitGC.java +++ b/hotspot/test/gc/TestDisableExplicitGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,6 +26,8 @@ * @requires vm.opt.DisableExplicitGC == null * @summary Verify GC behavior with DisableExplicitGC flag. * @library /testlibrary + * @modules java.base/jdk.internal.misc + * @modules jdk.management/com.sun.management.internal * @run main/othervm -Xlog:gc=debug TestDisableExplicitGC * @run main/othervm/fail -XX:+DisableExplicitGC -Xlog:gc=debug TestDisableExplicitGC * @run main/othervm -XX:-DisableExplicitGC -Xlog:gc=debug TestDisableExplicitGC diff --git a/hotspot/test/gc/TestSmallHeap.java b/hotspot/test/gc/TestSmallHeap.java index ffafa078a71..9c0dba31fc0 100644 --- a/hotspot/test/gc/TestSmallHeap.java +++ b/hotspot/test/gc/TestSmallHeap.java @@ -30,6 +30,7 @@ * @requires vm.opt.UseCompressedOops != false * @summary Verify that starting the VM with a small heap works * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @ignore 8076621 * @build TestSmallHeap diff --git a/hotspot/test/gc/TestVerifySilently.java b/hotspot/test/gc/TestVerifySilently.java index 864a1ef8d03..a387ae4df41 100644 --- a/hotspot/test/gc/TestVerifySilently.java +++ b/hotspot/test/gc/TestVerifySilently.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -34,6 +34,7 @@ import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; import java.util.ArrayList; import java.util.Collections; +import jdk.test.lib.Utils; class RunSystemGC { public static void main(String args[]) throws Exception { @@ -43,19 +44,11 @@ class RunSystemGC { public class TestVerifySilently { - private static String[] getTestJavaOpts() { - String testVmOptsStr = System.getProperty("test.java.opts"); - if (!testVmOptsStr.isEmpty()) { - return testVmOptsStr.split(" "); - } else { - return new String[] {}; - } - } private static OutputAnalyzer runTest(boolean verifySilently) throws Exception { ArrayList vmOpts = new ArrayList(); - Collections.addAll(vmOpts, getTestJavaOpts()); + Collections.addAll(vmOpts, Utils.getFilteredTestJavaOpts("-Xlog.*")); Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyDuringStartup", "-XX:+VerifyBeforeGC", diff --git a/hotspot/test/gc/TestVerifySubSet.java b/hotspot/test/gc/TestVerifySubSet.java index 7126b9658b5..9208d478247 100644 --- a/hotspot/test/gc/TestVerifySubSet.java +++ b/hotspot/test/gc/TestVerifySubSet.java @@ -34,6 +34,7 @@ import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; import java.util.ArrayList; import java.util.Collections; +import jdk.test.lib.Utils; class RunSystemGC { public static void main(String args[]) throws Exception { @@ -42,19 +43,11 @@ class RunSystemGC { } public class TestVerifySubSet { - private static String[] getTestJavaOpts() { - String testVmOptsStr = System.getProperty("test.java.opts"); - if (!testVmOptsStr.isEmpty()) { - return testVmOptsStr.split(" "); - } else { - return new String[] {}; - } - } private static OutputAnalyzer runTest(String subset) throws Exception { ArrayList vmOpts = new ArrayList(); - Collections.addAll(vmOpts, getTestJavaOpts()); + Collections.addAll(vmOpts, Utils.getFilteredTestJavaOpts("-Xlog.*")); Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions", "-XX:+VerifyBeforeGC", "-XX:+VerifyAfterGC", diff --git a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java index 4d0a2953e88..91935810e6d 100644 --- a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java @@ -31,6 +31,7 @@ import jdk.test.lib.DynamicVMOption; * @bug 8028391 * @summary Verify that MaxHeapFreeRatio flag is manageable * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.management * @run main TestDynMaxHeapFreeRatio * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio diff --git a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java index 53a21a1e9f2..f8dca9b8223 100644 --- a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java +++ b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java @@ -26,6 +26,7 @@ * @bug 8028391 * @summary Verify that MinHeapFreeRatio flag is manageable * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.management * @run main TestDynMinHeapFreeRatio * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMinHeapFreeRatio diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java index d25b19c3439..1864a472ea5 100644 --- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java +++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java @@ -27,6 +27,7 @@ * @bug 8021879 * @requires vm.gc=="null" | vm.gc=="G1" * @summary Verify that the flag G1HeapRegionSize is updated properly + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @library /testlibrary * @run main TestG1HeapRegionSize diff --git a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java index 19d03b28c97..85d0fcd6031 100644 --- a/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java +++ b/hotspot/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java @@ -39,7 +39,7 @@ import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; import jdk.test.lib.Utils; import jdk.test.lib.HeapRegionUsageTool; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class TestMaxMinHeapFreeRatioFlags { @@ -88,6 +88,7 @@ public class TestMaxMinHeapFreeRatioFlags { (useXmaxf ? "-Xmaxf" + maxRatio / 100.0 : "-XX:MaxHeapFreeRatio=" + maxRatio), "-Xmx" + MAX_HEAP_SIZE, "-Xms" + HEAP_SIZE, + "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:NewSize=" + NEW_SIZE, "-XX:MaxNewSize=" + MAX_NEW_SIZE, "-XX:" + (shrinkHeapInSteps ? '+' : '-') + "ShrinkHeapInSteps", @@ -119,6 +120,7 @@ public class TestMaxMinHeapFreeRatioFlags { Collections.addAll(vmOptions, (useXminf ? "-Xminf" + minRatio / 100.0 : "-XX:MinHeapFreeRatio=" + minRatio), (useXmaxf ? "-Xmaxf" + maxRatio / 100.0 : "-XX:MaxHeapFreeRatio=" + maxRatio), + "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-version" ); ProcessBuilder procBuilder = ProcessTools.createJavaProcessBuilder(vmOptions.toArray(new String[vmOptions.size()])); diff --git a/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java b/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java index 2e386c2f6d2..2891eb1daa5 100644 --- a/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java +++ b/hotspot/test/gc/arguments/TestSurvivorRatioFlag.java @@ -74,6 +74,7 @@ public class TestSurvivorRatioFlag { Collections.addAll(vmOptions, "-Xbootclasspath/a:.", + "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-XX:GCLockerEdenExpansionPercent=0", diff --git a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java index b1198e77251..aadb620ef9d 100644 --- a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java +++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java @@ -42,7 +42,7 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import jdk.test.lib.HeapRegionUsageTool; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import jdk.test.lib.OutputAnalyzer; import jdk.test.lib.ProcessTools; import jdk.test.lib.Utils; @@ -130,6 +130,7 @@ public class TestTargetSurvivorRatioFlag { LinkedList vmOptions = new LinkedList<>(options); Collections.addAll(vmOptions, "-Xbootclasspath/a:.", + "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", "-XX:+UseAdaptiveSizePolicy", diff --git a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java index 3706d955bda..d092c11dbca 100644 --- a/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java +++ b/hotspot/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java @@ -28,6 +28,7 @@ * @summary Runs an simple application (GarbageProducer) with various combinations of -XX:{+|-}Verify{After|Before}GC flags and checks that output contain or doesn't contain expected patterns + * @modules java.base/jdk.internal.misc * @modules java.management * @library /testlibrary * @run driver TestVerifyBeforeAndAfterGCFlags diff --git a/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java index 1cd9e1191de..7b262fd3723 100644 --- a/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java +++ b/hotspot/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java @@ -27,6 +27,7 @@ * @summary Ensure that UseDynamicNumberOfGCThreads runs * @requires vm.gc=="null" * @key gc + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java b/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java index 4c88649d1b2..f572ed0b757 100644 --- a/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java +++ b/hotspot/test/gc/g1/TestGreyReclaimedHumongousObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -27,6 +27,7 @@ * @requires vm.gc == "G1" | vm.gc == "null" * @summary Test handling of marked but unscanned reclaimed humongous objects. * @key gc + * @modules jdk.management * @run main/othervm -XX:+UseG1GC -Xss32m -Xmx128m -XX:G1HeapRegionSize=1m * -XX:+UnlockExperimentalVMOptions * -XX:+G1EagerReclaimHumongousObjects diff --git a/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java b/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java index 2173dbdb9f4..a7a34442814 100644 --- a/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java +++ b/hotspot/test/gc/g1/TestHumongousAllocNearlyFullRegion.java @@ -26,6 +26,7 @@ * @bug 8143587 * @summary G1: humongous object allocations should work even when there is * not enough space in the heapRegion to fit a filler object. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run driver TestHumongousAllocNearlyFullRegion */ diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java index a689fbc955d..da1c08a1be8 100644 --- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java +++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java @@ -28,6 +28,7 @@ * @summary Verify that heap shrinks after GC in the presence of fragmentation * due to humongous objects * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10 * -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc diff --git a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java index 28f1b166a4d..463fadcbbb8 100644 --- a/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java +++ b/hotspot/test/gc/g1/TestLargePageUseForAuxMemory.java @@ -26,6 +26,7 @@ * @summary Test that auxiliary data structures are allocated using large pages if available. * @bug 8058354 8079208 * @key gc + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @requires (vm.gc=="G1" | vm.gc=="null") * @build jdk.test.lib.* sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/g1/TestPLABOutput.java b/hotspot/test/gc/g1/TestPLABOutput.java index 4b85b1cbcd6..f7d7cebf89c 100644 --- a/hotspot/test/gc/g1/TestPLABOutput.java +++ b/hotspot/test/gc/g1/TestPLABOutput.java @@ -27,6 +27,7 @@ * @summary Check that G1 does not report empty PLAB statistics in the first evacuation. * @requires vm.gc=="G1" | vm.gc=="null" * @key gc + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/g1/TestRegionLivenessPrint.java b/hotspot/test/gc/g1/TestRegionLivenessPrint.java index 17af16c38a8..9abbe4c1570 100644 --- a/hotspot/test/gc/g1/TestRegionLivenessPrint.java +++ b/hotspot/test/gc/g1/TestRegionLivenessPrint.java @@ -32,7 +32,7 @@ * @build TestRegionLivenessPrint * @run main ClassFileInstaller sun.hotspot.WhiteBox * sun.hotspot.WhiteBox$WhiteBoxPermission - * @run main/othervm -Xbootclasspath/a:. -XX:+WhiteBoxAPI -XX:+UseG1GC -Xmx128M -XX:G1HeapRegionSize=1m -Xlog:gc+liveness=trace TestRegionLivenessPrint + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC -Xmx128M -XX:G1HeapRegionSize=1m -Xlog:gc+liveness=trace TestRegionLivenessPrint */ import sun.hotspot.WhiteBox; diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java index 65247c6edf4..1600989394e 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java @@ -36,7 +36,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; -import sun.misc.Unsafe; // for ADDRESS_SIZE +import jdk.internal.misc.Unsafe; // for ADDRESS_SIZE import sun.hotspot.WhiteBox; public class TestShrinkAuxiliaryData { @@ -52,6 +52,7 @@ public class TestShrinkAuxiliaryData { "-Xlog:gc=debug", "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", + "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-Xbootclasspath/a:.", }; diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java index e4149b4b7c1..ae12f5c83d3 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java @@ -25,6 +25,7 @@ * @test TestShrinkAuxiliaryData00 * @bug 8038423 8061715 * @summary Checks that decommitment occurs for JVM with different + * @ignore 8155957 * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java index db611f6ac09..0e00ffee174 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java @@ -26,6 +26,7 @@ * @bug 8038423 8061715 8078405 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @ignore 8155957 * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" * @library /testlibrary /test/lib diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java index 8e645ed5b7e..afad2ca15e7 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java @@ -26,6 +26,7 @@ * @bug 8038423 8061715 8078405 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @ignore 8155957 * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" * @library /testlibrary /test/lib diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java index 2b4401fa46b..598caaaa63a 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java @@ -26,6 +26,7 @@ * @bug 8038423 8061715 8078405 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @ignore 8155957 * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" * @library /testlibrary /test/lib diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java index b0854ea2a10..13ad25d305e 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java @@ -26,6 +26,7 @@ * @bug 8038423 8061715 8078405 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @ignore 8155957 * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" * @library /testlibrary /test/lib diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java index 60f6e5037c5..8e8f84f2ba9 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java @@ -26,6 +26,7 @@ * @bug 8038423 8061715 8078405 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @ignore 8155957 * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" * @library /testlibrary /test/lib diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java index 6b73629b70a..249a7216d42 100644 --- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java +++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java @@ -26,6 +26,7 @@ * @bug 8038423 8061715 8078405 * @summary Checks that decommitment occurs for JVM with different * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values + * @ignore 8155957 * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null" * @library /testlibrary /test/lib diff --git a/hotspot/test/gc/g1/humongousObjects/ClassLoaderGenerator.java b/hotspot/test/gc/g1/humongousObjects/ClassLoaderGenerator.java new file mode 100644 index 00000000000..6767e4b3d23 --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/ClassLoaderGenerator.java @@ -0,0 +1,100 @@ +/* + * 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 gc.g1.humongousObjects; + +import gc.testlibrary.Helpers; + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * Generates non-humongous and humongous class loaders. + * Since the generation depends on current host architecture it cannot be done as part of pre-compilation step + */ +public class ClassLoaderGenerator { + public static void main(String[] args) throws IOException { + + if (args.length != 1) { + throw new Error("Test Bug: Expected region size wasn't provided as command line argument"); + } + + long regionSize = Long.parseLong(args[0]) * 1024 * 1024; + + Path wrkDir = Paths.get(""); + generateClassLoader(regionSize, wrkDir); + + } + + public static void generateClassLoader(long regionSize, Path wrkDir) throws IOException { + // Generating simple classloader + String finalSimpleClassLoaderPrototype = TestHumongousClassLoader.GENERIC_PROTOTYPE + .replace("${Methods}", + TestHumongousClassLoader.LOAD_CLASS_METHOD_PROTOTYPE + .replace("${ClassLoadFilter}", + "fileName.equals(\"" + TestHumongousClassLoader.HUMONGOUS_CLASSLOADER_NAME + + "\")")) + .replace("${ClassHeader}", TestHumongousClassLoader.CLASS_HEADER) + .replace("${ConstructorClause}", TestHumongousClassLoader.CONSTUCTOR_PROTOTYPE); + + Helpers.generateByTemplateAndCompile(TestHumongousClassLoader.SIMPLE_CLASSLOADER_NAME, "ClassLoader", + finalSimpleClassLoaderPrototype, TestHumongousClassLoader.CONSTUCTOR_PROTOTYPE, regionSize / 4, + wrkDir, TestHumongousClassLoader.SIMPLE_CLASSLOADER_NAME + "Base"); + + + // Preparations for generating humongous classloader + + // Generating condition for loadClass method of generated class loader + // We want the generated class loader to load only classes from G1SampleClass enum + // All other classes should be loaded by parent classloader + // As result we get full loadClass method + StringBuilder classesToLoadBuilder = new StringBuilder(); + for (G1SampleClass g1SampleClass : G1SampleClass.values()) { + if (classesToLoadBuilder.length() != 0) { + classesToLoadBuilder.append(" || "); + } + classesToLoadBuilder.append("fileName.startsWith(\"" + Helpers.enumNameToClassName(g1SampleClass.name()) + + "\")"); + } + + // Generating final class loader prototype - with specified methods,header and constructor + String finalHumongousClassLoaderPrototype = TestHumongousClassLoader.GENERIC_PROTOTYPE + .replace("${Methods}", + TestHumongousClassLoader.LOAD_CLASS_METHOD_PROTOTYPE + .replace("${ClassLoadFilter}", classesToLoadBuilder)) + .replace("${ClassHeader}", TestHumongousClassLoader.CLASS_HEADER) + .replace("${ConstructorClause}", TestHumongousClassLoader.CONSTUCTOR_PROTOTYPE); + + + // Generating humongous classloader with specified name, base class, final class prototype and + // constructor prototype for filler classes + // Generated class instance should be humongous since we specify size of (regionSize * 3 / 4) + Helpers.generateByTemplateAndCompile(TestHumongousClassLoader.HUMONGOUS_CLASSLOADER_NAME, "ClassLoader", + finalHumongousClassLoaderPrototype, TestHumongousClassLoader.CONSTUCTOR_PROTOTYPE, + regionSize * 3 / 4, + wrkDir, TestHumongousClassLoader.HUMONGOUS_CLASSLOADER_NAME + "Base"); + + + } +} diff --git a/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java b/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java index d843d35dff4..7fe5262b7f8 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHeapCounters.java @@ -39,6 +39,7 @@ import java.util.List; * @summary Checks that heap counters work as expected after humongous allocations/deallocations * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox * gc.testlibrary.Helpers diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java new file mode 100644 index 00000000000..03952363fb4 --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousClassLoader.java @@ -0,0 +1,222 @@ +/* + * 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 gc.g1.humongousObjects; + +import gc.testlibrary.Helpers; +import jdk.test.lib.Asserts; +import sun.hotspot.WhiteBox; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Path; +import java.nio.file.Paths; + +/** + * @test gc.g1.humongousObjects.TestHumongousClassLoader + * @summary Checks that unreachable classes and unreachable humongous class loader are unloaded after GC + * @requires vm.gc=="G1" | vm.gc=="null" + * @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M" + * @requires vm.opt.ExplicitGCInvokesConcurrent != true + * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc + * @modules java.management + * @build sun.hotspot.WhiteBox + * gc.testlibrary.Helpers + * gc.g1.humongousObjects.G1SampleClass + * gc.g1.humongousObjects.ClassLoaderGenerator + * gc.g1.humongousObjects.TestHumongousClassLoader + * + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * + * @run main/othervm/timeout=240 -Xms256M -Xmx256M -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * gc.g1.humongousObjects.ClassLoaderGenerator 1 + * + * @run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_Full_GC.log + * -XX:G1HeapRegionSize=1M + * gc.g1.humongousObjects.TestHumongousClassLoader FULL_GC + * + * @run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_Full_GC_Mem_Pressure.log + * -XX:G1HeapRegionSize=1M + * gc.g1.humongousObjects.TestHumongousClassLoader FULL_GC_MEMORY_PRESSURE + * + *@run main/othervm -Xms256M -Xmx256M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -Xlog:class+load,class+unload=debug:file=TestHumongousClassLoader_CMC.log + * -XX:G1HeapRegionSize=1M -XX:MaxTenuringThreshold=1 + * gc.g1.humongousObjects.TestHumongousClassLoader CMC + * + */ + +public class TestHumongousClassLoader { + + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + private static final String SAMPLE_CLASS_NAME_PREFIX = "SampleClassFiller"; + public static final String SIMPLE_CLASSLOADER_NAME = "SimpleClassLoader"; + public static final String HUMONGOUS_CLASSLOADER_NAME = "HumongousClassLoader"; + + + public static final String LOAD_CLASS_METHOD_PROTOTYPE = + " @Override\n" + + " public Class loadClass(String fileName) throws ClassNotFoundException {\n" + + " if (${ClassLoadFilter}) {\n" + + " System.out.println(\"Loading class \" + fileName);\n" + + " byte[] b = null;\n" + + " try {\n" + + " b = Files.readAllBytes(new File(fileName + \".class\").toPath());\n" + + " } catch (IOException e) {\n" + + " e.printStackTrace();\n" + + " }\n" + + " Class c = defineClass(fileName, b, 0, b.length);\n" + + " resolveClass(c);\n" + + " return c;\n" + + " } else {\n" + + " return super.loadClass(fileName);\n" + + " }\n" + + "\n" + + "\n" + + " }\n"; + + public static final String CLASS_HEADER = "import java.io.File;\n" + + "import java.io.IOException;\n" + + "import java.nio.file.Files;\n" + + "import java.nio.file.Paths;\n"; + + public static final String GENERIC_PROTOTYPE = "${ClassHeader}\n" + + "public class ${ClassName} extends ${BaseClass}{\n" + + " ${ConstructorClause}\n" + + " ${Methods}\n" + + " ${Fields}\n" + + "}\n"; + + public static final String CONSTUCTOR_PROTOTYPE = "public ${ClassName}(ClassLoader parent) { super(parent);}\n"; + + private enum GC { + FULL_GC { + @Override + public void provoke() { + System.gc(); + } + }, + CMC { + @Override + public void provoke() { + // We need 2 young gc to promote class loader to old gen + // Otherwise it will not be unloaded after CMC + WHITE_BOX.youngGC(); + Helpers.waitTillCMCFinished(WHITE_BOX, 0); + WHITE_BOX.youngGC(); + Helpers.waitTillCMCFinished(WHITE_BOX, 0); + WHITE_BOX.g1StartConcMarkCycle(); + Helpers.waitTillCMCFinished(WHITE_BOX, 0); + } + }, + FULL_GC_MEMORY_PRESSURE { + @Override + public void provoke() { + WHITE_BOX.fullGC(); + } + }; + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + + public abstract void provoke(); + } + + public static void main(String[] args) throws ClassNotFoundException, InstantiationException, + IllegalAccessException, IOException, NoSuchMethodException, InvocationTargetException { + + if (args.length != 1) { + throw new Error("Test Bug: Expected GC type wasn't provided as command line argument"); + } + GC gc = GC.valueOf(args[0]); + + Path wrkDir = Paths.get(""); + URL[] url = {wrkDir.toUri().toURL()}; + URLClassLoader urlLoader = new URLClassLoader(url); + + Class simpleClassLoaderClass = urlLoader.loadClass(SIMPLE_CLASSLOADER_NAME); + + ClassLoader simpleClassLoader = (ClassLoader) simpleClassLoaderClass + .getConstructor(java.lang.ClassLoader.class) + .newInstance(TestHumongousClassLoader.class.getClassLoader()); + + // Sanity check + Asserts.assertEquals(WB.g1IsHumongous(simpleClassLoader), false, + "Test Bug: simpleClassLoader is expected to be non-humongous but it's humongous"); + + + Class humongousClassLoaderClass = simpleClassLoader.loadClass(HUMONGOUS_CLASSLOADER_NAME); + + ClassLoader humongousClassLoader = (ClassLoader) humongousClassLoaderClass + .getConstructor(java.lang.ClassLoader.class) + .newInstance(simpleClassLoader); + + // Sanity check + Asserts.assertEquals(WB.g1IsHumongous(humongousClassLoader), true, + "Test Bug: humongousClassLoader is expected to be humongous but it's non-humongous"); + + //Asserts.assertEquals(1,0); + + Object[] loadedClasses = new Object[]{ + G1SampleClass.LARGEST_NON_HUMONGOUS.getCls(humongousClassLoader, wrkDir, SAMPLE_CLASS_NAME_PREFIX) + .newInstance(), + G1SampleClass.SMALLEST_HUMONGOUS.getCls(humongousClassLoader, wrkDir, SAMPLE_CLASS_NAME_PREFIX) + .newInstance(), + G1SampleClass.ONE_REGION_HUMONGOUS.getCls(humongousClassLoader, wrkDir, SAMPLE_CLASS_NAME_PREFIX) + .newInstance(), + G1SampleClass.TWO_REGION_HUMONGOUS.getCls(humongousClassLoader, wrkDir, SAMPLE_CLASS_NAME_PREFIX) + .newInstance(), + }; + + // forgetting references to loaded classes + for (int i = 0; i < loadedClasses.length; ++i) { + loadedClasses[i] = null; + } + + // forgetting referencies to classloaders + humongousClassLoader = null; + humongousClassLoaderClass = null; + + simpleClassLoader = null; + simpleClassLoaderClass = null; + + gc.provoke(); + + // Test checks + Asserts.assertEquals(WB.isClassAlive(HUMONGOUS_CLASSLOADER_NAME), false, + String.format("Classloader class %s is loaded after we forget all references to it", + HUMONGOUS_CLASSLOADER_NAME)); + + for (G1SampleClass sampleClass : G1SampleClass.values()) { + String className = Helpers.enumNameToClassName(sampleClass.name()) + "Class"; + Asserts.assertEquals(WB.isClassAlive(className), false, + String.format("Class %s is loaded after we forget all references to it", className)); + } + } + +} diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java index 66ca21bf05e..a7d1cc852e8 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousMovement.java @@ -41,6 +41,7 @@ import java.util.stream.Collectors; * @summary Checks that Humongous objects are not moved during GC * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox * gc.testlibrary.Helpers diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java index 118c3114b0c..e1ad30c56f0 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousNonArrayAllocation.java @@ -40,6 +40,7 @@ import java.nio.file.Paths; * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.G1HeapRegionSize == "null" | vm.opt.G1HeapRegionSize == "1M" * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox * gc.testlibrary.Helpers diff --git a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java index 3b66bc7507c..8ff4a568600 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java +++ b/hotspot/test/gc/g1/humongousObjects/TestHumongousThreshold.java @@ -33,6 +33,7 @@ import sun.hotspot.WhiteBox; * @summary Checks that objects larger than half a region are allocated as humongous * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox * gc.testlibrary.Helpers diff --git a/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java b/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java index be17365da8a..f5f5484b946 100644 --- a/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java +++ b/hotspot/test/gc/g1/humongousObjects/TestObjectCollected.java @@ -39,6 +39,7 @@ import java.lang.ref.WeakReference; * actual object behavior * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox * gc.testlibrary.Helpers diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java new file mode 100644 index 00000000000..17aa97413eb --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java @@ -0,0 +1,199 @@ +/* + * 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 gc.g1.humongousObjects.objectGraphTest; + +import gc.testlibrary.Helpers; +import jdk.test.lib.Asserts; +import sun.hotspot.WhiteBox; + +import java.util.Arrays; +import java.util.List; +import java.util.function.Consumer; + +/** + * Provides methods to initiate GC of requested type and + * checks for states of humongous and non-humongous soft/weak externally + * referenced objects after GCs + */ +public enum GC { + + YOUNG_GC { + @Override + public Runnable get() { + return WHITE_BOX::youngGC; + } + + public Consumer> getChecker() { + return getCheckerImpl(false, false, true, false); + } + + @Override + public List shouldContain() { + return Arrays.asList(GCTokens.WB_INITIATED_YOUNG_GC); + } + + @Override + public List shouldNotContain() { + return Arrays.asList(GCTokens.WB_INITIATED_MIXED_GC, GCTokens.FULL_GC, GCTokens.WB_INITIATED_CMC, + GCTokens.CMC, GCTokens.YOUNG_GC); + } + }, + FULL_GC { + @Override + public Runnable get() { + return System::gc; + } + + public Consumer> getChecker() { + return getCheckerImpl(true, false, true, false); + } + + @Override + public List shouldContain() { + return Arrays.asList(GCTokens.FULL_GC); + } + + @Override + public List shouldNotContain() { + return Arrays.asList(GCTokens.WB_INITIATED_YOUNG_GC, GCTokens.WB_INITIATED_MIXED_GC, + GCTokens.WB_INITIATED_CMC, GCTokens.CMC, GCTokens.YOUNG_GC); + } + }, + + FULL_GC_MEMORY_PRESSURE { + @Override + public Runnable get() { + return WHITE_BOX::fullGC; + } + + public Consumer> getChecker() { + return getCheckerImpl(true, true, true, true); + } + + @Override + public List shouldContain() { + return Arrays.asList(GCTokens.FULL_GC_MEMORY_PRESSURE); + } + + @Override + public List shouldNotContain() { + return Arrays.asList(GCTokens.WB_INITIATED_YOUNG_GC, GCTokens.WB_INITIATED_MIXED_GC, + GCTokens.WB_INITIATED_CMC, GCTokens.CMC, GCTokens.YOUNG_GC, GCTokens.FULL_GC); + } + }; + + protected String getErrorMessage(ReferenceInfo ref, boolean expectedNull, String gcType) { + return String.format("Externally effectively %s referenced %shumongous object was%s deleted after %s", + (ref.softlyReachable ? "soft" : "weak"), (ref.effectiveHumongous ? "" : "non-"), + (expectedNull ? " not" : ""), gcType); + } + + protected Consumer> getCaseCheck(boolean expectedNull) { + return expectedNull + ? r -> Asserts.assertNull(r.reference.get(), getErrorMessage(r, true, name())) + : r -> Asserts.assertNotNull(r.reference.get(), getErrorMessage(r, false, name())); + } + + protected Consumer> getCheckerImpl(boolean weakH, boolean softH, + boolean weakS, boolean softS) { + return new Checker(getCaseCheck(weakH), getCaseCheck(softH), getCaseCheck(weakS), getCaseCheck(softS)); + } + + protected String getGcLogName(String prefix) { + return prefix + "_" + name() + ".gc.log"; + } + + private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); + + /** + * @return method to initiate GC + */ + public abstract Runnable get(); + + /** + * @return checker for objects' states after GC + */ + public abstract Consumer> getChecker(); + + /** + * @return list of tokens that should be contained in gc log after gc of specified type + */ + public abstract List shouldContain(); + + /** + * @return list of tokens that should not be contained in gc log after gc of specified type + */ + public abstract List shouldNotContain(); + + + /** + * Checks object' state after gc + * Contains 4 Consumers which are called depending on humongous/non-humongous and + * external weak/soft referenced objects + */ + private static class Checker implements Consumer> { + // 4 consumers with checks for (humongous /simple objects)*(weak/soft referenced) + final Consumer> weakHumongousCheck; + final Consumer> softHumongousCheck; + final Consumer> weakSimpleCheck; + final Consumer> softSimpleCheck; + + public Checker(Consumer> weakHumongousCheck, + Consumer> softHumongousCheck, + Consumer> weakSimpleCheck, + Consumer> softSimpleCheck) { + this.weakHumongousCheck = weakHumongousCheck; + this.softHumongousCheck = softHumongousCheck; + this.weakSimpleCheck = weakSimpleCheck; + this.softSimpleCheck = softSimpleCheck; + } + + public void accept(ReferenceInfo ref) { + + System.out.println("reference.get() returned " + ref.reference.get()); + if (ref.effectiveHumongous && ref.softlyReachable) { + System.out.println("soft and humongous"); + softHumongousCheck.accept(ref); + } + + if (ref.effectiveHumongous && !ref.softlyReachable) { + System.out.println("weak and humongous"); + weakHumongousCheck.accept(ref); + + } + + if (!ref.effectiveHumongous && ref.softlyReachable) { + System.out.println("soft and non-humongous"); + softSimpleCheck.accept(ref); + } + + if (!ref.effectiveHumongous && !ref.softlyReachable) { + System.out.println("weak and non-humongous"); + weakSimpleCheck.accept(ref); + } + } + } + +} diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GCTokens.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GCTokens.java new file mode 100644 index 00000000000..e8a52001d65 --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GCTokens.java @@ -0,0 +1,42 @@ +/* + * 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 gc.g1.humongousObjects.objectGraphTest; + +/** + * Contains tokens that could appear in gc log + */ +public final class GCTokens { + // Private c-tor to prevent instantiating + private GCTokens() { + } + + public static final String WB_INITIATED_YOUNG_GC = "Young (WhiteBox Initiated Young GC)"; + public static final String WB_INITIATED_MIXED_GC = "Pause Mixed (WhiteBox Initiated Young GC)"; + public static final String WB_INITIATED_CMC = "WhiteBox Initiated Concurrent Mark"; + public static final String FULL_GC = "Full (System.gc())"; + public static final String FULL_GC_MEMORY_PRESSURE = "WhiteBox Initiated Full GC"; + public static final String CMC = "Concurrent Mark)"; + public static final String YOUNG_GC = "GC pause (young)"; +} diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ObjectGraph.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ObjectGraph.java new file mode 100644 index 00000000000..48ca3d3fdcc --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ObjectGraph.java @@ -0,0 +1,150 @@ +/* + * 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 gc.g1.humongousObjects.objectGraphTest; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Predicate; + +public class ObjectGraph { + + private ObjectGraph() { + } + + public enum ReferenceType { + NONE, + WEAK, + SOFT, + STRONG; + } + + /** + * Performs operation on all nodes that are reachable from initial ones + * + * @param nodes initial nodes + * @param operation operation + */ + public static void propagateTransitiveProperty(Set nodes, Consumer operation) { + Deque roots = new ArrayDeque<>(); + nodes.stream().forEach(roots::push); + ObjectGraph.enumerateAndMark(roots, operation); + } + + /** + * Connects graph's vertexes with single-directed (vertex -> neighbour) link + * + * @param vertex who is connected + * @param neighbour connected to whom + */ + private static void connectVertexes(Object[] vertex, Object[] neighbour) { + + // check if vertex array is full + if (vertex[vertex.length - 1] != null) { + throw new Error("Array is full and no connections could be added"); + } + int i = 0; + while (vertex[i] != null) { + ++i; + } + vertex[i] = neighbour; + } + + + /** + * Builds object graph using description from list of parsed nodes. Graph uses Object[] as nodes, first n elements + * of array are links to connected nodes, others are null. Then runs visitors on generated graph + * + * @param parsedNodes list of nodes' description + * @param visitors visitors that will visit each node of generated graph + * @param humongousAllocationSize size of humongous node + * @param simpleAllocationSize size of simple (non-humongous) node + * @return root reference to generated graph + */ + public static Object[] generateObjectNodes(List parsedNodes, + Map, + BiConsumer> visitors, + int humongousAllocationSize, int simpleAllocationSize) { + + Object[][] objectNodes = new Object[parsedNodes.size()][]; + + // Allocating nodes on Object[] + for (int i = 0; i < parsedNodes.size(); ++i) { + objectNodes[i] = new Object[(parsedNodes.get(i).isHumongous ? + humongousAllocationSize : simpleAllocationSize)]; + } + + // Connecting nodes on allocated on Object[] + for (int i = 0; i < parsedNodes.size(); ++i) { + for (int j = 0; j < parsedNodes.get(i).getConnectedTo().size(); ++j) { + connectVertexes(objectNodes[i], objectNodes[parsedNodes.get(i).getConnectedTo().get(j)]); + } + } + + // Calling visitors + visitors.entrySet() + .stream() + .forEach( + entry -> parsedNodes.stream() + .filter(parsedNode -> entry.getKey().test(parsedNode)) + .forEach(node -> entry.getValue().accept(node, objectNodes)) + ); + + return objectNodes[0]; + } + + /** + * Enumerates graph starting with provided vertexes. All vertexes that are reachable from the provided ones are + * marked + * + * @param markedParents provided vertexes + * @param markVertex lambda which marks vertexes + */ + public static void enumerateAndMark(Deque markedParents, + Consumer markVertex) { + Map isVisited = new HashMap<>(); + while (!markedParents.isEmpty()) { + Object[] vertex = markedParents.pop(); + if (vertex == null || isVisited.containsKey(vertex)) { + continue; + } + isVisited.put(vertex, true); + markVertex.accept(vertex); + + for (int i = 0; i < vertex.length; ++i) { + if (vertex[i] == null) { + break; + } + markedParents.add((Object[]) vertex[i]); + } + } + } + +} diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/README b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/README new file mode 100644 index 00000000000..1c3522e6ff3 --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/README @@ -0,0 +1,56 @@ +/* + * 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. + * + */ + +The test checks that after different type of GC unreachable objects behave as expected: + +1. Young GC - weakly referenced non-humongous objects are collected, other objects are not collected. + +2. Full GC - weakly referenced non-humongous and humongous objects are collected, softly referenced non-humongous and + humongous objects are not collected. + +3. Full GC with memory pressure - weakly and softly referenced non-humongous and humongous objects are collected. + +The test gets gc type as a command line argument. +Then the test allocates object graph in heap (currently testing scenarios are pre-generated and stored in +TestcaseData.getPregeneratedTestcases()) with TestObjectGraphAfterGC::allocateObjectGraph. + +Since we are testing humongous objects we need pretty unusual nodes - arrays of Object. +We need this since only large enough array could be Humongous object (in fact class with huge amount of fields is +humongous too but it's for other tests). +ObjectGraph class generates object graph with Object[] nodes. It also provides a way to collect +information about each node using "visitor" pattern. + +Using visitors we build Set of ReferenceInfo instances which contains the following information: +reference - external weak/soft reference to graph's node +graphId and nodeId - graph's and node's ids - we need this for error handling +softlyReachable - is node effectively referenced by external soft reference. It could be when external +soft reference or when this node is reachable from node that exteranally referenced by soft reference +effectiveHumongous - if node behaves effectively humongous. It could be when node is humongous +or when this node is reachable from humongous node. + +When we leave TestObjectGraphAfterGC::allocateObjectGraph we make graph reachable only with references from Set of +ReferenceInfo instances. + +We run specified gc and check that each instance of ReferenceInfo set behaves as expected. +Then we check that gc log file contains expected tokens and doesn't contain tokens that it should not contain. diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ReferenceInfo.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ReferenceInfo.java new file mode 100644 index 00000000000..98e249a2c7b --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/ReferenceInfo.java @@ -0,0 +1,63 @@ +/* + * 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 gc.g1.humongousObjects.objectGraphTest; + +import java.lang.ref.Reference; + +/** + * Immutable structure that holds the following information about graph's node + * reference - weak/soft reference to graph's node + * graphId and nodeId - graph's and node's ids - we need this for error handling + * softlyReachable - is node effectively referenced by external soft reference. It could be when external + * soft reference or when this node is reachable from node that externally referenced by soft reference + * effectiveHumongous - if node behaves effectively humongous. It could be when node is humongous + * or when this node is reachable from humongous node. + * + * @param - actual type of node + */ +public class ReferenceInfo { + public final Reference reference; + public final String graphId; + public final String nodeId; + public final boolean softlyReachable; + public final boolean effectiveHumongous; + + public ReferenceInfo(Reference reference, String graphId, String nodeId, boolean softlyReachable, + boolean effectiveHumongous) { + this.reference = reference; + this.graphId = graphId; + this.nodeId = nodeId; + this.softlyReachable = softlyReachable; + this.effectiveHumongous = effectiveHumongous; + } + + @Override + public String toString() { + return String.format("Node %s is effectively %shumongous and effectively %ssoft referenced\n" + + "\tReference type is %s and it points to %s", nodeId, + (effectiveHumongous ? "" : "non-"), (softlyReachable ? "" : "non-"), + reference.getClass().getSimpleName(), reference.get()); + } +} diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java new file mode 100644 index 00000000000..53c58b49c09 --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java @@ -0,0 +1,250 @@ +/* + * 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 gc.g1.humongousObjects.objectGraphTest; + +import jdk.test.lib.OutputAnalyzer; +import sun.hotspot.WhiteBox; + +import java.io.File; +import java.io.IOException; +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.lang.ref.SoftReference; +import java.lang.ref.WeakReference; +import java.nio.file.Files; +import java.util.Map; +import java.util.HashMap; +import java.util.List; +import java.util.HashSet; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.stream.Collectors; + + +/** + * @test TestObjectGraphAfterGC + * @summary Checks that objects' graph behave as expected after gc + * @requires vm.gc=="G1" | vm.gc=="null" + * @requires vm.opt.ExplicitGCInvokesConcurrent != true + * @library /testlibrary /test/lib / + * @modules java.management java.base/jdk.internal.misc + * @build sun.hotspot.WhiteBox + * gc.testlibrary.Helpers + * gc.g1.humongousObjects.objectGraphTest.GCTokens + * gc.g1.humongousObjects.objectGraphTest.ReferenceInfo + * gc.g1.humongousObjects.objectGraphTest.GC + * gc.g1.humongousObjects.objectGraphTest.ObjectGraph + * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC + * + * @ignore 8156755 + * + * @run driver ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * + * @run main/othervm -Xms200M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -XX:G1HeapRegionSize=1M -Xlog:gc*=debug:file=TestObjectGraphAfterGC_YOUNG_GC.gc.log + * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC YOUNG_GC + * + * @run main/othervm -Xms200M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -XX:G1HeapRegionSize=1M -Xlog:gc=info:file=TestObjectGraphAfterGC_FULL_GC.gc.log + * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC FULL_GC + * + * @run main/othervm -Xms200M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. + * -XX:G1HeapRegionSize=1M -Xlog:gc=info:file=TestObjectGraphAfterGC_FULL_GC_MEMORY_PRESSURE.gc.log + * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC FULL_GC_MEMORY_PRESSURE + * + */ + +/** + * Checks that objects' graph behave as expected after gc + * See README file for detailed info on test's logic + */ +public class TestObjectGraphAfterGC { + + private static final int simpleAllocationSize = 1024; + + /** + * Entry point + * + * @param args - first argument - gc name + */ + public static void main(String[] args) { + + if (args.length < 1) { + throw new Error("Expected gc name wasn't provided as command line argument"); + } + + GC gcType = GC.valueOf(args[0].toUpperCase()); + + System.out.println("Testing " + gcType.name()); + + TestcaseData.getPregeneratedTestcases().stream().forEach(testcase -> { + System.out.println("Testcase: " + testcase); + + try { + TestObjectGraphAfterGC.doTesting(testcase, gcType.get(), gcType.getChecker(), + gcType.getGcLogName(TestObjectGraphAfterGC.class.getSimpleName()), gcType.shouldContain(), + gcType.shouldNotContain()); + } catch (IOException e) { + throw new Error("Problems trying to find or open " + TestObjectGraphAfterGC.class.getSimpleName() + + ".gc.log", e); + } + System.out.println(" Passed"); + }); + } + + /** + * Implements testing with 3 methods - allocateObjectGraph, checkResults and checkGCLog + * + * @param testcaseData testcase in the following notation: + * H - humongous node + * S - non-humongous node + * s - external soft reference + * w - external weak reference + * Hs->Sw - 1st node is humongous, externally soft referenced and strong references to + * non-humongous node 2 which is externally weak referenced + * H->1 - humongous node connects to the first node of chain + * @param doGC method that initiates gc + * @param checker consumer that checks node's state after gc and throws Error if it's wrong + * @param gcLogName name of gc log + * @param shouldContain list of tokens that should be contained in gc log + * @param shouldNotContain list of tokens that should not be contained in gc log + * @throws IOException if there are some issues with gc log + */ + private static void doTesting(String testcaseData, Runnable doGC, Consumer> checker, + String gcLogName, List shouldContain, List shouldNotContain) + throws IOException { + Set> nodeData = allocateObjectGraph(testcaseData); + doGC.run(); + checkResults(nodeData, checker); + checkGCLog(gcLogName, shouldContain, shouldNotContain); + } + + /** + * Allocates a number of objects of humongous and regular size and links then with strong references. + * How many objects to create, their size and links between them is encoded in the given parameters. + * As the result an object graph will be created. + * For the testing purpose for each created object (a graph node) an extra ReferenceInfo object will be created. + * The ReferenceInfo instances will contain either weak or soft reference to the graph node. + * + * @param testcaseData testcase in the + *

+ * H - humongous node + * S - non-humongous node + * s - external soft reference + * w - external weak reference + * Hs->Sw - 1st node is humongous, externally soft referenced and strong references to + * non-humongous node 2 which is externally weak referenced + * H->1 - humongous node connects to the first node of chain + * @return set of ReferenceInfo objects containing weak/soft reference to the graph node and other data on how + * objects should behave after gc + */ + private static Set> allocateObjectGraph(String testcaseData) { + Map nodeIds = new HashMap<>(); + Set humongousNodes = new HashSet<>(); + Set externalSoftReferenced = new HashSet<>(); + Set externalWeakReferenced = new HashSet<>(); + + Map, BiConsumer> visitors + = new HashMap<>(); + + visitors.put((parsedNode -> true), + (parsedNode, objects) -> nodeIds.put(objects[Integer.valueOf(parsedNode.id)], parsedNode.id) + ); + + visitors.put((parsedNode -> parsedNode.isHumongous), + (parsedNode, objects) -> humongousNodes.add(objects[Integer.valueOf(parsedNode.id)]) + ); + + visitors.put(parsedNode -> parsedNode.getReferencesTypes().stream(). + anyMatch(referenceType -> referenceType == ObjectGraph.ReferenceType.SOFT), + (parsedNode, objects) -> externalSoftReferenced.add(objects[Integer.valueOf(parsedNode.id)]) + ); + + visitors.put(parsedNode -> parsedNode.getReferencesTypes().stream(). + anyMatch(referenceType -> referenceType == ObjectGraph.ReferenceType.WEAK), + (parsedNode, objects) -> externalWeakReferenced.add(objects[Integer.valueOf(parsedNode.id)]) + ); + + List internalParsedNodes = TestcaseData.parse(testcaseData); + + Object[] root = ObjectGraph.generateObjectNodes(internalParsedNodes, visitors, + WhiteBox.getWhiteBox().g1RegionSize(), simpleAllocationSize); + + ObjectGraph.propagateTransitiveProperty(humongousNodes, humongousNodes::add); + Set effectiveSoftReferenced = new HashSet<>(); + ObjectGraph.propagateTransitiveProperty(externalSoftReferenced, effectiveSoftReferenced::add); + + // Create external references + ReferenceQueue referenceQueue = new ReferenceQueue<>(); + Set> externalRefs = new HashSet<>(); + + externalWeakReferenced.stream() + .forEach(objects -> externalRefs.add(new WeakReference<>(objects, referenceQueue))); + externalSoftReferenced.stream() + .forEach(objects -> externalRefs.add(new SoftReference<>(objects, referenceQueue))); + + return externalRefs.stream() + .map(ref -> new ReferenceInfo<>(ref, testcaseData, nodeIds.get(ref.get()), + effectiveSoftReferenced.contains(ref.get()), humongousNodes.contains(ref.get()))) + .collect(Collectors.toSet()); + + } + + /** + * Checks that object' state after gc is as expected + * + * @param nodeData array with information about nodes + * @param checker consumer that checks node's state after gc and throws Error if it's wrong + */ + private static void checkResults(Set> nodeData, Consumer> checker) { + nodeData.stream().forEach(checker::accept); + } + + /** + * Checks that gc log contains what we expected and does not contain what we didn't expect + * + * @param gcLogName gc log name + * @param shouldContain list of tokens that should be contained in gc log + * @param shouldNotContain list of tokens that should not be contained in gc log + * @throws IOException if there are some issues with gc log + */ + private static void checkGCLog(String gcLogName, List shouldContain, List shouldNotContain) + throws IOException { + + if (gcLogName == null) { + return; + } + String gcLog = new String(Files.readAllBytes(new File(gcLogName).toPath())); + + OutputAnalyzer outputAnalyzer = new OutputAnalyzer(gcLog, ""); + + shouldContain.stream().forEach(outputAnalyzer::shouldContain); + shouldNotContain.stream().forEach(outputAnalyzer::shouldNotContain); + } + +} diff --git a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestcaseData.java b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestcaseData.java new file mode 100644 index 00000000000..022934683a6 --- /dev/null +++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestcaseData.java @@ -0,0 +1,207 @@ +/* + * 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 gc.g1.humongousObjects.objectGraphTest; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class TestcaseData { + /** + * Temporary node description used during parsing + */ + private static class InternalParsedNode { + public String id; + public final ArrayList connectedTo = new ArrayList<>(); + public final ArrayList connectedFrom = new ArrayList<>(); + public final List referencesTypes = new ArrayList<>(); + public boolean isHumongous; + } + + /** + * Immutable node description. + * Contains: + * Node id + * Humongous flag + * List of external references' types + * List of nodes connected to + */ + public static class FinalParsedNode { + public final String id; + public final boolean isHumongous; + private final List referencesTypes; + private final ArrayList connectedTo; + + + public FinalParsedNode(InternalParsedNode internalParsedNode) { + referencesTypes = internalParsedNode.referencesTypes; + connectedTo = internalParsedNode.connectedTo; + id = internalParsedNode.id; + isHumongous = internalParsedNode.isHumongous; + } + + public List getReferencesTypes() { + return Collections.unmodifiableList(referencesTypes); + } + + public List getConnectedTo() { + return Collections.unmodifiableList(connectedTo); + } + } + + /** + * @param testcaseDesc testcase in the following notation: + * H - humongous node + * S - non-humongous node + * s - external soft reference + * w - external weak reference + * Hs->Sw - 1st node is humongous, externally soft referenced and strong references to non-humongous node 2 which is + * externally weak referenced + * H->1 - humongous node connects to the first node of chain + * @return list of nodes description in FinalParsedNode structure + */ + public static List parse(String testcaseDesc) { + String[] nodes = testcaseDesc.split("-"); + List internalParsedNodeList = new ArrayList<>(); + + for (int i = 0; i < nodes.length; ++i) { + String node = nodes[i]; + InternalParsedNode nd; + if (node.contains("1")) { + nd = internalParsedNodeList.get(0); + + } else { + nd = new InternalParsedNode(); + internalParsedNodeList.add(nd); + nd.id = String.valueOf(i); + } + + if (node.startsWith(">")) { + nd.connectedFrom.add(i - 1); + } + if (node.endsWith("<")) { + nd.connectedFrom.add(i + 1); + } + if (node.contains("w")) { + nd.referencesTypes.add(ObjectGraph.ReferenceType.WEAK); + } + + if (node.contains("s")) { + nd.referencesTypes.add(ObjectGraph.ReferenceType.SOFT); + } + if (node.contains("H")) { + nd.isHumongous = true; + } + + if (node.contains("S")) { + nd.isHumongous = false; + } + } + + // we have connectedFrom but we need to get connectedTo + for (int i = 0; i < internalParsedNodeList.size(); ++i) { + for (Integer reference : internalParsedNodeList.get(i).connectedFrom) { + internalParsedNodeList.get(reference).connectedTo.add(i); + } + } + + List finalParsedNodes = internalParsedNodeList.stream().map(FinalParsedNode::new) + .collect(Collectors.toList()); + + return finalParsedNodes; + } + + /** + * @return List of pregenerated testing cases + */ + public static List getPregeneratedTestcases() { + return Arrays.asList( + "Hw", + "Sw", + "Sw->Hw", + "Hw->Sw", + "Sw<->Hw", + "Sw<->Sw", + "Hw->Sw->Sw", + "Hw->Sw->Sw", + "Sw->Hw->Sw", + "Hw->Sw->Sw->1", + "Sw->Hw->Sw->1", + "Sw->Hw->Hw->1", + "Sw<->Hw<->Hw->1", + "Sw<->Hw<->Sw->1", + "Sw->Hw<->Sw", + "Hs", + "Ss", + "Ss->Hs", + "Hs->Ss", + "Ss<->Hs", + "Ss<->Ss", + "Hs->Ss->Ss", + "Hs->Ss->Ss", + "Ss->Hs->Ss", + "Hs->Ss->Ss->1", + "Ss->Hs->Ss->1", + "Ss->Hs->Hs->1", + "Ss<->Hs<->Hs->1", + "Ss<->Hs<->Ss->1", + "Ss->Hs<->Ss", + "Ss->Hw", + "Sw->Hs", + "Hs->Sw", + "Hw->Ss", + "Ss<->Hw", + "Sw<->Hs", + "Ss<->Sw", + "Sw<->Ss", + "Hs->Sw->Sw", + "Hw->Ss->Sw", + "Hw->Sw->Ss", + "Ss->Hw->Sw", + "Sw->Hs->Sw", + "Sw->Hw->Ss", + "Hs->Sw->Sw->1", + "Hw->Ss->Sw->1", + "Hw->Sw->Ss->1", + "Ss->Hw->Sw->1", + "Ss->Hs->Sw->1", + "Sw->Hw->Ss->1", + "Ss->Hw->Hw->1", + "Sw->Hs->Hw->1", + "Sw->Hw->Hs->1", + "Ss<->Hw<->Hw->1", + "Sw<->Hs<->Hw->1", + "Sw<->Hw<->Hs->1", + "Ss<->Hw<->Sw->1", + "Sw<->Hs<->Sw->1", + "Sw<->Hw<->Ss->1", + "Ss->Hw<->Sw", + "Sw->Hs<->Sw", + "Sw->Hw<->Ss" + ); + } +} diff --git a/hotspot/test/gc/g1/ihop/TestIHOPErgo.java b/hotspot/test/gc/g1/ihop/TestIHOPErgo.java index 10299299c73..95609b84d4d 100644 --- a/hotspot/test/gc/g1/ihop/TestIHOPErgo.java +++ b/hotspot/test/gc/g1/ihop/TestIHOPErgo.java @@ -29,6 +29,7 @@ * @requires vm.opt.FlightRecorder != true * @requires vm.opt.ExplicitGCInvokesConcurrent != true * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build gc.g1.ihop.TestIHOPErgo * gc.g1.ihop.lib.IhopUtils diff --git a/hotspot/test/gc/g1/ihop/TestIHOPStatic.java b/hotspot/test/gc/g1/ihop/TestIHOPStatic.java index 4e91a95c089..efbe6d6ab69 100644 --- a/hotspot/test/gc/g1/ihop/TestIHOPStatic.java +++ b/hotspot/test/gc/g1/ihop/TestIHOPStatic.java @@ -29,6 +29,7 @@ * @requires vm.opt.FlightRecorder != true * @requires vm.opt.ExplicitGCInvokesConcurrent != true * @library /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.management * @build gc.g1.ihop.TestIHOPStatic * gc.g1.ihop.lib.IhopUtils diff --git a/hotspot/test/gc/g1/mixedgc/TestLogging.java b/hotspot/test/gc/g1/mixedgc/TestLogging.java index 913097d50ae..f99fdbd21a4 100644 --- a/hotspot/test/gc/g1/mixedgc/TestLogging.java +++ b/hotspot/test/gc/g1/mixedgc/TestLogging.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -26,7 +26,7 @@ * @summary Check that a mixed GC is reflected in the gc logs * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary /test/lib - * @ignore 8138607 + * @modules java.base/jdk.internal.misc * @modules java.management * @build sun.hotspot.WhiteBox gc.g1.mixedgc.TestLogging * @run main ClassFileInstaller sun.hotspot.WhiteBox @@ -57,8 +57,8 @@ public class TestLogging { "-XX:SurvivorRatio=1", // Survivor-to-eden ratio is 1:1 "-Xms10M", "-Xmx10M", "-XX:MaxTenuringThreshold=1", // promote objects after first gc - "-XX:InitiatingHeapOccupancyPercent=0", // marking cycle happens - // each time + "-XX:InitiatingHeapOccupancyPercent=100", // set initial CMC threshold and disable adaptive IHOP + "-XX:-G1UseAdaptiveIHOP", // to avoid additional concurrent cycles caused by ergonomics "-XX:G1MixedGCCountTarget=4", "-XX:MaxGCPauseMillis=30000", // to have enough time "-XX:G1HeapRegionSize=1m", "-XX:G1HeapWastePercent=0", @@ -120,8 +120,8 @@ class MixedGCProvoker { // Allocates buffer and promotes it to the old gen. Mix live and dead old // objects for (int i = 0; i < TestLogging.ALLOCATION_COUNT; ++i) { - liveOldObjects.add(new byte[TestLogging.ALLOCATION_SIZE * 10]); - deadOldObjects.add(new byte[TestLogging.ALLOCATION_SIZE * 10]); + liveOldObjects.add(new byte[TestLogging.ALLOCATION_SIZE * 5]); + deadOldObjects.add(new byte[TestLogging.ALLOCATION_SIZE * 5]); } // need only 2 promotions to promote objects to the old gen diff --git a/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java b/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java index 5bcad7f2404..6aa5834a79f 100644 --- a/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java +++ b/hotspot/test/gc/g1/plab/TestPLABEvacuationFailure.java @@ -27,6 +27,7 @@ * @summary Checks PLAB statistics on evacuation failure * @requires vm.gc=="G1" | vm.gc=="null" * @library /testlibrary / + * @modules java.base/jdk.internal.misc * @modules java.management * @build gc.g1.plab.lib.LogParser * gc.g1.plab.lib.AppPLABEvacuationFailure diff --git a/hotspot/test/gc/g1/plab/TestPLABPromotion.java b/hotspot/test/gc/g1/plab/TestPLABPromotion.java index 7af09694dfa..3664897ea83 100644 --- a/hotspot/test/gc/g1/plab/TestPLABPromotion.java +++ b/hotspot/test/gc/g1/plab/TestPLABPromotion.java @@ -28,6 +28,7 @@ * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.FlightRecorder != true * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build ClassFileInstaller * sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/g1/plab/TestPLABResize.java b/hotspot/test/gc/g1/plab/TestPLABResize.java index 71e00bbae8e..f3ac2aad802 100644 --- a/hotspot/test/gc/g1/plab/TestPLABResize.java +++ b/hotspot/test/gc/g1/plab/TestPLABResize.java @@ -28,6 +28,7 @@ * @requires vm.gc=="G1" | vm.gc=="null" * @requires vm.opt.FlightRecorder != true * @library /testlibrary /test/lib / + * @modules java.base/jdk.internal.misc * @modules java.management * @build ClassFileInstaller * sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java new file mode 100644 index 00000000000..647cd63128e --- /dev/null +++ b/hotspot/test/gc/logging/TestUnifiedLoggingSwitchStress.java @@ -0,0 +1,245 @@ +/* + * 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 gc.logging; + +import jdk.test.lib.Utils; + +import javax.management.InstanceNotFoundException; +import javax.management.MBeanException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; +import javax.management.ReflectionException; +import java.lang.management.ManagementFactory; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; + + +/** + * @test TestUnifiedLoggingSwitchStress + * @summary Switches gc log level on fly while stressing memory/gc + * @key gc + * @key stress + * @library /testlibrary /test/lib / + * @modules java.management java.base/jdk.internal.misc + * + * @run main/othervm -Xmx256M -Xms256M + * gc.logging.TestUnifiedLoggingSwitchStress 60 + */ + +class MemoryStresser implements Runnable { + public static volatile boolean shouldStop = false; + + private final List liveObjects = new LinkedList<>(); + private final List liveHObjects = new LinkedList<>(); + private int maxSimpleAllocationMemory = 0; + private int usedMemory = 0; + + /** + * Maximum amount of huge allocations + */ + private static int H_ALLOCATION_MAX_COUNT = 4; + /** + * Maximum regions in one huge allocation + */ + private static int H_ALLOCATION_REGION_SIZE = 2; + private static final int G1_REGION_SIZE = 1024 * 1024; + /** + * Maximum size of simple allocation + */ + private static final int MAX_SIMPLE_ALLOCATION_SIZE = (int) (G1_REGION_SIZE / 2 * 0.9); + + /** + * Maximum size of dead (i.e. one which is made unreachable right after allocation) object + */ + private static final int DEAD_OBJECT_MAX_SIZE = G1_REGION_SIZE / 10; + private static final Random RND = Utils.getRandomInstance(); + + /** + * @param maxMemory maximum memory that could be allocated + */ + public MemoryStresser(int maxMemory) { + maxSimpleAllocationMemory = maxMemory - G1_REGION_SIZE * H_ALLOCATION_MAX_COUNT * H_ALLOCATION_REGION_SIZE; + } + + public final Runnable[] actions = new Runnable[]{ + // Huge allocation + () -> { + if (liveHObjects.size() < H_ALLOCATION_MAX_COUNT) { + int allocationSize = RND.nextInt((int) (G1_REGION_SIZE * (H_ALLOCATION_REGION_SIZE - 0.5) + * 0.9)); + liveHObjects.add(new byte[allocationSize + G1_REGION_SIZE / 2]); + } + }, + + // Huge deallocation + () -> { + if (liveHObjects.size() > 0) { + int elementNum = RND.nextInt(liveHObjects.size()); + liveHObjects.remove(elementNum); + } + }, + + // Simple allocation + () -> { + if (maxSimpleAllocationMemory - usedMemory != 0) { + int arraySize = RND.nextInt(Math.min(maxSimpleAllocationMemory - usedMemory, + MAX_SIMPLE_ALLOCATION_SIZE)); + if (arraySize != 0) { + liveObjects.add(new byte[arraySize]); + usedMemory += arraySize; + } + } + }, + + // Simple deallocation + () -> { + if (liveObjects.size() != 0) { + int elementNum = RND.nextInt(liveObjects.size()); + int shouldFree = liveObjects.get(elementNum).length; + liveObjects.remove(elementNum); + usedMemory -= shouldFree; + } + }, + + // Dead object allocation + () -> { + int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE); + byte[] deadObject = new byte[size]; + } + }; + + @Override + public void run() { + while (!shouldStop) { + actions[RND.nextInt(actions.length)].run(); + Thread.yield(); + } + + System.out.println("Memory Stresser finished"); + } +} + +class LogLevelSwitcher implements Runnable { + + public static volatile boolean shouldStop = false; + private final int logCount; // how many various log files will be used + private final String logFilePrefix; // name of log file will be logFilePrefix + index + private final Random RND = Utils.getRandomInstance(); + private final MBeanServer MBS = ManagementFactory.getPlatformMBeanServer(); + + /** + * @param logFilePrefix prefix for log files + * @param logCount amount of log files + */ + public LogLevelSwitcher(String logFilePrefix, int logCount) { + this.logCount = logCount; + this.logFilePrefix = logFilePrefix; + + } + + private static final String[] LOG_LEVELS = {"error", "warning", "info", "debug", "trace"}; + + @Override + public void run() { + + while (!shouldStop) { + int fileNum = RND.nextInt(logCount); + int logLevel = RND.nextInt(LOG_LEVELS.length); + + String outputCommand = String.format("output=%s_%d.log", logFilePrefix, fileNum); + String logLevelCommand = "what='gc*=" + LOG_LEVELS[logLevel] + "'"; + + try { + Object out = MBS.invoke(new ObjectName("com.sun.management:type=DiagnosticCommand"), + "vmLog", + new Object[]{new String[]{outputCommand, logLevelCommand}}, + new String[]{String[].class.getName()}); + + if (!out.toString().isEmpty()) { + System.out.format("WARNING: Diagnostic command vmLog with arguments %s,%s returned not empty" + + " output %s\n", + outputCommand, logLevelCommand, out); + } + } catch (InstanceNotFoundException | MBeanException | ReflectionException | MalformedObjectNameException e) { + System.out.println("Got exception trying to change log level:" + e); + e.printStackTrace(); + throw new Error(e); + } + Thread.yield(); + } + System.out.println("Log Switcher finished"); + } +} + + +public class TestUnifiedLoggingSwitchStress { + /** + * Count of memory stressing threads + */ + private static final int MEMORY_STRESSERS_COUNT = 3; + /** + * Count of log switching threads + */ + private static final int LOG_LEVEL_SWITCHERS_COUNT = 2; + /** + * Count of log files created by each log switching thread + */ + private static final int LOG_FILES_COUNT = 2; + /** + * Maximum amount memory allocated by each stressing thread + */ + private static final int MAX_MEMORY_PER_STRESSER = (int) (Runtime.getRuntime().freeMemory() + / MEMORY_STRESSERS_COUNT * 0.7); + + public static void main(String[] args) throws InterruptedException { + if (args.length != 1) { + throw new Error("Test Bug: Expected duration (in seconds) wasn't provided as command line argument"); + } + long duration = Integer.parseInt(args[0]) * 1000; + + long startTime = System.currentTimeMillis(); + + List threads = new LinkedList<>(); + + for (int i = 0; i < LOG_LEVEL_SWITCHERS_COUNT; i++) { + threads.add(new Thread(new LogLevelSwitcher("Output_" + i, LOG_FILES_COUNT))); + } + + for (int i = 0; i < MEMORY_STRESSERS_COUNT; i++) { + threads.add(new Thread(new MemoryStresser(MAX_MEMORY_PER_STRESSER))); + } + + threads.stream().forEach(Thread::start); + + while (System.currentTimeMillis() - startTime < duration) { + Thread.yield(); + } + + MemoryStresser.shouldStop = true; + LogLevelSwitcher.shouldStop = true; + } +} diff --git a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java index 57fb611fd73..ebe90eebae0 100644 --- a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java +++ b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java @@ -49,10 +49,12 @@ public class CompressedClassSpaceSizeInJmapHeap { return; } - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); - JDKToolLauncher jmap = JDKToolLauncher.create("jmap") - .addToolArg("-heap") + JDKToolLauncher jmap = JDKToolLauncher.create("jhsdb") + .addToolArg("jmap") + .addToolArg("--heap") + .addToolArg("--pid") .addToolArg(pid); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); diff --git a/hotspot/test/gc/metaspace/PerfCounters.java b/hotspot/test/gc/metaspace/PerfCounters.java index d6848f2b7b7..9dce3bd4e70 100644 --- a/hotspot/test/gc/metaspace/PerfCounters.java +++ b/hotspot/test/gc/metaspace/PerfCounters.java @@ -40,7 +40,7 @@ public class PerfCounters { static { try { - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); VmIdentifier vmId = new VmIdentifier(pid); MonitoredHost host = MonitoredHost.getMonitoredHost(vmId); vm = host.getMonitoredVm(vmId); diff --git a/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java b/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java index c7bbcec0829..e38ef160acd 100644 --- a/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java +++ b/hotspot/test/gc/metaspace/TestMetaspaceInitialization.java @@ -26,6 +26,7 @@ import java.util.ArrayList; /* @test TestMetaspaceInitialization * @bug 8042933 * @summary Tests to initialize metaspace with a very low MetaspaceSize + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -XX:MetaspaceSize=2m TestMetaspaceInitialization */ diff --git a/hotspot/test/gc/parallel/TestDynShrinkHeap.java b/hotspot/test/gc/parallel/TestDynShrinkHeap.java index a71f335ae15..809706f8e32 100644 --- a/hotspot/test/gc/parallel/TestDynShrinkHeap.java +++ b/hotspot/test/gc/parallel/TestDynShrinkHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -26,6 +26,8 @@ * @bug 8016479 * @requires vm.gc=="Parallel" | vm.gc=="null" * @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags + * @modules java.base/jdk.internal.misc + * @modules jdk.management * @library /testlibrary * @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap */ diff --git a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java index 1a7501e0981..17fd5ece8b2 100644 --- a/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java +++ b/hotspot/test/gc/parallel/TestPrintGCDetailsVerbose.java @@ -27,6 +27,7 @@ * @summary Tests that jvm with maximally verbose GC logging does not crash when ParOldGC has no memory * @key gc * @requires vm.gc=="Parallel" | vm.gc=="null" + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -Xmx50m -XX:+UseParallelGC -Xlog:gc*=trace TestPrintGCDetailsVerbose */ diff --git a/hotspot/test/gc/stress/TestMultiThreadStressRSet.java b/hotspot/test/gc/stress/TestMultiThreadStressRSet.java index 8947cb7237e..5a69888a502 100644 --- a/hotspot/test/gc/stress/TestMultiThreadStressRSet.java +++ b/hotspot/test/gc/stress/TestMultiThreadStressRSet.java @@ -35,6 +35,7 @@ import sun.hotspot.WhiteBox; * @requires os.maxMemory > 2G * * @summary Stress G1 Remembered Set using multiple threads + * @modules java.base/jdk.internal.misc * @library /test/lib /testlibrary * @build sun.hotspot.WhiteBox * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/gc/stress/TestStressG1Humongous.java b/hotspot/test/gc/stress/TestStressG1Humongous.java new file mode 100644 index 00000000000..91a5f06a421 --- /dev/null +++ b/hotspot/test/gc/stress/TestStressG1Humongous.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test TestStressG1Humongous + * @key gc + * @key stress + * @summary Stress G1 by humongous allocations in situation near OOM + * @requires vm.gc=="G1" | vm.gc=="null" + * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=4m + * -Dtimeout=120 -Dthreads=3 -Dhumongoussize=1.1 -Dregionsize=4 TestStressG1Humongous + * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=16m + * -Dtimeout=120 -Dthreads=5 -Dhumongoussize=2.1 -Dregionsize=16 TestStressG1Humongous + * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=32m + * -Dtimeout=120 -Dthreads=4 -Dhumongoussize=0.6 -Dregionsize=32 TestStressG1Humongous + * @run main/othervm/timeout=700 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=1m + * -Dtimeout=600 -Dthreads=7 -Dhumongoussize=0.6 -Dregionsize=1 TestStressG1Humongous + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.Collections; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.atomic.AtomicInteger; + +public class TestStressG1Humongous { + + // Timeout in seconds + private static final int TIMEOUT = Integer.getInteger("timeout", 60); + private static final int THREAD_COUNT = Integer.getInteger("threads", 2); + private static final int REGION_SIZE = Integer.getInteger("regionsize", 1) * 1024 * 1024; + private static final int HUMONGOUS_SIZE = (int) (REGION_SIZE * Double.parseDouble(System.getProperty("humongoussize", "1.5"))); + + private volatile boolean isRunning; + private final ExecutorService threadExecutor; + private final AtomicInteger alocatedObjectsCount; + private CountDownLatch countDownLatch; + public static final List GARBAGE = Collections.synchronizedList(new ArrayList<>()); + + public static void main(String[] args) throws InterruptedException { + new TestStressG1Humongous().run(); + } + + public TestStressG1Humongous() { + isRunning = true; + threadExecutor = Executors.newFixedThreadPool(THREAD_COUNT + 1); + alocatedObjectsCount = new AtomicInteger(0); + } + + private void run() throws InterruptedException { + threadExecutor.submit(new Timer()); + int checkedAmountOfHObjects = getExpectedAmountOfObjects(); + while (isRunning()) { + countDownLatch = new CountDownLatch(THREAD_COUNT); + startAllocationThreads(checkedAmountOfHObjects); + countDownLatch.await(); + GARBAGE.clear(); + System.out.println("Allocated " + alocatedObjectsCount.get() + " objects."); + alocatedObjectsCount.set(0); + } + threadExecutor.shutdown(); + System.out.println("Done!"); + } + + /** + * Tries to fill available memory with humongous objects to get expected amount. + * @return expected amount of humongous objects + */ + private int getExpectedAmountOfObjects() { + long maxMem = Runtime.getRuntime().maxMemory(); + int expectedHObjects = (int) (maxMem / HUMONGOUS_SIZE); + // Will allocate 1 region less to give some free space for VM. + int checkedAmountOfHObjects = checkHeapCapacity(expectedHObjects) - 1; + return checkedAmountOfHObjects; + } + + /** + * Starts several threads to allocate the requested amount of humongous objects. + * @param totalObjects total amount of object that will be created + */ + private void startAllocationThreads(int totalObjects) { + int objectsPerThread = totalObjects / THREAD_COUNT; + int objectsForLastThread = objectsPerThread + totalObjects % THREAD_COUNT; + for (int i = 0; i < THREAD_COUNT - 1; ++i) { + threadExecutor.submit(new AllocationThread(countDownLatch, objectsPerThread, alocatedObjectsCount)); + } + threadExecutor.submit(new AllocationThread(countDownLatch, objectsForLastThread, alocatedObjectsCount)); + } + + /** + * Creates a humongous object of the predefined size. + */ + private void createObject() { + GARBAGE.add(new byte[HUMONGOUS_SIZE]); + } + + /** + * Tries to create the requested amount of humongous objects. + * In case of OOME, stops creating and cleans the created garbage. + * @param expectedObjects amount of objects based on heap size + * @return amount of created objects + */ + private int checkHeapCapacity(int expectedObjects) { + int allocated = 0; + try { + while (isRunning() && allocated < expectedObjects) { + createObject(); + ++allocated; + } + } catch (OutOfMemoryError oome) { + GARBAGE.clear(); + } + return allocated; + } + + private void setDone() { + isRunning = false; + } + + private boolean isRunning() { + return isRunning; + } + + /** + * Thread which allocates requested amount of humongous objects. + */ + private class AllocationThread implements Runnable { + + private final int totalObjects; + private final CountDownLatch cdl; + private final AtomicInteger allocationCounter; + + /** + * Creates allocation thread + * @param cdl CountDownLatch + * @param objects amount of objects to allocate + * @param counter + */ + public AllocationThread(CountDownLatch cdl, int objects, AtomicInteger counter) { + totalObjects = objects; + this.cdl = cdl; + allocationCounter = counter; + } + + @Override + public void run() { + int allocatedObjects = 0; + try { + while (isRunning && allocatedObjects < totalObjects) { + createObject(); + allocatedObjects++; + allocationCounter.incrementAndGet(); + } + + } catch (OutOfMemoryError oome) { + GARBAGE.clear(); + System.out.print("OOME was caught."); + System.out.println(" Allocated in thread: " + allocatedObjects + " . Totally allocated: " + allocationCounter.get() + "."); + } finally { + cdl.countDown(); + } + } + } + + /** + * Simple Runnable which waits TIMEOUT and sets isRunning to false. + */ + class Timer implements Runnable { + + @Override + public void run() { + try { + Thread.sleep(TIMEOUT * 1000); + } catch (InterruptedException ex) { + } + setDone(); + } + } +} diff --git a/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java b/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java index 5b7e167c90b..8be8115cfe2 100644 --- a/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java +++ b/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java @@ -31,7 +31,7 @@ import java.util.regex.Pattern; import jdk.test.lib.Asserts; import com.sun.management.ThreadMXBean; import sun.hotspot.WhiteBox; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Main class for tests on {@code SurvivorAlignmentInBytes} option. diff --git a/hotspot/test/gc/testlibrary/Helpers.java b/hotspot/test/gc/testlibrary/Helpers.java index aa20031cd10..b28d92dd406 100644 --- a/hotspot/test/gc/testlibrary/Helpers.java +++ b/hotspot/test/gc/testlibrary/Helpers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -32,6 +32,7 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; public class Helpers { @@ -45,14 +46,14 @@ public class Helpers { /** * According class file format theoretical amount of fields in class is u2 which is (256 * 256 - 1). - * Some service info takes place in constant pool and we really could make a class with only (256 * 256 - 29) - * fields. + * Some service info takes place in constant pool and we really could make a class with lesser amount of fields. + * * Since the exact value is not so important and I would like to avoid issues that may be caused by future changes/ - * different archs etc I selected (256 * 256 - 32) for this constant. + * different archs etc I selected (256 * 256 - 1024) for this constant. * The test works with other values too but the smaller the number the more classes we need to generate and it takes * more time */ - private static final int MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS = 256 * 256 - 32; + private static final int MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS = 256 * 256 - 1024; /** * Detects amount of extra bytes required to allocate a byte array. @@ -139,6 +140,28 @@ public class Helpers { return builder.toString(); } + /** + * Generates specified amount of long fields + * Result string will looks like this: + *

+ * long f0; + * ... + * long fNNN; + * + * @param fieldCount count of long fields + * @return generated fields + */ + private static String fieldsGenerator(long fieldCount) { + StringBuilder fieldsBuilder = new StringBuilder(); + + for (int i = 0; i < fieldCount; ++i) { + fieldsBuilder.append(String.format("long f%d;\n", i)); + } + + return fieldsBuilder.toString(); + } + + /** * Changes string from enum notation to class notation - i.e. "VERY_SMALL_CAT" to "VerySmallCat" * @@ -216,22 +239,121 @@ public class Helpers { // for the last generated class we use specified class name String clsName = (i == generatedClassesCount - 1) ? className : prefix + i; - Helpers.compileClass(clsName, workDir, - Helpers.generate( - clsName, - // for first generated class we don't have 'extends' - (i == 0 ? null : prefix + (i - 1)), - null, - // for the last generated class we use different field count - (i == generatedClassesCount - 1) ? fieldsInLastClassCount - : MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS)); + // If we already have a file with the same name we do not create it again + if (Files.notExists(Paths.get(clsName + ".java"))) { + Helpers.compileClass(clsName, workDir, + Helpers.generate( + clsName, + // for first generated class we don't have 'extends' + (i == 0 ? null : prefix + (i - 1)), + null, + // for the last generated class we use different field count + (i == generatedClassesCount - 1) ? fieldsInLastClassCount + : MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS)); + } else { + System.out.println("Class " + clsName + + ".java already exists, skipping class' generation and compilation"); + } + } return classLoader.loadClass(className); } + /** + * Creates a class which instances will be approximately of the requested size. + * This method produces a java source from a class template by substituting values instead of parameters. + * Then the obtained source is compiled. + * Generated class will looks like this: + * classTemplate + * constructorTemplate + * long f0; + * ... + * long fNNN; + *

+ * } + * + * @param className generated class name + * @param baseClass base class + * @param classTemplate class template - the first part of class. ${ClassName} and ${BaseClass} will be replaced + * with values from className and baseClass,one entry of ${Fields} will be replaced with + * generated long fields. Class template should look like this: + * imports; + * public class ${ClassName} extends ${BaseClass} { + * public ${ClassName} { some code here;} + * some methods + * ${Fields} + * + * } + * @param constructorTemplate constructor template, ${ClassName} would be replaced on actual class name + * @param instanceSize size of generated class' instance. Size should be aligned by 8 bytes + * @param workDir working dir where generated classes are put and compiled + * @param prefix prefix for service classes (ones we use to create chain of inheritance). + * The names will be prefix_1, prefix_2,.., prefix_n + * @return Class object of generated and compiled class loaded in specified class loader + * @throws IOException if cannot write or read to workDir + */ + public static void generateByTemplateAndCompile(String className, String baseClass, String classTemplate, + String constructorTemplate, long instanceSize, Path workDir, + String prefix) throws IOException { + + if (instanceSize % SIZE_OF_LONG != 0L) { + throw new Error(String.format("Test bug: only sizes aligned by %d bytes are supported and %d was specified", + SIZE_OF_LONG, instanceSize)); + } + + int instanceSizeWithoutObjectHeaderInWords = + (int) (instanceSize - WhiteBox.getWhiteBox().getObjectSize(new Object())) / SIZE_OF_LONG; + + if (instanceSizeWithoutObjectHeaderInWords <= 0) { + throw new Error(String.format("Test bug: specified instance size is too small - %d." + + " Cannot generate any classes", instanceSize)); + } + + int sizeOfLastFile = instanceSizeWithoutObjectHeaderInWords % MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS; + int generatedClassesCount = instanceSizeWithoutObjectHeaderInWords / MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS; + + // Do all the classes have the maximum number of fields? + int fieldsInLastClassCount; + + if (sizeOfLastFile == 0) { + fieldsInLastClassCount = MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS; + } else { + generatedClassesCount++; + fieldsInLastClassCount = sizeOfLastFile; + } + + // first (generatedClassesCount - 1) classes are just fillers - just long fields and constructor + for (int i = 0; i < generatedClassesCount - 1; i++) { + String clsName = prefix + i; + + Helpers.compileClass(clsName, workDir, + Helpers.generate( + clsName, + // first generated class extends base class + (i == 0 ? baseClass : prefix + (i - 1)), + constructorTemplate.replace("${ClassName}", clsName), + MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS)); + } + + // generating last class - the one with specified className + Helpers.compileClass(className, workDir, + classTemplate.replaceAll("\\$\\{ClassName\\}", className) + // if no fillers were generated (generatedClassesCount == 1) + // the last class should extends baseClass + // otherwise it should extend last generated filler class which name is + // prefix + (generatedClassesCount - 2) + // generatedClassesCount is always not smaller than 1 + .replace("${BaseClass}", + generatedClassesCount == 1 ? baseClass : + prefix + (generatedClassesCount - 2)) + .replace("${Fields}", fieldsGenerator(fieldsInLastClassCount)) + ); + } + /** * Waits until Concurent Mark Cycle finishes - * @param wb Whitebox instance + * + * @param wb Whitebox instance * @param sleepTime sleep time */ public static void waitTillCMCFinished(WhiteBox wb, int sleepTime) { diff --git a/hotspot/test/native/GTestWrapper.java b/hotspot/test/native/GTestWrapper.java new file mode 100644 index 00000000000..9ba93995618 --- /dev/null +++ b/hotspot/test/native/GTestWrapper.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/* @test + * @summary a jtreg wrapper for gtest tests + * @library /test/lib/share/classes + * @modules java.base/jdk.internal.misc + * @run main/native GTestWrapper + */ + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; +import java.util.stream.Collectors; + +import java.nio.file.Paths; +import java.nio.file.Path; + +import jdk.test.lib.Platform; +import jdk.test.lib.Utils; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class GTestWrapper { + public static void main(String[] args) throws Throwable { + // gtestLauncher is located in /hotspot/gtest// + // nativePath points either to /hotspot/jtreg/native or to /hotspot/gtest + Path nativePath = Paths.get(System.getProperty("test.nativepath")); + String jvmVariantDir = getJVMVariantSubDir(); + // let's assume it's /hotspot/gtest + Path path = nativePath.resolve(jvmVariantDir); + if (!path.toFile().exists()) { + // maybe it is /hotspot/jtreg/native + path = nativePath.getParent() + .getParent() + .resolve("gtest") + .resolve(jvmVariantDir); + } + if (!path.toFile().exists()) { + throw new Error("TESTBUG: the library has not been found in " + nativePath); + } + path = path.resolve("gtestLauncher" + (Platform.isWindows() ? ".exe" : "")); + Stream launcherArgs = Stream.of(path.toString(), "-jdk", + System.getProperty("test.jdk")); + // JVM accepts only -X and -D flags + Stream vmFLags = Arrays.stream(Utils.getTestJavaOpts()) + .filter(s -> s.startsWith("-X") || s.startsWith("-D")); + String[] cmds = Stream.concat(launcherArgs, vmFLags) + .toArray(String[]::new); + ProcessTools.executeCommand(cmds).shouldHaveExitValue(0); + } + + private static String getJVMVariantSubDir() { + if (Platform.isServer()) { + return "server"; + } else if (Platform.isClient()) { + return "client"; + } else if (Platform.isMinimal()) { + return "minimal"; + } else { + throw new Error("TESTBUG: unsuppported vm variant"); + } + } +} diff --git a/jdk/src/java.httpclient/share/classes/java/net/http/HttpHeaders1.java b/hotspot/test/native/gtestLauncher.cpp similarity index 70% rename from jdk/src/java.httpclient/share/classes/java/net/http/HttpHeaders1.java rename to hotspot/test/native/gtestLauncher.cpp index c9ff689a931..d25a0f9b14f 100644 --- a/jdk/src/java.httpclient/share/classes/java/net/http/HttpHeaders1.java +++ b/hotspot/test/native/gtestLauncher.cpp @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -20,10 +18,17 @@ * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any + * questions. + * */ -package java.net.http; +#include "prims/jni.h" -public interface HttpHeaders1 extends HttpHeaders { - public void makeUnmodifiable(); +extern "C" { + JNIIMPORT void JNICALL runUnitTests(int argv, char** argc); +} + +int main(int argc, char** argv) { + runUnitTests(argc, argv); + return 0; } diff --git a/hotspot/test/native/gtestMain.cpp b/hotspot/test/native/gtestMain.cpp new file mode 100644 index 00000000000..3c48e80d752 --- /dev/null +++ b/hotspot/test/native/gtestMain.cpp @@ -0,0 +1,203 @@ +/* + * 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. + * + */ + +#include +#include +#include +#ifdef __APPLE__ +# include +#endif + +#include "prims/jni.h" +#include "unittest.hpp" + +extern "C" { + +static int init_jvm(int argc, char **argv, bool is_executing_death_test) { + // don't care about the program name + argc--; + argv++; + + int extra_jvm_args = is_executing_death_test ? 4 : 2; + int num_jvm_options = argc + extra_jvm_args; + + JavaVMOption* options = new JavaVMOption[num_jvm_options]; + options[0].optionString = (char*) "-Dsun.java.launcher.is_altjvm=true"; + options[1].optionString = (char*) "-XX:+ExecutingUnitTests"; + + if (is_executing_death_test) { + // don't create core files or hs_err files when executing death tests + options[2].optionString = (char*) "-XX:+SuppressFatalErrorMessage"; + options[3].optionString = (char*) "-XX:-CreateCoredumpOnCrash"; + } + + for (int i = 0; i < argc; i++) { + options[extra_jvm_args + i].optionString = argv[i]; + } + + JavaVMInitArgs args; + args.version = JNI_VERSION_1_8; + args.nOptions = num_jvm_options; + args.options = options; + + JavaVM* jvm; + JNIEnv* env; + + return JNI_CreateJavaVM(&jvm, (void**)&env, &args); +} + +class JVMInitializerListener : public ::testing::EmptyTestEventListener { + private: + int _argc; + char** _argv; + bool _is_initialized; + + void initialize_jvm() { + } + + public: + JVMInitializerListener(int argc, char** argv) : + _argc(argc), _argv(argv), _is_initialized(false) { + } + + virtual void OnTestStart(const ::testing::TestInfo& test_info) { + const char* name = test_info.name(); + if (strstr(name, "_test_vm") != NULL && !_is_initialized) { + ASSERT_EQ(init_jvm(_argc, _argv, false), 0) << "Could not initialize the JVM"; + _is_initialized = true; + } + } +}; + +static bool is_prefix(const char* prefix, const char* str) { + return strncmp(str, prefix, strlen(prefix)) == 0; +} + +static char* get_java_home_arg(int argc, char** argv) { + for (int i = 0; i < argc; i++) { + if (strncmp(argv[i], "-jdk", strlen(argv[i])) == 0) { + return argv[i+1]; + } + if (is_prefix("--jdk=", argv[i])) { + return argv[i] + strlen("--jdk="); + } + if (is_prefix("-jdk:", argv[i])) { + return argv[i] + strlen("-jdk:"); + } + } + return NULL; +} + +static int num_args_to_skip(char* arg) { + if (strcmp(arg, "-jdk") == 0) { + return 2; // skip the argument after -jdk as well + } + if (is_prefix("--jdk=", arg)) { + return 1; + } + if (is_prefix("-jdk:", arg)) { + return 1; + } + return 0; +} + +static char** remove_test_runner_arguments(int* argcp, char **argv) { + int argc = *argcp; + char** new_argv = (char**) malloc(sizeof(char*) * argc); + int new_argc = 0; + + int i = 0; + while (i < argc) { + int args_to_skip = num_args_to_skip(argv[i]); + if (args_to_skip == 0) { + new_argv[new_argc] = argv[i]; + i++; + new_argc++; + } else { + i += num_args_to_skip(argv[i]); + } + } + + *argcp = new_argc; + return new_argv; +} + +JNIEXPORT void JNICALL runUnitTests(int argc, char** argv) { + // Must look at googletest options before initializing googletest, since + // InitGoogleTest removes googletest options from argv. + bool is_executing_death_test = true; + for (int i = 0; i < argc; i++) { + const char* death_test_flag = "--gtest_internal_run_death_test"; + if (is_prefix(death_test_flag, argv[i])) { + is_executing_death_test = true; + } + } + + ::testing::InitGoogleTest(&argc, argv); + ::testing::GTEST_FLAG(death_test_style) = "threadsafe"; +// ::testing::GTEST_FLAG(death_test_output_prefix) = "Other VM"; + + char* java_home = get_java_home_arg(argc, argv); + if (java_home == NULL) { + fprintf(stderr, "ERROR: You must specify a JDK to use for running the unit tests.\n"); + exit(1); + } +#ifndef _WIN32 + int overwrite = 1; // overwrite an eventual existing value for JAVA_HOME + setenv("JAVA_HOME", java_home, overwrite); + +// workaround for JDK-7131356 +#ifdef __APPLE__ + size_t len = strlen(java_home) + strlen("/lib/jli/libjli.dylib") + 1; + char* path = new char[len]; + snprintf(path, len, "%s/lib/jli/libjli.dylib", java_home); + dlopen(path, RTLD_NOW | RTLD_GLOBAL); +#endif // __APPLE__ + +#else // _WIN32 + char* java_home_var = "_ALT_JAVA_HOME_DIR"; + size_t len = strlen(java_home) + strlen(java_home_var) + 2; + char * envString = new char[len]; + sprintf_s(envString, len, "%s=%s", java_home_var, java_home); + _putenv(envString); +#endif // _WIN32 + argv = remove_test_runner_arguments(&argc, argv); + + if (is_executing_death_test) { + if (init_jvm(argc, argv, true) != 0) { + abort(); + } + } else { + ::testing::TestEventListeners& listeners = ::testing::UnitTest::GetInstance()->listeners(); + listeners.Append(new JVMInitializerListener(argc, argv)); + } + + int result = RUN_ALL_TESTS(); + if (result != 0) { + fprintf(stderr, "ERROR: RUN_ALL_TESTS() failed. Error %d\n", result); + exit(2); + } +} + +} // extern "C" diff --git a/hotspot/test/native/runtime/test_os.cpp b/hotspot/test/native/runtime/test_os.cpp new file mode 100644 index 00000000000..734668501fb --- /dev/null +++ b/hotspot/test/native/runtime/test_os.cpp @@ -0,0 +1,45 @@ +/* + * 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. + * + */ + +#include "runtime/os.hpp" +#include "unittest.hpp" + +TEST_VM(os, page_size_for_region) { + size_t large_page_example = 4 * M; + size_t large_page = os::page_size_for_region_aligned(large_page_example, 1); + + size_t small_page = os::vm_page_size(); + if (large_page > small_page) { + size_t num_small_in_large = large_page / small_page; + size_t page = os::page_size_for_region_aligned(large_page, num_small_in_large); + ASSERT_EQ(page, small_page) << "Did not get a small page"; + } +} + +#ifdef ASSERT +TEST_VM_ASSERT_MSG(os, page_size_for_region_with_zero_min_pages, "sanity") { + size_t region_size = 16 * os::vm_page_size(); + os::page_size_for_region_aligned(region_size, 0); // should assert +} +#endif diff --git a/hotspot/test/native/unittest.hpp b/hotspot/test/native/unittest.hpp new file mode 100644 index 00000000000..5f3f28eeecf --- /dev/null +++ b/hotspot/test/native/unittest.hpp @@ -0,0 +1,104 @@ +/* + * 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. + * + */ + +#include +#include + +#define GTEST_DONT_DEFINE_TEST 1 +#include "gtest/gtest.h" +#ifdef assert + #undef assert +#endif + +#define CONCAT(a, b) a ## b + +#define TEST(category, name) GTEST_TEST(category, CONCAT(name, _test)) + +#define TEST_VM(category, name) GTEST_TEST(category, CONCAT(name, _test_vm)) + +#define TEST_VM_F(test_fixture, name) \ + GTEST_TEST_(test_fixture, name ## _test_vm, test_fixture, \ + ::testing::internal::GetTypeId()) + +#define TEST_OTHER_VM(category, name) \ + static void test_ ## category ## _ ## name ## _(); \ + \ + static void child_ ## category ## _ ## name ## _() { \ + ::testing::GTEST_FLAG(throw_on_failure) = true; \ + test_ ## category ## _ ## name ## _(); \ + fprintf(stderr, "OKIDOKI"); \ + exit(0); \ + } \ + \ + TEST(category, CONCAT(name, _other_vm)) { \ + ASSERT_EXIT(child_ ## category ## _ ## name ## _(), \ + ::testing::ExitedWithCode(0), \ + ".*OKIDOKI.*"); \ + } \ + \ + void test_ ## category ## _ ## name ## _() + +#ifdef ASSERT +#define TEST_VM_ASSERT(category, name) \ + static void test_ ## category ## _ ## name ## _(); \ + \ + static void child_ ## category ## _ ## name ## _() { \ + ::testing::GTEST_FLAG(throw_on_failure) = true; \ + test_ ## category ## _ ## name ## _(); \ + exit(0); \ + } \ + \ + TEST(category, CONCAT(name, _vm_assert)) { \ + ASSERT_EXIT(child_ ## category ## _ ## name ## _(), \ + ::testing::ExitedWithCode(1), \ + "assert failed"); \ + } \ + \ + void test_ ## category ## _ ## name ## _() +#else +#define TEST_VM_ASSERT(...) \ + TEST_VM_ASSERT is only available in debug builds +#endif + +#ifdef ASSERT +#define TEST_VM_ASSERT_MSG(category, name, msg) \ + static void test_ ## category ## _ ## name ## _(); \ + \ + static void child_ ## category ## _ ## name ## _() { \ + ::testing::GTEST_FLAG(throw_on_failure) = true; \ + test_ ## category ## _ ## name ## _(); \ + exit(0); \ + } \ + \ + TEST(category, CONCAT(name, _vm_assert)) { \ + ASSERT_EXIT(child_ ## category ## _ ## name ## _(), \ + ::testing::ExitedWithCode(1), \ + "assert failed: " msg); \ + } \ + \ + void test_ ## category ## _ ## name ## _() +#else +#define TEST_VM_ASSERT_MSG(...) \ + TEST_VM_ASSERT_MSG is only available in debug builds +#endif diff --git a/hotspot/test/native/utilities/test_quicksort.cpp b/hotspot/test/native/utilities/test_quicksort.cpp new file mode 100644 index 00000000000..5a56c877786 --- /dev/null +++ b/hotspot/test/native/utilities/test_quicksort.cpp @@ -0,0 +1,47 @@ +/* + * 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. + * + */ + +#include "prims/jvm.h" +#include "utilities/quickSort.hpp" +#include "unittest.hpp" + +static int int_comparator(int a, int b) { + if (a == b) { + return 0; + } else if (a < b) { + return -1; + } + + // a > b + return 1; +} + +TEST(utilities, quicksort) { + int test_array[] = {3,2,1}; + QuickSort::sort(test_array, 3, int_comparator, false); + + ASSERT_EQ(1, test_array[0]); + ASSERT_EQ(2, test_array[1]); + ASSERT_EQ(3, test_array[2]); +} diff --git a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java index c84bf5c1806..a9f69d60f38 100644 --- a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java +++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java @@ -35,7 +35,7 @@ */ import jdk.internal.org.objectweb.asm.*; import java.lang.reflect.Constructor; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class InvokeSpecialAnonTest implements Opcodes { diff --git a/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java b/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java index d911435382a..6ce8cb1252c 100644 --- a/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java +++ b/hotspot/test/runtime/BoolReturn/NativeSmallIntCallsTest.java @@ -24,6 +24,7 @@ /* @test * @bug 8149170 * @summary Test native functions return booleans as 0/1 but differently than java functions + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile BoolConstructor.java * @run main/native NativeSmallIntCallsTest diff --git a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java index db3b5f6e173..9694382001a 100644 --- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java +++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java @@ -67,6 +67,7 @@ public class XShareAuto { // if sharing failed due to ASLR or similar reasons, // check whether sharing was attempted at all (UseSharedSpaces) output.shouldContain("UseSharedSpaces:"); + output.shouldNotContain("Unable to map %s"); } output.shouldHaveExitValue(0); } diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveClass.java b/hotspot/test/runtime/ClassUnload/KeepAliveClass.java index a1080269447..9c0b50cbe7e 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveClass.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveClass.java @@ -24,6 +24,7 @@ /* * @test KeepAliveClass * @summary This test case uses a java.lang.Class instance to keep a class alive. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /runtime/testlibrary * @library classes * @build KeepAliveClass test.Empty diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java b/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java index 21e92a108f2..ec8fa0d621b 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveClassLoader.java @@ -24,6 +24,7 @@ /* * @test KeepAliveClassLoader * @summary This test case uses a java.lang.ClassLoader instance to keep a class alive. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /runtime/testlibrary * @library classes * @build KeepAliveClassLoader test.Empty diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveObject.java b/hotspot/test/runtime/ClassUnload/KeepAliveObject.java index 4a8ffb70000..aca13b0ea0f 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveObject.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveObject.java @@ -24,6 +24,7 @@ /* * @test KeepAliveObject * @summary This test case uses a class instance to keep the class alive. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /runtime/testlibrary * @library classes * @build KeepAliveObject test.Empty diff --git a/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java b/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java index 0aa3547fc3f..e6321a5ff5f 100644 --- a/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java +++ b/hotspot/test/runtime/ClassUnload/KeepAliveSoftReference.java @@ -24,6 +24,7 @@ /* * @test KeepAliveSoftReference * @summary This test case uses a java.lang.ref.SoftReference referencing a class instance to keep a class alive. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /runtime/testlibrary * @library classes * @build KeepAliveSoftReference test.Empty diff --git a/hotspot/test/runtime/ClassUnload/UnloadTest.java b/hotspot/test/runtime/ClassUnload/UnloadTest.java index cb8f0526329..eada2704506 100644 --- a/hotspot/test/runtime/ClassUnload/UnloadTest.java +++ b/hotspot/test/runtime/ClassUnload/UnloadTest.java @@ -23,6 +23,7 @@ /* * @test UnloadTest + * @modules java.base/jdk.internal.misc * @library /runtime/testlibrary /testlibrary /test/lib * @library classes * @build ClassUnloadCommon test.Empty diff --git a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java index b65df44590f..f2401c778d4 100644 --- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java +++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java @@ -25,6 +25,7 @@ * @test * @bug 8060449 8073989 * @summary Newly obsolete command line options should still give useful error messages when used improperly. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java index e6ec4c5ea8d..7da0e14c225 100644 --- a/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java +++ b/hotspot/test/runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java @@ -90,11 +90,12 @@ public class TestOptionsWithRanges { excludeTestMaxRange("CICompilerCount"); /* - * JDK-8153340 - * Temporary exclude AllocatePrefetchDistance option from testing + * JDK-8156679 + * Temporarily exclude from range testing as the range is not + * valid for all platforms */ - excludeTestRange("AllocatePrefetchDistance"); - + excludeTestRange("AllocatePrefetchLines"); + excludeTestRange("AllocateInstancePrefetchLines"); /* * JDK-8136766 diff --git a/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java b/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java index f0661cd7431..2fd472e2af7 100644 --- a/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java +++ b/hotspot/test/runtime/CommandLine/PrintTouchedMethods.java @@ -106,7 +106,7 @@ public class PrintTouchedMethods { output.shouldHaveExitValue(0); // Test jcmd PrintTouchedMethods VM.print_touched_methods - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); pb = new ProcessBuilder(); pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.print_touched_methods"}); output = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java b/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java index 321a435af6f..3566e5936e2 100644 --- a/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java +++ b/hotspot/test/runtime/CommandLine/TestLongUnrecognizedVMOption.java @@ -26,6 +26,7 @@ * @bug 8129786 * @summary Verify that JVM correctly processes very long unrecognized VM option * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.management * @run main TestLongUnrecognizedVMOption */ diff --git a/hotspot/test/runtime/CommandLine/VMAliasOptions.java b/hotspot/test/runtime/CommandLine/VMAliasOptions.java index fbb350611b3..ee516b9e9d2 100644 --- a/hotspot/test/runtime/CommandLine/VMAliasOptions.java +++ b/hotspot/test/runtime/CommandLine/VMAliasOptions.java @@ -28,6 +28,7 @@ import jdk.test.lib.cli.*; * @test * @bug 8061611 * @summary Test that various alias options correctly set the target options. See aliased_jvm_flags in arguments.cpp. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ public class VMAliasOptions { diff --git a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java index 2b568c0e6a2..5ea7653b7b9 100644 --- a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java +++ b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java @@ -28,6 +28,7 @@ import jdk.test.lib.cli.*; * @test * @bug 8066821 * @summary Test that various options are deprecated. See deprecated_jvm_flags in arguments.cpp. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ public class VMDeprecatedOptions { diff --git a/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java b/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java index de7ed44b05a..0049548897f 100644 --- a/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java +++ b/hotspot/test/runtime/CommandLine/VMOptionsFile/TestVMOptionsFile.java @@ -26,6 +26,7 @@ * @bug 8061999 8135195 8136552 * @summary Test "-XX:VMOptionsFile" VM option * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules jdk.management * @run main TestVMOptionsFile */ diff --git a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java index 299444ffba3..a864f4d3c90 100644 --- a/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java +++ b/hotspot/test/runtime/ErrorHandling/CreateCoredumpOnCrash.java @@ -33,7 +33,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class CreateCoredumpOnCrash { private static class Crasher { @@ -56,7 +56,7 @@ public class CreateCoredumpOnCrash { public static OutputAnalyzer runTest(String option) throws Exception { return new OutputAnalyzer( ProcessTools.createJavaProcessBuilder( - "-Xmx64m", "-XX:-TransmitErrorReport", option, Crasher.class.getName()) + "-Xmx64m", "-XX:-TransmitErrorReport", "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", option, Crasher.class.getName()) .start()); } } diff --git a/hotspot/test/runtime/ErrorHandling/ErrorHandler.java b/hotspot/test/runtime/ErrorHandling/ErrorHandler.java index deabd01755f..ba5cdbc7ab9 100644 --- a/hotspot/test/runtime/ErrorHandling/ErrorHandler.java +++ b/hotspot/test/runtime/ErrorHandling/ErrorHandler.java @@ -27,6 +27,7 @@ * @bug 8015884 * @summary Exercise HotSpot error handling code by invoking java with * -XX:ErrorHandlerTest option to cause an error report. Check the results. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run driver ErrorHandler */ diff --git a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java index 85a0749bd7a..df6b9cea1fe 100644 --- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java +++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java @@ -36,7 +36,7 @@ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import jdk.test.lib.Utils; public class ProblematicFrameTest { diff --git a/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java b/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java index 27bcab55c1f..c34e56a49a4 100644 --- a/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java +++ b/hotspot/test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java @@ -35,6 +35,7 @@ import jdk.test.lib.ProcessTools; * @test * @bug 8074552 * @summary SafeFetch32 and SafeFetchN do not work in error handling + * @modules java.base/jdk.internal.misc * @library /testlibrary * @author Thomas Stuefe (SAP) */ diff --git a/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java b/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java index 0a6e82dcd3c..d658401de68 100644 --- a/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java +++ b/hotspot/test/runtime/ErrorHandling/TestCrashOnOutOfMemoryError.java @@ -24,6 +24,7 @@ /* * @test TestCrashOnOutOfMemoryError * @summary Test using -XX:+CrashOnOutOfMemoryError + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.* * @run driver TestCrashOnOutOfMemoryError diff --git a/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java b/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java index 2f266da6c5d..79d064f6df8 100644 --- a/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java +++ b/hotspot/test/runtime/ErrorHandling/TestExitOnOutOfMemoryError.java @@ -24,6 +24,7 @@ /* * @test TestExitOnOutOfMemoryError * @summary Test using -XX:ExitOnOutOfMemoryError + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.* * @run driver TestExitOnOutOfMemoryError diff --git a/hotspot/test/runtime/ErrorHandling/TestOnError.java b/hotspot/test/runtime/ErrorHandling/TestOnError.java index 4e8763f662e..4fa5c44c32b 100644 --- a/hotspot/test/runtime/ErrorHandling/TestOnError.java +++ b/hotspot/test/runtime/ErrorHandling/TestOnError.java @@ -24,6 +24,7 @@ /* * @test TestOnError * @summary Test using -XX:OnError= + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build TestOnError * @run main TestOnError diff --git a/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java b/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java index 775e1bf1d5b..c81cab5e699 100644 --- a/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java +++ b/hotspot/test/runtime/ErrorHandling/TestOnOutOfMemoryError.java @@ -24,6 +24,7 @@ /* * @test TestOnOutOfMemoryError * @summary Test using -XX:OnOutOfMemoryError= + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build TestOnOutOfMemoryError * @run main TestOnOutOfMemoryError diff --git a/hotspot/test/runtime/Metaspace/FragmentMetaspace.java b/hotspot/test/runtime/Metaspace/FragmentMetaspace.java index d4423a38552..acd64cd3e25 100644 --- a/hotspot/test/runtime/Metaspace/FragmentMetaspace.java +++ b/hotspot/test/runtime/Metaspace/FragmentMetaspace.java @@ -24,6 +24,7 @@ /** * @test * @library /runtime/testlibrary + * @modules java.base/jdk.internal.misc * @modules java.compiler * @build GeneratedClassLoader * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace diff --git a/hotspot/test/runtime/8003720/Asmator.java b/hotspot/test/runtime/MirrorFrame/Asmator.java similarity index 100% rename from hotspot/test/runtime/8003720/Asmator.java rename to hotspot/test/runtime/MirrorFrame/Asmator.java diff --git a/hotspot/test/runtime/8003720/Test8003720.java b/hotspot/test/runtime/MirrorFrame/Test8003720.java similarity index 100% rename from hotspot/test/runtime/8003720/Test8003720.java rename to hotspot/test/runtime/MirrorFrame/Test8003720.java diff --git a/hotspot/test/runtime/8003720/Victim.java b/hotspot/test/runtime/MirrorFrame/Victim.java similarity index 100% rename from hotspot/test/runtime/8003720/Victim.java rename to hotspot/test/runtime/MirrorFrame/Victim.java diff --git a/hotspot/test/runtime/8003720/VictimClassLoader.java b/hotspot/test/runtime/MirrorFrame/VictimClassLoader.java similarity index 100% rename from hotspot/test/runtime/8003720/VictimClassLoader.java rename to hotspot/test/runtime/MirrorFrame/VictimClassLoader.java diff --git a/hotspot/test/runtime/NMT/BaselineWithParameter.java b/hotspot/test/runtime/NMT/BaselineWithParameter.java index 38d31ffcfee..b4982116fc2 100644 --- a/hotspot/test/runtime/NMT/BaselineWithParameter.java +++ b/hotspot/test/runtime/NMT/BaselineWithParameter.java @@ -38,7 +38,7 @@ public class BaselineWithParameter { public static void main(String args[]) throws Exception { // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); OutputAnalyzer output; ProcessBuilder pb = new ProcessBuilder(); diff --git a/hotspot/test/runtime/NMT/ChangeTrackingLevel.java b/hotspot/test/runtime/NMT/ChangeTrackingLevel.java index a5e8beb4a36..e7905480665 100644 --- a/hotspot/test/runtime/NMT/ChangeTrackingLevel.java +++ b/hotspot/test/runtime/NMT/ChangeTrackingLevel.java @@ -26,6 +26,7 @@ * @bug 8059100 * @summary Test that you can decrease NMT tracking level but not increase it. * @key nmt + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build ChangeTrackingLevel * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/NMT/JcmdBaselineDetail.java b/hotspot/test/runtime/NMT/JcmdBaselineDetail.java index ce99b202742..1318dc339e3 100644 --- a/hotspot/test/runtime/NMT/JcmdBaselineDetail.java +++ b/hotspot/test/runtime/NMT/JcmdBaselineDetail.java @@ -37,7 +37,7 @@ public class JcmdBaselineDetail { public static void main(String args[]) throws Exception { // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); OutputAnalyzer output; ProcessBuilder pb = new ProcessBuilder(); diff --git a/hotspot/test/runtime/NMT/JcmdDetailDiff.java b/hotspot/test/runtime/NMT/JcmdDetailDiff.java index 694d47edb66..962afd155f1 100644 --- a/hotspot/test/runtime/NMT/JcmdDetailDiff.java +++ b/hotspot/test/runtime/NMT/JcmdDetailDiff.java @@ -45,7 +45,7 @@ public class JcmdDetailDiff { ProcessBuilder pb = new ProcessBuilder(); OutputAnalyzer output; // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); long commitSize = 128 * 1024; long reserveSize = 256 * 1024; diff --git a/hotspot/test/runtime/NMT/JcmdScale.java b/hotspot/test/runtime/NMT/JcmdScale.java index 13cb50abd22..b8d8e5686e2 100644 --- a/hotspot/test/runtime/NMT/JcmdScale.java +++ b/hotspot/test/runtime/NMT/JcmdScale.java @@ -39,7 +39,7 @@ public class JcmdScale { ProcessBuilder pb = new ProcessBuilder(); OutputAnalyzer output; // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=KB"}); output = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/runtime/NMT/JcmdScaleDetail.java b/hotspot/test/runtime/NMT/JcmdScaleDetail.java index 0379e234dce..27cb8c8dc47 100644 --- a/hotspot/test/runtime/NMT/JcmdScaleDetail.java +++ b/hotspot/test/runtime/NMT/JcmdScaleDetail.java @@ -39,7 +39,7 @@ public class JcmdScaleDetail { ProcessBuilder pb = new ProcessBuilder(); OutputAnalyzer output; // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "scale=KB"}); output = new OutputAnalyzer(pb.start()); diff --git a/hotspot/test/runtime/NMT/JcmdSummaryDiff.java b/hotspot/test/runtime/NMT/JcmdSummaryDiff.java index a53d75f999a..2c0b39cf77d 100644 --- a/hotspot/test/runtime/NMT/JcmdSummaryDiff.java +++ b/hotspot/test/runtime/NMT/JcmdSummaryDiff.java @@ -45,7 +45,7 @@ public class JcmdSummaryDiff { ProcessBuilder pb = new ProcessBuilder(); OutputAnalyzer output; // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); long commitSize = 128 * 1024; long reserveSize = 256 * 1024; diff --git a/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java b/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java index b9c506be5d1..40818656b8f 100644 --- a/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java +++ b/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java @@ -60,7 +60,7 @@ public class JcmdWithNMTDisabled { } // Grab my own PID - pid = Integer.toString(ProcessTools.getProcessId()); + pid = Long.toString(ProcessTools.getProcessId()); jcmdCommand("summary"); jcmdCommand("detail"); diff --git a/hotspot/test/runtime/NMT/MallocRoundingReportTest.java b/hotspot/test/runtime/NMT/MallocRoundingReportTest.java index b823679c486..b5ff6dda485 100644 --- a/hotspot/test/runtime/NMT/MallocRoundingReportTest.java +++ b/hotspot/test/runtime/NMT/MallocRoundingReportTest.java @@ -46,7 +46,7 @@ public class MallocRoundingReportTest { WhiteBox wb = WhiteBox.getWhiteBox(); // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); long[] additionalBytes = {0, 1, 512, 650}; diff --git a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java index 7e754f4bbc2..3bb39aa0afe 100644 --- a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java +++ b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java @@ -26,6 +26,7 @@ * @summary Test corner case that overflows malloc site hashtable bucket * @requires sun.arch.data.model == "32" * @key nmt jcmd stress + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build MallocSiteHashOverflow * @run main ClassFileInstaller sun.hotspot.WhiteBox @@ -48,7 +49,7 @@ public class MallocSiteHashOverflow { int MAX_HASH_SIZE = wb.NMTGetHashSize(); // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); // Verify that current tracking level is "detail" diff --git a/hotspot/test/runtime/NMT/MallocStressTest.java b/hotspot/test/runtime/NMT/MallocStressTest.java index af7f97f5d1f..8d7061f7ce2 100644 --- a/hotspot/test/runtime/NMT/MallocStressTest.java +++ b/hotspot/test/runtime/NMT/MallocStressTest.java @@ -74,7 +74,7 @@ public class MallocStressTest { whiteBox = WhiteBox.getWhiteBox(); // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); AllocThread[] alloc_threads = new AllocThread[256]; diff --git a/hotspot/test/runtime/NMT/MallocTestType.java b/hotspot/test/runtime/NMT/MallocTestType.java index abd04a799e4..3ee5e481a01 100644 --- a/hotspot/test/runtime/NMT/MallocTestType.java +++ b/hotspot/test/runtime/NMT/MallocTestType.java @@ -44,7 +44,7 @@ public class MallocTestType { WhiteBox wb = WhiteBox.getWhiteBox(); // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); // Use WB API to alloc and free with the mtTest type diff --git a/hotspot/test/runtime/NMT/MallocTrackingVerify.java b/hotspot/test/runtime/NMT/MallocTrackingVerify.java index cefbcd9a012..0a77bd25bd4 100644 --- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java +++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java @@ -53,7 +53,7 @@ public class MallocTrackingVerify { OutputAnalyzer output; // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); Random random = new Random(); diff --git a/hotspot/test/runtime/NMT/PrintNMTStatistics.java b/hotspot/test/runtime/NMT/PrintNMTStatistics.java index 7966f23704d..413ade55e80 100644 --- a/hotspot/test/runtime/NMT/PrintNMTStatistics.java +++ b/hotspot/test/runtime/NMT/PrintNMTStatistics.java @@ -26,6 +26,7 @@ * @key nmt regression * @bug 8005936 8058606 * @summary Verify PrintNMTStatistics on normal JVM exit for detail and summary tracking level + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java b/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java index 8453d886ed8..c67b6227754 100644 --- a/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java +++ b/hotspot/test/runtime/NMT/ReleaseCommittedMemory.java @@ -26,6 +26,7 @@ * @bug 8013120 * @summary Release committed memory and make sure NMT handles it correctly * @key nmt regression + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build ReleaseCommittedMemory * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/NMT/ReleaseNoCommit.java b/hotspot/test/runtime/NMT/ReleaseNoCommit.java index 7499d608c13..0d354115b06 100644 --- a/hotspot/test/runtime/NMT/ReleaseNoCommit.java +++ b/hotspot/test/runtime/NMT/ReleaseNoCommit.java @@ -49,7 +49,7 @@ public class ReleaseNoCommit { ProcessBuilder pb = new ProcessBuilder(); OutputAnalyzer output; // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); addr = wb.NMTReserveMemory(reserveSize); // Check for reserved diff --git a/hotspot/test/runtime/NMT/ShutdownTwice.java b/hotspot/test/runtime/NMT/ShutdownTwice.java index 1d354168fe7..d0a7c7777e4 100644 --- a/hotspot/test/runtime/NMT/ShutdownTwice.java +++ b/hotspot/test/runtime/NMT/ShutdownTwice.java @@ -37,7 +37,7 @@ public class ShutdownTwice { public static void main(String args[]) throws Exception { // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); OutputAnalyzer output; ProcessBuilder pb = new ProcessBuilder(); diff --git a/hotspot/test/runtime/NMT/SummaryAfterShutdown.java b/hotspot/test/runtime/NMT/SummaryAfterShutdown.java index 66921152b76..aec1a808576 100644 --- a/hotspot/test/runtime/NMT/SummaryAfterShutdown.java +++ b/hotspot/test/runtime/NMT/SummaryAfterShutdown.java @@ -38,7 +38,7 @@ public class SummaryAfterShutdown { public static void main(String args[]) throws Exception { OutputAnalyzer output; // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); // Run 'jcmd VM.native_memory shutdown' diff --git a/hotspot/test/runtime/NMT/SummarySanityCheck.java b/hotspot/test/runtime/NMT/SummarySanityCheck.java index d322fa649a3..511596bb61d 100644 --- a/hotspot/test/runtime/NMT/SummarySanityCheck.java +++ b/hotspot/test/runtime/NMT/SummarySanityCheck.java @@ -45,7 +45,7 @@ public class SummarySanityCheck { private static String jcmdout; public static void main(String args[]) throws Exception { // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); diff --git a/hotspot/test/runtime/NMT/ThreadedMallocTestType.java b/hotspot/test/runtime/NMT/ThreadedMallocTestType.java index a0e29fca618..2fee0c79f73 100644 --- a/hotspot/test/runtime/NMT/ThreadedMallocTestType.java +++ b/hotspot/test/runtime/NMT/ThreadedMallocTestType.java @@ -46,7 +46,7 @@ public class ThreadedMallocTestType { final WhiteBox wb = WhiteBox.getWhiteBox(); // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); Thread allocThread = new Thread() { diff --git a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java index 8ba7e7c53cd..1611b6f345d 100644 --- a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java +++ b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java @@ -45,7 +45,7 @@ public class ThreadedVirtualAllocTestType { public static void main(String args[]) throws Exception { OutputAnalyzer output; - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); Thread reserveThread = new Thread() { diff --git a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java index fbc5fe9032b..dabdcd443a2 100644 --- a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java +++ b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java @@ -48,7 +48,7 @@ public class VirtualAllocCommitUncommitRecommit { long reserveSize = 4 * 1024 * 1024; // 4096KB long addr; - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); // reserve diff --git a/hotspot/test/runtime/NMT/VirtualAllocTestType.java b/hotspot/test/runtime/NMT/VirtualAllocTestType.java index b8bd3be77a6..da611ab8b29 100644 --- a/hotspot/test/runtime/NMT/VirtualAllocTestType.java +++ b/hotspot/test/runtime/NMT/VirtualAllocTestType.java @@ -46,7 +46,7 @@ public class VirtualAllocTestType { long reserveSize = 256 * 1024; long addr; - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); addr = wb.NMTReserveMemory(reserveSize); diff --git a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java index 0593014f3ee..a759574aada 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java +++ b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java @@ -25,6 +25,7 @@ * @test * @library /testlibrary * @summary Test that type annotations are retained after a retransform + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.instrument * jdk.jartool/sun.tools.jar diff --git a/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java b/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java index 394e31c3907..de76aea5b1d 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java +++ b/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java @@ -26,6 +26,7 @@ * @bug 6904403 * @summary Don't assert if we redefine finalize method * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar diff --git a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java index 525d890b4b7..9921afb1809 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java +++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java @@ -26,6 +26,7 @@ * @bug 8055008 * @summary Redefine EMCP and non-EMCP methods that are running in an infinite loop * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar diff --git a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java index d90007f3627..283d08ddc6b 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java +++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithBacktrace.java @@ -26,6 +26,7 @@ * @bug 8087315 * @summary Get old method's stack trace elements after GC * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar diff --git a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java index 29247220f69..a56907ae0af 100644 --- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java +++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethodsWithResolutionErrors.java @@ -26,6 +26,7 @@ * @bug 8076110 * @summary Redefine running methods that have cached resolution errors * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.org.objectweb.asm * java.instrument * jdk.jartool/sun.tools.jar diff --git a/hotspot/test/runtime/ReservedStack/ReservedStackTest.java b/hotspot/test/runtime/ReservedStack/ReservedStackTest.java index 43177dda31e..3c60d4709ce 100644 --- a/hotspot/test/runtime/ReservedStack/ReservedStackTest.java +++ b/hotspot/test/runtime/ReservedStack/ReservedStackTest.java @@ -24,6 +24,7 @@ /* * @test ReservedStackTest * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @build jdk.test.lib.* * @run main/othervm -XX:-Inline -XX:CompileCommand=exclude,java/util/concurrent/locks/AbstractOwnableSynchronizer.setExclusiveOwnerThread ReservedStackTest diff --git a/hotspot/test/runtime/SameObject/SameObject.java b/hotspot/test/runtime/SameObject/SameObject.java index 14ca5168ff2..10bb41d1a24 100644 --- a/hotspot/test/runtime/SameObject/SameObject.java +++ b/hotspot/test/runtime/SameObject/SameObject.java @@ -30,6 +30,7 @@ import jdk.test.lib.Asserts; * @summary -Xcheck:jni overly strict in JNI method IsSameObject * Fixed in JDK1.3.1_10 * Fixed in JDK1.4.1_07 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm/native -Xcheck:jni SameObject */ diff --git a/hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java b/hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java deleted file mode 100644 index ab8955cb0f7..00000000000 --- a/hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -/* - * @summary Simple jar builder - * Input: jarName className1 className2 ... - * do not specify extensions, just the names - * E.g. prot_domain ProtDomainA ProtDomainB - * Output: A jar containing compiled classes, placed in a test classes folder - */ - -import jdk.test.lib.*; - -import java.io.File; -import java.util.ArrayList; -import sun.tools.jar.Main; - -// Using JarBuilder requires that all to-be-jarred classes should be placed -// in the current working directory, aka "." -public class BasicJarBuilder { - private static final String classDir = System.getProperty("test.classes"); - - public static void build(boolean classesInWorkDir, String jarName, - String ...classNames) throws Exception { - - if (classesInWorkDir) { - createSimpleJar(".", classDir + File.separator + jarName + ".jar", classNames); - } else { - build(jarName, classNames); - } - } - - public static void build(String jarName, String ...classNames) throws Exception { - createSimpleJar(classDir, classDir + File.separator + jarName + ".jar", - classNames); - } - - private static void createSimpleJar(String jarclassDir, String jarName, - String[] classNames) throws Exception { - ArrayList args = new ArrayList(); - args.add("cf"); - args.add(jarName); - addClassArgs(args, jarclassDir, classNames); - createJar(args); - } - - private static void addClassArgs(ArrayList args, String jarclassDir, - String[] classNames) { - - for (String name : classNames) { - args.add("-C"); - args.add(jarclassDir); - args.add(name + ".class"); - } - } - - private static void createJar(ArrayList args) { - Main jarTool = new Main(System.out, System.err, "jar"); - if (!jarTool.run(args.toArray(new String[1]))) { - throw new RuntimeException("jar operation failed"); - } - } - - // Get full path to the test jar - public static String getTestJar(String jar) { - File dir = new File(System.getProperty("test.classes", ".")); - File jarFile = new File(dir, jar); - if (!jarFile.exists()) { - throw new RuntimeException("Cannot find " + jarFile.getPath()); - } - if (!jarFile.isFile()) { - throw new RuntimeException("Not a regular file: " + jarFile.getPath()); - } - return jarFile.getPath(); - } -} diff --git a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java index efc95b94b83..502adcf24be 100644 --- a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java +++ b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java @@ -154,7 +154,7 @@ public class BootAppendTests { APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("[classload] org.omg.CORBA.Context source: jrt:/java.corba"); + output.shouldContain("[class,load] org.omg.CORBA.Context source: jrt:/java.corba"); } } @@ -179,11 +179,11 @@ public class BootAppendTests { APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("[classload] javax.sound.sampled.MyClass"); + output.shouldContain("[class,load] javax.sound.sampled.MyClass"); // When CDS is enabled, the shared class should be loaded from the archive. if (mode.equals("on")) { - output.shouldContain("[classload] javax.sound.sampled.MyClass source: shared objects file"); + output.shouldContain("[class,load] javax.sound.sampled.MyClass source: shared objects file"); } } } @@ -211,8 +211,8 @@ public class BootAppendTests { APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("[classload] org.omg.CORBA.Context"); - output.shouldMatch(".*\\[classload\\] org.omg.CORBA.Context source:.*bootAppend.jar"); + output.shouldContain("[class,load] org.omg.CORBA.Context"); + output.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar"); } } @@ -235,13 +235,13 @@ public class BootAppendTests { APP_CLASS, BOOT_APPEND_CLASS_NAME); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("[classload] nonjdk.myPackage.MyClass"); + output.shouldContain("[class,load] nonjdk.myPackage.MyClass"); // If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded // from the shared archive. if (mode.equals("on")) { output.shouldContain( - "[classload] nonjdk.myPackage.MyClass source: shared objects file"); + "[class,load] nonjdk.myPackage.MyClass source: shared objects file"); } } } diff --git a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java index 1d30fd6b963..4d24b549fd4 100644 --- a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java +++ b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java @@ -36,7 +36,7 @@ import jdk.test.lib.*; public class DumpSymbolAndStringTable { public static void main(String[] args) throws Exception { // Grab my own PID - String pid = Integer.toString(ProcessTools.getProcessId()); + String pid = Long.toString(ProcessTools.getProcessId()); ProcessBuilder pb = new ProcessBuilder(); pb.command(new String[] {JDKToolFinder.getJDKTool("jcmd"), pid, "VM.symboltable", "-verbose"}); diff --git a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java index 32dfb2a2445..47304b4f287 100644 --- a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java +++ b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java @@ -125,7 +125,7 @@ public class LimitSharedSizes { // test with sizes which just meet the minimum required sizes // the following tests also attempt to use the shared archive - new SharedSizeTestData(Region.RO, Platform.is64bit() ? "9M":"8M", Result.VALID_ARCHIVE), + new SharedSizeTestData(Region.RO, Platform.is64bit() ? "10M":"9M", Result.VALID_ARCHIVE), new SharedSizeTestData(Region.RW, Platform.is64bit() ? "12M":"7M", Result.VALID_ARCHIVE), new SharedSizeTestData(Region.MD, Platform.is64bit() ? "4M":"2M", Result.VALID_ARCHIVE), new SharedSizeTestData(Region.MC, "120k", Result.VALID_ARCHIVE), @@ -176,7 +176,7 @@ public class LimitSharedSizes { output.getOutput().contains("Unable to reserve shared space at required address")) && output.getExitValue() == 1) { System.out.println("Unable to use shared archive: test not executed; assumed passed"); - return; + continue; } } output.shouldHaveExitValue(0); diff --git a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java new file mode 100644 index 00000000000..2cd84536659 --- /dev/null +++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTest.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test SASymbolTableTest + * @summary Walk symbol table using SA, with and without CDS. + * @library /testlibrary + * @modules java.base/jdk.internal.misc + * jdk.hotspot.agent/sun.jvm.hotspot.oops + * jdk.hotspot.agent/sun.jvm.hotspot.memory + * jdk.hotspot.agent/sun.jvm.hotspot.runtime + * jdk.hotspot.agent/sun.jvm.hotspot.tools + * java.management + * @build SASymbolTableTestAgent SASymbolTableTestAttachee jdk.test.lib.* + * @run main SASymbolTableTest + */ + +import jdk.test.lib.*; + +/* + * The purpose of this test is to validate that we can use SA to + * attach a process and walk its SymbolTable, regardless whether + * the attachee process runs in CDS mode or not. + * + * SASymbolTableTest Just sets up the agent and attachee processes. + * The SymbolTable walking is done in the SASymbolTableTestAgent class. + */ +public class SASymbolTableTest { + static String jsaName = "./SASymbolTableTest.jsa"; + + public static void main(String[] args) throws Exception { + if (!Platform.shouldSAAttach()) { + System.out.println("SA attach not expected to work - test skipped."); + return; + } + createArchive(); + run(true); + run(false); + } + + private static void createArchive() throws Exception { + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:SharedArchiveFile=" + jsaName, + "-Xshare:dump"); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Loading classes to share"); + output.shouldHaveExitValue(0); + } + + private static void run(boolean useArchive) throws Exception { + String flag = useArchive ? "auto" : "off"; + + // (1) Launch the attachee process + ProcessBuilder attachee = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:SharedArchiveFile=" + jsaName, + "-Xshare:" + flag, + "-showversion", // so we can see "sharing" in the output + "SASymbolTableTestAttachee"); + + final Process p = attachee.start(); + + // (2) Launch the agent process + long pid = p.getPid(); + System.out.println("Attaching agent " + pid); + ProcessBuilder tool = ProcessTools.createJavaProcessBuilder( + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED", + "-XaddExports:jdk.hotspot.agent/sun.jvm.hotspot.tools=ALL-UNNAMED", + "SASymbolTableTestAgent", + Long.toString(pid)); + OutputAnalyzer output = ProcessTools.executeProcess(tool); + System.out.println(output.getOutput()); + output.shouldHaveExitValue(0); + + Thread t = new Thread() { + public void run() { + try { + OutputAnalyzer output = new OutputAnalyzer(p); + System.out.println("STDOUT["); + System.out.print(output.getStdout()); + System.out.println("]"); + System.out.println("STDERR["); + System.out.print(output.getStderr()); + System.out.println("]"); + } catch (Throwable t) { + t.printStackTrace(); + } + } + }; + t.start(); + + Thread.sleep(2 * 1000); + p.destroy(); + t.join(); + } +} diff --git a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAgent.java b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAgent.java new file mode 100644 index 00000000000..4c5193fbcc4 --- /dev/null +++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAgent.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import sun.jvm.hotspot.memory.SymbolTable; +import sun.jvm.hotspot.oops.Symbol; +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.tools.Tool; + +/** + * This class is launched in a sub-process by the main test, + * SASymbolTableTest.java. + * + * It uses SA to connect to another JVM process, whose PID is specified in args[]. + * The purpose of the test is to validate that we can walk the SymbolTable + * and CompactHashTable of the other process. Everything should work regardless + * of whether the other process runs in CDS mode or not. + * + * Note: CompactHashTable is used only when CDS is enabled. + */ +public class SASymbolTableTestAgent extends Tool { + public SASymbolTableTestAgent() { + super(); + } + public static void main(String args[]) { + SASymbolTableTestAgent tool = new SASymbolTableTestAgent(); + tool.execute(args); + } + + static String[] commonNames = { + "java/lang/Object", + "java/lang/String", + "java/lang/Class", + "java/lang/Cloneable", + "java/lang/ClassLoader", + "java/io/Serializable", + "java/lang/System", + "java/lang/Throwable", + "java/lang/Error", + "java/lang/ThreadDeath", + "java/lang/Exception", + "java/lang/RuntimeException", + "java/lang/SecurityManager", + "java/security/ProtectionDomain", + "java/security/AccessControlContext", + "java/security/SecureClassLoader", + "java/lang/ClassNotFoundException", + "java/lang/NoClassDefFoundError", + "java/lang/LinkageError", + "java/lang/ClassCastException", + "java/lang/ArrayStoreException", + "java/lang/VirtualMachineError", + "java/lang/OutOfMemoryError", + "java/lang/StackOverflowError", + "java/lang/IllegalMonitorStateException", + "java/lang/ref/Reference", + "java/lang/ref/SoftReference", + "java/lang/ref/WeakReference", + "java/lang/ref/FinalReference", + "java/lang/ref/PhantomReference", + "java/lang/ref/Finalizer", + "java/lang/Thread", + "java/lang/ThreadGroup", + "java/util/Properties", + "java/lang/reflect/AccessibleObject", + "java/lang/reflect/Field", + "java/lang/reflect/Method", + "java/lang/reflect/Constructor", + "java/lang/invoke/MethodHandle", + "java/lang/invoke/MemberName", + "java/lang/invoke/MethodHandleNatives", + "java/lang/invoke/MethodType", + "java/lang/BootstrapMethodError", + "java/lang/invoke/CallSite", + "java/lang/invoke/ConstantCallSite", + "java/lang/invoke/MutableCallSite", + "java/lang/invoke/VolatileCallSite", + "java/lang/StringBuffer", + "java/lang/StringBuilder", + "java/io/ByteArrayInputStream", + "java/io/File", + "java/net/URLClassLoader", + "java/net/URL", + "java/util/jar/Manifest", + "java/security/CodeSource", + }; + + static String[] badNames = { + "java/lang/badbadbad", + "java/io/badbadbadbad", + "this*symbol*must*not*exist" + }; + + public void run() { + System.out.println("SASymbolTableTestAgent: starting"); + VM vm = VM.getVM(); + SymbolTable table = vm.getSymbolTable(); + + // (a) These are names that are likely to exist in the symbol table + // of a JVM after start-up. They were taken from vmSymbols.hpp + // during the middle of JDK9 development. + // + // The purpose is not to check that each name must exist (a future + // version of JDK may not preload some of the classes). + // + // The purpose of this loops is to ensure that we check a lot of symbols, + // so we will (most likely) hit on both VALUE_ONLY_BUCKET_TYPE and normal bucket type + // in CompactHashTable.probe(). + for (String n : commonNames) { + Symbol s = table.probe(n); + System.out.format("%-40s = %s\n", n, s); + } + + System.out.println("======================================================================"); + + // (b) Also test a few strings that are known to not exist in the table. This will + // both the compact table (if it exists) and the regular table to be walked. + for (String n : badNames) { + Symbol s = table.probe(n); + System.out.format("%-40s = %s\n", n, s); + } + } +} diff --git a/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAttachee.java b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAttachee.java new file mode 100644 index 00000000000..e08d1a55bf5 --- /dev/null +++ b/hotspot/test/runtime/SharedArchiveFile/SASymbolTableTestAttachee.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * This class is launched in a sub-process by the main test, + * SASymbolTableTest.java. + * + * This class does nothing in particular. It just sleeps for 120 + * seconds so SASymbolTableTestAgent can have a chance to examine its + * SymbolTable. This process should be killed by the parent process + * after SASymbolTableTestAgent has completed testing. + */ +public class SASymbolTableTestAttachee { + public static void main(String args[]) throws Throwable { + System.out.println("SASymbolTableTestAttachee: sleeping to wait for SA tool to attach ..."); + Thread.sleep(120 * 1000); + } +} diff --git a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java index ed2b3e3dbc5..ec7bf3aaa1f 100644 --- a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java +++ b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java @@ -40,37 +40,51 @@ import jdk.test.lib.*; public class SharedStrings { public static void main(String[] args) throws Exception { + boolean test_runtime = true; ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./SharedStrings.jsa", + "-XX:+UseG1GC", + "-XX:+UseCompressedOops", "-XX:+PrintSharedSpaces", // Needed for bootclasspath match, for CDS to work with WhiteBox API "-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), "-Xshare:dump"); - new OutputAnalyzer(pb.start()) - .shouldContain("Loading classes to share") - .shouldContain("Shared string table stats") - .shouldHaveExitValue(0); - - pb = ProcessTools.createJavaProcessBuilder( - "-XX:+UnlockDiagnosticVMOptions", - "-XX:SharedArchiveFile=./SharedStrings.jsa", - // these are required modes for shared strings - "-XX:+UseCompressedOops", "-XX:+UseG1GC", - // needed for access to white box test API - "-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), - "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", - "-Xshare:on", "-showversion", "SharedStringsWb"); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - + OutputAnalyzer dumpOutput = new OutputAnalyzer(pb.start()); try { - output.shouldContain("sharing"); - output.shouldHaveExitValue(0); + dumpOutput.shouldContain("Loading classes to share"); + dumpOutput.shouldContain("Shared string table stats"); + dumpOutput.shouldHaveExitValue(0); } catch (RuntimeException e) { - output.shouldContain("Unable to use shared archive"); - output.shouldHaveExitValue(1); + if (dumpOutput.getOutput().indexOf("Shared strings are excluded") != -1 || + dumpOutput.getOutput().indexOf("Cannot dump shared archive") != -1) { + test_runtime = false; + } else { + throw new RuntimeException("Unexpected failure"); + } + } + + if (test_runtime) { + pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", + "-XX:SharedArchiveFile=./SharedStrings.jsa", + // these are required modes for shared strings + "-XX:+UseCompressedOops", "-XX:+UseG1GC", + // needed for access to white box test API + "-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"), + "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI", + "-Xshare:on", "-showversion", "SharedStringsWb"); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + try { + output.shouldContain("sharing"); + output.shouldHaveExitValue(0); + } catch (RuntimeException e) { + output.shouldContain("Unable to use shared archive"); + output.shouldHaveExitValue(1); + } } } } diff --git a/hotspot/test/runtime/Thread/Fibonacci.java b/hotspot/test/runtime/Thread/Fibonacci.java index c8bbed1f980..65ae1c320b1 100644 --- a/hotspot/test/runtime/Thread/Fibonacci.java +++ b/hotspot/test/runtime/Thread/Fibonacci.java @@ -28,6 +28,7 @@ * This test is skipped on 32-bit Windows: limited virtual space on Win-32 * make this test inherently unstable on Windows with 32-bit VM data model. * @requires !(os.family == "windows" & sun.arch.data.model == "32") + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm Fibonacci 15 */ diff --git a/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java b/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java index 39af699218d..1670b02656f 100644 --- a/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java +++ b/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java @@ -36,6 +36,7 @@ import jdk.test.lib.Asserts; * @bug 4345157 * @summary JDK 1.3.0 alters thread signal mask * @requires (os.simpleArch == "sparcv9") + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile Prog.java * @run main/native ThreadSignalMask diff --git a/hotspot/test/runtime/Throwable/TestThrowable.java b/hotspot/test/runtime/Throwable/TestThrowable.java index f3cb1ad2bcc..9cdef2d4b89 100644 --- a/hotspot/test/runtime/Throwable/TestThrowable.java +++ b/hotspot/test/runtime/Throwable/TestThrowable.java @@ -25,6 +25,7 @@ * @test * @bug 8150778 * @summary Test exception depths, and code to get stack traces + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm -XX:MaxJavaStackTraceDepth=1024 TestThrowable */ diff --git a/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java b/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java index fd4be6c88e1..71f1dc22d46 100644 --- a/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java +++ b/hotspot/test/runtime/Throwable/ThrowableIntrospectionSegfault.java @@ -25,6 +25,7 @@ * @test * @bug 8033735 * @summary check backtrace field introspection + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main ThrowableIntrospectionSegfault */ diff --git a/hotspot/test/runtime/Unsafe/AllocateInstance.java b/hotspot/test/runtime/Unsafe/AllocateInstance.java index e9748e539db..6b283d3556b 100644 --- a/hotspot/test/runtime/Unsafe/AllocateInstance.java +++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java @@ -31,7 +31,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class AllocateInstance { diff --git a/hotspot/test/runtime/Unsafe/AllocateMemory.java b/hotspot/test/runtime/Unsafe/AllocateMemory.java index 0af6fcbf014..d9f8a122afb 100644 --- a/hotspot/test/runtime/Unsafe/AllocateMemory.java +++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java @@ -32,7 +32,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class AllocateMemory { diff --git a/hotspot/test/runtime/Unsafe/CopyMemory.java b/hotspot/test/runtime/Unsafe/CopyMemory.java index ef67517c2a2..e2328d35851 100644 --- a/hotspot/test/runtime/Unsafe/CopyMemory.java +++ b/hotspot/test/runtime/Unsafe/CopyMemory.java @@ -31,7 +31,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class CopyMemory { diff --git a/hotspot/test/runtime/Unsafe/DefineClass.java b/hotspot/test/runtime/Unsafe/DefineClass.java index bf10a393d0e..fa0d3b64ccd 100644 --- a/hotspot/test/runtime/Unsafe/DefineClass.java +++ b/hotspot/test/runtime/Unsafe/DefineClass.java @@ -34,7 +34,7 @@ import java.security.ProtectionDomain; import java.io.InputStream; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class DefineClass { diff --git a/hotspot/test/runtime/Unsafe/FieldOffset.java b/hotspot/test/runtime/Unsafe/FieldOffset.java index 6bbd785019b..abf62fc1adc 100644 --- a/hotspot/test/runtime/Unsafe/FieldOffset.java +++ b/hotspot/test/runtime/Unsafe/FieldOffset.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.*; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetField.java b/hotspot/test/runtime/Unsafe/GetField.java index 48e71b58b02..f01d5deeb7d 100644 --- a/hotspot/test/runtime/Unsafe/GetField.java +++ b/hotspot/test/runtime/Unsafe/GetField.java @@ -31,7 +31,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import java.lang.reflect.*; import static jdk.test.lib.Asserts.*; diff --git a/hotspot/test/runtime/Unsafe/GetKlassPointerGetJavaMirror.java b/hotspot/test/runtime/Unsafe/GetKlassPointerGetJavaMirror.java index f1fc7d52331..7a53be5e7e5 100644 --- a/hotspot/test/runtime/Unsafe/GetKlassPointerGetJavaMirror.java +++ b/hotspot/test/runtime/Unsafe/GetKlassPointerGetJavaMirror.java @@ -32,7 +32,7 @@ import static jdk.test.lib.Asserts.*; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class GetKlassPointerGetJavaMirror { diff --git a/hotspot/test/runtime/Unsafe/GetPutAddress.java b/hotspot/test/runtime/Unsafe/GetPutAddress.java index 9650d040c72..1dd0a18de83 100644 --- a/hotspot/test/runtime/Unsafe/GetPutAddress.java +++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java @@ -31,7 +31,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutAddress { diff --git a/hotspot/test/runtime/Unsafe/GetPutBoolean.java b/hotspot/test/runtime/Unsafe/GetPutBoolean.java index eddbc6c23ac..51e59cf4069 100644 --- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java +++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutBoolean { diff --git a/hotspot/test/runtime/Unsafe/GetPutByte.java b/hotspot/test/runtime/Unsafe/GetPutByte.java index ec08dd2ad85..48f4700d95d 100644 --- a/hotspot/test/runtime/Unsafe/GetPutByte.java +++ b/hotspot/test/runtime/Unsafe/GetPutByte.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutByte { diff --git a/hotspot/test/runtime/Unsafe/GetPutChar.java b/hotspot/test/runtime/Unsafe/GetPutChar.java index 79e94f0a6de..86b5c80cc36 100644 --- a/hotspot/test/runtime/Unsafe/GetPutChar.java +++ b/hotspot/test/runtime/Unsafe/GetPutChar.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutChar { diff --git a/hotspot/test/runtime/Unsafe/GetPutDouble.java b/hotspot/test/runtime/Unsafe/GetPutDouble.java index b1d7431e3b1..1073c8e1435 100644 --- a/hotspot/test/runtime/Unsafe/GetPutDouble.java +++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutDouble { diff --git a/hotspot/test/runtime/Unsafe/GetPutFloat.java b/hotspot/test/runtime/Unsafe/GetPutFloat.java index 16de792dac6..f49ac7541ed 100644 --- a/hotspot/test/runtime/Unsafe/GetPutFloat.java +++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutFloat { diff --git a/hotspot/test/runtime/Unsafe/GetPutInt.java b/hotspot/test/runtime/Unsafe/GetPutInt.java index 0a4403668aa..49f82d5d7b4 100644 --- a/hotspot/test/runtime/Unsafe/GetPutInt.java +++ b/hotspot/test/runtime/Unsafe/GetPutInt.java @@ -31,7 +31,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutInt { diff --git a/hotspot/test/runtime/Unsafe/GetPutLong.java b/hotspot/test/runtime/Unsafe/GetPutLong.java index 2c524e2e516..8336c858f6b 100644 --- a/hotspot/test/runtime/Unsafe/GetPutLong.java +++ b/hotspot/test/runtime/Unsafe/GetPutLong.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutLong { diff --git a/hotspot/test/runtime/Unsafe/GetPutObject.java b/hotspot/test/runtime/Unsafe/GetPutObject.java index e4add8f9e76..6607db3b8f6 100644 --- a/hotspot/test/runtime/Unsafe/GetPutObject.java +++ b/hotspot/test/runtime/Unsafe/GetPutObject.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutObject { diff --git a/hotspot/test/runtime/Unsafe/GetPutShort.java b/hotspot/test/runtime/Unsafe/GetPutShort.java index f7b94fb0e54..2ede76c1402 100644 --- a/hotspot/test/runtime/Unsafe/GetPutShort.java +++ b/hotspot/test/runtime/Unsafe/GetPutShort.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetPutShort { diff --git a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java index 9673c75aea9..dc72a5e7209 100644 --- a/hotspot/test/runtime/Unsafe/GetUncompressedObject.java +++ b/hotspot/test/runtime/Unsafe/GetUncompressedObject.java @@ -32,7 +32,7 @@ import static jdk.test.lib.Asserts.*; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class GetUncompressedObject { diff --git a/hotspot/test/runtime/Unsafe/GetUnsafe.java b/hotspot/test/runtime/Unsafe/GetUnsafe.java index 8cb95f54eae..64ad19d8bdd 100644 --- a/hotspot/test/runtime/Unsafe/GetUnsafe.java +++ b/hotspot/test/runtime/Unsafe/GetUnsafe.java @@ -29,7 +29,7 @@ * @run main GetUnsafe */ -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class GetUnsafe { diff --git a/hotspot/test/runtime/Unsafe/PageSize.java b/hotspot/test/runtime/Unsafe/PageSize.java index 6b29f6dcca5..6ce5a1c5f47 100644 --- a/hotspot/test/runtime/Unsafe/PageSize.java +++ b/hotspot/test/runtime/Unsafe/PageSize.java @@ -32,7 +32,7 @@ import java.lang.reflect.Field; import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class PageSize { diff --git a/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java b/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java index 5405d4bce08..f081efcaf80 100644 --- a/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java +++ b/hotspot/test/runtime/Unsafe/PrimitiveHostClass.java @@ -25,7 +25,7 @@ import java.awt.Component; import java.lang.reflect.Field; import static jdk.internal.org.objectweb.asm.Opcodes.*; import jdk.internal.org.objectweb.asm.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /* * @test PrimitiveHostClass diff --git a/hotspot/test/runtime/Unsafe/RangeCheck.java b/hotspot/test/runtime/Unsafe/RangeCheck.java index ecd413c3bc4..0e9b914234b 100644 --- a/hotspot/test/runtime/Unsafe/RangeCheck.java +++ b/hotspot/test/runtime/Unsafe/RangeCheck.java @@ -31,7 +31,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; public class RangeCheck { @@ -44,6 +44,7 @@ public class RangeCheck { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( true, "-Xmx32m", + "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-TransmitErrorReport", "-XX:-CreateCoredumpOnCrash", "-XX:-InlineUnsafeOps", // The compiler intrinsics doesn't have the assert diff --git a/hotspot/test/runtime/Unsafe/Reallocate.java b/hotspot/test/runtime/Unsafe/Reallocate.java index 10992fca115..b2fe5d939e2 100644 --- a/hotspot/test/runtime/Unsafe/Reallocate.java +++ b/hotspot/test/runtime/Unsafe/Reallocate.java @@ -32,7 +32,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class Reallocate { diff --git a/hotspot/test/runtime/Unsafe/SetMemory.java b/hotspot/test/runtime/Unsafe/SetMemory.java index e1991968429..8ff36cc788b 100644 --- a/hotspot/test/runtime/Unsafe/SetMemory.java +++ b/hotspot/test/runtime/Unsafe/SetMemory.java @@ -31,7 +31,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class SetMemory { diff --git a/hotspot/test/runtime/Unsafe/ThrowException.java b/hotspot/test/runtime/Unsafe/ThrowException.java index 957be3c1db8..c263aa18684 100644 --- a/hotspot/test/runtime/Unsafe/ThrowException.java +++ b/hotspot/test/runtime/Unsafe/ThrowException.java @@ -31,7 +31,7 @@ */ import jdk.test.lib.*; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import static jdk.test.lib.Asserts.*; public class ThrowException { diff --git a/hotspot/test/runtime/contended/Basic.java b/hotspot/test/runtime/contended/Basic.java index bf64e946f29..5ffba1aa920 100644 --- a/hotspot/test/runtime/contended/Basic.java +++ b/hotspot/test/runtime/contended/Basic.java @@ -35,13 +35,14 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.Contended; /* * @test * @bug 8003985 * @summary Support Contended Annotation - JEP 142 + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @run main/othervm -XX:-RestrictContended Basic */ diff --git a/hotspot/test/runtime/contended/DefaultValue.java b/hotspot/test/runtime/contended/DefaultValue.java index 8ed4f064088..b61ab3d4502 100644 --- a/hotspot/test/runtime/contended/DefaultValue.java +++ b/hotspot/test/runtime/contended/DefaultValue.java @@ -35,7 +35,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.Contended; /* @@ -43,6 +43,7 @@ import jdk.internal.vm.annotation.Contended; * @bug 8014509 * @summary \@Contended: explicit default value behaves differently from the implicit value * + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @run main/othervm -XX:-RestrictContended DefaultValue */ diff --git a/hotspot/test/runtime/contended/HasNonStatic.java b/hotspot/test/runtime/contended/HasNonStatic.java index 3e07c09fcfe..04f2fb8708b 100644 --- a/hotspot/test/runtime/contended/HasNonStatic.java +++ b/hotspot/test/runtime/contended/HasNonStatic.java @@ -35,7 +35,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.Contended; /* @@ -43,6 +43,7 @@ import jdk.internal.vm.annotation.Contended; * @bug 8015270 * @summary \@Contended: fix multiple issues in the layout code * + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @run main/othervm -XX:-RestrictContended HasNonStatic */ diff --git a/hotspot/test/runtime/contended/Inheritance1.java b/hotspot/test/runtime/contended/Inheritance1.java index f3333610cf3..57dec49b3ae 100644 --- a/hotspot/test/runtime/contended/Inheritance1.java +++ b/hotspot/test/runtime/contended/Inheritance1.java @@ -35,7 +35,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.Contended; /* @@ -43,6 +43,7 @@ import jdk.internal.vm.annotation.Contended; * @bug 8012939 * @summary \@Contended doesn't work correctly with inheritance * + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.vm.annotation * @run main/othervm -XX:-RestrictContended Inheritance1 */ diff --git a/hotspot/test/runtime/contended/OopMaps.java b/hotspot/test/runtime/contended/OopMaps.java index 27d5ba8ddf8..a3b3e01e622 100644 --- a/hotspot/test/runtime/contended/OopMaps.java +++ b/hotspot/test/runtime/contended/OopMaps.java @@ -35,7 +35,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import sun.misc.Unsafe; import jdk.internal.vm.annotation.Contended; /* diff --git a/hotspot/test/runtime/contended/OopMapsSameGroup.java b/hotspot/test/runtime/contended/OopMapsSameGroup.java index 6975fd3dc68..5adb0129483 100644 --- a/hotspot/test/runtime/contended/OopMapsSameGroup.java +++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java @@ -35,7 +35,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.lang.reflect.Field; import java.lang.reflect.Modifier; -import sun.misc.Unsafe; import jdk.internal.vm.annotation.Contended; /* diff --git a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java index 94b6368f7db..04916a3e7b8 100644 --- a/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java +++ b/hotspot/test/runtime/getSysPackage/GetSysPkgTest.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.loader * java.desktop * @library /testlibrary diff --git a/hotspot/test/runtime/interned/SanityTest.java b/hotspot/test/runtime/interned/SanityTest.java index 6f07b0cc907..c0f2f726040 100644 --- a/hotspot/test/runtime/interned/SanityTest.java +++ b/hotspot/test/runtime/interned/SanityTest.java @@ -24,6 +24,7 @@ /* * @test SanityTest * @summary Sanity check of String.intern() & GC + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build SanityTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java index e9a8406f0f1..49201a7aa13 100644 --- a/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java +++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java @@ -27,6 +27,7 @@ * @bug 8141445 * @summary make sure the Solaris Sparc M7 libadimalloc.so library generates SIGSEGV's on buffer overflow * @requires (os.family == "solaris" & os.arch == "sparcv9") + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.* * @compile SEGVOverflow.java diff --git a/hotspot/test/runtime/logging/ClassInitializationTest.java b/hotspot/test/runtime/logging/ClassInitializationTest.java index a95cc489a3e..9ffd4d236fe 100644 --- a/hotspot/test/runtime/logging/ClassInitializationTest.java +++ b/hotspot/test/runtime/logging/ClassInitializationTest.java @@ -25,6 +25,7 @@ /* * @test ClassInitializationTest * @bug 8142976 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile BadMap50.jasm * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools @@ -40,7 +41,7 @@ public class ClassInitializationTest { public static void main(String... args) throws Exception { // (1) - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:classinit=info", + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=info", "-Xverify:all", "-Xmx64m", "BadMap50"); @@ -53,7 +54,7 @@ public class ClassInitializationTest { // (2) if (Platform.isDebugBuild()) { - pb = ProcessTools.createJavaProcessBuilder("-Xlog:classinit=info", + pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=info", "-Xverify:all", "-XX:+EagerInitialization", "-Xmx64m", @@ -63,13 +64,13 @@ public class ClassInitializationTest { out.shouldHaveExitValue(0); } - // (3) classinit should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xlog:classinit=off", + // (3) class+init should turn off. + pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=off", "-Xverify:all", "-Xmx64m", "BadMap50"); out = new OutputAnalyzer(pb.start()); - out.shouldNotContain("[classinit]"); + out.shouldNotContain("[class,init]"); out.shouldNotContain("Fail over class verification to old verifier for: BadMap50"); } diff --git a/hotspot/test/runtime/logging/ClassLoadUnloadTest.java b/hotspot/test/runtime/logging/ClassLoadUnloadTest.java index 85cf5cb2284..e9c5d97ba83 100644 --- a/hotspot/test/runtime/logging/ClassLoadUnloadTest.java +++ b/hotspot/test/runtime/logging/ClassLoadUnloadTest.java @@ -25,6 +25,7 @@ /* * @test ClassLoadUnloadTest * @bug 8142506 + * @modules java.base/jdk.internal.misc * @library /testlibrary /runtime/testlibrary * @library classes * @build ClassUnloadCommon test.Empty jdk.test.lib.* jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools @@ -79,50 +80,50 @@ public class ClassLoadUnloadTest { public static void main(String... args) throws Exception { - // -Xlog:classunload=info - pb = exec("-Xlog:classunload=info"); - checkFor("[classunload]", "unloading class"); + // -Xlog:class+unload=info + pb = exec("-Xlog:class+unload=info"); + checkFor("[class,unload]", "unloading class"); - // -Xlog:classunload=off - pb = exec("-Xlog:classunload=off"); - checkAbsent("[classunload]"); + // -Xlog:class+unload=off + pb = exec("-Xlog:class+unload=off"); + checkAbsent("[class,unload]"); // -XX:+TraceClassUnloading pb = exec("-XX:+TraceClassUnloading"); - checkFor("[classunload]", "unloading class"); + checkFor("[class,unload]", "unloading class"); // -XX:-TraceClassUnloading pb = exec("-XX:-TraceClassUnloading"); - checkAbsent("[classunload]"); + checkAbsent("[class,unload]"); - // -Xlog:classload=info - pb = exec("-Xlog:classload=info"); - checkFor("[classload]", "java.lang.Object", "source:"); + // -Xlog:class+load=info + pb = exec("-Xlog:class+load=info"); + checkFor("[class,load]", "java.lang.Object", "source:"); - // -Xlog:classload=debug - pb = exec("-Xlog:classload=debug"); - checkFor("[classload]", "java.lang.Object", "source:", "klass:", "super:", "loader:", "bytes:"); + // -Xlog:class+load=debug + pb = exec("-Xlog:class+load=debug"); + checkFor("[class,load]", "java.lang.Object", "source:", "klass:", "super:", "loader:", "bytes:"); - // -Xlog:classload=off - pb = exec("-Xlog:classload=off"); - checkAbsent("[classload]"); + // -Xlog:class+load=off + pb = exec("-Xlog:class+load=off"); + checkAbsent("[class,load]"); // -XX:+TraceClassLoading pb = exec("-XX:+TraceClassLoading"); - checkFor("[classload]", "java.lang.Object", "source:"); + checkFor("[class,load]", "java.lang.Object", "source:"); // -XX:-TraceClassLoading pb = exec("-XX:-TraceClassLoading"); - checkAbsent("[classload]"); + checkAbsent("[class,load]"); // -verbose:class pb = exec("-verbose:class"); - checkFor("[classload]", "java.lang.Object", "source:"); - checkFor("[classunload]", "unloading class"); + checkFor("[class,load]", "java.lang.Object", "source:"); + checkFor("[class,unload]", "unloading class"); - // -Xlog:classloaderdata=trace - pb = exec("-Xlog:classloaderdata=trace"); - checkFor("[classloaderdata]", "create class loader data"); + // -Xlog:class+loader+data=trace + pb = exec("-Xlog:class+loader+data=trace"); + checkFor("[class,loader,data]", "create class loader data"); } } diff --git a/hotspot/test/runtime/logging/ClassResolutionTest.java b/hotspot/test/runtime/logging/ClassResolutionTest.java index 700fc77cb29..ceebd4c3ac0 100644 --- a/hotspot/test/runtime/logging/ClassResolutionTest.java +++ b/hotspot/test/runtime/logging/ClassResolutionTest.java @@ -25,6 +25,7 @@ /* * @test ClassResolutionTest * @bug 8144874 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver ClassResolutionTest @@ -58,32 +59,32 @@ public class ClassResolutionTest { public static void main(String... args) throws Exception { - // (1) classresolve should turn on. - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:classresolve=debug", + // (1) class+resolve should turn on. + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+resolve=debug", ClassResolutionTestMain.class.getName()); OutputAnalyzer o = new OutputAnalyzer(pb.start()); - o.shouldContain("[classresolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1"); - o.shouldContain("[classresolve] resolve JVM_CONSTANT_MethodHandle"); + o.shouldContain("[class,resolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1"); + o.shouldContain("[class,resolve] resolve JVM_CONSTANT_MethodHandle"); - // (2) classresolve should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xlog:classresolve=debug", - "-Xlog:classresolve=off", + // (2) class+resolve should turn off. + pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+resolve=debug", + "-Xlog:class+resolve=off", ClassResolutionTestMain.class.getName()); o = new OutputAnalyzer(pb.start()); - o.shouldNotContain("[classresolve]"); + o.shouldNotContain("[class,resolve]"); // (3) TraceClassResolution should turn on. pb = ProcessTools.createJavaProcessBuilder("-XX:+TraceClassResolution", ClassResolutionTestMain.class.getName()); o = new OutputAnalyzer(pb.start()); - o.shouldContain("[classresolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1"); + o.shouldContain("[class,resolve] ClassResolutionTest$ClassResolutionTestMain$Thing1Handler ClassResolutionTest$ClassResolutionTestMain$Thing1"); // (4) TraceClassResolution should turn off. - pb = ProcessTools.createJavaProcessBuilder("-Xlog:classresolve=debug", + pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+resolve=debug", "-XX:-TraceClassResolution", ClassResolutionTestMain.class.getName()); o = new OutputAnalyzer(pb.start()); - o.shouldNotContain("[classresolve]"); + o.shouldNotContain("[class,resolve]"); }; diff --git a/hotspot/test/runtime/logging/LoaderConstraintsTest.java b/hotspot/test/runtime/logging/LoaderConstraintsTest.java index 7d7fdffe87a..ea6e13b673e 100644 --- a/hotspot/test/runtime/logging/LoaderConstraintsTest.java +++ b/hotspot/test/runtime/logging/LoaderConstraintsTest.java @@ -25,6 +25,7 @@ /* * @test LoaderConstraintsTest * @bug 8149996 + * @modules java.base/jdk.internal.misc * @library /testlibrary /runtime/testlibrary * @library classes * @build ClassUnloadCommon test.Empty jdk.test.lib.* jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools @@ -67,22 +68,22 @@ public class LoaderConstraintsTest { pb = exec("-XX:+TraceLoaderConstraints"); out = new OutputAnalyzer(pb.start()); out.getOutput(); - out.shouldContain("[classload,constraints] adding new constraint for name: java/lang/Class, loader[0]: jdk/internal/loader/ClassLoaders$AppClassLoader, loader[1]: "); + out.shouldContain("[class,loader,constraints] adding new constraint for name: java/lang/Class, loader[0]: jdk/internal/loader/ClassLoaders$AppClassLoader, loader[1]: "); - // -Xlog:classload+constraints=info - pb = exec("-Xlog:classload+constraints=info"); + // -Xlog:class+loader+constraints=info + pb = exec("-Xlog:class+loader+constraints=info"); out = new OutputAnalyzer(pb.start()); - out.shouldContain("[classload,constraints] adding new constraint for name: java/lang/Class, loader[0]: jdk/internal/loader/ClassLoaders$AppClassLoader, loader[1]: "); + out.shouldContain("[class,loader,constraints] adding new constraint for name: java/lang/Class, loader[0]: jdk/internal/loader/ClassLoaders$AppClassLoader, loader[1]: "); // -XX:-TraceLoaderConstraints pb = exec("-XX:-TraceLoaderConstraints"); out = new OutputAnalyzer(pb.start()); - out.shouldNotContain("[classload,constraints]"); + out.shouldNotContain("[class,loaderconstraints]"); - // -Xlog:classload+constraints=off - pb = exec("-Xlog:classload+constraints=off"); + // -Xlog:class+loader+constraints=off + pb = exec("-Xlog:class+loader+constraints=off"); out = new OutputAnalyzer(pb.start()); - out.shouldNotContain("[classload,constraints]"); + out.shouldNotContain("[class,loader,constraints]"); } } diff --git a/hotspot/test/runtime/logging/MonitorMismatchTest.java b/hotspot/test/runtime/logging/MonitorMismatchTest.java index 6aacb538152..82d464c49c0 100644 --- a/hotspot/test/runtime/logging/MonitorMismatchTest.java +++ b/hotspot/test/runtime/logging/MonitorMismatchTest.java @@ -25,6 +25,7 @@ /* * @test MonitorMismatchTest * @bug 8150084 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile MonitorMismatchHelper.jasm * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools jdk.test.lib.Platform diff --git a/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java b/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java index 57790ad1248..919d9582074 100644 --- a/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java +++ b/hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java @@ -24,6 +24,7 @@ /* * @test ProtectionDomainVerificationTest * @bug 8149064 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools * @run driver ProtectionDomainVerificationTest diff --git a/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java b/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java index a5d44d98116..47d61d1b0f2 100644 --- a/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java +++ b/hotspot/test/runtime/logging/RemovedDevelopFlagsTest.java @@ -25,6 +25,7 @@ /* * @test RemovedDevelopFlagsTest * @bug 8146632 + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.ProcessTools * @run driver RemovedDevelopFlagsTest @@ -49,8 +50,8 @@ public class RemovedDevelopFlagsTest { public static void main(String... args) throws Exception { if (Platform.isDebugBuild()){ - exec("TraceClassInitialization", "-Xlog:classinit"); - exec("TraceClassLoaderData", "-Xlog:classloaderdata"); + exec("TraceClassInitialization", "-Xlog:class+init"); + exec("TraceClassLoaderData", "-Xlog:class+loader+data"); exec("TraceDefaultMethods", "-Xlog:defaultmethods=debug"); exec("TraceItables", "-Xlog:itables=debug"); exec("TraceSafepoint", "-Xlog:safepoint=debug"); diff --git a/hotspot/test/runtime/logging/SafepointCleanupTest.java b/hotspot/test/runtime/logging/SafepointCleanupTest.java index efe47cb431b..cbec3cb5763 100644 --- a/hotspot/test/runtime/logging/SafepointCleanupTest.java +++ b/hotspot/test/runtime/logging/SafepointCleanupTest.java @@ -24,7 +24,7 @@ /* * @test * @bug 8149991 - * @summary safepointcleanup=info should have output from the code + * @summary safepoint+cleanup=info should have output from the code * @library /testlibrary * @modules java.base/jdk.internal.misc * java.management @@ -38,7 +38,7 @@ import jdk.test.lib.ProcessTools; public class SafepointCleanupTest { static void analyzeOutputOn(ProcessBuilder pb) throws Exception { OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("[safepointcleanup]"); + output.shouldContain("[safepoint,cleanup]"); output.shouldContain("deflating idle monitors"); output.shouldContain("updating inline caches"); output.shouldContain("compilation policy safepoint handler"); @@ -49,12 +49,12 @@ public class SafepointCleanupTest { static void analyzeOutputOff(ProcessBuilder pb) throws Exception { OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldNotContain("[safepointcleanup]"); + output.shouldNotContain("[safepoint,cleanup]"); output.shouldHaveExitValue(0); } public static void main(String[] args) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepointcleanup=info", + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=info", InnerClass.class.getName()); analyzeOutputOn(pb); @@ -62,7 +62,7 @@ public class SafepointCleanupTest { InnerClass.class.getName()); analyzeOutputOn(pb); - pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepointcleanup=off", + pb = ProcessTools.createJavaProcessBuilder("-Xlog:safepoint+cleanup=off", InnerClass.class.getName()); analyzeOutputOff(pb); diff --git a/hotspot/test/runtime/memory/ReadVMPageSize.java b/hotspot/test/runtime/memory/ReadVMPageSize.java index bbd23c5622c..aa83ce0b582 100644 --- a/hotspot/test/runtime/memory/ReadVMPageSize.java +++ b/hotspot/test/runtime/memory/ReadVMPageSize.java @@ -24,6 +24,7 @@ /* * @test * @summary Using WhiteBox to get VM page size + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build ReadVMPageSize * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/memory/StressVirtualSpaceResize.java b/hotspot/test/runtime/memory/StressVirtualSpaceResize.java index 417c8de1463..4fd0534b873 100644 --- a/hotspot/test/runtime/memory/StressVirtualSpaceResize.java +++ b/hotspot/test/runtime/memory/StressVirtualSpaceResize.java @@ -24,6 +24,7 @@ /* * @test * @summary Stress test that expands/shrinks VirtualSpace + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build StressVirtualSpaceResize * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java index ec88eef6525..71435b1718f 100644 --- a/hotspot/test/runtime/modules/AccessCheck/CheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheck/CheckRead.java @@ -27,6 +27,7 @@ * @test * @summary Test that if module m1 can not read module m2, then class p1.c1 * in module m1 can not access p2.c2 in module m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -102,7 +103,7 @@ public class CheckRead { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java index 7ccf918d232..3342d8f9073 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_CheckRead.java @@ -27,6 +27,7 @@ * @test * @summary Test that if module m1 can not read module m2, then class p1.c1 * in module m1 can not access p2.c2 in module m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -102,7 +103,7 @@ public class DiffCL_CheckRead { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java index c815a85fac7..3d2bb9eda86 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualOther.java @@ -28,6 +28,7 @@ * @summary Test that if module m1 can read module m2, but package p2 in m2 * is exported specifically to module m3, then class p1.c1 in m1 can not * access p2.c2 in m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -104,7 +105,7 @@ public class DiffCL_ExpQualOther { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java index c1c38fd61dc..5854c4530ea 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpQualToM1.java @@ -27,6 +27,7 @@ * @test * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in m2. * Access allowed since m1 can read m2 and package p2 is exported to m1. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -90,7 +91,7 @@ public class DiffCL_ExpQualToM1 { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java index a8668333d73..57490768b2f 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_ExpUnqual.java @@ -27,6 +27,7 @@ * @test * @summary Test that if module m1 can read module m2, and package p2 in m2 is * exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -91,7 +92,7 @@ public class DiffCL_ExpUnqual { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java index d4f3d62d4ec..9b1bd9613cc 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_PkgNotExp.java @@ -27,6 +27,7 @@ * @test * @summary Test that if module m1 can read module m2, but package p2 in m2 is not * exported, then class p1.c1 in m1 can not read p2.c2 in m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -90,7 +91,7 @@ public class DiffCL_PkgNotExp { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java index d40911fe438..09488b60327 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_Umod.java @@ -27,6 +27,7 @@ * @test * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module. * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.module * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -91,7 +92,7 @@ public class DiffCL_Umod { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MyDiffClassLoader.loader1 = new MyDiffClassLoader(); MyDiffClassLoader.loader2 = new MyDiffClassLoader(); @@ -140,7 +141,7 @@ public class DiffCL_Umod { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MyDiffClassLoader.loader1 = new MyDiffClassLoader(); MyDiffClassLoader.loader2 = new MyDiffClassLoader(); @@ -189,7 +190,7 @@ public class DiffCL_Umod { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MyDiffClassLoader.loader1 = new MyDiffClassLoader(); MyDiffClassLoader.loader2 = new MyDiffClassLoader(); diff --git a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java index 5cd133db695..3ce98422ec6 100644 --- a/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/DiffCL_UmodUpkg.java @@ -27,6 +27,7 @@ * @test * @summary class p3.c3 defined in module m1 tries to access c4 defined in an unnamed package * and an unnamed module. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile c4.java @@ -86,7 +87,7 @@ public class DiffCL_UmodUpkg { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MyDiffClassLoader.loader1 = new MyDiffClassLoader(); MyDiffClassLoader.loader2 = new MyDiffClassLoader(); @@ -135,7 +136,7 @@ public class DiffCL_UmodUpkg { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MyDiffClassLoader.loader1 = new MyDiffClassLoader(); MyDiffClassLoader.loader2 = new MyDiffClassLoader(); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java index 4645d096746..5cf5132ece9 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualOther.java @@ -28,6 +28,7 @@ * @summary Test that if module m1 can read module m2, but package p2 in m2 * is exported specifically to module m3, then class p1.c1 in m1 can not * access p2.c2 in m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -104,7 +105,7 @@ public class ExpQualOther { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java index fa0b0944ff1..4a7822fb4d7 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpQualToM1.java @@ -27,6 +27,7 @@ * @test * @summary Test that if module m1 can read module m2, AND package p2 in m2 is * exported qualifiedly to m1, then class p1.c1 in m1 can read p2.c2 in m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -80,7 +81,7 @@ public class ExpQualToM1 { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to the same class loader for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java index a7c74ba5084..67e69ea42e0 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExpUnqual.java @@ -27,6 +27,7 @@ * @test * @summary Test that if module m1 can read module m2, AND package p2 in module2 is * exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -80,7 +81,7 @@ public class ExpUnqual { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to the same class loader for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java index a75fda9668f..3762f13b696 100644 --- a/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheck/ExportAllUnnamed.java @@ -28,6 +28,7 @@ * @summary Test if package p2 in module m2 is exported to all unnamed, * then class p1.c1 in an unnamed module can read p2.c2 in module m2. * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.module * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -92,7 +93,7 @@ public class ExportAllUnnamed { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java index b8a56173988..0b044974fa8 100644 --- a/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/PkgNotExp.java @@ -27,6 +27,7 @@ * @test * @summary Test that if module m1 can read module m2, but package p2 in m2 is not * exported, then class p1.c1 in m1 can not read p2.c2 in m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -90,7 +91,7 @@ public class PkgNotExp { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to the same class loader for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod.java b/hotspot/test/runtime/modules/AccessCheck/Umod.java index 7bea0a51d2f..c61bcf45896 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod.java @@ -27,6 +27,7 @@ * @test * @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module. * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.base/jdk.internal.module * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -91,7 +92,7 @@ public class Umod { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map module m1 to class loader. // class c2 will be loaded in an unnamed module/loader. @@ -137,7 +138,7 @@ public class Umod { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MySameClassLoader loader = new MySameClassLoader(); // map module m1 to class loader. @@ -183,7 +184,7 @@ public class Umod { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MySameClassLoader loader = new MySameClassLoader(); // map module m1 to class loader. diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java index 34ea50f6c1e..cde2644146d 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpQualOther.java @@ -28,6 +28,7 @@ * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2. * Access is denied, since an unnamed module can read all modules but p2 in module * m2 is exported specifically to module m1, not to all modules. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -91,7 +92,7 @@ public class UmodDiffCL_ExpQualOther { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java index 52d253b352c..93b2f14428a 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_ExpUnqual.java @@ -28,6 +28,7 @@ * @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2. * Access allowed, an unnamed module can read all modules and p2 in module m2 * which is exported unqualifiedly. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p2/c2.java @@ -91,7 +92,7 @@ public class UmodDiffCL_ExpUnqual { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java index ebe3e5d004e..aca576bd721 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodDiffCL_PkgNotExp.java @@ -28,6 +28,7 @@ * @summary class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2. * Access is denied since even though unnamed module can read all modules, p2 * in module m2 is not exported at all. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p1/c1.java @@ -90,7 +91,7 @@ public class UmodDiffCL_PkgNotExp { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java index 97f781c8c7a..36035e9c4d2 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUPkg.java @@ -26,6 +26,7 @@ /* * @test * @summary class p3.c3 defined in module m1 tries to access c4 defined in unnamed module. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile c4.java @@ -86,7 +87,7 @@ public class UmodUPkg { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map module m1 to class loader. // class c4 will be loaded in an unnamed module/loader. @@ -132,7 +133,7 @@ public class UmodUPkg { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); MySameClassLoader loader = new MySameClassLoader(); // map module m1 to class loader. diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java index 299a41f4003..ed81b24fc7f 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_ExpQualOther.java @@ -28,6 +28,7 @@ * @summary class c5 defined in an unnamed module tries to access p6.c6 defined in m2. * Access is denied, since an unnamed module can read all modules but p6 in module * m2 is exported specifically to module m1, not to all modules. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p6/c6.java @@ -91,7 +92,7 @@ public class UmodUpkgDiffCL_ExpQualOther { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java index 9210c295ac7..11d42b74673 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkgDiffCL_NotExp.java @@ -27,6 +27,7 @@ * @test * @summary class c5 in an unnamed module can read module m2, but package p6 in module m2 is not exported. * Access denied since even though unnamed module can read all modules, p6 in module m2 is not exported at all. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MyDiffClassLoader.java * @compile p6/c6.java @@ -90,7 +91,7 @@ public class UmodUpkgDiffCL_NotExp { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java index 1084294a1e5..8ea1cdd1daa 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_ExpQualOther.java @@ -27,6 +27,7 @@ * @test * @summary Test that if class c5 in an unnamed module can read package p6 in module m2, but package p6 in module m2 is * exported qualifiedly to module m3, then class c5 in an unnamed module can not read p6.c6 in module m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p6/c6.java @@ -100,7 +101,7 @@ public class UmodUpkg_ExpQualOther { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java index 8ee6e92921c..ebf9b5e8a2a 100644 --- a/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/UmodUpkg_NotExp.java @@ -27,6 +27,7 @@ * @test * @summary Test if package p6 in module m2 is not exported, then class c5 * in an unnamed module can not access p6.c2 in module m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p6/c6.java @@ -88,7 +89,7 @@ public class UmodUpkg_NotExp { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to the same class loader for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java index fe2fb7bb076..3c58cdb1a34 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpQualOther.java @@ -27,6 +27,7 @@ * @test * @summary Test that if package p2 in module m2 is exported to module m3, * then class p1.c1 in an unnamed module can not read p2.c2 in module m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -100,7 +101,7 @@ public class Umod_ExpQualOther { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java index 445713c8352..6f8f83f0e59 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_ExpUnqual.java @@ -27,6 +27,7 @@ * @test * @summary Test if package p2 in module m2 is exported unqualifiedly, * then class p1.c1 in an unnamed module can read p2.c2 in module m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -90,7 +91,7 @@ public class Umod_ExpUnqual { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to differing class loaders for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java index 7a346cfda1b..90c071cb345 100644 --- a/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java +++ b/hotspot/test/runtime/modules/AccessCheck/Umod_PkgNotExp.java @@ -27,6 +27,7 @@ * @test * @summary Test if package p2 in module m2 is not exported, then class p1.c1 * in an unnamed module can not access p2.c2 in module m2. + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @compile myloaders/MySameClassLoader.java * @compile p2/c2.java @@ -88,7 +89,7 @@ public class Umod_PkgNotExp { // Resolves "m1" Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, ModuleFinder.empty(), Set.of("m1")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); // map each module to the same class loader for this test Map map = new HashMap<>(); diff --git a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java index a97f7ccf8d1..8846108567f 100644 --- a/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheckAllUnnamed.java @@ -26,6 +26,7 @@ import static jdk.test.lib.Asserts.*; /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/AccessCheckExp.java b/hotspot/test/runtime/modules/AccessCheckExp.java index 304af7f9ee8..0adbd72c553 100644 --- a/hotspot/test/runtime/modules/AccessCheckExp.java +++ b/hotspot/test/runtime/modules/AccessCheckExp.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/AccessCheckJavaBase.java b/hotspot/test/runtime/modules/AccessCheckJavaBase.java index 764f9fb2be4..dc1b691cf17 100644 --- a/hotspot/test/runtime/modules/AccessCheckJavaBase.java +++ b/hotspot/test/runtime/modules/AccessCheckJavaBase.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/AccessCheckRead.java b/hotspot/test/runtime/modules/AccessCheckRead.java index 8158582e866..320ba55ec7c 100644 --- a/hotspot/test/runtime/modules/AccessCheckRead.java +++ b/hotspot/test/runtime/modules/AccessCheckRead.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/AccessCheckSuper.java b/hotspot/test/runtime/modules/AccessCheckSuper.java index bd2065b5ff0..663679b48c9 100644 --- a/hotspot/test/runtime/modules/AccessCheckSuper.java +++ b/hotspot/test/runtime/modules/AccessCheckSuper.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p3/c3.java diff --git a/hotspot/test/runtime/modules/AccessCheckUnnamed.java b/hotspot/test/runtime/modules/AccessCheckUnnamed.java index 0451489be56..319ee7402c2 100644 --- a/hotspot/test/runtime/modules/AccessCheckUnnamed.java +++ b/hotspot/test/runtime/modules/AccessCheckUnnamed.java @@ -26,6 +26,7 @@ import static jdk.test.lib.Asserts.*; /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/AccessCheckWorks.java b/hotspot/test/runtime/modules/AccessCheckWorks.java index 3a13b04a59b..63de8ca8b2a 100644 --- a/hotspot/test/runtime/modules/AccessCheckWorks.java +++ b/hotspot/test/runtime/modules/AccessCheckWorks.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/ExportTwice.java b/hotspot/test/runtime/modules/ExportTwice.java index b33b55ef787..93f4e682ac4 100644 --- a/hotspot/test/runtime/modules/ExportTwice.java +++ b/hotspot/test/runtime/modules/ExportTwice.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java index b7b34b7411f..8ea4f6b1106 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExportToAllUnnamed.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/JVMAddModuleExports.java b/hotspot/test/runtime/modules/JVMAddModuleExports.java index 330dd923411..1f0dcae38c0 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExports.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExports.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java index f41d401c10d..9f6e69fc6cf 100644 --- a/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java +++ b/hotspot/test/runtime/modules/JVMAddModuleExportsToAll.java @@ -26,6 +26,7 @@ import static jdk.test.lib.Asserts.*; /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @compile p1/c1.java diff --git a/hotspot/test/runtime/modules/JVMAddModulePackage.java b/hotspot/test/runtime/modules/JVMAddModulePackage.java index 430c67ca6fd..359e3f2b132 100644 --- a/hotspot/test/runtime/modules/JVMAddModulePackage.java +++ b/hotspot/test/runtime/modules/JVMAddModulePackage.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/JVMAddReadsModule.java b/hotspot/test/runtime/modules/JVMAddReadsModule.java index 9d5e2adcacf..dda62822367 100644 --- a/hotspot/test/runtime/modules/JVMAddReadsModule.java +++ b/hotspot/test/runtime/modules/JVMAddReadsModule.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/JVMCanReadModule.java b/hotspot/test/runtime/modules/JVMCanReadModule.java index ca131df42ec..daabd21d213 100644 --- a/hotspot/test/runtime/modules/JVMCanReadModule.java +++ b/hotspot/test/runtime/modules/JVMCanReadModule.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/JVMDefineModule.java b/hotspot/test/runtime/modules/JVMDefineModule.java index 77d3c0f3940..602c5fdc0bc 100644 --- a/hotspot/test/runtime/modules/JVMDefineModule.java +++ b/hotspot/test/runtime/modules/JVMDefineModule.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java index 25065e2812c..88ff93a5040 100644 --- a/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java +++ b/hotspot/test/runtime/modules/JVMGetModuleByPkgName.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @compile p2/c2.java * @build sun.hotspot.WhiteBox diff --git a/hotspot/test/runtime/modules/JVMIsExportedToModule.java b/hotspot/test/runtime/modules/JVMIsExportedToModule.java index 0e35b7d8d1c..2d465001ce2 100644 --- a/hotspot/test/runtime/modules/JVMIsExportedToModule.java +++ b/hotspot/test/runtime/modules/JVMIsExportedToModule.java @@ -23,6 +23,7 @@ /* * @test + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java index 53d45c9a892..ec30f58d2e3 100644 --- a/hotspot/test/runtime/modules/LoadUnloadModuleStress.java +++ b/hotspot/test/runtime/modules/LoadUnloadModuleStress.java @@ -24,6 +24,7 @@ /* * @test * @summary Ensure module information is cleaned when owning class loader unloads + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib /compiler/whitebox .. * @build sun.hotspot.WhiteBox * @compile/module=java.base java/lang/reflect/ModuleHelper.java diff --git a/hotspot/test/runtime/modules/Xpatch/Xpatch2Dirs.java b/hotspot/test/runtime/modules/Xpatch/Xpatch2Dirs.java index b0dbfcfb309..d874d10fb04 100644 --- a/hotspot/test/runtime/modules/Xpatch/Xpatch2Dirs.java +++ b/hotspot/test/runtime/modules/Xpatch/Xpatch2Dirs.java @@ -24,6 +24,7 @@ /* * @test * @summary Make sure -Xpatch works with multiple directories. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile Xpatch2DirsMain.java * @run main Xpatch2Dirs diff --git a/hotspot/test/runtime/modules/Xpatch/XpatchDupJavaBase.java b/hotspot/test/runtime/modules/Xpatch/XpatchDupJavaBase.java index 93935df3ce4..69448a62796 100644 --- a/hotspot/test/runtime/modules/Xpatch/XpatchDupJavaBase.java +++ b/hotspot/test/runtime/modules/Xpatch/XpatchDupJavaBase.java @@ -24,6 +24,7 @@ /* * @test * @summary VM exit initialization results if java.base is specificed more than once to Xpatch. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/runtime/modules/Xpatch/XpatchDupModule.java b/hotspot/test/runtime/modules/Xpatch/XpatchDupModule.java index 2a44b97932b..9fcffa4157a 100644 --- a/hotspot/test/runtime/modules/Xpatch/XpatchDupModule.java +++ b/hotspot/test/runtime/modules/Xpatch/XpatchDupModule.java @@ -24,6 +24,7 @@ /* * @test * @summary Module system initialization exception results if a module is specificed twice to Xpatch. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/runtime/modules/Xpatch/XpatchTest.java b/hotspot/test/runtime/modules/Xpatch/XpatchTest.java index e72be0e184e..6c67a4fe514 100644 --- a/hotspot/test/runtime/modules/Xpatch/XpatchTest.java +++ b/hotspot/test/runtime/modules/Xpatch/XpatchTest.java @@ -25,6 +25,7 @@ * @test * @bug 8130399 * @summary Make sure -Xpatch works for modules besides java.base. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile XpatchMain.java * @run main XpatchTest diff --git a/hotspot/test/runtime/modules/Xpatch/XpatchTraceCL.java b/hotspot/test/runtime/modules/Xpatch/XpatchTraceCL.java index 1a961679bca..c3484971407 100644 --- a/hotspot/test/runtime/modules/Xpatch/XpatchTraceCL.java +++ b/hotspot/test/runtime/modules/Xpatch/XpatchTraceCL.java @@ -26,6 +26,7 @@ * @bug 8069469 * @summary Make sure -Xlog:classload=info works properly with "modules" jimage, -Xpatch, and with -Xbootclasspath/a + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile XpatchMain.java * @run main XpatchTraceCL @@ -50,15 +51,15 @@ public class XpatchTraceCL { "mods/java.naming"); ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xpatch:java.naming=mods/java.naming", - "-Xlog:classload=info", "XpatchMain", "javax.naming.spi.NamingManager"); + "-Xlog:class+load=info", "XpatchMain", "javax.naming.spi.NamingManager"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); // "modules" jimage case. - output.shouldContain("[classload] java.lang.Thread source: jrt:/java.base"); + output.shouldContain("[class,load] java.lang.Thread source: jrt:/java.base"); // -Xpatch case. - output.shouldContain("[classload] javax.naming.spi.NamingManager source: mods/java.naming"); + output.shouldContain("[class,load] javax.naming.spi.NamingManager source: mods/java.naming"); // -cp case. - output.shouldContain("[classload] XpatchMain source: file"); + output.shouldContain("[class,load] XpatchMain source: file"); // Test -Xlog:classload=info output for -Xbootclasspath/a source = "package XpatchTraceCL_pkg; " + @@ -73,10 +74,10 @@ public class XpatchTraceCL { "xbcp"); pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/a:xbcp", - "-Xlog:classload=info", "XpatchMain", "XpatchTraceCL_pkg.ItIsI"); + "-Xlog:class+load=info", "XpatchMain", "XpatchTraceCL_pkg.ItIsI"); output = new OutputAnalyzer(pb.start()); // -Xbootclasspath/a case. - output.shouldContain("[classload] XpatchTraceCL_pkg.ItIsI source: xbcp"); + output.shouldContain("[class,load] XpatchTraceCL_pkg.ItIsI source: xbcp"); output.shouldHaveExitValue(0); } } diff --git a/hotspot/test/runtime/modules/getModuleJNI/GetModule.java b/hotspot/test/runtime/modules/getModuleJNI/GetModule.java index bc9883c6a64..c9ef4952d4d 100644 --- a/hotspot/test/runtime/modules/getModuleJNI/GetModule.java +++ b/hotspot/test/runtime/modules/getModuleJNI/GetModule.java @@ -42,10 +42,22 @@ public class GetModule { public static void main(String[] args) { Module module; + Module javaBaseModule; + + // Module for primitive type, should be "java.base" + java.lang.Integer primitive_int = 1; + try { + javaBaseModule = (Module)callGetModule(primitive_int.getClass()); + if (!javaBaseModule.getName().equals("java.base")) { + throw new RuntimeException("Unexpected module name for primitive type: " + + javaBaseModule.getName()); + } + } catch(Throwable e) { + throw new RuntimeException("Unexpected exception for Integer: " + e.toString()); + } // Module for array of primitives, should be "java.base" int[] int_array = {1, 2, 3}; - Module javaBaseModule; try { javaBaseModule = (Module)callGetModule(int_array.getClass()); if (!javaBaseModule.getName().equals("java.base")) { @@ -56,7 +68,19 @@ public class GetModule { throw new RuntimeException("Unexpected exception for [I: " + e.toString()); } - // Module for java.lang.String + // Module for multi-dimensional array of primitives, should be "java.base" + int[][] multi_int_array = { {1, 2, 3}, {4, 5, 6} }; + try { + javaBaseModule = (Module)callGetModule(multi_int_array.getClass()); + if (!javaBaseModule.getName().equals("java.base")) { + throw new RuntimeException("Unexpected module name for multi-dimensional array of primitives: " + + javaBaseModule.getName()); + } + } catch(Throwable e) { + throw new RuntimeException("Unexpected exception for multi-dimensional Integer array: " + e.toString()); + } + + // Module for java.lang.String, should be "java.base" java.lang.String str = "abc"; try { module = (Module)callGetModule(str.getClass()); @@ -68,6 +92,30 @@ public class GetModule { throw new RuntimeException("Unexpected exception for String: " + e.toString()); } + // Module for array of java.lang.Strings, should be "java.base" + java.lang.String[] str_array = {"a", "b", "c"}; + try { + javaBaseModule = (Module)callGetModule(str_array.getClass()); + if (!javaBaseModule.getName().equals("java.base")) { + throw new RuntimeException("Unexpected module name for array of Strings: " + + javaBaseModule.getName()); + } + } catch(Throwable e) { + throw new RuntimeException("Unexpected exception for String array: " + e.toString()); + } + + // Module for multi-dimensional array of java.lang.Strings, should be "java.base" + java.lang.String[][] multi_str_array = { {"a", "b", "c"}, {"d", "e", "f"} }; + try { + javaBaseModule = (Module)callGetModule(multi_str_array.getClass()); + if (!javaBaseModule.getName().equals("java.base")) { + throw new RuntimeException("Unexpected module name for multi-dimensional array of Strings: " + + javaBaseModule.getName()); + } + } catch(Throwable e) { + throw new RuntimeException("Unexpected exception for multidimensional String array: " + e.toString()); + } + // Module for java.lang.management.LockInfo try { LockInfo li = new LockInfo("java.lang.Class", 57); diff --git a/hotspot/test/runtime/os/AvailableProcessors.java b/hotspot/test/runtime/os/AvailableProcessors.java index 529f2a0889b..a60757391ee 100644 --- a/hotspot/test/runtime/os/AvailableProcessors.java +++ b/hotspot/test/runtime/os/AvailableProcessors.java @@ -30,6 +30,7 @@ import java.util.ArrayList; * @bug 6515172 8148766 * @summary Check that availableProcessors reports the correct value when running in a cpuset on linux * @requires os.family == "linux" + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.* * @run driver AvailableProcessors diff --git a/hotspot/test/runtime/verifier/TraceClassRes.java b/hotspot/test/runtime/verifier/TraceClassRes.java index ef18a5cfe4e..c8b5d5e95db 100644 --- a/hotspot/test/runtime/verifier/TraceClassRes.java +++ b/hotspot/test/runtime/verifier/TraceClassRes.java @@ -25,6 +25,7 @@ * @test * @bug 8076318 * @summary split verifier needs to add TraceClassResolution + * @modules java.base/jdk.internal.misc * @library /testlibrary */ @@ -38,7 +39,7 @@ public class TraceClassRes { "-XX:+TraceClassResolution", "-verify", "-Xshare:off", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("[classresolve] java.lang.ClassLoader java.lang.Throwable ClassLoader.java (verification)"); + output.shouldContain("[class,resolve] java.lang.ClassLoader java.lang.Throwable ClassLoader.java (verification)"); output.shouldHaveExitValue(0); } } diff --git a/hotspot/test/runtime/whitebox/WBStackSize.java b/hotspot/test/runtime/whitebox/WBStackSize.java index 0d3ccc36fc5..9bc117b3927 100644 --- a/hotspot/test/runtime/whitebox/WBStackSize.java +++ b/hotspot/test/runtime/whitebox/WBStackSize.java @@ -24,6 +24,7 @@ /* * @test WBStackSize * @summary verify that whitebox functions getThreadFullStackSize() and getThreadRemainingStackSize are working + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build WBStackSize * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java b/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java index 87d56e442cb..a6f442476d2 100644 --- a/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java +++ b/hotspot/test/sanity/MismatchedWhiteBox/WhiteBox.java @@ -26,6 +26,7 @@ * @bug 8011675 * @summary verify that whitebox can be used even if not all functions are declared in java-part * @author igor.ignatyev@oracle.com + * @modules java.base/jdk.internal.misc * @library /testlibrary * @compile WhiteBox.java * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/sanity/WBApi.java b/hotspot/test/sanity/WBApi.java index 75ac5c3ab57..e24e672bc82 100644 --- a/hotspot/test/sanity/WBApi.java +++ b/hotspot/test/sanity/WBApi.java @@ -24,6 +24,7 @@ /* * @test WBApi * @summary verify that whitebox functions can be linked and executed + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build WBApi * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/serviceability/ParserTest.java b/hotspot/test/serviceability/ParserTest.java index a9d6c8dbb7d..58ef23bdf86 100644 --- a/hotspot/test/serviceability/ParserTest.java +++ b/hotspot/test/serviceability/ParserTest.java @@ -24,6 +24,7 @@ /* * @test * @summary Test that the diagnostic command arguemnt parser works + * @modules java.base/jdk.internal.misc * @library /testlibrary /test/lib * @build ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.parser.* * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/serviceability/attach/AttachWithStalePidFile.java b/hotspot/test/serviceability/attach/AttachWithStalePidFile.java index 8ed9b479f63..5cc42cab22f 100644 --- a/hotspot/test/serviceability/attach/AttachWithStalePidFile.java +++ b/hotspot/test/serviceability/attach/AttachWithStalePidFile.java @@ -26,6 +26,7 @@ * @bug 7162400 * @key regression * @summary Regression test for attach issue where stale pid files in /tmp lead to connection issues + * @modules java.base/jdk.internal.misc * @modules jdk.attach/sun.tools.attach * @library /testlibrary * @build jdk.test.lib.* AttachWithStalePidFileTarget diff --git a/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java b/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java index 6434bb0f918..996074a5a67 100644 --- a/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java +++ b/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -57,33 +57,34 @@ public class ClassHistogramTest { /* * example output: - * num #instances #bytes class name - * ---------------------------------------------- - * 1: 1647 1133752 [B - * 2: 6198 383168 [C - * 3: 1464 165744 java.lang.Class - * 4: 6151 147624 java.lang.String - * 5: 2304 73728 java.util.concurrent.ConcurrentHashMap$Node - * 6: 1199 64280 [Ljava.lang.Object; + * num #instances #bytes class name (module) + * ------------------------------------------------------- + * 1: 7991 757792 [B (java.base@9-internal) + * 2: 1811 217872 java.lang.Class (java.base@9-internal) + * 3: 6724 215168 java.util.HashMap$Node (java.base@9-internal) + * 4: 7852 188448 java.lang.String (java.base@9-internal) + * 5: 1378 105040 [Ljava.util.HashMap$Node; (java.base@9-internal) + * 6: 1863 95096 [Ljava.lang.Object; (java.base@9-internal) + * ... */ /* Require at least one java.lang.Class */ - output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Class\\s*$"); + output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Class \\(java.base@\\S*\\)\\s*$"); /* Require at least one java.lang.String */ - output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.String\\s*$"); + output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.String \\(java.base@\\S*\\)\\s*$"); /* Require at least one java.lang.Object */ - output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Object\\s*$"); + output.shouldMatch("^\\s+\\d+:\\s+\\d+\\s+\\d+\\s+java.lang.Object \\(java.base@\\S*\\)\\s*$"); /* Require at exactly one TestClass[] */ output.shouldMatch("^\\s+\\d+:\\s+1\\s+\\d+\\s+" + - Pattern.quote(TestClass[].class.getName()) + "\\s*$"); + Pattern.quote(TestClass[].class.getName()) + "\\s*$"); /* Require at exactly 1024 TestClass */ output.shouldMatch("^\\s+\\d+:\\s+1024\\s+\\d+\\s+" + - Pattern.quote(TestClass.class.getName()) + "\\s*$"); + Pattern.quote(TestClass.class.getName()) + "\\s*$"); } @Test diff --git a/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java b/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java index 1e53a234b5a..05b06270bcf 100644 --- a/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java +++ b/hotspot/test/serviceability/dcmd/gc/FinalizerInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -36,6 +36,9 @@ import jdk.test.lib.dcmd.PidJcmdExecutor; * @test * @summary * @library /testlibrary + * @modules java.base/jdk.internal.misc + * @modules java.xml + * java.management * @build jdk.test.lib.* * @build jdk.test.lib.dcmd.* * @run testng FinalizerInfoTest diff --git a/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java b/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java index daedf1252ef..5193e6c6821 100644 --- a/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java +++ b/hotspot/test/serviceability/dcmd/gc/HeapInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -35,6 +35,9 @@ import jdk.test.lib.OutputAnalyzer; * @test * @summary Test of diagnostic command GC.heap_info * @library /testlibrary + * @modules java.base/jdk.internal.misc + * @modules java.xml + * java.management * @build jdk.test.lib.* * @build jdk.test.lib.dcmd.* * @run testng HeapInfoTest diff --git a/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java b/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java index 1586db2d51c..b25999a77bd 100644 --- a/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java +++ b/hotspot/test/serviceability/dcmd/jvmti/DataDumpDcmdTest.java @@ -31,6 +31,7 @@ import org.testng.annotations.Test; * @test * @bug 8054890 * @summary Test of JVMTI.data_dump diagnostic command + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.* * @run testng DataDumpDcmdTest diff --git a/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java b/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java index b6e674476de..9132aece076 100644 --- a/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java +++ b/hotspot/test/serviceability/dcmd/vm/SetVMFlagTest.java @@ -31,6 +31,7 @@ import static org.testng.Assert.*; * @test * @bug 8054890 * @summary Test of VM.set_flag diagnostic command + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.* * @build jdk.test.lib.dcmd.* diff --git a/hotspot/test/serviceability/logging/TestBasicLogOutput.java b/hotspot/test/serviceability/logging/TestBasicLogOutput.java index c74a258f278..345e3737932 100644 --- a/hotspot/test/serviceability/logging/TestBasicLogOutput.java +++ b/hotspot/test/serviceability/logging/TestBasicLogOutput.java @@ -24,6 +24,7 @@ /* * @test TestBasicLogOutput * @summary Ensure logging can be enabled and successfully prints to stdout. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/serviceability/logging/TestLogRotation.java b/hotspot/test/serviceability/logging/TestLogRotation.java index ca59cf6e4a4..3e3696b3fb0 100644 --- a/hotspot/test/serviceability/logging/TestLogRotation.java +++ b/hotspot/test/serviceability/logging/TestLogRotation.java @@ -75,7 +75,7 @@ public class TestLogRotation { ArrayList args = new ArrayList(); String[] logOpts = new String[]{ "-cp", System.getProperty("java.class.path"), - "-Xlog:gc=debug:" + logFileName + "::filesize=" + logFileSizeK + ",filecount=" + numberOfFiles, + "-Xlog:gc=debug:" + logFileName + "::filesize=" + logFileSizeK + "k,filecount=" + numberOfFiles, "-XX:-DisableExplicitGC", // to ensure that System.gc() works "-Xmx128M"}; // System.getProperty("test.java.opts") is '' if no options is set diff --git a/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java b/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java index 6914927fdb3..dfc62f7ca10 100644 --- a/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java +++ b/hotspot/test/serviceability/logging/TestMultipleXlogArgs.java @@ -24,6 +24,7 @@ /* * @test TestMultipleXlogArgs * @summary Ensure multiple -Xlog arguments aggregate the logging options. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java b/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java index 39789ea01df..77b4e007412 100644 --- a/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java +++ b/hotspot/test/serviceability/logging/TestQuotedLogOutputs.java @@ -24,6 +24,7 @@ /* * @test TestQuotedLogOutputs * @summary Ensure proper parsing of quoted output names for -Xlog arguments. + * @modules java.base/jdk.internal.misc * @library /testlibrary */ diff --git a/hotspot/test/serviceability/sa/DeadlockDetectionTest.java b/hotspot/test/serviceability/sa/DeadlockDetectionTest.java index 23ce96f6399..85e5529509d 100644 --- a/hotspot/test/serviceability/sa/DeadlockDetectionTest.java +++ b/hotspot/test/serviceability/sa/DeadlockDetectionTest.java @@ -40,6 +40,7 @@ import jdk.test.lib.ProcessTools; * @summary Test deadlock detection * @library /test/lib/share/classes * @library /testlibrary + * @modules java.base/jdk.internal.misc * @modules java.management * @build jdk.test.lib.* * @build jdk.test.lib.apps.* diff --git a/hotspot/test/serviceability/sa/TestClassLoaderStats.java b/hotspot/test/serviceability/sa/TestClassLoaderStats.java index 92f843e11d9..df46c4136fc 100644 --- a/hotspot/test/serviceability/sa/TestClassLoaderStats.java +++ b/hotspot/test/serviceability/sa/TestClassLoaderStats.java @@ -32,6 +32,7 @@ import jdk.test.lib.apps.LingeredApp; /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library /testlibrary * @build jdk.test.lib.* diff --git a/hotspot/test/serviceability/sa/TestStackTrace.java b/hotspot/test/serviceability/sa/TestStackTrace.java index 203735c3125..7044f104f65 100644 --- a/hotspot/test/serviceability/sa/TestStackTrace.java +++ b/hotspot/test/serviceability/sa/TestStackTrace.java @@ -32,6 +32,7 @@ import jdk.test.lib.apps.LingeredApp; /* * @test + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library /testlibrary * @build jdk.test.lib.* diff --git a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java index ac0ef6dca94..0328e393339 100644 --- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java +++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java @@ -44,7 +44,7 @@ import java.io.File; public class Test8028623 { public static int \u00CB = 1; - public static String dumpFile = "heap.out"; + public static String dumpFile = "heap.bin"; public static void main (String[] args) { @@ -55,11 +55,12 @@ public class Test8028623 { System.out.println("SA attach not expected to work - test skipped."); return; } - int pid = ProcessTools.getProcessId(); - JDKToolLauncher jmap = JDKToolLauncher.create("jmap") - .addToolArg("-F") - .addToolArg("-dump:live,format=b,file=" + dumpFile) - .addToolArg(Integer.toString(pid)); + long pid = ProcessTools.getProcessId(); + JDKToolLauncher jmap = JDKToolLauncher.create("jhsdb") + .addToolArg("jmap") + .addToolArg("--binaryheap") + .addToolArg("--pid") + .addToolArg(Long.toString(pid)); ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); OutputBuffer output = ProcessTools.getOutput(pb); Process p = pb.start(); diff --git a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java index c1b6e955ef8..077617b2fb0 100644 --- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java +++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java @@ -53,33 +53,22 @@ import jdk.test.lib.ProcessTools; */ public class JMapHProfLargeHeapTest { - private static final String HEAP_DUMP_FILE_NAME = "heap.hprof"; + private static final String HEAP_DUMP_FILE_NAME = "heap.bin"; + private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1"; private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2"; private static final long M = 1024L; private static final long G = 1024L * M; public static void main(String[] args) throws Exception { - // If we are on MacOSX, test if JMap tool is signed, otherwise return - // since test will fail with privilege error. - if (Platform.isOSX()) { - String jmapToolPath = JDKToolFinder.getTestJDKTool("jmap"); - ProcessBuilder codesignProcessBuilder = new ProcessBuilder( - "codesign", "-v", jmapToolPath); - Process codesignProcess = codesignProcessBuilder.start(); - OutputAnalyzer analyser = new OutputAnalyzer(codesignProcess); - try { - analyser.shouldNotContain("code object is not signed at all"); - System.out.println("Signed jmap found at: " + jmapToolPath); - } catch (Exception e) { - // Abort since we can't know if the test will work - System.out - .println("Test aborted since we are on MacOSX and the jmap tool is not signed."); - return; - } + if (!Platform.shouldSAAttach()) { + System.out.println("SA attach not expected to work - test skipped."); + return; } // All heap dumps should create 1.0.2 file format - testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_2); + // Hotspot internal heapdumper always use HPROF_HEADER_1_0_2 format, + // but SA heapdumper still use HPROF_HEADER_1_0_1 for small heaps + testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_1); /** * This test was deliberately commented out since the test system lacks @@ -110,9 +99,10 @@ public class JMapHProfLargeHeapTest { System.out.println("Extracted pid: " + pid); JDKToolLauncher jMapLauncher = JDKToolLauncher - .createUsingTestJDK("jmap"); - jMapLauncher.addToolArg("-dump:format=b,file=" + pid + "-" - + HEAP_DUMP_FILE_NAME); + .createUsingTestJDK("jhsdb"); + jMapLauncher.addToolArg("jmap"); + jMapLauncher.addToolArg("--binaryheap"); + jMapLauncher.addToolArg("--pid"); jMapLauncher.addToolArg(String.valueOf(pid)); ProcessBuilder jMapProcessBuilder = new ProcessBuilder( @@ -123,12 +113,11 @@ public class JMapHProfLargeHeapTest { Process jMapProcess = jMapProcessBuilder.start(); OutputAnalyzer analyzer = new OutputAnalyzer(jMapProcess); analyzer.shouldHaveExitValue(0); - analyzer.shouldContain(pid + "-" + HEAP_DUMP_FILE_NAME); - analyzer.shouldContain("Heap dump file created"); + analyzer.shouldContain(HEAP_DUMP_FILE_NAME); largeHeapProc.getOutputStream().write('\n'); - File dumpFile = new File(pid + "-" + HEAP_DUMP_FILE_NAME); + File dumpFile = new File(HEAP_DUMP_FILE_NAME); Asserts.assertTrue(dumpFile.exists(), "Heap dump file not found."); try (Reader reader = new BufferedReader(new FileReader(dumpFile))) { diff --git a/hotspot/test/serviceability/threads/TestFalseDeadLock.java b/hotspot/test/serviceability/threads/TestFalseDeadLock.java index 2954d5d6318..e4654f4a266 100644 --- a/hotspot/test/serviceability/threads/TestFalseDeadLock.java +++ b/hotspot/test/serviceability/threads/TestFalseDeadLock.java @@ -30,6 +30,7 @@ import java.util.Random; * @test * @bug 8016304 * @summary Make sure no deadlock is reported for this program which has no deadlocks. + * @modules java.base/jdk.internal.misc * @library /testlibrary * @run main/othervm TestFalseDeadLock */ diff --git a/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java b/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java index 6b154ecc890..cebd2c7d65f 100644 --- a/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java @@ -25,6 +25,7 @@ * @test * @summary Create daemon and non-deamon threads. * Check the correctness of thread's status from jstack. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java b/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java index 6ca81885814..2d0eb05686c 100644 --- a/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/JstackThreadTest.java @@ -32,6 +32,7 @@ import java.util.concurrent.CountDownLatch; * @test JstackThreadTest * @bug 8151442 * @summary jstack doesn't close quotation marks properly with threads' name greater than 1996 characters + * @modules java.base/jdk.internal.misc * @library /testlibrary * @build jdk.test.lib.* * @run main JstackThreadTest diff --git a/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java b/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java index 92bd5e5c90a..884c8d2bfa3 100644 --- a/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java @@ -27,6 +27,7 @@ * synchronizing on one monitor inside of each method. * After checking that lock info is correct invoke another method * and get the lock again. Repeat this action. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java b/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java index c5943d11e98..282bfda2186 100644 --- a/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java @@ -24,6 +24,7 @@ /* * @test * @summary Checks that jstack correctly prints the thread names + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java b/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java index 9f478158a3f..174bcdb7257 100644 --- a/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java @@ -27,6 +27,7 @@ * synchronizing on one monitor inside of each method. * After checking that lock info is correct free the lock and * invoke another method. Repeat this action. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java b/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java index 198124cf3a0..6f87c0a04b3 100644 --- a/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java +++ b/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java @@ -27,6 +27,7 @@ * presented in the stack is correct. Call notifyAll method * monitor info have to disappear from the stack. * Repeats the same scenario calling interrupt() method + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java index ec6d1bc2f4d..2ed5c0576fd 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java @@ -27,6 +27,7 @@ import utils.*; * @test * @summary Test checks the consistency of the output * displayed with jstat -gccapacity. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java index 508b7865a3c..688670f3d9d 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java @@ -28,6 +28,7 @@ * test several times provokes garbage collection in the debuggee application and after each garbage * collection runs jstat. jstat should show that after garbage collection number of GC events and garbage * collection time increase. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java index 95200d453c5..0efd59fe764 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java @@ -27,6 +27,7 @@ * Test scenario: * tests forces debuggee application eat ~70% of heap and runs jstat. * jstat should show that ~70% of heap (OC/OU ~= 70%). + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java index 94514d4b634..a014c373fac 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java @@ -27,6 +27,7 @@ * Test scenario: * test forces debuggee application call System.gc(), runs jstat and checks that * cause of last garbage collection displayed by jstat (LGCC) is 'System.gc()'. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java b/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java index bdb06c1e6b2..4e2fbdc801b 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java @@ -29,6 +29,7 @@ import utils.*; * test several times provokes garbage collection in the debuggee application and after each garbage * collection runs jstat. jstat should show that after garbage collection number of GC events and garbage * collection time increase. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* diff --git a/hotspot/test/serviceability/tmtools/jstat/GcTest01.java b/hotspot/test/serviceability/tmtools/jstat/GcTest01.java index 2a6b0c544a8..5738da18fc3 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcTest01.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcTest01.java @@ -31,6 +31,7 @@ * jstat should show that after garbage collection * number of GC events and garbage * collection time increase. + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @requires vm.opt.ExplicitGCInvokesConcurrent != true diff --git a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java b/hotspot/test/serviceability/tmtools/jstat/GcTest02.java index bcdc258c934..171b87b78e5 100644 --- a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java +++ b/hotspot/test/serviceability/tmtools/jstat/GcTest02.java @@ -28,10 +28,12 @@ import utils.*; * Test scenario: * tests forces debuggee application eat ~70% of heap and runs jstat. * jstat should show that ~70% of heap is utilized (OC/OU ~= 70%). + * @modules java.base/jdk.internal.misc * @library /test/lib/share/classes * @library ../share * @build common.* * @build utils.* + * @ignore 8155570 * @run main/othervm -XX:+UsePerfData -Xmx128M -XX:MaxMetaspaceSize=128M GcTest02 */ diff --git a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java index f05a02a61b8..96b627a3e4e 100644 --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,7 +25,7 @@ package sun.hotspot.tools.ctw; import sun.hotspot.WhiteBox; import jdk.internal.misc.SharedSecrets; -import sun.reflect.ConstantPool; +import jdk.internal.reflect.ConstantPool; import java.lang.reflect.Executable; diff --git a/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java b/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java index 70e990ac59d..21ff4159761 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java +++ b/hotspot/test/testlibrary/jdk/test/lib/ProcessTools.java @@ -90,27 +90,8 @@ public final class ProcessTools { * * @return Process id */ - public static int getProcessId() throws Exception { - RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); - int pid = Integer.parseInt(runtime.getName().split("@")[0]); - - return pid; - } - - /** - * Get the string containing input arguments passed to the VM - * - * @return arguments - */ - public static String getVmInputArguments() { - RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); - - List args = runtime.getInputArguments(); - StringBuilder result = new StringBuilder(); - for (String arg : args) - result.append(arg).append(' '); - - return result.toString(); + public static long getProcessId() throws Exception { + return ProcessHandle.current().getPid(); } /** diff --git a/hotspot/test/testlibrary/jdk/test/lib/Utils.java b/hotspot/test/testlibrary/jdk/test/lib/Utils.java index 9dcf0632ffe..8ad11fdcbb5 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/Utils.java +++ b/hotspot/test/testlibrary/jdk/test/lib/Utils.java @@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.regex.Matcher; import java.util.regex.Pattern; -import sun.misc.Unsafe; +import jdk.internal.misc.Unsafe; /** * Common library for various test helper functions. diff --git a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java b/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java index 48306619f55..228c0270a5b 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java +++ b/hotspot/test/testlibrary/jdk/test/lib/cli/predicate/CPUSpecificPredicate.java @@ -44,7 +44,7 @@ public class CPUSpecificPredicate implements BooleanSupplier { @Override public boolean getAsBoolean() { if (!Platform.getOsArch().matches(cpuArchPattern)) { - System.out.println("CPU arch does not match " + cpuArchPattern); + System.out.println("CPU arch " + Platform.getOsArch() + " does not match " + cpuArchPattern); return false; } diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/FileJcmdExecutor.java b/hotspot/test/testlibrary/jdk/test/lib/dcmd/FileJcmdExecutor.java index 24836e66d9b..17ffd91b761 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/FileJcmdExecutor.java +++ b/hotspot/test/testlibrary/jdk/test/lib/dcmd/FileJcmdExecutor.java @@ -55,7 +55,7 @@ public class FileJcmdExecutor extends PidJcmdExecutor { File cmdFile = createTempFile(); writeCommandToTemporaryFile(cmd, cmdFile); - return Arrays.asList(jcmdBinary, Integer.toString(pid), + return Arrays.asList(jcmdBinary, Long.toString(pid), "-f", cmdFile.getAbsolutePath()); } diff --git a/hotspot/test/testlibrary/jdk/test/lib/dcmd/PidJcmdExecutor.java b/hotspot/test/testlibrary/jdk/test/lib/dcmd/PidJcmdExecutor.java index bce55d7be31..f1caddb8b16 100644 --- a/hotspot/test/testlibrary/jdk/test/lib/dcmd/PidJcmdExecutor.java +++ b/hotspot/test/testlibrary/jdk/test/lib/dcmd/PidJcmdExecutor.java @@ -32,7 +32,7 @@ import java.util.List; * Executes Diagnostic Commands on the target VM (specified by pid) using the jcmd tool */ public class PidJcmdExecutor extends JcmdExecutor { - protected final int pid; + protected final long pid; /** * Instantiates a new PidJcmdExecutor targeting the current VM @@ -53,11 +53,11 @@ public class PidJcmdExecutor extends JcmdExecutor { */ public PidJcmdExecutor(String target) { super(); - pid = Integer.valueOf(target); + pid = Long.valueOf(target); } protected List createCommandLine(String cmd) throws CommandExecutorException { - return Arrays.asList(jcmdBinary, Integer.toString(pid), cmd); + return Arrays.asList(jcmdBinary, Long.toString(pid), cmd); } } diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ProductionFailedException.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ProductionFailedException.java index d06ecb00242..acc4493669c 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ProductionFailedException.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ProductionFailedException.java @@ -27,10 +27,10 @@ public class ProductionFailedException extends Exception { static final long serialVersionUID = -2325617203741536725L; public ProductionFailedException(String msg) { - super(msg); + super(msg, null, false, false); } public ProductionFailedException() { - super(); + super(null, null, false, false); } } diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/SymbolTable.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/SymbolTable.java index 9547bdbf41f..13078380a58 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/SymbolTable.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/SymbolTable.java @@ -26,6 +26,7 @@ package jdk.test.lib.jittester; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.Map; import java.util.Stack; import jdk.test.lib.jittester.types.TypeKlass; @@ -37,7 +38,7 @@ public class SymbolTable { private static int VARIABLE_NUMBER = 0; private static int FUNCTION_NUMBER = 0; - static private void initExternalSymbols() { + private static void initExternalSymbols() { String classList = ProductionParams.addExternalSymbols.value(); if (classList.equals("all")) { @@ -254,12 +255,12 @@ public class SymbolTable { public static void push() { // Do deep cloning.. HashMap> prev = SYMBOL_STACK.peek(); - SYMBOL_STACK.push(new HashMap<>()); - HashMap> top = SYMBOL_STACK.peek(); - for (Type type : prev.keySet()) { - ArrayList prevArray = prev.get(type); - top.put(type, new ArrayList<>(prevArray.size())); - ArrayList topArray = top.get(type); + HashMap> top = new HashMap<>(prev.size()); + SYMBOL_STACK.push(top); + for (Map.Entry> entry : prev.entrySet()) { + ArrayList prevArray = entry.getValue(); + ArrayList topArray = new ArrayList<>(prevArray.size()); + top.put(entry.getKey(), topArray); for (Symbol symbol : prevArray) { topArray.add(symbol.copy()); } diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TypeUtil.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TypeUtil.java deleted file mode 100644 index 181d0a52b9b..00000000000 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TypeUtil.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk.test.lib.jittester; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - - -public class TypeUtil { - - public static Collection getImplicitlyCastable(Collection types, Type type) { - ArrayList result = new ArrayList<>(types); - Iterator iterator = result.iterator(); - while (iterator.hasNext()) { - if (!iterator.next().canImplicitlyCastTo(type)) { - iterator.remove(); - } - } - return result; - } - - public static Collection getExplicitlyCastable(Collection types, Type type) { - ArrayList result = new ArrayList<>(types); - Iterator iterator = result.iterator(); - while (iterator.hasNext()) { - if (!iterator.next().canExplicitlyCastTo(type)) { - iterator.remove(); - } - } - return result; - } - - public static List getMoreCapatiousThan(Collection types, BuiltInType type) { - ArrayList result = new ArrayList<>(); - Iterator iterator = types.iterator(); - while (iterator.hasNext()) { - try { - BuiltInType builtInType = (BuiltInType) iterator.next(); - if (builtInType.isMoreCapaciousThan(type)) { - result.add(builtInType); - } - } catch (Exception e) { - } - } - return result; - } - - public static List getLessCapatiousOrEqualThan(Collection types, BuiltInType type) { - ArrayList result = new ArrayList<>(); - Iterator iterator = types.iterator(); - while (iterator.hasNext()) { - try { - BuiltInType builtInType = (BuiltInType) iterator.next(); - if (!builtInType.isMoreCapaciousThan(type) || builtInType.equals(type)) { - result.add(builtInType); - } - } catch (Exception e) { - } - } - return result; - } -} diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java index 2658be21303..d5ce37986b3 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/AssignmentOperatorImplFactory.java @@ -31,7 +31,7 @@ import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Rule; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.VariableBase; import jdk.test.lib.jittester.VariableInfo; import jdk.test.lib.jittester.types.TypeKlass; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java index 96f9e1842a6..b51cec7cf5b 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryArithmeticOperatorFactory.java @@ -29,7 +29,7 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeInt; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.utils.PseudoRandom; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java index 288eac1814f..6479644db7c 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryBitwiseOperatorFactory.java @@ -28,7 +28,7 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeBoolean; import jdk.test.lib.jittester.types.TypeInt; import jdk.test.lib.jittester.types.TypeKlass; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java index 81ffbd9cece..d5c74e2c976 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BinaryShiftOperatorFactory.java @@ -28,11 +28,11 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; import jdk.test.lib.jittester.types.TypeInt; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.types.TypeLong; import jdk.test.lib.jittester.utils.PseudoRandom; +import jdk.test.lib.jittester.utils.TypeUtil; class BinaryShiftOperatorFactory extends BinaryOperatorFactory { BinaryShiftOperatorFactory(OperatorKind opKind, long complexityLimit, int operatorLimit, diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BitwiseInversionOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BitwiseInversionOperatorFactory.java index 6ed509f6728..bad0bab3a8a 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BitwiseInversionOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BitwiseInversionOperatorFactory.java @@ -28,7 +28,7 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.UnaryOperator; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.types.TypeInt; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BlockFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BlockFactory.java index a47f4ae36cb..37b6072e123 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BlockFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/BlockFactory.java @@ -33,7 +33,7 @@ import jdk.test.lib.jittester.Switch; import jdk.test.lib.jittester.SymbolTable; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.loops.DoWhile; import jdk.test.lib.jittester.loops.For; import jdk.test.lib.jittester.loops.While; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java index a8d934c254a..e170ff5c2e6 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundArithmeticAssignmentOperatorFactory.java @@ -30,7 +30,7 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeBoolean; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.utils.PseudoRandom; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java index 1752b0c5c77..b61d23f9519 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundBitwiseAssignmentOperatorFactory.java @@ -30,7 +30,7 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.utils.PseudoRandom; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java index 286b6d719ff..901bf438a4f 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CompoundShiftAssignmentOperatorFactory.java @@ -30,7 +30,7 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.types.TypeBoolean; import jdk.test.lib.jittester.utils.PseudoRandom; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CounterInitializerFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CounterInitializerFactory.java index 8892901b98a..9112bc124d7 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CounterInitializerFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/CounterInitializerFactory.java @@ -30,7 +30,7 @@ import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.SymbolTable; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.VariableInfo; import jdk.test.lib.jittester.loops.CounterInitializer; import jdk.test.lib.jittester.types.TypeKlass; @@ -48,7 +48,7 @@ class CounterInitializerFactory extends SafeFactory { @Override protected IRNode sproduce() throws ProductionFailedException { - List types = TypeUtil.getMoreCapatiousThan(TypeList.getBuiltIn(), new TypeInt()); + List types = TypeUtil.getMoreCapaciousThan(TypeList.getBuiltIn(), new TypeInt()); types.add(new TypeInt()); final Type selectedType = PseudoRandom.randomElement(types); IRNode init = new LiteralInitializer(counterValue, selectedType); diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/SwitchFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/SwitchFactory.java index 8ee2ecf67ca..a1052ced09c 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/SwitchFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/SwitchFactory.java @@ -34,7 +34,7 @@ import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Rule; import jdk.test.lib.jittester.Switch; import jdk.test.lib.jittester.Type; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.types.TypeByte; import jdk.test.lib.jittester.types.TypeChar; @@ -63,7 +63,7 @@ class SwitchFactory extends SafeFactory { @Override protected IRNode sproduce() throws ProductionFailedException { if (statementLimit > 0 && complexityLimit > 0) { - ArrayList switchTypes = new ArrayList<>(); + List switchTypes = new ArrayList<>(); switchTypes.add(new TypeChar()); switchTypes.add(new TypeByte()); switchTypes.add(new TypeShort()); @@ -78,8 +78,8 @@ class SwitchFactory extends SafeFactory { .setCanHaveReturn(canHaveReturn); MAIN_LOOP: for (Type type : switchTypes) { - ArrayList caseConsts = new ArrayList<>(); - ArrayList caseBlocks = new ArrayList<>(); + List caseConsts = new ArrayList<>(); + List caseBlocks = new ArrayList<>(); try { int accumulatedStatements = 0; int currentStatementsLimit = 0; @@ -94,10 +94,10 @@ class SwitchFactory extends SafeFactory { .getLimitedExpressionFactory() .produce(); accumulatedComplexity += currentComplexityLimit; - ArrayList caseTypes = new ArrayList<>(); + List caseTypes = new ArrayList<>(); caseTypes.add(new TypeByte()); caseTypes.add(new TypeChar()); - caseTypes = new ArrayList<>(TypeUtil.getLessCapatiousOrEqualThan(caseTypes, + caseTypes = new ArrayList<>(TypeUtil.getLessCapaciousOrEqualThan(caseTypes, (BuiltInType) type)); if (PseudoRandom.randomBoolean()) { // "default" currentStatementsLimit = (int) (PseudoRandom.random() diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TernaryOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TernaryOperatorFactory.java index 5060736bd21..24e05e40d2e 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TernaryOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TernaryOperatorFactory.java @@ -30,7 +30,7 @@ import jdk.test.lib.jittester.SymbolTable; import jdk.test.lib.jittester.TernaryOperator; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.types.TypeBoolean; import jdk.test.lib.jittester.utils.PseudoRandom; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TryCatchBlockFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TryCatchBlockFactory.java index dea0c9325f6..523bfb5d0c4 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TryCatchBlockFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/TryCatchBlockFactory.java @@ -31,7 +31,7 @@ import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.TryCatchBlock; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.types.TypeKlass; import jdk.test.lib.jittester.utils.PseudoRandom; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/UnaryPlusMinusOperatorFactory.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/UnaryPlusMinusOperatorFactory.java index 79b0e23a7dd..12e5e982b2c 100644 --- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/UnaryPlusMinusOperatorFactory.java +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/UnaryPlusMinusOperatorFactory.java @@ -29,7 +29,7 @@ import jdk.test.lib.jittester.OperatorKind; import jdk.test.lib.jittester.ProductionFailedException; import jdk.test.lib.jittester.Type; import jdk.test.lib.jittester.TypeList; -import jdk.test.lib.jittester.TypeUtil; +import jdk.test.lib.jittester.utils.TypeUtil; import jdk.test.lib.jittester.UnaryOperator; import jdk.test.lib.jittester.types.TypeBoolean; import jdk.test.lib.jittester.types.TypeInt; diff --git a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/TypeUtil.java b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/TypeUtil.java new file mode 100644 index 00000000000..f9595de5d1b --- /dev/null +++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/TypeUtil.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.test.lib.jittester.utils; + +import jdk.test.lib.jittester.BuiltInType; +import jdk.test.lib.jittester.Type; + +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Utility functions for type system + */ +public class TypeUtil { + /** + * Gets a list of implicitly castable types to a given one from the collection of types + * + * @param types a collection to get types from + * @param type a target type which result type could be implicitly cast to + * @return a result collection of types that match given conditions + */ + public static Collection getImplicitlyCastable(Collection types, Type type) { + return types.stream() + .filter(t -> t.canImplicitlyCastTo(type)) + .collect(Collectors.toList()); + } + + /** + * Gets a list of explicitly castable types to a given one from the collection of types + * + * @param types a collection to get types from + * @param type a target type which result type could be explicitly cast to + * @return a result collection of types that match given conditions + */ + public static Collection getExplicitlyCastable(Collection types, Type type) { + return types.stream() + .filter(t -> t.canExplicitlyCastTo(type)) + .collect(Collectors.toList()); + } + + /** + * Gets a list of more capacious types than a given one from the collection of types + * + * @param types a collection to get types from + * @param type a type to filter given types by capacity + * @return a result collection of types that match given conditions + */ + public static List getMoreCapaciousThan(Collection types, BuiltInType type) { + return types.stream() + .filter(t -> ((BuiltInType) t).isMoreCapaciousThan(type)) + .collect(Collectors.toList()); + } + + /** + * Gets a list of less or equal capacious types than a given one from the collection of types + * + * @param types a collection to get types from + * @param type a type to filter given types by capacity + * @return a result collection of types that match given conditions + */ + public static List getLessCapaciousOrEqualThan(Collection types, BuiltInType type) { + return types.stream() + .filter(t -> !((BuiltInType) t).isMoreCapaciousThan(type) || t.equals(type)) + .collect(Collectors.toList()); + } +} diff --git a/hotspot/test/testlibrary/jvmti/libSimpleClassFileLoadHook.c b/hotspot/test/testlibrary/jvmti/libSimpleClassFileLoadHook.c new file mode 100644 index 00000000000..2424e87c880 --- /dev/null +++ b/hotspot/test/testlibrary/jvmti/libSimpleClassFileLoadHook.c @@ -0,0 +1,166 @@ +/* + * 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. + */ + +/* + * A simple way to test JVMTI ClassFileLoadHook. See ../testlibrary_tests/SimpleClassFileLoadHookTest.java + * for an example. + */ +#include +#include +#include +#include + +#include +#include + +static char* CLASS_NAME = NULL; +static char* FROM = NULL; +static char* TO = NULL; +static jvmtiEnv *jvmti = NULL; +static jvmtiEventCallbacks callbacks; + +/** + * For all classes whose name equals to CLASS_NAME, we replace all occurrence of FROM to TO + * in the classfile data. CLASS_NAME must be a binary class name. + * + * FROM is usually chosen as part of a UTF8 string in the class file. For example, if the + * original class file has + * String getXXX() { return "theXXX";} + * You can set FROM=XXX, TO=YYY to rewrite the class to be + * String getYYY() { return "theYYY";} + * + * Please note that the replacement is NOT limited just the UTF8 strings, but rather applies + * to all the bytes in the classfile. So if you pick a very short FROM string like X, + * it may override any POP2 bytecodes, which have the value 88 (ascii 'X'). + * + * A good FROM string to use is 'cellphone', where the first 4 bytes represent the bytecode + * sequence DADD/LSUB/IDIV/IDIV, which does not appear in valid bytecode streams. + */ +void JNICALL +ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_beeing_redefined, + jobject loader, const char* name, jobject protection_domain, + jint class_data_len, const unsigned char* class_data, + jint *new_class_data_len, unsigned char** new_class_data) { + + if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + size_t n = strlen(FROM); + unsigned char* new_data; + + if ((*jvmti)->Allocate(jvmti, class_data_len, &new_data) == JNI_OK) { + const unsigned char* s = class_data; + unsigned char* d = new_data; + unsigned char* end = d + class_data_len; + int count = 0; + + fprintf(stderr, "found class to be hooked: %s - rewriting ...\n", name); + + while (d + n < end) { + if (memcmp(s, FROM, n) == 0) { + memcpy(d, TO, n); + s += n; + d += n; + count++; + } else { + *d++ = *s++; + } + } + while (d < end) { + *d++ = *s++; + } + + *new_class_data_len = class_data_len; + *new_class_data = new_data; + + fprintf(stderr, "Rewriting done. Replaced %d occurrence(s)\n", count); + } + } +} + +static jint init_options(char *options) { + char* class_name; + char* from; + char* to; + + fprintf(stderr, "Agent library loaded with options = %s\n", options); + if ((class_name = options) != NULL && + (from = strchr(class_name, ',')) != NULL && (from[1] != 0)) { + *from = 0; + from++; + if ((to = strchr(from, ',')) != NULL && (to[1] != 0)) { + *to = 0; + to++; + if (strchr(to, ',') == NULL && + strlen(to) == strlen(from) && + strlen(class_name) > 0 && + strlen(to) > 0) { + CLASS_NAME = strdup(class_name); + FROM = strdup(from); + TO = strdup(to); + fprintf(stderr, "CLASS_NAME = %s, FROM = %s, TO = %s\n", + CLASS_NAME, FROM, TO); + return JNI_OK; + } + } + } + fprintf(stderr, + "Incorrect options. You need to start the JVM with -agentlib:ClassFileLoadHook=,,\n" + "where is the class you want to hook, is the string in the classfile to be replaced\n" + "with . and must have the same length. Example:\n" + " @run main/native -agentlib:ClassFileLoadHook=Foo,XXX,YYY ClassFileLoadHookTest\n"); + return JNI_ERR; +} + +static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { + int rc; + + if ((rc = (*jvm)->GetEnv(jvm, (void **)&jvmti, JVMTI_VERSION_1_1)) != JNI_OK) { + fprintf(stderr, "Unable to create jvmtiEnv, GetEnv failed, error = %d\n", rc); + return JNI_ERR; + } + if ((rc = init_options(options)) != JNI_OK) { + return JNI_ERR; + } + + (void) memset(&callbacks, 0, sizeof(callbacks)); + callbacks.ClassFileLoadHook = &ClassFileLoadHook; + if ((rc = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, sizeof(callbacks))) != JNI_OK) { + fprintf(stderr, "SetEventCallbacks failed, error = %d\n", rc); + return JNI_ERR; + } + + if ((rc = (*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, + JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)) != JNI_OK) { + fprintf(stderr, "SetEventNotificationMode failed, error = %d\n", rc); + return JNI_ERR; + } + + return JNI_OK; +} + +JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { + return Agent_Initialize(jvm, options, reserved); +} + +JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved) { + return Agent_Initialize(jvm, options, reserved); +} diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java deleted file mode 100644 index 367e46965c0..00000000000 --- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2012, 2014, 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.hotspot; - -import java.lang.reflect.Executable; -import java.util.Arrays; -import java.util.List; -import java.util.function.Function; -import java.util.stream.Stream; -import java.security.BasicPermission; - -import sun.hotspot.parser.DiagnosticCommand; - -public class WhiteBox { - - @SuppressWarnings("serial") - public static class WhiteBoxPermission extends BasicPermission { - public WhiteBoxPermission(String s) { - super(s); - } - } - - private WhiteBox() {} - private static final WhiteBox instance = new WhiteBox(); - private static native void registerNatives(); - - /** - * Returns the singleton WhiteBox instance. - * - * The returned WhiteBox object should be carefully guarded - * by the caller, since it can be used to read and write data - * at arbitrary memory addresses. It must never be passed to - * untrusted code. - */ - public synchronized static WhiteBox getWhiteBox() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(new WhiteBoxPermission("getInstance")); - } - return instance; - } - - static { - registerNatives(); - } - - // Get the maximum heap size supporting COOPs - public native long getCompressedOopsMaxHeapSize(); - // Arguments - public native void printHeapSizes(); - - // Memory - public native long getObjectAddress(Object o); - public native int getHeapOopSize(); - public native int getVMPageSize(); - public native boolean isObjectInOldGen(Object o); - public native long getObjectSize(Object o); - - // Runtime - // Make sure class name is in the correct format - public boolean isClassAlive(String name) { - return isClassAlive0(name.replace('.', '/')); - } - private native boolean isClassAlive0(String name); - - // JVMTI - public native void addToBootstrapClassLoaderSearch(String segment); - public native void addToSystemClassLoaderSearch(String segment); - - // G1 - public native boolean g1InConcurrentMark(); - public native boolean g1IsHumongous(Object o); - public native long g1NumFreeRegions(); - public native int g1RegionSize(); - public native Object[] parseCommandLine(String commandline, char delim, DiagnosticCommand[] args); - - // NMT - public native long NMTMalloc(long size); - public native void NMTFree(long mem); - public native long NMTReserveMemory(long size); - public native void NMTCommitMemory(long addr, long size); - public native void NMTUncommitMemory(long addr, long size); - public native void NMTReleaseMemory(long addr, long size); - public native long NMTMallocWithPseudoStack(long size, int index); - public native boolean NMTIsDetailSupported(); - public native boolean NMTChangeTrackingLevel(); - public native int NMTGetHashSize(); - - // Compiler - public native void deoptimizeAll(); - public boolean isMethodCompiled(Executable method) { - return isMethodCompiled(method, false /*not osr*/); - } - public native boolean isMethodCompiled(Executable method, boolean isOsr); - public boolean isMethodCompilable(Executable method) { - return isMethodCompilable(method, -1 /*any*/); - } - public boolean isMethodCompilable(Executable method, int compLevel) { - return isMethodCompilable(method, compLevel, false /*not osr*/); - } - public native boolean isMethodCompilable(Executable method, int compLevel, boolean isOsr); - public native boolean isMethodQueuedForCompilation(Executable method); - public int deoptimizeMethod(Executable method) { - return deoptimizeMethod(method, false /*not osr*/); - } - public native int deoptimizeMethod(Executable method, boolean isOsr); - public void makeMethodNotCompilable(Executable method) { - makeMethodNotCompilable(method, -1 /*any*/); - } - public void makeMethodNotCompilable(Executable method, int compLevel) { - makeMethodNotCompilable(method, compLevel, false /*not osr*/); - } - public native void makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr); - public int getMethodCompilationLevel(Executable method) { - return getMethodCompilationLevel(method, false /*not ost*/); - } - public native int getMethodCompilationLevel(Executable method, boolean isOsr); - public native boolean testSetDontInlineMethod(Executable method, boolean value); - public int getCompileQueuesSize() { - return getCompileQueueSize(-1 /*any*/); - } - public native int getCompileQueueSize(int compLevel); - public native boolean testSetForceInlineMethod(Executable method, boolean value); - public boolean enqueueMethodForCompilation(Executable method, int compLevel) { - return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/); - } - public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci); - public native void clearMethodState(Executable method); - public native void lockCompilation(); - public native void unlockCompilation(); - public native int getMethodEntryBci(Executable method); - public native Object[] getNMethod(Executable method, boolean isOsr); - public native long allocateCodeBlob(int size, int type); - public long allocateCodeBlob(long size, int type) { - int intSize = (int) size; - if ((long) intSize != size || size < 0) { - throw new IllegalArgumentException( - "size argument has illegal value " + size); - } - return allocateCodeBlob( intSize, type); - } - public native void freeCodeBlob(long addr); - public void forceNMethodSweep() { - try { - forceNMethodSweep0().join(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - public native Thread forceNMethodSweep0(); - public native Object[] getCodeHeapEntries(int type); - public native int getCompilationActivityMode(); - public native Object[] getCodeBlob(long addr); - - // Intered strings - public native boolean isInStringTable(String str); - - // Memory - public native void readReservedMemory(); - public native long allocateMetaspace(ClassLoader classLoader, long size); - public native void freeMetaspace(ClassLoader classLoader, long addr, long size); - public native long incMetaspaceCapacityUntilGC(long increment); - public native long metaspaceCapacityUntilGC(); - - // Force Young GC - public native void youngGC(); - - // Force Full GC - public native void fullGC(); - - // Method tries to start concurrent mark cycle. - // It returns false if CM Thread is always in concurrent cycle. - public native boolean g1StartConcMarkCycle(); - - // Tests on ReservedSpace/VirtualSpace classes - public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations); - public native void runMemoryUnitTests(); - public native void readFromNoaccessArea(); - public native long getThreadStackSize(); - public native long getThreadRemainingStackSize(); - - // CPU features - public native String getCPUFeatures(); - - // Native extensions - public native long getHeapUsageForContext(int context); - public native long getHeapRegionCountForContext(int context); - public native int getContextForObject(Object obj); - public native void printRegionInfo(int context); - - // VM flags - public native boolean isConstantVMFlag(String name); - public native boolean isLockedVMFlag(String name); - public native void setBooleanVMFlag(String name, boolean value); - public native void setIntxVMFlag(String name, long value); - public native void setUintxVMFlag(String name, long value); - public native void setUint64VMFlag(String name, long value); - public native void setSizeTVMFlag(String name, long value); - public native void setStringVMFlag(String name, String value); - public native void setDoubleVMFlag(String name, double value); - public native Boolean getBooleanVMFlag(String name); - public native Long getIntxVMFlag(String name); - public native Long getUintxVMFlag(String name); - public native Long getUint64VMFlag(String name); - public native Long getSizeTVMFlag(String name); - public native String getStringVMFlag(String name); - public native Double getDoubleVMFlag(String name); - private final List> flagsGetters = Arrays.asList( - this::getBooleanVMFlag, this::getIntxVMFlag, this::getUintxVMFlag, - this::getUint64VMFlag, this::getSizeTVMFlag, this::getStringVMFlag, - this::getDoubleVMFlag); - - public Object getVMFlag(String name) { - return flagsGetters.stream() - .map(f -> f.apply(name)) - .filter(x -> x != null) - .findAny() - .orElse(null); - } - - // Jigsaw - public native Object DefineModule(String name, Object loader, Object[] packages); - public native void AddModuleExports(Object from_module, String pkg, Object to_module); - public native void AddReadsModule(Object from_module, Object to_module); - public native boolean CanReadModule(Object asking_module, Object target_module); - public native boolean IsExportedToModule(Object from_module, String pkg, Object to_module); - public native Object GetModule(Class clazz); - public native void AddModulePackage(Object module, String pkg); - - // Image File - public native boolean readImageFile(String imagefile); - - public native int getOffsetForName0(String name); - public int getOffsetForName(String name) throws Exception { - int offset = getOffsetForName0(name); - if (offset == -1) { - throw new RuntimeException(name + " not found"); - } - return offset; - } - -} diff --git a/hotspot/test/testlibrary_tests/AssertsTest.java b/hotspot/test/testlibrary_tests/AssertsTest.java index baf10c99f89..449126cb31e 100644 --- a/hotspot/test/testlibrary_tests/AssertsTest.java +++ b/hotspot/test/testlibrary_tests/AssertsTest.java @@ -25,6 +25,7 @@ import static jdk.test.lib.Asserts.*; /* @test * @summary Tests the different assertions in the Assert class + * @modules java.base/jdk.internal.misc * @library /testlibrary */ public class AssertsTest { diff --git a/hotspot/test/testlibrary_tests/RedefineClassTest.java b/hotspot/test/testlibrary_tests/RedefineClassTest.java index 48905f97349..739352a815e 100644 --- a/hotspot/test/testlibrary_tests/RedefineClassTest.java +++ b/hotspot/test/testlibrary_tests/RedefineClassTest.java @@ -25,6 +25,7 @@ * @test * @library /testlibrary * @summary Proof of concept test for RedefineClassHelper + * @modules java.base/jdk.internal.misc * @modules java.compiler * java.instrument * jdk.jartool/sun.tools.jar diff --git a/jdk/src/jdk.jcmd/share/classes/jdk/internal/vm/agent/spi/ToolProviderFinder.java b/hotspot/test/testlibrary_tests/SimpleClassFileLoadHookTest.java similarity index 55% rename from jdk/src/jdk.jcmd/share/classes/jdk/internal/vm/agent/spi/ToolProviderFinder.java rename to hotspot/test/testlibrary_tests/SimpleClassFileLoadHookTest.java index b96e6ae6239..6f5ef8d4a71 100644 --- a/jdk/src/jdk.jcmd/share/classes/jdk/internal/vm/agent/spi/ToolProviderFinder.java +++ b/hotspot/test/testlibrary_tests/SimpleClassFileLoadHookTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -23,24 +21,29 @@ * questions. */ -package jdk.internal.vm.agent.spi; +/* + * @test + * @library /testlibrary + * + * @run main/othervm/native -agentlib:SimpleClassFileLoadHook=Foo,XXX,YYY + * SimpleClassFileLoadHookTest + */ +import jdk.test.lib.Asserts; -import java.lang.reflect.Layer; -import java.util.HashMap; -import java.util.Map; -import java.util.ServiceLoader; - -public final class ToolProviderFinder { - private static final Map providers = init(); - - public static ToolProvider find(String name) { - return providers.get(name); +class Foo { + static String getValue() { + return "XXX"; } - - private static Map init() { - Map providers = new HashMap<>(); - ServiceLoader.load(Layer.boot(), ToolProvider.class) - .forEach(p -> providers.putIfAbsent(p.getName(), p)); - return providers; + static String getOtherValue() { + return "xXXXxx"; + } +} +public class SimpleClassFileLoadHookTest { + public static void main(String args[]) { + System.out.println(Foo.getValue()); + System.out.println(Foo.getOtherValue()); + Asserts.assertTrue("YYY".equals(Foo.getValue()) && + "xYYYxx".equals(Foo.getOtherValue()), + "SimpleClassFileLoadHook should replace XXX with YYY"); } } diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java index f507fb068c5..a11436606b2 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java @@ -26,7 +26,7 @@ * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.misc - * java.base/sun.reflect + * java.base/jdk.internal.reflect * java.management * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar diff --git a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java index 5a792a0c413..f9feeaadc2c 100644 --- a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java +++ b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java @@ -26,7 +26,7 @@ * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.misc - * java.base/sun.reflect + * java.base/jdk.internal.reflect * java.management * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar diff --git a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java index 1bfdc45db93..7bc97e6966c 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java @@ -26,7 +26,7 @@ * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.misc - * java.base/sun.reflect + * java.base/jdk.internal.reflect * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor diff --git a/hotspot/test/testlibrary_tests/ctw/JarsTest.java b/hotspot/test/testlibrary_tests/ctw/JarsTest.java index 1050e512583..e35791201b8 100644 --- a/hotspot/test/testlibrary_tests/ctw/JarsTest.java +++ b/hotspot/test/testlibrary_tests/ctw/JarsTest.java @@ -26,7 +26,7 @@ * @bug 8012447 * @library /testlibrary /test/lib /testlibrary/ctw/src * @modules java.base/jdk.internal.misc - * java.base/sun.reflect + * java.base/jdk.internal.reflect * java.compiler * java.management * jdk.jvmstat/sun.jvmstat.monitor diff --git a/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java b/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java index 0ee48b5fb53..3146339e093 100644 --- a/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/BlobSanityTest.java @@ -25,6 +25,7 @@ * @test BlobSanityTest * @bug 8132980 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @build BlobSanityTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java index 7a15c7dd9a1..2694ba7046a 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java @@ -25,6 +25,7 @@ * @test DoubleTest * @bug 8028756 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @build DoubleTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java index b12f3065b22..56ffc53302d 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java @@ -25,6 +25,7 @@ * @test IntxTest * @bug 8038756 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @build IntxTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java index 531f59f4e32..f8b98fa4daa 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java @@ -25,6 +25,7 @@ * @test StringTest * @bug 8028756 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @build StringTest * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java index c82e35ee54e..015c02eba49 100644 --- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java +++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java @@ -25,6 +25,7 @@ * @test Uint64Test * @bug 8028756 * @library /testlibrary /test/lib + * @modules java.base/jdk.internal.misc * @modules java.management/sun.management * @build Uint64Test * @run main ClassFileInstaller sun.hotspot.WhiteBox diff --git a/jdk/.hgtags b/jdk/.hgtags index 2b6d80debed..b7e36c324d5 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -361,3 +361,4 @@ bb8379287f3736f38c52b2d1418784e2592461d1 jdk-9+114 baeb5edb38939cdb78ae0ac6f4fd368465cbf188 jdk-9+116 4da0f73ce03aaf245b92cc040cc0ab0e3fa54dc2 jdk-9+117 e1eba5cfa5cc8c66d524396a05323dc93568730a jdk-9+118 +bad3f8a33db271a6143ba6eac0c8bd5bbd942417 jdk-9+119 diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk index d479b095514..29e4ce0f19e 100644 --- a/jdk/make/Import.gmk +++ b/jdk/make/Import.gmk @@ -112,7 +112,7 @@ $(BASE_INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_ $(LN) -s ../$(@F) $@ ifeq ($(OPENJDK_TARGET_OS), macosx) - $(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM + $(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM: $(MKDIR) -p $(@D) $(RM) $@ $(LN) -s ../$(@F) $@ diff --git a/jdk/make/data/currency/CurrencyData.properties b/jdk/make/data/currency/CurrencyData.properties index 808d01d6958..0288b04390b 100644 --- a/jdk/make/data/currency/CurrencyData.properties +++ b/jdk/make/data/currency/CurrencyData.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 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 @@ -26,7 +26,8 @@ # Version of the currency data format. # 1: initial # 2: Change in minor unit (allowing 4-9 digits) -formatVersion=2 +# 3: Change in the order of special case and other currency entries +formatVersion=3 # Version of the currency code information in this class. # It is a serial number that accompanies with each amendment. diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk index 73b452f43f6..b4c6f5e20a3 100644 --- a/jdk/make/lib/Awt2dLibraries.gmk +++ b/jdk/make/lib/Awt2dLibraries.gmk @@ -96,10 +96,7 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc) mlib_c_ImageAffine_BL.c \ mlib_c_ImageAffine_BL_S16.c \ mlib_c_ImageAffine_BL_U16.c \ - mlib_c_ImageAffineIndex_BC.c \ - mlib_c_ImageAffineIndex_BL.c \ mlib_c_ImageAffine_NN.c \ - mlib_c_ImageBlendTable.c \ mlib_c_ImageConvClearEdge.c \ mlib_c_ImageConvCopyEdge.c \ mlib_c_ImageConv_f.c \ @@ -107,14 +104,6 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc) mlib_c_ImageCopy.c \ mlib_c_ImageLookUp.c \ mlib_c_ImageLookUp_f.c \ - mlib_v_ImageChannelExtract.c \ - mlib_v_ImageChannelExtract_f.c \ - mlib_v_ImageChannelInsert_34.c \ - mlib_v_ImageChannelInsert.c \ - mlib_v_ImageConvIndex3_8_16nw.c \ - mlib_v_ImageConvIndex3_8_8nw.c \ - mlib_v_ImageCopy.c \ - mlib_v_ImageCopy_blk.s \ # LIBMLIB_IMAGE_V_CFLAGS += $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS)) diff --git a/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java b/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java index f15834202b0..b72ac9225b1 100644 --- a/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java +++ b/jdk/make/src/classes/build/tools/cldrconverter/CLDRConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -584,7 +584,9 @@ public class CLDRConverter { String[] data = (String[])e[1]; if (map.get(TIMEZONE_ID_PREFIX + tzid) == null && - handlerMetaZones.get(tzid) == null) { + handlerMetaZones.get(tzid) == null || + handlerMetaZones.get(tzid) != null && + map.get(METAZONE_ID_PREFIX + handlerMetaZones.get(tzid)) == null) { // First, check the CLDR meta key Optional> cldrMeta = handlerMetaZones.getData().entrySet().stream() diff --git a/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java b/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java index cc125638c96..ae861c5abe5 100644 --- a/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java +++ b/jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -121,7 +121,7 @@ public class GenerateCurrencyData { private static final int maxOtherCurrencies = 128; private static int otherCurrenciesCount = 0; - private static StringBuffer otherCurrencies = new StringBuffer(); + private static String[] otherCurrencies = new String[maxOtherCurrencies]; private static int[] otherCurrenciesDefaultFractionDigits = new int[maxOtherCurrencies]; private static int[] otherCurrenciesNumericCode= new int[maxOtherCurrencies]; @@ -318,10 +318,7 @@ public class GenerateCurrencyData { if (otherCurrenciesCount == maxOtherCurrencies) { throw new RuntimeException("too many other currencies"); } - if (otherCurrencies.length() > 0) { - otherCurrencies.append('-'); - } - otherCurrencies.append(currencyCode); + otherCurrencies[otherCurrenciesCount] = currencyCode; otherCurrenciesDefaultFractionDigits[otherCurrenciesCount] = getDefaultFractionDigits(currencyCode); otherCurrenciesNumericCode[otherCurrenciesCount] = getNumericCode(currencyCode); otherCurrenciesCount++; @@ -350,35 +347,41 @@ public class GenerateCurrencyData { out.writeInt(Integer.parseInt(dataVersion)); writeIntArray(mainTable, mainTable.length); out.writeInt(specialCaseCount); - writeLongArray(specialCaseCutOverTimes, specialCaseCount); - writeStringArray(specialCaseOldCurrencies, specialCaseCount); - writeStringArray(specialCaseNewCurrencies, specialCaseCount); - writeIntArray(specialCaseOldCurrenciesDefaultFractionDigits, specialCaseCount); - writeIntArray(specialCaseNewCurrenciesDefaultFractionDigits, specialCaseCount); - writeIntArray(specialCaseOldCurrenciesNumericCode, specialCaseCount); - writeIntArray(specialCaseNewCurrenciesNumericCode, specialCaseCount); + writeSpecialCaseEntries(); out.writeInt(otherCurrenciesCount); - out.writeUTF(otherCurrencies.toString()); - writeIntArray(otherCurrenciesDefaultFractionDigits, otherCurrenciesCount); - writeIntArray(otherCurrenciesNumericCode, otherCurrenciesCount); + writeOtherCurrencies(); } private static void writeIntArray(int[] ia, int count) throws IOException { - for (int i = 0; i < count; i ++) { + for (int i = 0; i < count; i++) { out.writeInt(ia[i]); } } - private static void writeLongArray(long[] la, int count) throws IOException { - for (int i = 0; i < count; i ++) { - out.writeLong(la[i]); + private static void writeSpecialCaseEntries() throws IOException { + for (int index = 0; index < specialCaseCount; index++) { + out.writeLong(specialCaseCutOverTimes[index]); + String str = (specialCaseOldCurrencies[index] != null) + ? specialCaseOldCurrencies[index] : ""; + out.writeUTF(str); + str = (specialCaseNewCurrencies[index] != null) + ? specialCaseNewCurrencies[index] : ""; + out.writeUTF(str); + out.writeInt(specialCaseOldCurrenciesDefaultFractionDigits[index]); + out.writeInt(specialCaseNewCurrenciesDefaultFractionDigits[index]); + out.writeInt(specialCaseOldCurrenciesNumericCode[index]); + out.writeInt(specialCaseNewCurrenciesNumericCode[index]); } } - private static void writeStringArray(String[] sa, int count) throws IOException { - for (int i = 0; i < count; i ++) { - String str = (sa[i] != null) ? sa[i] : ""; + private static void writeOtherCurrencies() throws IOException { + for (int index = 0; index < otherCurrenciesCount; index++) { + String str = (otherCurrencies[index] != null) + ? otherCurrencies[index] : ""; out.writeUTF(str); + out.writeInt(otherCurrenciesDefaultFractionDigits[index]); + out.writeInt(otherCurrenciesNumericCode[index]); } } + } diff --git a/jdk/make/src/classes/build/tools/jigsaw/GenGraphs.java b/jdk/make/src/classes/build/tools/jigsaw/GenGraphs.java index da774751e1c..04badbd7f3d 100644 --- a/jdk/make/src/classes/build/tools/jigsaw/GenGraphs.java +++ b/jdk/make/src/classes/build/tools/jigsaw/GenGraphs.java @@ -82,14 +82,14 @@ public class GenGraphs { mods.add(name); Configuration cf = Configuration.empty() .resolveRequires(finder, - ModuleFinder.empty(), + ModuleFinder.of(), Set.of(name)); genGraphs.genDotFile(dir, name, cf); } Configuration cf = Configuration.empty() .resolveRequires(finder, - ModuleFinder.empty(), + ModuleFinder.of(), mods); genGraphs.genDotFile(dir, "jdk", cf); diff --git a/jdk/make/src/classes/build/tools/jigsaw/ModuleSummary.java b/jdk/make/src/classes/build/tools/jigsaw/ModuleSummary.java index c1b15d39219..f274afdc709 100644 --- a/jdk/make/src/classes/build/tools/jigsaw/ModuleSummary.java +++ b/jdk/make/src/classes/build/tools/jigsaw/ModuleSummary.java @@ -292,7 +292,7 @@ public class ModuleSummary { static Configuration resolve(Set roots) { return Configuration.empty() .resolveRequires(ModuleFinder.ofSystem(), - ModuleFinder.empty(), + ModuleFinder.of(), roots); } diff --git a/jdk/src/demo/share/jvmti/index.html b/jdk/src/demo/share/jvmti/index.html index 25440a104d9..5791b8b046f 100644 --- a/jdk/src/demo/share/jvmti/index.html +++ b/jdk/src/demo/share/jvmti/index.html @@ -415,7 +415,7 @@ Additional information can also be found by doing a search on "jvmti" at Various technical articles are also available through this website. And don't forget the Java Tutorials at -http://java.sun.com/docs/books/tutorial +http://docs.oracle.com/javase/tutorial for getting a quick start on all the various interfaces.

Comments and Feedback

diff --git a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java index fee0b800f2d..50dc8020b25 100644 --- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java +++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -43,9 +43,10 @@ class Constants { 1.0 to 1.3.X 45,3 1.4 to 1.4.X 46,0 1.5 to 1.5.X 49,0 - 1.6 to 1.5.x 50,0 - 1.7 to 1.6.x 51,0 - 1.8 to 1.7.x 52,0 + 1.6 to 1.6.X 50,0 + 1.7 to 1.7.X 51,0 + 1.8 to 1.8.X 52,0 + 1.9 to 1.9.X 53,0 */ public static final Package.Version JAVA_MIN_CLASS_VERSION = @@ -63,6 +64,9 @@ class Constants { public static final Package.Version JAVA8_MAX_CLASS_VERSION = Package.Version.of(52, 00); + public static final Package.Version JAVA9_MAX_CLASS_VERSION = + Package.Version.of(53, 00); + public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D; public static final Package.Version JAVA5_PACKAGE_VERSION = @@ -79,7 +83,7 @@ class Constants { // upper limit, should point to the latest class version public static final Package.Version JAVA_MAX_CLASS_VERSION = - JAVA8_MAX_CLASS_VERSION; + JAVA9_MAX_CLASS_VERSION; // upper limit should point to the latest package version, for version info!. public static final Package.Version MAX_PACKAGE_VERSION = diff --git a/jdk/src/java.base/share/classes/java/io/BufferedWriter.java b/jdk/src/java.base/share/classes/java/io/BufferedWriter.java index 28e170fe800..3d8e1ee1b19 100644 --- a/jdk/src/java.base/share/classes/java/io/BufferedWriter.java +++ b/jdk/src/java.base/share/classes/java/io/BufferedWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -153,13 +153,18 @@ public class BufferedWriter extends Writer { * needed. If the requested length is at least as large as the buffer, * however, then this method will flush the buffer and write the characters * directly to the underlying stream. Thus redundant - * BufferedWriters will not copy data unnecessarily. + * {@code BufferedWriter}s will not copy data unnecessarily. * * @param cbuf A character array * @param off Offset from which to start reading characters * @param len Number of characters to write * - * @exception IOException If an I/O error occurs + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given array + * + * @throws IOException If an I/O error occurs */ public void write(char cbuf[], int off, int len) throws IOException { synchronized (lock) { @@ -195,17 +200,24 @@ public class BufferedWriter extends Writer { /** * Writes a portion of a String. * - *

If the value of the {@code len} parameter is negative then no - * characters are written. This is contrary to the specification of this - * method in the {@linkplain java.io.Writer#write(java.lang.String,int,int) - * superclass}, which requires that an {@link IndexOutOfBoundsException} be - * thrown. + * @implSpec + * While the specification of this method in the + * {@linkplain java.io.Writer#write(java.lang.String,int,int) superclass} + * recommends that an {@link IndexOutOfBoundsException} be thrown + * if {@code len} is negative or {@code off + len} is negative, + * the implementation in this class does not throw such an exception in + * these cases but instead simply writes no characters. * * @param s String to be written * @param off Offset from which to start reading characters * @param len Number of characters to be written * - * @exception IOException If an I/O error occurs + * @throws IndexOutOfBoundsException + * If {@code off} is negative, + * or {@code off + len} is greater than the length + * of the given string + * + * @throws IOException If an I/O error occurs */ public void write(String s, int off, int len) throws IOException { synchronized (lock) { diff --git a/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java b/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java index ed27bbae314..773b59614d9 100644 --- a/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java +++ b/jdk/src/java.base/share/classes/java/io/CharArrayWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,6 +91,11 @@ class CharArrayWriter extends Writer { * @param c the data to be written * @param off the start offset in the data * @param len the number of chars that are written + * + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given array */ public void write(char c[], int off, int len) { if ((off < 0) || (off > c.length) || (len < 0) || @@ -114,6 +119,11 @@ class CharArrayWriter extends Writer { * @param str String to be written from * @param off Offset from which to start reading characters * @param len Number of characters to be written + * + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given string */ public void write(String str, int off, int len) { synchronized (lock) { diff --git a/jdk/src/java.base/share/classes/java/io/FilterWriter.java b/jdk/src/java.base/share/classes/java/io/FilterWriter.java index 303c674e0c0..8272b3cc8bf 100644 --- a/jdk/src/java.base/share/classes/java/io/FilterWriter.java +++ b/jdk/src/java.base/share/classes/java/io/FilterWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,7 +72,12 @@ public abstract class FilterWriter extends Writer { * @param off Offset from which to start reading characters * @param len Number of characters to be written * - * @exception IOException If an I/O error occurs + * @throws IndexOutOfBoundsException + * If the values of the {@code off} and {@code len} parameters + * cause the corresponding method of the underlying {@code Writer} + * to throw an {@code IndexOutOfBoundsException} + * + * @throws IOException If an I/O error occurs */ public void write(char cbuf[], int off, int len) throws IOException { out.write(cbuf, off, len); @@ -85,7 +90,12 @@ public abstract class FilterWriter extends Writer { * @param off Offset from which to start reading characters * @param len Number of characters to be written * - * @exception IOException If an I/O error occurs + * @throws IndexOutOfBoundsException + * If the values of the {@code off} and {@code len} parameters + * cause the corresponding method of the underlying {@code Writer} + * to throw an {@code IndexOutOfBoundsException} + * + * @throws IOException If an I/O error occurs */ public void write(String str, int off, int len) throws IOException { out.write(str, off, len); diff --git a/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java b/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java index 0d597e6bef4..4fdb148baaf 100644 --- a/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java +++ b/jdk/src/java.base/share/classes/java/io/OutputStreamWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -202,7 +202,12 @@ public class OutputStreamWriter extends Writer { * @param off Offset from which to start writing characters * @param len Number of characters to write * - * @exception IOException If an I/O error occurs + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given array + * + * @throws IOException If an I/O error occurs */ public void write(char cbuf[], int off, int len) throws IOException { se.write(cbuf, off, len); @@ -215,7 +220,12 @@ public class OutputStreamWriter extends Writer { * @param off Offset from which to start writing characters * @param len Number of characters to write * - * @exception IOException If an I/O error occurs + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given string + * + * @throws IOException If an I/O error occurs */ public void write(String str, int off, int len) throws IOException { se.write(str, off, len); diff --git a/jdk/src/java.base/share/classes/java/io/PipedWriter.java b/jdk/src/java.base/share/classes/java/io/PipedWriter.java index 02201fbec1a..a4534b8604c 100644 --- a/jdk/src/java.base/share/classes/java/io/PipedWriter.java +++ b/jdk/src/java.base/share/classes/java/io/PipedWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,19 +125,25 @@ public class PipedWriter extends Writer { } /** - * Writes len characters from the specified character array - * starting at offset off to this piped output stream. + * Writes {@code len} characters from the specified character array + * starting at offset {@code off} to this piped output stream. * This method blocks until all the characters are written to the output * stream. * If a thread was reading data characters from the connected piped input * stream, but the thread is no longer alive, then an - * IOException is thrown. + * {@code IOException} is thrown. * * @param cbuf the data. * @param off the start offset in the data. * @param len the number of characters to write. - * @exception IOException if the pipe is - * broken, + * + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given array + * + * @throws IOException if the pipe is + * broken, * {@link #connect(java.io.PipedReader) unconnected}, closed * or an I/O error occurs. */ diff --git a/jdk/src/java.base/share/classes/java/io/PrintWriter.java b/jdk/src/java.base/share/classes/java/io/PrintWriter.java index 662f930ef90..d516b8ef404 100644 --- a/jdk/src/java.base/share/classes/java/io/PrintWriter.java +++ b/jdk/src/java.base/share/classes/java/io/PrintWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -410,6 +410,11 @@ public class PrintWriter extends Writer { * @param buf Array of characters * @param off Offset from which to start writing characters * @param len Number of characters to write + * + * @throws IndexOutOfBoundsException + * If the values of the {@code off} and {@code len} parameters + * cause the corresponding method of the underlying {@code Writer} + * to throw an {@code IndexOutOfBoundsException} */ public void write(char buf[], int off, int len) { try { @@ -440,6 +445,11 @@ public class PrintWriter extends Writer { * @param s A String * @param off Offset from which to start writing characters * @param len Number of characters to write + * + * @throws IndexOutOfBoundsException + * If the values of the {@code off} and {@code len} parameters + * cause the corresponding method of the underlying {@code Writer} + * to throw an {@code IndexOutOfBoundsException} */ public void write(String s, int off, int len) { try { diff --git a/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java b/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java index 1a8344df88b..3806675cdca 100644 --- a/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java +++ b/jdk/src/java.base/share/classes/java/io/RandomAccessFile.java @@ -27,6 +27,8 @@ package java.io; import java.nio.channels.FileChannel; import java.util.concurrent.atomic.AtomicBoolean; +import jdk.internal.misc.JavaIORandomAccessFileAccess; +import jdk.internal.misc.SharedSecrets; import sun.nio.ch.FileChannelImpl; @@ -75,6 +77,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { private static final int O_RDWR = 2; private static final int O_SYNC = 4; private static final int O_DSYNC = 8; + private static final int O_TEMPORARY = 16; /** * Creates a random access file stream to read from, and optionally @@ -202,6 +205,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { */ public RandomAccessFile(File file, String mode) throws FileNotFoundException + { + this(file, mode, false); + } + + private RandomAccessFile(File file, String mode, boolean openAndDelete) + throws FileNotFoundException { String name = (file != null ? file.getPath() : null); int imode = -1; @@ -219,6 +228,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { imode = -1; } } + if (openAndDelete) + imode |= O_TEMPORARY; if (imode < 0) throw new IllegalArgumentException("Illegal mode \"" + mode + "\" must be one of " @@ -1165,5 +1176,15 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable { static { initIDs(); + SharedSecrets.setJavaIORandomAccessFileAccess(new JavaIORandomAccessFileAccess() + { + // This is for j.u.z.ZipFile.OPEN_DELETE. The O_TEMPORARY flag + // is only implemented/supported on windows. + public RandomAccessFile openAndDelete(File file, String mode) + throws IOException + { + return new RandomAccessFile(file, mode, true); + } + }); } } diff --git a/jdk/src/java.base/share/classes/java/io/StringWriter.java b/jdk/src/java.base/share/classes/java/io/StringWriter.java index 5d1babc3127..15022b353a8 100644 --- a/jdk/src/java.base/share/classes/java/io/StringWriter.java +++ b/jdk/src/java.base/share/classes/java/io/StringWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,6 +83,11 @@ public class StringWriter extends Writer { * @param cbuf Array of characters * @param off Offset from which to start writing characters * @param len Number of characters to write + * + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given array */ public void write(char cbuf[], int off, int len) { if ((off < 0) || (off > cbuf.length) || (len < 0) || @@ -107,6 +112,11 @@ public class StringWriter extends Writer { * @param str String to be written * @param off Offset from which to start writing characters * @param len Number of characters to write + * + * @throws IndexOutOfBoundsException + * If {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given string */ public void write(String str, int off, int len) { buf.append(str, off, off + len); diff --git a/jdk/src/java.base/share/classes/java/io/Writer.java b/jdk/src/java.base/share/classes/java/io/Writer.java index 5ad5e554fb3..17e8de3ef8a 100644 --- a/jdk/src/java.base/share/classes/java/io/Writer.java +++ b/jdk/src/java.base/share/classes/java/io/Writer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,12 +32,11 @@ package java.io; * Most subclasses, however, will override some of the methods defined here in * order to provide higher efficiency, additional functionality, or both. * - * @see Writer * @see BufferedWriter * @see CharArrayWriter * @see FilterWriter * @see OutputStreamWriter - * @see FileWriter + * @see FileWriter * @see PipedWriter * @see PrintWriter * @see StringWriter @@ -139,6 +138,12 @@ public abstract class Writer implements Appendable, Closeable, Flushable { * @param len * Number of characters to write * + * @throws IndexOutOfBoundsException + * Implementations should throw this exception + * if {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length + * of the given array + * * @throws IOException * If an I/O error occurs */ @@ -160,6 +165,11 @@ public abstract class Writer implements Appendable, Closeable, Flushable { /** * Writes a portion of a string. * + * @implSpec + * The implementation in this class throws an + * {@code IndexOutOfBoundsException} for the indicated conditions; + * overriding methods may choose to do otherwise. + * * @param str * A String * @@ -170,8 +180,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable { * Number of characters to write * * @throws IndexOutOfBoundsException - * If {@code off} is negative, or {@code len} is negative, - * or {@code off+len} is negative or greater than the length + * Implementations should throw this exception + * if {@code off} is negative, or {@code len} is negative, + * or {@code off + len} is negative or greater than the length * of the given string * * @throws IOException diff --git a/jdk/src/java.base/share/classes/java/lang/Math.java b/jdk/src/java.base/share/classes/java/lang/Math.java index 4244d40a3b9..aa678b875ec 100644 --- a/jdk/src/java.base/share/classes/java/lang/Math.java +++ b/jdk/src/java.base/share/classes/java/lang/Math.java @@ -95,7 +95,7 @@ import jdk.internal.HotSpotIntrinsicCandidate; * {@code subtractExact}, {@code multiplyExact}, and {@code toIntExact} * throw an {@code ArithmeticException} when the results overflow. * For other arithmetic operations such as divide, absolute value, - * increment, decrement, and negation overflow occurs only with + * increment by one, decrement by one, and negation, overflow occurs only with * a specific minimum or maximum value and should be checked against * the minimum or maximum as appropriate. * @@ -861,7 +861,7 @@ public final class Math { public static int subtractExact(int x, int y) { int r = x - y; // HD 2-12 Overflow iff the arguments have different signs and - // the sign of the result is different than the sign of x + // the sign of the result is different from the sign of x if (((x ^ y) & (x ^ r)) < 0) { throw new ArithmeticException("integer overflow"); } @@ -882,7 +882,7 @@ public final class Math { public static long subtractExact(long x, long y) { long r = x - y; // HD 2-12 Overflow iff the arguments have different signs and - // the sign of the result is different than the sign of x + // the sign of the result is different from the sign of x if (((x ^ y) & (x ^ r)) < 0) { throw new ArithmeticException("long overflow"); } @@ -908,6 +908,20 @@ public final class Math { return (int)r; } + /** + * Returns the product of the arguments, throwing an exception if the result + * overflows a {@code long}. + * + * @param x the first value + * @param y the second value + * @return the result + * @throws ArithmeticException if the result overflows a long + * @since 9 + */ + public static long multiplyExact(long x, int y) { + return multiplyExact(x, (long)y); + } + /** * Returns the product of the arguments, * throwing an exception if the result overflows a {@code long}. @@ -1059,18 +1073,65 @@ public final class Math { return (int)value; } + /** + * Returns the exact mathematical product of the arguments. + * + * @param x the first value + * @param y the second value + * @return the result + */ + public static long multiplyFull(int x, int y) { + return (long)x * (long)y; + } + + /** + * Returns as a {@code long} the most significant 64 bits of the 128-bit + * product of two 64-bit factors. + * + * @param x the first value + * @param y the second value + * @return the result + */ + public static long multiplyHigh(long x, long y) { + if (x < 0 || y < 0) { + // Use technique from section 8-2 of Henry S. Warren, Jr., + // Hacker's Delight (2nd ed.) (Addison Wesley, 2013), 173-174. + long x1 = x >> 32; + long x2 = x & 0xFFFFFFFFL; + long y1 = y >> 32; + long y2 = y & 0xFFFFFFFFL; + long z2 = x2 * y2; + long t = x1 * y2 + (z2 >>> 32); + long z1 = t & 0xFFFFFFFFL; + long z0 = t >> 32; + z1 += x2 * y1; + return x1 * y1 + z0 + (z1 >> 32); + } else { + // Use Karatsuba technique with two base 2^32 digits. + long x1 = x >>> 32; + long y1 = y >>> 32; + long x2 = x & 0xFFFFFFFFL; + long y2 = y & 0xFFFFFFFFL; + long A = x1 * y1; + long B = x2 * y2; + long C = (x1 + x2) * (y1 + y2); + long K = C - A - B; + return (((B >>> 32) + K) >>> 32) + A; + } + } + /** * Returns the largest (closest to positive infinity) * {@code int} value that is less than or equal to the algebraic quotient. * There is one special case, if the dividend is the * {@linkplain Integer#MIN_VALUE Integer.MIN_VALUE} and the divisor is {@code -1}, * then integer overflow occurs and - * the result is equal to the {@code Integer.MIN_VALUE}. + * the result is equal to {@code Integer.MIN_VALUE}. *

* Normal integer division operates under the round to zero rounding mode * (truncation). This operation instead acts under the round toward * negative infinity (floor) rounding mode. - * The floor rounding mode gives different results than truncation + * The floor rounding mode gives different results from truncation * when the exact result is negative. *

    *
  • If the signs of the arguments are the same, the results of @@ -1108,12 +1169,41 @@ public final class Math { * There is one special case, if the dividend is the * {@linkplain Long#MIN_VALUE Long.MIN_VALUE} and the divisor is {@code -1}, * then integer overflow occurs and - * the result is equal to the {@code Long.MIN_VALUE}. + * the result is equal to {@code Long.MIN_VALUE}. *

    * Normal integer division operates under the round to zero rounding mode * (truncation). This operation instead acts under the round toward * negative infinity (floor) rounding mode. - * The floor rounding mode gives different results than truncation + * The floor rounding mode gives different results from truncation + * when the exact result is negative. + *

    + * For examples, see {@link #floorDiv(int, int)}. + * + * @param x the dividend + * @param y the divisor + * @return the largest (closest to positive infinity) + * {@code int} value that is less than or equal to the algebraic quotient. + * @throws ArithmeticException if the divisor {@code y} is zero + * @see #floorMod(long, int) + * @see #floor(double) + * @since 9 + */ + public static long floorDiv(long x, int y) { + return floorDiv(x, (long)y); + } + + /** + * Returns the largest (closest to positive infinity) + * {@code long} value that is less than or equal to the algebraic quotient. + * There is one special case, if the dividend is the + * {@linkplain Long#MIN_VALUE Long.MIN_VALUE} and the divisor is {@code -1}, + * then integer overflow occurs and + * the result is equal to {@code Long.MIN_VALUE}. + *

    + * Normal integer division operates under the round to zero rounding mode + * (truncation). This operation instead acts under the round toward + * negative infinity (floor) rounding mode. + * The floor rounding mode gives different results from truncation * when the exact result is negative. *

    * For examples, see {@link #floorDiv(int, int)}. @@ -1181,8 +1271,34 @@ public final class Math { * @since 1.8 */ public static int floorMod(int x, int y) { - int r = x - floorDiv(x, y) * y; - return r; + return x - floorDiv(x, y) * y; + } + + /** + * Returns the floor modulus of the {@code long} and {@int} arguments. + *

    + * The floor modulus is {@code x - (floorDiv(x, y) * y)}, + * has the same sign as the divisor {@code y}, and + * is in the range of {@code -abs(y) < r < +abs(y)}. + * + *

    + * The relationship between {@code floorDiv} and {@code floorMod} is such that: + *

      + *
    • {@code floorDiv(x, y) * y + floorMod(x, y) == x} + *
    + *

    + * For examples, see {@link #floorMod(int, int)}. + * + * @param x the dividend + * @param y the divisor + * @return the floor modulus {@code x - (floorDiv(x, y) * y)} + * @throws ArithmeticException if the divisor {@code y} is zero + * @see #floorDiv(long, int) + * @since 9 + */ + public static int floorMod(long x, int y) { + // Result cannot overflow the range of int. + return (int)(x - floorDiv(x, y) * y); } /** diff --git a/jdk/src/java.base/share/classes/java/lang/Runtime.java b/jdk/src/java.base/share/classes/java/lang/Runtime.java index 3c73d5b61a3..1533130017b 100644 --- a/jdk/src/java.base/share/classes/java/lang/Runtime.java +++ b/jdk/src/java.base/share/classes/java/lang/Runtime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -26,9 +26,21 @@ package java.lang; import java.io.*; +import java.math.BigInteger; +import java.util.AbstractList; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.RandomAccess; import java.util.StringTokenizer; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.Reflection; +import sun.security.action.GetPropertyAction; /** * Every Java application has a single instance of class @@ -46,6 +58,8 @@ import jdk.internal.reflect.Reflection; public class Runtime { private static final Runtime currentRuntime = new Runtime(); + private static Version version; + /** * Returns the runtime object associated with the current Java application. * Most of the methods of class {@code Runtime} are instance @@ -917,4 +931,591 @@ public class Runtime { return out; } + /** + * Returns the version of the Java Runtime Environment as a {@link + * Runtime.Version}. + * + * @return the {@link Runtime.Version} of the Java Runtime Environment + * + * @since 9 + */ + public static Version version() { + if (version == null) { + version = Version.parse( + GetPropertyAction.privilegedGetProperty("java.runtime.version")); + } + return version; + } + + /** + * A representation of a version string for an implemenation of the + * Java SE Platform. A version string contains a version number + * optionally followed by pre-release and build information. + * + *

    Version numbers

    + * + *

    A version number, {@code $VNUM}, is a non-empty sequence + * of elements separated by period characters (U+002E). An element is + * either zero, or a unsigned integer numeral without leading zeros. The + * final element in a version number must not be zero. The format is: + *

    + * + *
    +     *     ^[1-9][0-9]*(((\.0)*\.[1-9][0-9]*)*)*$
    +     * 
    + * + *

    The sequence may be of arbitrary length but the first three + * elements are assigned specific meanings, as follows:

    + * + *
    +     *     $MAJOR.$MINOR.$SECURITY
    +     * 
    + * + *
      + * + *
    • {@code $MAJOR} --- The major version + * number, incremented for a major release that contains significant new + * features as specified in a new edition of the Java SE Platform + * Specification, e.g., JSR 337 for + * Java SE 8. Features may be removed in a major release, given + * advance notice at least one major release ahead of time, and + * incompatible changes may be made when justified. The {@code $MAJOR} + * version number of JDK 8 is {@code 8}; the {@code $MAJOR} version + * number of JDK 9 is {@code 9}. When {@code $MAJOR} is incremented, + * all subsequent elements are removed.

    • + * + *
    • {@code $MINOR} --- The minor version + * number, incremented for a minor update release that may contain + * compatible bug fixes, revisions to standard APIs mandated by a + * Maintenance Release + * of the relevant Platform Specification, and implementation features + * outside the scope of that Specification such as new JDK-specific APIs, + * additional service providers, new garbage collectors, and ports to new + * hardware architectures.

    • + * + *
    • {@code $SECURITY} --- The security + * level, incremented for a security update release that contains critical + * fixes including those necessary to improve security. {@code $SECURITY} + * is not reset when {@code $MINOR} is incremented. A + * higher value of {@code $SECURITY} for a given {@code $MAJOR} value, + * therefore, always indicates a more secure release, regardless of the + * value of {@code $MINOR}.

    • + * + *
    + * + *

    The fourth and later elements of a version number are free for use + * by downstream consumers of this code base. Such a consumer may, + * e.g., use the fourth element to identify patch releases which + * contain a small number of critical non-security fixes in addition to + * the security fixes in the corresponding security release.

    + * + *

    The version number does not include trailing zero elements; + * i.e., {@code $SECURITY} is omitted if it has the value zero, + * and {@code $MINOR} is omitted if both {@code $MINOR} and {@code + * $SECURITY} have the value zero.

    + * + *

    The sequence of numerals in a version number is compared to another + * such sequence in numerical, pointwise fashion; e.g., {@code + * 9.9.1} is less than {@code 9.10.3}. If one sequence is shorter than + * another then the missing elements of the shorter sequence are + * considered to be less than the corresponding elements of the longer + * sequence; e.g., {@code 9.1.2} is less than {@code 9.1.2.1}. + *

    + * + *

    Version strings

    + * + *

    A version string, {@code $VSTR}, consists of a version + * number {@code $VNUM}, as described above, optionally followed by + * pre-release and build information, in the format

    + * + *
    +     *     $VNUM(-$PRE)?(\+($BUILD)?(-$OPT)?)?
    +     * 
    + * + *

    where:

    + * + *
      + * + *
    • {@code $PRE}, matching {@code ([a-zA-Z0-9]+)} + * --- A pre-release identifier. Typically {@code ea}, for a + * potentially unstable early-access release under active development, + * or {@code internal}, for an internal developer build. + * + *

    • {@code $BUILD}, matching {@code + * (0|[1-9][0-9]*)} --- The build number, incremented for each promoted + * build. {@code $BUILD} is reset to {@code 1} when any portion of {@code + * $VNUM} is incremented.

      + * + *
    • {@code $OPT}, matching {@code + * ([-a-zA-Z0-9\.]+)} --- Additional build information, if desired. In + * the case of an {@code internal} build this will often contain the date + * and time of the build.

      + * + *
    + * + *

    A version number {@code 10-ea} matches {@code $VNUM = "10"} and + * {@code $PRE = "ea"}. The version number {@code 10+-ea} matches + * {@code $VNUM = "10"} and {@code $OPT = "ea"}.

    + * + *

    When comparing two version strings, the value of {@code $OPT}, if + * present, may or may not be significant depending on the chosen + * comparison method. The comparison methods {@link #compareTo(Version) + * compareTo()} and {@link #compareToIgnoreOpt(Version) + * compareToIgnoreOpt()} should be used consistently with the + * corresponding methods {@link #equals(Object) equals()} and {@link + * #equalsIgnoreOpt(Object) equalsIgnoreOpt()}.

    + * + *

    A short version string, {@code $SVSTR}, often useful in + * less formal contexts, is a version number optionally followed by a + * pre-release identifier: + * + *

    +     *     $VNUM(-$PRE)?
    +     * 
    + * + * @since 9 + */ + public static class Version + implements Comparable + { + private final List version; + private final Optional pre; + private final Optional build; + private final Optional optional; + + + // $VNUM(-$PRE)?(\+($BUILD)?(\-$OPT)?)? + // RE limits the format of version strings + // ([1-9][0-9]*(?:(?:\.0)*\.[1-9][0-9]*)*)(?:-([a-zA-Z0-9]+))?(?:(\+)(0|[1-9][0-9]*)?)?(?:-([-a-zA-Z0-9.]+))? + + private static final String VNUM + = "(?[1-9][0-9]*(?:(?:\\.0)*\\.[1-9][0-9]*)*)"; + private static final String VNUM_GROUP = "VNUM"; + + private static final String PRE = "(?:-(?
    [a-zA-Z0-9]+))?";
    +        private static final String PRE_GROUP   = "PRE";
    +
    +        private static final String BUILD
    +            = "(?:(?\\+)(?0|[1-9][0-9]*)?)?";
    +        private static final String PLUS_GROUP  = "PLUS";
    +        private static final String BUILD_GROUP = "BUILD";
    +
    +        private static final String OPT      = "(?:-(?[-a-zA-Z0-9.]+))?";
    +        private static final String OPT_GROUP   = "OPT";
    +
    +        private static final String VSTR_FORMAT
    +            = "^" + VNUM + PRE + BUILD + OPT + "$";
    +        private static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
    +
    +        /**
    +         * Constructs a valid version string containing
    +         * a version number followed by pre-release and
    +         * build information.
    +         *
    +         * @param  s
    +         *         A string to be interpreted as a version
    +         *
    +         * @throws  IllegalArgumentException
    +         *          If the given string cannot be interpreted as a valid
    +         *          version
    +         *
    +         * @throws  NullPointerException
    +         *          If {@code s} is {@code null}
    +         *
    +         * @throws  NumberFormatException
    +         *          If an element of the version number or the build number
    +         *          cannot be represented as an {@link Integer}
    +         */
    +        private Version(String s) {
    +            if (s == null)
    +                throw new NullPointerException();
    +
    +            Matcher m = VSTR_PATTERN.matcher(s);
    +            if (!m.matches())
    +                throw new IllegalArgumentException("Invalid version string: '"
    +                                                   + s + "'");
    +
    +            // $VNUM is a dot-separated list of integers of arbitrary length
    +            List list = new ArrayList<>();
    +            for (String i : m.group(VNUM_GROUP).split("\\."))
    +                list.add(Integer.parseInt(i));
    +            version = Collections.unmodifiableList(list);
    +
    +            pre = Optional.ofNullable(m.group(PRE_GROUP));
    +
    +            String b = m.group(BUILD_GROUP);
    +            // $BUILD is an integer
    +            build = (b == null)
    +                ? Optional.empty()
    +                : Optional.ofNullable(Integer.parseInt(b));
    +
    +            optional = Optional.ofNullable(m.group(OPT_GROUP));
    +
    +            // empty '+'
    +            if ((m.group(PLUS_GROUP) != null) && !build.isPresent()) {
    +                if (optional.isPresent()) {
    +                    if (pre.isPresent())
    +                        throw new IllegalArgumentException("'+' found with"
    +                            + " pre-release and optional components:'" + s
    +                            + "'");
    +                } else {
    +                    throw new IllegalArgumentException("'+' found with neither"
    +                        + " build or optional components: '" + s + "'");
    +                }
    +            }
    +        }
    +
    +        /**
    +         * Parses the given string as a valid
    +         * version string containing a
    +         * version number followed by pre-release and
    +         * build information.
    +         *
    +         * @param  s
    +         *         A string to interpret as a version
    +         *
    +         * @throws  IllegalArgumentException
    +         *          If the given string cannot be interpreted as a valid
    +         *          version
    +         *
    +         * @throws  NullPointerException
    +         *          If the given string is {@code null}
    +         *
    +         * @throws  NumberFormatException
    +         *          If an element of the version number or the build number
    +         *          cannot be represented as an {@link Integer}
    +         *
    +         * @return  The Version of the given string
    +         */
    +        public static Version parse(String s) {
    +            return new Version(s);
    +        }
    +
    +        /**
    +         * Returns the major version number.
    +         *
    +         * @return  The major version number
    +         */
    +        public int major() {
    +            return version.get(0);
    +        }
    +
    +        /**
    +         * Returns the minor version number or zero if it
    +         * was not set.
    +         *
    +         * @return  The minor version number or zero if it was not set
    +         */
    +        public int minor() {
    +            return (version.size() > 1 ? version.get(1) : 0);
    +        }
    +
    +        /**
    +         * Returns the security version number or zero
    +         * if it was not set.
    +         *
    +         * @return  The security version number or zero if it was not set
    +         */
    +        public int security() {
    +            return (version.size() > 2 ? version.get(2) : 0);
    +        }
    +
    +        /**
    +         * Returns an unmodifiable {@link java.util.List List} of the
    +         * integer numerals contained in the version
    +         * number.  The {@code List} always contains at least one
    +         * element corresponding to the major version
    +         * number.
    +         *
    +         * @return  An unmodifiable list of the integer numerals
    +         *          contained in the version number
    +         */
    +        public List version() {
    +            return version;
    +        }
    +
    +        /**
    +         * Returns the optional pre-release information.
    +         *
    +         * @return  The optional pre-release information as a String
    +         */
    +        public Optional pre() {
    +            return pre;
    +        }
    +
    +        /**
    +         * Returns the build number.
    +         *
    +         * @return  The optional build number.
    +         */
    +        public Optional build() {
    +            return build;
    +        }
    +
    +        /**
    +         * Returns optional additional identifying build
    +         * information.
    +         *
    +         * @return  Additional build information as a String
    +         */
    +        public Optional optional() {
    +            return optional;
    +        }
    +
    +        /**
    +         * Compares this version to another.
    +         *
    +         * 

    Each of the components in the version is + * compared in the follow order of precedence: version numbers, + * pre-release identifiers, build numbers, optional build information. + *

    + * + *

    Comparison begins by examining the sequence of version numbers. + * If one sequence is shorter than another, then the missing elements + * of the shorter sequence are considered to be less than the + * corresponding elements of the longer sequence.

    + * + *

    A version with a pre-release identifier is always considered to + * be less than a version without one. Pre-release identifiers are + * compared numerically when they consist only of digits, and + * lexicographically otherwise. Numeric identifiers are considered to + * be less than non-numeric identifiers.

    + * + *

    A version without a build number is always less than one with a + * build number; otherwise build numbers are compared numerically.

    + * + *

    The optional build information is compared lexicographically. + * During this comparison, a version with optional build information is + * considered to be greater than a version without one.

    + * + *

    A version is not comparable to any other type of object. + * + * @param ob + * The object to be compared + * + * @return A negative integer, zero, or a positive integer if this + * {@code Version} is less than, equal to, or greater than the + * given {@code Version} + * + * @throws NullPointerException + * If the given object is {@code null} + */ + @Override + public int compareTo(Version ob) { + return compare(ob, false); + } + + /** + * Compares this version to another disregarding optional build + * information. + * + *

    Two versions are compared by examining the version string as + * described in {@link #compareTo(Version)} with the exception that the + * optional build information is always ignored.

    + * + *

    A version is not comparable to any other type of object. + * + * @param ob + * The object to be compared + * + * @return A negative integer, zero, or a positive integer if this + * {@code Version} is less than, equal to, or greater than the + * given {@code Version} + * + * @throws NullPointerException + * If the given object is {@code null} + */ + public int compareToIgnoreOpt(Version ob) { + return compare(ob, true); + } + + private int compare(Version ob, boolean ignoreOpt) { + if (ob == null) + throw new NullPointerException("Invalid argument"); + + int ret = compareVersion(ob); + if (ret != 0) + return ret; + + ret = comparePre(ob); + if (ret != 0) + return ret; + + ret = compareBuild(ob); + if (ret != 0) + return ret; + + if (!ignoreOpt) + return compareOpt(ob); + + return 0; + } + + private int compareVersion(Version ob) { + int size = version.size(); + int oSize = ob.version().size(); + int min = Math.min(size, oSize); + for (int i = 0; i < min; i++) { + Integer val = version.get(i); + Integer oVal = ob.version().get(i); + if (val != oVal) + return val - oVal; + } + if (size != oSize) + return size - oSize; + return 0; + } + + private int comparePre(Version ob) { + Optional oPre = ob.pre(); + if (!pre.isPresent()) { + if (oPre.isPresent()) + return 1; + } else { + if (!oPre.isPresent()) + return -1; + String val = pre.get(); + String oVal = oPre.get(); + if (val.matches("\\d+")) { + return (oVal.matches("\\d+") + ? (new BigInteger(val)).compareTo(new BigInteger(oVal)) + : -1); + } else { + return (oVal.matches("\\d+") + ? 1 + : val.compareTo(oVal)); + } + } + return 0; + } + + private int compareBuild(Version ob) { + Optional oBuild = ob.build(); + if (oBuild.isPresent()) { + return (build.isPresent() + ? build.get().compareTo(oBuild.get()) + : 1); + } else if (build.isPresent()) { + return -1; + } + return 0; + } + + private int compareOpt(Version ob) { + Optional oOpt = ob.optional(); + if (!optional.isPresent()) { + if (oOpt.isPresent()) + return -1; + } else { + if (!oOpt.isPresent()) + return 1; + return optional.get().compareTo(oOpt.get()); + } + return 0; + } + + /** + * Returns a string representation of this version. + * + * @return The version string + */ + @Override + public String toString() { + StringBuilder sb + = new StringBuilder(version.stream() + .map(Object::toString) + .collect(Collectors.joining("."))); + + pre.ifPresent(v -> sb.append("-").append(v)); + + if (build.isPresent()) { + sb.append("+").append(build.get()); + if (optional.isPresent()) + sb.append("-").append(optional.get()); + } else { + if (optional.isPresent()) { + sb.append(pre.isPresent() ? "-" : "+-"); + sb.append(optional.get()); + } + } + + return sb.toString(); + } + + /** + * Determines whether this {@code Version} is equal to another object. + * + *

    Two {@code Version}s are equal if and only if they represent the + * same version string. + * + *

    This method satisfies the general contract of the {@link + * Object#equals(Object) Object.equals} method.

    + * + * @param ob + * The object to which this {@code Version} is to be compared + * + * @return {@code true} if, and only if, the given object is a {@code + * Version} that is identical to this {@code Version} + * + */ + @Override + public boolean equals(Object ob) { + boolean ret = equalsIgnoreOpt(ob); + if (!ret) + return false; + + Version that = (Version)ob; + return (this.optional().equals(that.optional())); + } + + /** + * Determines whether this {@code Version} is equal to another + * disregarding optional build information. + * + *

    Two {@code Version}s are equal if and only if they represent the + * same version string disregarding the optional build information. + * + * @param ob + * The object to which this {@code Version} is to be compared + * + * @return {@code true} if, and only if, the given object is a {@code + * Version} that is identical to this {@code Version} + * ignoring the optinal build information + * + */ + public boolean equalsIgnoreOpt(Object ob) { + if (this == ob) + return true; + if (!(ob instanceof Version)) + return false; + + Version that = (Version)ob; + return (this.version().equals(that.version()) + && this.pre().equals(that.pre()) + && this.build().equals(that.build())); + } + + /** + * Returns the hash code of this version. + * + *

    This method satisfies the general contract of the {@link + * Object#hashCode Object.hashCode} method. + * + * @return The hashcode of this version + */ + @Override + public int hashCode() { + int h = 1; + int p = 17; + + h = p * h + version.hashCode(); + h = p * h + pre.hashCode(); + h = p * h + build.hashCode(); + h = p * h + optional.hashCode(); + + return h; + } + } + } diff --git a/jdk/src/java.base/share/classes/java/lang/StrictMath.java b/jdk/src/java.base/share/classes/java/lang/StrictMath.java index a92f566c153..998fc1eb426 100644 --- a/jdk/src/java.base/share/classes/java/lang/StrictMath.java +++ b/jdk/src/java.base/share/classes/java/lang/StrictMath.java @@ -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 @@ -70,7 +70,7 @@ import jdk.internal.HotSpotIntrinsicCandidate; * {@code subtractExact}, {@code multiplyExact}, and {@code toIntExact} * throw an {@code ArithmeticException} when the results overflow. * For other arithmetic operations such as divide, absolute value, - * increment, decrement, and negation overflow occurs only with + * increment by one, decrement by one, and negation overflow occurs only with * a specific minimum or maximum value and should be checked against * the minimum or maximum as appropriate. * @@ -802,6 +802,21 @@ public final class StrictMath { return Math.multiplyExact(x, y); } + /** + * Returns the product of the arguments, throwing an exception if the result + * overflows a {@code long}. + * + * @param x the first value + * @param y the second value + * @return the result + * @throws ArithmeticException if the result overflows a long + * @see Math#multiplyExact(long,int) + * @since 9 + */ + public static long multiplyExact(long x, int y) { + return Math.multiplyExact(x, y); + } + /** * Returns the product of the arguments, * throwing an exception if the result overflows a {@code long}. @@ -831,6 +846,33 @@ public final class StrictMath { return Math.toIntExact(value); } + /** + * Returns the exact mathematical product of the arguments. + * + * @param x the first value + * @param y the second value + * @return the result + * @see Math#multiplyFull(int,int) + * @since 9 + */ + public static long multiplyFull(int x, int y) { + return Math.multiplyFull(x, y); + } + + /** + * Returns as a {@code long} the most significant 64 bits of the 128-bit + * product of two 64-bit factors. + * + * @param x the first value + * @param y the second value + * @return the result + * @see Math#multiplyHigh(long,long) + * @since 9 + */ + public static long multiplyHigh(long x, long y) { + return Math.multiplyHigh(x, y); + } + /** * Returns the largest (closest to positive infinity) * {@code int} value that is less than or equal to the algebraic quotient. @@ -855,6 +897,30 @@ public final class StrictMath { return Math.floorDiv(x, y); } + /** + * Returns the largest (closest to positive infinity) + * {@code long} value that is less than or equal to the algebraic quotient. + * There is one special case, if the dividend is the + * {@linkplain Long#MIN_VALUE Long.MIN_VALUE} and the divisor is {@code -1}, + * then integer overflow occurs and + * the result is equal to {@code Long.MIN_VALUE}. + *

    + * See {@link Math#floorDiv(int, int) Math.floorDiv} for examples and + * a comparison to the integer division {@code /} operator. + * + * @param x the dividend + * @param y the divisor + * @return the largest (closest to positive infinity) + * {@code int} value that is less than or equal to the algebraic quotient. + * @throws ArithmeticException if the divisor {@code y} is zero + * @see Math#floorDiv(long, int) + * @see Math#floor(double) + * @since 9 + */ + public static long floorDiv(long x, int y) { + return Math.floorDiv(x, y); + } + /** * Returns the largest (closest to positive infinity) * {@code long} value that is less than or equal to the algebraic quotient. @@ -905,6 +971,35 @@ public final class StrictMath { public static int floorMod(int x, int y) { return Math.floorMod(x , y); } + + /** + * Returns the floor modulus of the {@code long} and {@int} arguments. + *

    + * The floor modulus is {@code x - (floorDiv(x, y) * y)}, + * has the same sign as the divisor {@code y}, and + * is in the range of {@code -abs(y) < r < +abs(y)}. + * + *

    + * The relationship between {@code floorDiv} and {@code floorMod} is such that: + *

      + *
    • {@code floorDiv(x, y) * y + floorMod(x, y) == x} + *
    + *

    + * See {@link Math#floorMod(int, int) Math.floorMod} for examples and + * a comparison to the {@code %} operator. + * + * @param x the dividend + * @param y the divisor + * @return the floor modulus {@code x - (floorDiv(x, y) * y)} + * @throws ArithmeticException if the divisor {@code y} is zero + * @see Math#floorMod(long, int) + * @see StrictMath#floorDiv(long, int) + * @since 9 + */ + public static int floorMod(long x, int y) { + return Math.floorMod(x , y); + } + /** * Returns the floor modulus of the {@code long} arguments. *

    diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java index ab7bb02c1f7..7ac564d959a 100644 --- a/jdk/src/java.base/share/classes/java/lang/System.java +++ b/jdk/src/java.base/share/classes/java/lang/System.java @@ -576,7 +576,8 @@ public final class System { * Key * Description of Associated Value * java.version - * Java Runtime Environment version + * Java Runtime Environment version which may be interpreted + * as a {@link Runtime.Version} * java.vendor * Java Runtime Environment vendor * java.vendor.url @@ -584,19 +585,22 @@ public final class System { * java.home * Java installation directory * java.vm.specification.version - * Java Virtual Machine specification version + * Java Virtual Machine specification version which may be + * interpreted as a {@link Runtime.Version} * java.vm.specification.vendor * Java Virtual Machine specification vendor * java.vm.specification.name * Java Virtual Machine specification name * java.vm.version - * Java Virtual Machine implementation version + * Java Virtual Machine implementation version which may be + * interpreted as a {@link Runtime.Version} * java.vm.vendor * Java Virtual Machine implementation vendor * java.vm.name * Java Virtual Machine implementation name * java.specification.version - * Java Runtime Environment specification version + * Java Runtime Environment specification version which may be + * interpreted as a {@link Runtime.Version} * java.specification.vendor * Java Runtime Environment specification vendor * java.specification.name diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java index 54fc27f31b5..310ada1b470 100644 --- a/jdk/src/java.base/share/classes/java/lang/Thread.java +++ b/jdk/src/java.base/share/classes/java/lang/Thread.java @@ -340,6 +340,45 @@ class Thread implements Runnable { sleep(millis); } + /** + * Indicates that the caller is momentarily unable to progress, until the + * occurrence of one or more actions on the part of other activities. By + * invoking this method within each iteration of a spin-wait loop construct, + * the calling thread indicates to the runtime that it is busy-waiting. + * The runtime may take action to improve the performance of invoking + * spin-wait loop constructions. + *

    + * @apiNote + * As an example consider a method in a class that spins in a loop until + * some flag is set outside of that method. A call to the {@code onSpinWait} + * method should be placed inside the spin loop. + *

    {@code
    +     *     class EventHandler {
    +     *         volatile boolean eventNotificationNotReceived;
    +     *         void waitForEventAndHandleIt() {
    +     *             while ( eventNotificationNotReceived ) {
    +     *                 java.lang.Thread.onSpinWait();
    +     *             }
    +     *             readAndProcessEvent();
    +     *         }
    +     *
    +     *         void readAndProcessEvent() {
    +     *             // Read event from some source and process it
    +     *              . . .
    +     *         }
    +     *     }
    +     * }
    + *

    + * The code above would remain correct even if the {@code onSpinWait} + * method was not called at all. However on some architectures the Java + * Virtual Machine may issue the processor instructions to address such + * code patterns in a more beneficial way. + *

    + * @since 9 + */ + @HotSpotIntrinsicCandidate + public static void onSpinWait() {} + /** * Initializes a Thread with the current AccessControlContext. * @see #init(ThreadGroup,Runnable,String,long,AccessControlContext,boolean) diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java index 08e38987bf2..da1700ffdb1 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java @@ -706,6 +706,9 @@ class InvokerBytecodeGenerator { case ARRAY_STORE: emitArrayStore(name); continue; + case ARRAY_LENGTH: + emitArrayLength(name); + continue; case IDENTITY: assert(name.arguments.length == 1); emitPushArguments(name); @@ -740,15 +743,16 @@ class InvokerBytecodeGenerator { return classFile; } - void emitArrayLoad(Name name) { emitArrayOp(name, Opcodes.AALOAD); } - void emitArrayStore(Name name) { emitArrayOp(name, Opcodes.AASTORE); } + void emitArrayLoad(Name name) { emitArrayOp(name, Opcodes.AALOAD); } + void emitArrayStore(Name name) { emitArrayOp(name, Opcodes.AASTORE); } + void emitArrayLength(Name name) { emitArrayOp(name, Opcodes.ARRAYLENGTH); } void emitArrayOp(Name name, int arrayOpcode) { - assert arrayOpcode == Opcodes.AALOAD || arrayOpcode == Opcodes.AASTORE; + assert arrayOpcode == Opcodes.AALOAD || arrayOpcode == Opcodes.AASTORE || arrayOpcode == Opcodes.ARRAYLENGTH; Class elementType = name.function.methodType().parameterType(0).getComponentType(); assert elementType != null; emitPushArguments(name); - if (elementType.isPrimitive()) { + if (arrayOpcode != Opcodes.ARRAYLENGTH && elementType.isPrimitive()) { Wrapper w = Wrapper.forPrimitiveType(elementType); arrayOpcode = arrayInsnOpcode(arrayTypeCode(w), arrayOpcode); } diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java index 29cc430f877..1aca86298fe 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/Invokers.java @@ -95,12 +95,12 @@ class Invokers { /*non-public*/ MethodHandle varHandleMethodInvoker(VarHandle.AccessMode ak) { // TODO cache invoker - return makeVarHandleMethodInvoker(ak); + return makeVarHandleMethodInvoker(ak, false); } /*non-public*/ MethodHandle varHandleMethodExactInvoker(VarHandle.AccessMode ak) { // TODO cache invoker - return makeVarHandleMethodExactInvoker(ak); + return makeVarHandleMethodInvoker(ak, true); } private MethodHandle cachedInvoker(int idx) { @@ -127,26 +127,11 @@ class Invokers { return invoker; } - private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak) { + private MethodHandle makeVarHandleMethodInvoker(VarHandle.AccessMode ak, boolean isExact) { MethodType mtype = targetType; MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class); - LambdaForm lform = varHandleMethodGenericInvokerHandleForm(ak.methodName(), mtype); - VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal()); - MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad); - - invoker = invoker.withInternalMemberName(MemberName.makeVarHandleMethodInvoke(ak.methodName(), mtype), false); - assert(checkVarHandleInvoker(invoker)); - - maybeCompileToBytecode(invoker); - return invoker; - } - - private MethodHandle makeVarHandleMethodExactInvoker(VarHandle.AccessMode ak) { - MethodType mtype = targetType; - MethodType invokerType = mtype.insertParameterTypes(0, VarHandle.class); - - LambdaForm lform = varHandleMethodExactInvokerHandleForm(ak.methodName(), mtype); + LambdaForm lform = varHandleMethodInvokerHandleForm(ak.methodName(), mtype, isExact); VarHandle.AccessDescriptor ad = new VarHandle.AccessDescriptor(mtype, ak.at.ordinal(), ak.ordinal()); MethodHandle invoker = BoundMethodHandle.bindSingle(invokerType, lform, ad); @@ -400,59 +385,7 @@ class Invokers { return lform; } - private static LambdaForm varHandleMethodExactInvokerHandleForm(String name, MethodType mtype) { - // TODO Cache form? - - final int THIS_MH = 0; - final int CALL_VH = THIS_MH + 1; - final int ARG_BASE = CALL_VH + 1; - final int ARG_LIMIT = ARG_BASE + mtype.parameterCount(); - int nameCursor = ARG_LIMIT; - final int VAD_ARG = nameCursor++; - final int CHECK_TYPE = nameCursor++; - final int GET_MEMBER = nameCursor++; - final int LINKER_CALL = nameCursor++; - - MethodType invokerFormType = mtype.insertParameterTypes(0, VarHandle.class) - .basicType() - .appendParameterTypes(MemberName.class); - - MemberName linker = new MemberName(MethodHandle.class, "linkToStatic", invokerFormType, REF_invokeStatic); - try { - linker = MemberName.getFactory().resolveOrFail(REF_invokeStatic, linker, null, NoSuchMethodException.class); - } catch (ReflectiveOperationException ex) { - throw newInternalError(ex); - } - - Name[] names = new Name[LINKER_CALL + 1]; - names[THIS_MH] = argument(THIS_MH, BasicType.basicType(Object.class)); - names[CALL_VH] = argument(CALL_VH, BasicType.basicType(Object.class)); - for (int i = 0; i < mtype.parameterCount(); i++) { - names[ARG_BASE + i] = argument(ARG_BASE + i, BasicType.basicType(mtype.parameterType(i))); - } - - BoundMethodHandle.SpeciesData speciesData = BoundMethodHandle.speciesData_L(); - names[THIS_MH] = names[THIS_MH].withConstraint(speciesData); - - NamedFunction getter = speciesData.getterFunction(0); - names[VAD_ARG] = new Name(getter, names[THIS_MH]); - - Object[] outArgs = Arrays.copyOfRange(names, CALL_VH, ARG_LIMIT + 1, Object[].class); - - names[CHECK_TYPE] = new Name(NF_checkVarHandleExactType, names[CALL_VH], names[VAD_ARG]); - - names[GET_MEMBER] = new Name(NF_getVarHandleMemberName, names[CALL_VH], names[VAD_ARG]); - outArgs[outArgs.length - 1] = names[GET_MEMBER]; - - names[LINKER_CALL] = new Name(linker, outArgs); - LambdaForm lform = new LambdaForm(name + ":VarHandle_exactInvoker" + shortenSignature(basicTypeSignature(mtype)), - ARG_LIMIT, names); - - lform.compileToBytecode(); - return lform; - } - - private static LambdaForm varHandleMethodGenericInvokerHandleForm(String name, MethodType mtype) { + private static LambdaForm varHandleMethodInvokerHandleForm(String name, MethodType mtype, boolean isExact) { // TODO Cache form? final int THIS_MH = 0; @@ -477,8 +410,11 @@ class Invokers { NamedFunction getter = speciesData.getterFunction(0); names[VAD_ARG] = new Name(getter, names[THIS_MH]); - names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[CALL_VH], names[VAD_ARG]); - + if (isExact) { + names[CHECK_TYPE] = new Name(NF_checkVarHandleExactType, names[CALL_VH], names[VAD_ARG]); + } else { + names[CHECK_TYPE] = new Name(NF_checkVarHandleGenericType, names[CALL_VH], names[VAD_ARG]); + } Object[] outArgs = new Object[ARG_LIMIT]; outArgs[0] = names[CHECK_TYPE]; for (int i = 1; i < ARG_LIMIT; i++) { @@ -488,7 +424,8 @@ class Invokers { MethodType outCallType = mtype.insertParameterTypes(0, VarHandle.class) .basicType(); names[LINKER_CALL] = new Name(outCallType, outArgs); - LambdaForm lform = new LambdaForm(name + ":VarHandle_invoker" + shortenSignature(basicTypeSignature(mtype)), + String debugName = isExact ? ":VarHandle_exactInvoker" : ":VarHandle_invoker"; + LambdaForm lform = new LambdaForm(name + debugName + shortenSignature(basicTypeSignature(mtype)), ARG_LIMIT, names); lform.prepare(); @@ -511,21 +448,13 @@ class Invokers { /*non-public*/ static @ForceInline - void checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) { - MethodType erasedTarget = handle.vform.methodType_table[ad.type]; - MethodType erasedSymbolic = ad.symbolicMethodTypeErased; - if (erasedTarget != erasedSymbolic) - throw newWrongMethodTypeException(erasedTarget, erasedSymbolic); - } - - /*non-public*/ static - @ForceInline - MemberName getVarHandleMemberName(VarHandle handle, VarHandle.AccessDescriptor ad) { - MemberName mn = handle.vform.memberName_table[ad.mode]; - if (mn == null) { - throw handle.unsupported(); + MethodHandle checkVarHandleExactType(VarHandle handle, VarHandle.AccessDescriptor ad) { + MethodHandle mh = handle.getMethodHandle(ad.mode); + MethodType mt = mh.type(); + if (mt != ad.symbolicMethodTypeInvoker) { + throw newWrongMethodTypeException(mt, ad.symbolicMethodTypeInvoker); } - return mn; + return mh; } /*non-public*/ static @@ -649,8 +578,7 @@ class Invokers { NF_getCallSiteTarget, NF_checkCustomized, NF_checkVarHandleGenericType, - NF_checkVarHandleExactType, - NF_getVarHandleMemberName; + NF_checkVarHandleExactType; static { try { NamedFunction nfs[] = { @@ -666,8 +594,6 @@ class Invokers { .getDeclaredMethod("checkVarHandleGenericType", VarHandle.class, VarHandle.AccessDescriptor.class)), NF_checkVarHandleExactType = new NamedFunction(Invokers.class .getDeclaredMethod("checkVarHandleExactType", VarHandle.class, VarHandle.AccessDescriptor.class)), - NF_getVarHandleMemberName = new NamedFunction(Invokers.class - .getDeclaredMethod("getVarHandleMemberName", VarHandle.class, VarHandle.AccessDescriptor.class)) }; // Each nf must be statically invocable or we get tied up in our bootstraps. assert(InvokerBytecodeGenerator.isStaticallyInvocable(nfs)); diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java index 782eff613ae..ac0b5847fff 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -41,9 +41,15 @@ import sun.invoke.empty.Empty; import sun.invoke.util.ValueConversions; import sun.invoke.util.VerifyType; import sun.invoke.util.Wrapper; + +import jdk.internal.org.objectweb.asm.AnnotationVisitor; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; + import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; +import static jdk.internal.org.objectweb.asm.Opcodes.*; /** * Trusted implementation code for MethodHandle. @@ -66,25 +72,28 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; /// Factory methods to create method handles: - static MethodHandle makeArrayElementAccessor(Class arrayClass, boolean isSetter) { - if (arrayClass == Object[].class) - return (isSetter ? ArrayAccessor.OBJECT_ARRAY_SETTER : ArrayAccessor.OBJECT_ARRAY_GETTER); + static MethodHandle makeArrayElementAccessor(Class arrayClass, ArrayAccess access) { + if (arrayClass == Object[].class) { + return ArrayAccess.objectAccessor(access); + } if (!arrayClass.isArray()) throw newIllegalArgumentException("not an array: "+arrayClass); MethodHandle[] cache = ArrayAccessor.TYPED_ACCESSORS.get(arrayClass); - int cacheIndex = (isSetter ? ArrayAccessor.SETTER_INDEX : ArrayAccessor.GETTER_INDEX); + int cacheIndex = ArrayAccess.cacheIndex(access); MethodHandle mh = cache[cacheIndex]; if (mh != null) return mh; - mh = ArrayAccessor.getAccessor(arrayClass, isSetter); - MethodType correctType = ArrayAccessor.correctType(arrayClass, isSetter); + mh = ArrayAccessor.getAccessor(arrayClass, access); + MethodType correctType = ArrayAccessor.correctType(arrayClass, access); if (mh.type() != correctType) { assert(mh.type().parameterType(0) == Object[].class); - assert((isSetter ? mh.type().parameterType(2) : mh.type().returnType()) == Object.class); - assert(isSetter || correctType.parameterType(0).getComponentType() == correctType.returnType()); + /* if access == SET */ assert(access != ArrayAccess.SET || mh.type().parameterType(2) == Object.class); + /* if access == GET */ assert(access != ArrayAccess.GET || + (mh.type().returnType() == Object.class && + correctType.parameterType(0).getComponentType() == correctType.returnType())); // safe to view non-strictly, because element type follows from array type mh = mh.viewAsType(correctType, false); } - mh = makeIntrinsic(mh, (isSetter ? Intrinsic.ARRAY_STORE : Intrinsic.ARRAY_LOAD)); + mh = makeIntrinsic(mh, ArrayAccess.intrinsic(access)); // Atomically update accessor cache. synchronized(cache) { if (cache[cacheIndex] == null) { @@ -97,9 +106,56 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; return mh; } + enum ArrayAccess { + GET, SET, LENGTH; + + // As ArrayAccess and ArrayAccessor have a circular dependency, the ArrayAccess properties cannot be stored in + // final fields. + + static String opName(ArrayAccess a) { + switch (a) { + case GET: return "getElement"; + case SET: return "setElement"; + case LENGTH: return "length"; + } + throw unmatchedArrayAccess(a); + } + + static MethodHandle objectAccessor(ArrayAccess a) { + switch (a) { + case GET: return ArrayAccessor.OBJECT_ARRAY_GETTER; + case SET: return ArrayAccessor.OBJECT_ARRAY_SETTER; + case LENGTH: return ArrayAccessor.OBJECT_ARRAY_LENGTH; + } + throw unmatchedArrayAccess(a); + } + + static int cacheIndex(ArrayAccess a) { + switch (a) { + case GET: return ArrayAccessor.GETTER_INDEX; + case SET: return ArrayAccessor.SETTER_INDEX; + case LENGTH: return ArrayAccessor.LENGTH_INDEX; + } + throw unmatchedArrayAccess(a); + } + + static Intrinsic intrinsic(ArrayAccess a) { + switch (a) { + case GET: return Intrinsic.ARRAY_LOAD; + case SET: return Intrinsic.ARRAY_STORE; + case LENGTH: return Intrinsic.ARRAY_LENGTH; + } + throw unmatchedArrayAccess(a); + } + } + + static InternalError unmatchedArrayAccess(ArrayAccess a) { + return newInternalError("should not reach here (unmatched ArrayAccess: " + a + ")"); + } + static final class ArrayAccessor { - /// Support for array element access - static final int GETTER_INDEX = 0, SETTER_INDEX = 1, INDEX_LIMIT = 2; + /// Support for array element and length access + static final int GETTER_INDEX = 0, SETTER_INDEX = 1, LENGTH_INDEX = 2, INDEX_LIMIT = 3; static final ClassValue TYPED_ACCESSORS = new ClassValue() { @Override @@ -107,14 +163,16 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; return new MethodHandle[INDEX_LIMIT]; } }; - static final MethodHandle OBJECT_ARRAY_GETTER, OBJECT_ARRAY_SETTER; + static final MethodHandle OBJECT_ARRAY_GETTER, OBJECT_ARRAY_SETTER, OBJECT_ARRAY_LENGTH; static { MethodHandle[] cache = TYPED_ACCESSORS.get(Object[].class); - cache[GETTER_INDEX] = OBJECT_ARRAY_GETTER = makeIntrinsic(getAccessor(Object[].class, false), Intrinsic.ARRAY_LOAD); - cache[SETTER_INDEX] = OBJECT_ARRAY_SETTER = makeIntrinsic(getAccessor(Object[].class, true), Intrinsic.ARRAY_STORE); + cache[GETTER_INDEX] = OBJECT_ARRAY_GETTER = makeIntrinsic(getAccessor(Object[].class, ArrayAccess.GET), Intrinsic.ARRAY_LOAD); + cache[SETTER_INDEX] = OBJECT_ARRAY_SETTER = makeIntrinsic(getAccessor(Object[].class, ArrayAccess.SET), Intrinsic.ARRAY_STORE); + cache[LENGTH_INDEX] = OBJECT_ARRAY_LENGTH = makeIntrinsic(getAccessor(Object[].class, ArrayAccess.LENGTH), Intrinsic.ARRAY_LENGTH); assert(InvokerBytecodeGenerator.isStaticallyInvocable(ArrayAccessor.OBJECT_ARRAY_GETTER.internalMemberName())); assert(InvokerBytecodeGenerator.isStaticallyInvocable(ArrayAccessor.OBJECT_ARRAY_SETTER.internalMemberName())); + assert(InvokerBytecodeGenerator.isStaticallyInvocable(ArrayAccessor.OBJECT_ARRAY_LENGTH.internalMemberName())); } static int getElementI(int[] a, int i) { return a[i]; } @@ -137,31 +195,47 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; static void setElementC(char[] a, int i, char x) { a[i] = x; } static void setElementL(Object[] a, int i, Object x) { a[i] = x; } - static String name(Class arrayClass, boolean isSetter) { + static int lengthI(int[] a) { return a.length; } + static int lengthJ(long[] a) { return a.length; } + static int lengthF(float[] a) { return a.length; } + static int lengthD(double[] a) { return a.length; } + static int lengthZ(boolean[] a) { return a.length; } + static int lengthB(byte[] a) { return a.length; } + static int lengthS(short[] a) { return a.length; } + static int lengthC(char[] a) { return a.length; } + static int lengthL(Object[] a) { return a.length; } + + static String name(Class arrayClass, ArrayAccess access) { Class elemClass = arrayClass.getComponentType(); if (elemClass == null) throw newIllegalArgumentException("not an array", arrayClass); - return (!isSetter ? "getElement" : "setElement") + Wrapper.basicTypeChar(elemClass); + return ArrayAccess.opName(access) + Wrapper.basicTypeChar(elemClass); } - static MethodType type(Class arrayClass, boolean isSetter) { + static MethodType type(Class arrayClass, ArrayAccess access) { Class elemClass = arrayClass.getComponentType(); Class arrayArgClass = arrayClass; if (!elemClass.isPrimitive()) { arrayArgClass = Object[].class; elemClass = Object.class; } - return !isSetter ? - MethodType.methodType(elemClass, arrayArgClass, int.class) : - MethodType.methodType(void.class, arrayArgClass, int.class, elemClass); + switch (access) { + case GET: return MethodType.methodType(elemClass, arrayArgClass, int.class); + case SET: return MethodType.methodType(void.class, arrayArgClass, int.class, elemClass); + case LENGTH: return MethodType.methodType(int.class, arrayArgClass); + } + throw unmatchedArrayAccess(access); } - static MethodType correctType(Class arrayClass, boolean isSetter) { + static MethodType correctType(Class arrayClass, ArrayAccess access) { Class elemClass = arrayClass.getComponentType(); - return !isSetter ? - MethodType.methodType(elemClass, arrayClass, int.class) : - MethodType.methodType(void.class, arrayClass, int.class, elemClass); + switch (access) { + case GET: return MethodType.methodType(elemClass, arrayClass, int.class); + case SET: return MethodType.methodType(void.class, arrayClass, int.class, elemClass); + case LENGTH: return MethodType.methodType(int.class, arrayClass); + } + throw unmatchedArrayAccess(access); } - static MethodHandle getAccessor(Class arrayClass, boolean isSetter) { - String name = name(arrayClass, isSetter); - MethodType type = type(arrayClass, isSetter); + static MethodHandle getAccessor(Class arrayClass, ArrayAccess access) { + String name = name(arrayClass, access); + MethodType type = type(arrayClass, access); try { return IMPL_LOOKUP.findStatic(ArrayAccessor.class, name, type); } catch (ReflectiveOperationException ex) { @@ -1091,6 +1165,8 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; // Put the whole mess into its own nested class. // That way we can lazily load the code and set up the constants. private static class BindCaller { + private static MethodType INVOKER_MT = MethodType.methodType(Object.class, MethodHandle.class, Object[].class); + static MethodHandle bindCaller(MethodHandle mh, Class hostClass) { // Do not use this function to inject calls into system classes. @@ -1109,38 +1185,15 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; } private static MethodHandle makeInjectedInvoker(Class hostClass) { - Class bcc = UNSAFE.defineAnonymousClass(hostClass, T_BYTES, null); - if (hostClass.getClassLoader() != bcc.getClassLoader()) - throw new InternalError(hostClass.getName()+" (CL)"); try { - if (hostClass.getProtectionDomain() != bcc.getProtectionDomain()) - throw new InternalError(hostClass.getName()+" (PD)"); - } catch (SecurityException ex) { - // Self-check was blocked by security manager. This is OK. - // In fact the whole try body could be turned into an assertion. - } - try { - MethodHandle init = IMPL_LOOKUP.findStatic(bcc, "init", MethodType.methodType(void.class)); - init.invokeExact(); // force initialization of the class - } catch (Throwable ex) { - throw uncaughtException(ex); - } - MethodHandle bccInvoker; - try { - MethodType invokerMT = MethodType.methodType(Object.class, MethodHandle.class, Object[].class); - bccInvoker = IMPL_LOOKUP.findStatic(bcc, "invoke_V", invokerMT); + Class invokerClass = UNSAFE.defineAnonymousClass(hostClass, INJECTED_INVOKER_TEMPLATE, null); + assert checkInjectedInvoker(hostClass, invokerClass); + return IMPL_LOOKUP.findStatic(invokerClass, "invoke_V", INVOKER_MT); } catch (ReflectiveOperationException ex) { throw uncaughtException(ex); } - // Test the invoker, to ensure that it really injects into the right place. - try { - MethodHandle vamh = prepareForInvoker(MH_checkCallerClass); - Object ok = bccInvoker.invokeExact(vamh, new Object[]{hostClass, bcc}); - } catch (Throwable ex) { - throw new InternalError(ex); - } - return bccInvoker; } + private static ClassValue CV_makeInjectedInvoker = new ClassValue() { @Override protected MethodHandle computeValue(Class hostClass) { return makeInjectedInvoker(hostClass); @@ -1171,62 +1224,82 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; return mh; } + private static boolean checkInjectedInvoker(Class hostClass, Class invokerClass) { + assert (hostClass.getClassLoader() == invokerClass.getClassLoader()) : hostClass.getName()+" (CL)"; + try { + assert (hostClass.getProtectionDomain() == invokerClass.getProtectionDomain()) : hostClass.getName()+" (PD)"; + } catch (SecurityException ex) { + // Self-check was blocked by security manager. This is OK. + } + try { + // Test the invoker to ensure that it really injects into the right place. + MethodHandle invoker = IMPL_LOOKUP.findStatic(invokerClass, "invoke_V", INVOKER_MT); + MethodHandle vamh = prepareForInvoker(MH_checkCallerClass); + return (boolean)invoker.invoke(vamh, new Object[]{ invokerClass }); + } catch (Throwable ex) { + throw new InternalError(ex); + } + } + private static final MethodHandle MH_checkCallerClass; static { final Class THIS_CLASS = BindCaller.class; - assert(checkCallerClass(THIS_CLASS, THIS_CLASS)); + assert(checkCallerClass(THIS_CLASS)); try { MH_checkCallerClass = IMPL_LOOKUP .findStatic(THIS_CLASS, "checkCallerClass", - MethodType.methodType(boolean.class, Class.class, Class.class)); - assert((boolean) MH_checkCallerClass.invokeExact(THIS_CLASS, THIS_CLASS)); + MethodType.methodType(boolean.class, Class.class)); + assert((boolean) MH_checkCallerClass.invokeExact(THIS_CLASS)); } catch (Throwable ex) { throw new InternalError(ex); } } @CallerSensitive - private static boolean checkCallerClass(Class expected, Class expected2) { - // This method is called via MH_checkCallerClass and so it's - // correct to ask for the immediate caller here. + private static boolean checkCallerClass(Class expected) { + // This method is called via MH_checkCallerClass and so it's correct to ask for the immediate caller here. Class actual = Reflection.getCallerClass(); - if (actual != expected && actual != expected2) - throw new InternalError("found "+actual.getName()+", expected "+expected.getName() - +(expected == expected2 ? "" : ", or else "+expected2.getName())); + if (actual != expected) + throw new InternalError("found " + actual.getName() + ", expected " + expected.getName()); return true; } - private static final byte[] T_BYTES; - static { - final Object[] values = {null}; - AccessController.doPrivileged(new PrivilegedAction<>() { - public Void run() { - try { - Class tClass = T.class; - String tName = tClass.getName(); - String tResource = tName.substring(tName.lastIndexOf('.')+1)+".class"; - try (java.io.InputStream in = tClass.getResourceAsStream(tResource)) { - values[0] = in.readAllBytes(); - } - } catch (java.io.IOException ex) { - throw new InternalError(ex); - } - return null; - } - }); - T_BYTES = (byte[]) values[0]; - } + private static final byte[] INJECTED_INVOKER_TEMPLATE = generateInvokerTemplate(); - // The following class is used as a template for Unsafe.defineAnonymousClass: - private static class T { - static void init() { } // side effect: initializes this class - static Object invoke_V(MethodHandle vamh, Object[] args) throws Throwable { - return vamh.invokeExact(args); - } + /** Produces byte code for a class that is used as an injected invoker. */ + private static byte[] generateInvokerTemplate() { + ClassWriter cw = new ClassWriter(0); + + // private static class InjectedInvoker { + // @Hidden + // static Object invoke_V(MethodHandle vamh, Object[] args) throws Throwable { + // return vamh.invokeExact(args); + // } + // } + cw.visit(52, ACC_PRIVATE | ACC_SUPER, "InjectedInvoker", null, "java/lang/Object", null); + + MethodVisitor mv = cw.visitMethod(ACC_STATIC, "invoke_V", + "(Ljava/lang/invoke/MethodHandle;[Ljava/lang/Object;)Ljava/lang/Object;", + null, null); + + // Suppress invoker method in stack traces. + AnnotationVisitor av0 = mv.visitAnnotation("Ljava/lang/invoke/LambdaForm$Hidden;", true); + av0.visitEnd(); + + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invokeExact", + "([Ljava/lang/Object;)Ljava/lang/Object;", false); + mv.visitInsn(ARETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + + cw.visitEnd(); + return cw.toByteArray(); } } - /** This subclass allows a wrapped method handle to be re-associated with an arbitrary member name. */ private static final class WrappedMember extends DelegatingMethodHandle { private final MethodHandle target; @@ -1282,6 +1355,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; NEW_ARRAY, ARRAY_LOAD, ARRAY_STORE, + ARRAY_LENGTH, IDENTITY, ZERO, NONE // no intrinsic associated diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index c3a97a178a3..716d62ff177 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -2244,6 +2244,21 @@ return mh1; return ani.asType(ani.type().changeReturnType(arrayClass)); } + /** + * Produces a method handle returning the length of an array. + * The type of the method handle will have {@code int} as return type, + * and its sole argument will be the array type. + * @param arrayClass an array type + * @return a method handle which can retrieve the length of an array of the given array type + * @throws NullPointerException if the argument is {@code null} + * @throws IllegalArgumentException if arrayClass is not an array type + * @since 9 + */ + public static + MethodHandle arrayLength(Class arrayClass) throws IllegalArgumentException { + return MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.LENGTH); + } + /** * Produces a method handle giving read access to elements of an array. * The type of the method handle will have a return type of the array's @@ -2256,7 +2271,7 @@ return mh1; */ public static MethodHandle arrayElementGetter(Class arrayClass) throws IllegalArgumentException { - return MethodHandleImpl.makeArrayElementAccessor(arrayClass, false); + return MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.GET); } /** @@ -2271,7 +2286,7 @@ return mh1; */ public static MethodHandle arrayElementSetter(Class arrayClass) throws IllegalArgumentException { - return MethodHandleImpl.makeArrayElementAccessor(arrayClass, true); + return MethodHandleImpl.makeArrayElementAccessor(arrayClass, MethodHandleImpl.ArrayAccess.SET); } /** diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java index 0d965ed5a54..7da455097b8 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java @@ -128,7 +128,7 @@ public final class StringConcatFactory { /** * Default strategy to use for concatenation. */ - private static final Strategy DEFAULT_STRATEGY = Strategy.BC_SB; + private static final Strategy DEFAULT_STRATEGY = Strategy.MH_INLINE_SIZED_EXACT; private enum Strategy { /** diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java index 78a75bf05cc..ee7be4096bf 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java @@ -26,6 +26,7 @@ package java.lang.invoke; import jdk.internal.HotSpotIntrinsicCandidate; +import jdk.internal.util.Preconditions; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.Stable; @@ -33,7 +34,6 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.function.BiFunction; import java.util.function.Function; @@ -1475,11 +1475,11 @@ public abstract class VarHandle { TypesAndInvokers tis = getTypesAndInvokers(); MethodHandle mh = tis.methodHandle_table[mode]; if (mh == null) { - mh = tis.methodHandle_table[mode] = getMethodHandleUncached(tis, mode); + mh = tis.methodHandle_table[mode] = getMethodHandleUncached(mode); } return mh; } - private final MethodHandle getMethodHandleUncached(TypesAndInvokers tis, int mode) { + private final MethodHandle getMethodHandleUncached(int mode) { MethodType mt = accessModeType(AccessMode.values()[mode]). insertParameterTypes(0, VarHandle.class); MemberName mn = vform.getMemberName(mode); @@ -1501,7 +1501,7 @@ public abstract class VarHandle { } static final BiFunction, ArrayIndexOutOfBoundsException> - AIOOBE_SUPPLIER = Objects.outOfBoundsExceptionFormatter( + AIOOBE_SUPPLIER = Preconditions.outOfBoundsExceptionFormatter( new Function() { @Override public ArrayIndexOutOfBoundsException apply(String s) { diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template index 7a058afedec..ebb6dd31b79 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template @@ -24,9 +24,11 @@ */ package java.lang.invoke; -import java.util.Objects; +import jdk.internal.util.Preconditions; import jdk.internal.vm.annotation.ForceInline; +import java.util.Objects; + import static java.lang.invoke.MethodHandleStatics.UNSAFE; #warn @@ -163,8 +165,7 @@ final class VarHandle$Type$s { @ForceInline static boolean weakCompareAndSetVolatile(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { - // TODO defer to strong form until new Unsafe method is added - return UNSAFE.compareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + return UNSAFE.weakCompareAndSwap$Type$Volatile(Objects.requireNonNull(handle.receiverType.cast(holder)), handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(value):value}); @@ -345,8 +346,7 @@ final class VarHandle$Type$s { @ForceInline static boolean weakCompareAndSetVolatile(FieldStaticReadWrite handle, $type$ expected, $type$ value) { - // TODO defer to strong form until new Unsafe method is added - return UNSAFE.compareAndSwap$Type$(handle.base, + return UNSAFE.weakCompareAndSwap$Type$Volatile(handle.base, handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, {#if[Object]?handle.fieldType.cast(value):value}); @@ -447,7 +447,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.get$Type$Volatile(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase); + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase); } @ForceInline @@ -458,7 +458,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] UNSAFE.put$Type$Volatile(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(value):value}); } @@ -470,7 +470,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.get$Type$Opaque(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase); + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase); } @ForceInline @@ -481,7 +481,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] UNSAFE.put$Type$Opaque(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(value):value}); } @@ -493,7 +493,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.get$Type$Acquire(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase); + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase); } @ForceInline @@ -504,7 +504,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] UNSAFE.put$Type$Release(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(value):value}); } #if[CAS] @@ -517,7 +517,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.compareAndSwap$Type$(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -530,7 +530,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.compareAndExchange$Type$Volatile(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -543,7 +543,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.compareAndExchange$Type$Acquire(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -556,7 +556,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.compareAndExchange$Type$Release(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -569,7 +569,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.weakCompareAndSwap$Type$(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -581,9 +581,8 @@ final class VarHandle$Type$s { #else[Object] $type$[] array = ($type$[]) oarray; #end[Object] - // TODO defer to strong form until new Unsafe method is added - return UNSAFE.compareAndSwap$Type$(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + return UNSAFE.weakCompareAndSwap$Type$Volatile(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -596,7 +595,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.weakCompareAndSwap$Type$Acquire(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -609,7 +608,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.weakCompareAndSwap$Type$Release(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(expected):expected}, {#if[Object]?handle.componentType.cast(value):value}); } @@ -622,7 +621,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.getAndSet$Type$(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(value):value}); } #end[CAS] @@ -636,7 +635,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.getAndAdd$Type$(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, value); } @@ -648,7 +647,7 @@ final class VarHandle$Type$s { $type$[] array = ($type$[]) oarray; #end[Object] return UNSAFE.getAndAdd$Type$(array, - (((long) Objects.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, value) + value; } #end[AtomicAdd] diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template index 8639e0d342e..66bf267476e 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template @@ -25,6 +25,7 @@ package java.lang.invoke; import jdk.internal.misc.Unsafe; +import jdk.internal.util.Preconditions; import jdk.internal.vm.annotation.ForceInline; import java.nio.ByteBuffer; @@ -81,7 +82,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { @ForceInline static int index(byte[] ba, int index) { - return Objects.checkIndex(index, ba.length - ALIGN, null); + return Preconditions.checkIndex(index, ba.length - ALIGN, null); } @ForceInline @@ -233,8 +234,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { @ForceInline static boolean weakCompareAndSetVolatile(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { byte[] ba = (byte[]) oba; - // TODO defer to strong form until new Unsafe method is added - return UNSAFE.compareAndSwap$RawType$( + return UNSAFE.weakCompareAndSwap$RawType$Volatile( ba, address(ba, index(ba, index)), convEndian(handle.be, expected), convEndian(handle.be, value)); @@ -271,22 +271,33 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { #if[AtomicAdd] @ForceInline - static $type$ getAndAdd(ArrayHandle handle, Object oba, int index, $type$ value) { + static $type$ getAndAdd(ArrayHandle handle, Object oba, int index, $type$ delta) { byte[] ba = (byte[]) oba; - return convEndian(handle.be, - UNSAFE.getAndAdd$RawType$( - ba, - address(ba, index(ba, index)), - convEndian(handle.be, value))); + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$( + ba, + address(ba, index(ba, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(ba, index, delta); + } } @ForceInline - static $type$ addAndGet(ArrayHandle handle, Object oba, int index, $type$ value) { - byte[] ba = (byte[]) oba; - return convEndian(handle.be, UNSAFE.getAndAdd$RawType$( - ba, - address(ba, index(ba, index)), - convEndian(handle.be, value))) + value; + static $type$ getAndAddConvEndianWithCAS(byte[] ba, int index, $type$ delta) { + $type$ nativeExpectedValue, expectedValue; + long offset = address(ba, index(ba, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); + return expectedValue; + } + + @ForceInline + static $type$ addAndGet(ArrayHandle handle, Object oba, int index, $type$ delta) { + return getAndAdd(handle, oba, index, delta) + delta; } #end[AtomicAdd] @@ -307,14 +318,14 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { @ForceInline static int index(ByteBuffer bb, int index) { - return Objects.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); + return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); } @ForceInline static int indexRO(ByteBuffer bb, int index) { if (UNSAFE.getBoolean(bb, BYTE_BUFFER_IS_READ_ONLY)) throw new ReadOnlyBufferException(); - return Objects.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); + return Preconditions.checkIndex(index, UNSAFE.getInt(bb, BUFFER_LIMIT) - ALIGN, null); } @ForceInline @@ -466,8 +477,7 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { @ForceInline static boolean weakCompareAndSetVolatile(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { ByteBuffer bb = (ByteBuffer) obb; - // TODO defer to strong form until new Unsafe method is added - return UNSAFE.compareAndSwap$RawType$( + return UNSAFE.weakCompareAndSwap$RawType$Volatile( UNSAFE.getObject(bb, BYTE_BUFFER_HB), address(bb, indexRO(bb, index)), convEndian(handle.be, expected), convEndian(handle.be, value)); @@ -504,23 +514,34 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase { #if[AtomicAdd] @ForceInline - static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ value) { + static $type$ getAndAdd(ByteBufferHandle handle, Object obb, int index, $type$ delta) { ByteBuffer bb = (ByteBuffer) obb; - return convEndian(handle.be, - UNSAFE.getAndAdd$RawType$( - UNSAFE.getObject(bb, BYTE_BUFFER_HB), - address(bb, indexRO(bb, index)), - convEndian(handle.be, value))); + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(bb, index, delta); + } } @ForceInline - static $type$ addAndGet(ByteBufferHandle handle, Object obb, int index, $type$ value) { - ByteBuffer bb = (ByteBuffer) obb; - return convEndian(handle.be, - UNSAFE.getAndAdd$RawType$( - UNSAFE.getObject(bb, BYTE_BUFFER_HB), - address(bb, indexRO(bb, index)), - convEndian(handle.be, value))) + value; + static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) { + $type$ nativeExpectedValue, expectedValue; + Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); + long offset = address(bb, indexRO(bb, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); + return expectedValue; + } + + @ForceInline + static $type$ addAndGet(ByteBufferHandle handle, Object obb, int index, $type$ delta) { + return getAndAdd(handle, obb, index, delta) + delta; } #end[AtomicAdd] diff --git a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java index 4b6ab934dcf..d1efde87f50 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/Configuration.java +++ b/jdk/src/java.base/share/classes/java/lang/module/Configuration.java @@ -152,7 +152,7 @@ import java.util.stream.Collectors; * Configuration parent = Layer.boot().configuration(); * * Configuration cf = parent.resolveRequires(finder, - * ModuleFinder.empty(), + * ModuleFinder.of(), * Set.of("myapp")); * cf.modules().forEach(m -> { * System.out.format("%s -> %s%n", @@ -366,7 +366,7 @@ public final class Configuration { Configuration parent = empty(); Resolver resolver - = new Resolver(finder, parent, ModuleFinder.empty(), traceOutput); + = new Resolver(finder, parent, ModuleFinder.of(), traceOutput); resolver.resolveRequires(roots).resolveUses(); return new Configuration(parent, resolver, check); diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java index 1cdd12838b1..a6924484c0e 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java +++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleFinder.java @@ -33,12 +33,15 @@ import java.nio.file.Paths; import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedAction; +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.Objects; import java.util.Optional; import java.util.Set; -import java.util.stream.Collectors; -import java.util.stream.Stream; import sun.security.action.GetPropertyAction; /** @@ -60,15 +63,15 @@ import sun.security.action.GetPropertyAction; * ModuleFinder finder = ModuleFinder.of(dir1, dir2, dir3); * * Optional omref = finder.find("jdk.foo"); - * if (omref.isPresent()) { ... } + * omref.ifPresent(mref -> ... ); * * }

    * *

    The {@link #find(String) find} and {@link #findAll() findAll} methods - * defined here can fail for several reasons. These include include I/O errors, - * errors detected parsing a module descriptor ({@code module-info.class}), or - * in the case of {@code ModuleFinder} returned by {@link #of ModuleFinder.of}, - * that two or more modules with the same name are found in a directory. + * defined here can fail for several reasons. These include I/O errors, errors + * detected parsing a module descriptor ({@code module-info.class}), or in the + * case of {@code ModuleFinder} returned by {@link #of ModuleFinder.of}, that + * two or more modules with the same name are found in a directory. * When an error is detected then these methods throw {@link FindException * FindException} with an appropriate {@link Throwable#getCause cause}. * The behavior of a {@code ModuleFinder} after a {@code FindException} is @@ -205,11 +208,13 @@ public interface ModuleFinder { * *

    The module finder returned by this method supports modules that are * packaged as JAR files. A JAR file with a {@code module-info.class} in - * the top-level directory of the JAR file is a modular JAR and is an - * explicit module. A JAR file that does not have a {@code - * module-info.class} in the top-level directory is an {@link - * ModuleDescriptor#isAutomatic automatic} module. The {@link - * ModuleDescriptor} for an automatic module is created as follows: + * the top-level directory of the JAR file (or overridden by a versioned + * entry in a {@link java.util.jar.JarFile#isMultiRelease() multi-release} + * JAR file) is a modular JAR and is an explicit module. + * A JAR file that does not have a {@code module-info.class} in the + * top-level directory is an {@link ModuleDescriptor#isAutomatic automatic} + * module. The {@link ModuleDescriptor} for an automatic module is created as + * follows: * *

      * @@ -263,18 +268,22 @@ public interface ModuleFinder { *
    * *

    In addition to JAR files, an implementation may also support modules - * that are packaged in other implementation specific module formats. As - * with automatic modules, the contents of a packaged or exploded module - * may need to be scanned in order to determine the packages in - * the module. If a {@code .class} file that corresponds to a class in an + * that are packaged in other implementation specific module formats. When + * a file is encountered that is not recognized as a packaged module then + * {@code FindException} is thrown. An implementation may choose to ignore + * some files, {@link java.nio.file.Files#isHidden hidden} files for + * example. Paths to files that do not exist are always ignored.

    + * + *

    As with automatic modules, the contents of a packaged or exploded + * module may need to be scanned in order to determine the packages + * in the module. If a {@code .class} file that corresponds to a class in an * unnamed package is encountered then {@code FindException} is thrown.

    * *

    Finders created by this method are lazy and do not eagerly check * that the given file paths are directories or packaged modules. * Consequently, the {@code find} or {@code findAll} methods will only * fail if invoking these methods results in searching a directory or - * packaged module and an error is encountered. Paths to files that do not - * exist are ignored.

    + * packaged module and an error is encountered.

    * * @param entries * A possibly-empty array of paths to directories of modules @@ -283,81 +292,87 @@ public interface ModuleFinder { * @return A {@code ModuleFinder} that locates modules on the file system */ static ModuleFinder of(Path... entries) { + // special case zero entries + if (entries.length == 0) { + return new ModuleFinder() { + @Override + public Optional find(String name) { + Objects.requireNonNull(name); + return Optional.empty(); + } + + @Override + public Set findAll() { + return Collections.emptySet(); + } + }; + } + return new ModulePath(entries); } /** - * Returns a module finder that is the equivalent to composing two - * module finders. The resulting finder will locate modules references - * using {@code first}; if not found then it will attempt to locate module - * references using {@code second}. + * Returns a module finder that is composed from a sequence of zero or more + * module finders. The {@link #find(String) find} method of the resulting + * module finder will locate a module by invoking the {@code find} method + * of each module finder, in array index order, until either the module is + * found or all module finders have been searched. The {@link #findAll() + * findAll} method of the resulting module finder will return a set of + * modules that includes all modules located by the first module finder. + * The set of modules will include all modules located by the second or + * subsequent module finder that are not located by previous module finders + * in the sequence. * - *

    The {@link #findAll() findAll} method of the resulting module finder - * will locate all modules located by the first module finder. It will - * also locate all modules located by the second module finder that are not - * located by the first module finder.

    + *

    When locating modules then any exceptions or errors thrown by the + * {@code find} or {@code findAll} methods of the underlying module finders + * will be propogated to the caller of the resulting module finder's + * {@code find} or {@code findAll} methods.

    * - * @apiNote This method will eventually be changed to take a sequence of - * module finders. + * @param finders + * The array of module finders * - * @param first - * The first module finder - * @param second - * The second module finder - * - * @return A {@code ModuleFinder} that composes two module finders + * @return A {@code ModuleFinder} that composes a sequence of module finders */ - static ModuleFinder compose(ModuleFinder first, ModuleFinder second) { - Objects.requireNonNull(first); - Objects.requireNonNull(second); + static ModuleFinder compose(ModuleFinder... finders) { + final List finderList = Arrays.asList(finders); + finderList.forEach(Objects::requireNonNull); return new ModuleFinder() { - Set allModules; + private final Map nameToModule = new HashMap<>(); + private Set allModules; @Override public Optional find(String name) { - Optional om = first.find(name); - if (!om.isPresent()) - om = second.find(name); - return om; + // cached? + ModuleReference mref = nameToModule.get(name); + if (mref != null) + return Optional.of(mref); + Optional omref = finderList.stream() + .map(f -> f.find(name)) + .flatMap(Optional::stream) + .findFirst(); + omref.ifPresent(m -> nameToModule.put(name, m)); + return omref; } + @Override public Set findAll() { - if (allModules == null) { - allModules = Stream.concat(first.findAll().stream(), - second.findAll().stream()) - .map(a -> a.descriptor().name()) - .distinct() - .map(this::find) - .map(Optional::get) - .collect(Collectors.toSet()); - } + if (allModules != null) + return allModules; + // seed with modules already found + Set result = new HashSet<>(nameToModule.values()); + finderList.stream() + .flatMap(f -> f.findAll().stream()) + .forEach(mref -> { + String name = mref.descriptor().name(); + if (nameToModule.putIfAbsent(name, mref) == null) { + result.add(mref); + } + }); + allModules = Collections.unmodifiableSet(result); return allModules; } }; } - /** - * Returns an empty module finder. The empty finder does not find any - * modules. - * - * @apiNote This is useful when using methods such as {@link - * Configuration#resolveRequires resolveRequires} where two finders are - * specified. An alternative is {@code ModuleFinder.of()}. - * - * @return A {@code ModuleFinder} that does not find any modules - */ - static ModuleFinder empty() { - // an alternative implementation of ModuleFinder.of() - return new ModuleFinder() { - @Override public Optional find(String name) { - Objects.requireNonNull(name); - return Optional.empty(); - } - @Override public Set findAll() { - return Collections.emptySet(); - } - }; - } - } diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java index efc8c37b8a2..7bf9342ca88 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java +++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleInfo.java @@ -154,7 +154,7 @@ final class ModuleInfo { int minor_version = in.readUnsignedShort(); int major_version = in.readUnsignedShort(); if (major_version < 53) { - // throw invalidModuleDescriptor"Must be >= 53.0"); + throw invalidModuleDescriptor("Must be >= 53.0"); } ConstantPool cpool = new ConstantPool(in); diff --git a/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java b/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java index 6b0b5d46fe9..eccd0d493f4 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java +++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleReferences.java @@ -220,10 +220,10 @@ class ModuleReferences { Optional implFind(String name) throws IOException { JarEntry je = getEntry(name); if (je != null) { + if (jf.isMultiRelease()) + name = SharedSecrets.javaUtilJarAccess().getRealName(jf, je); String encodedPath = ParseUtil.encodePath(name, false); String uris = "jar:" + uri + "!/" + encodedPath; - if (jf.isMultiRelease()) - uris += "#runtime"; return Optional.of(URI.create(uris)); } else { return Optional.empty(); diff --git a/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java b/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java index d14ee8d60e4..77d5392821a 100644 --- a/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java +++ b/jdk/src/java.base/share/classes/java/lang/module/SystemModuleFinder.java @@ -45,6 +45,7 @@ import jdk.internal.jimage.ImageLocation; import jdk.internal.jimage.ImageReader; import jdk.internal.jimage.ImageReaderFactory; import jdk.internal.module.ModuleHashes; +import jdk.internal.module.ModuleHashes.HashSupplier; import jdk.internal.module.SystemModules; import jdk.internal.module.ModulePatcher; import jdk.internal.perf.PerfCounter; @@ -84,57 +85,23 @@ class SystemModuleFinder implements ModuleFinder { long t0 = System.nanoTime(); imageReader = ImageReaderFactory.getImageReader(); - String[] moduleNames = SystemModules.MODULE_NAMES; - ModuleDescriptor[] descriptors = null; + String[] names = moduleNames(); + ModuleDescriptor[] descriptors = descriptors(names); - boolean fastLoad = System.getProperty("jdk.installed.modules.disable") == null; - if (fastLoad) { - // fast loading of ModuleDescriptor of installed modules - descriptors = SystemModules.modules(); - } - - int n = moduleNames.length; + int n = names.length; moduleCount.add(n); Set mods = new HashSet<>(n); Map map = new HashMap<>(n); for (int i = 0; i < n; i++) { - String mn = moduleNames[i]; - ModuleDescriptor md; - String hash; - if (fastLoad) { - md = descriptors[i]; - hash = SystemModules.MODULES_TO_HASH[i]; - } else { - // fallback to read module-info.class - // if fast loading of ModuleDescriptors is disabled - ImageLocation location = imageReader.findLocation(mn, "module-info.class"); - md = ModuleDescriptor.read(imageReader.getResourceBuffer(location)); - hash = null; - } - if (!md.name().equals(mn)) - throw new InternalError(); + ModuleDescriptor md = descriptors[i]; // create the ModuleReference - - URI uri = URI.create("jrt:/" + mn); - - Supplier readerSupplier = new Supplier<>() { - @Override - public ModuleReader get() { - return new ImageModuleReader(mn, uri); - } - }; - - ModuleReference mref = - new ModuleReference(md, uri, readerSupplier, hashSupplier(hash)); - - // may need a reference to a patched module if -Xpatch specified - mref = ModulePatcher.interposeIfNeeded(mref); + ModuleReference mref = toModuleReference(md, hashSupplier(i, names[i])); mods.add(mref); - map.put(mn, mref); + map.put(names[i], mref); // counters packageCount.add(md.packages().size()); @@ -147,16 +114,114 @@ class SystemModuleFinder implements ModuleFinder { initTime.addElapsedTimeFrom(t0); } - private static ModuleHashes.HashSupplier hashSupplier(String hash) { - if (hash == null) - return null; + /* + * Returns an array of ModuleDescriptor of the given module names. + * + * This obtains ModuleDescriptors from SystemModules class that is generated + * from the jlink system-modules plugin. ModuleDescriptors have already + * been validated at link time. + * + * If java.base is patched, or fastpath is disabled for troubleshooting + * purpose, it will fall back to find system modules via jrt file system. + */ + private static ModuleDescriptor[] descriptors(String[] names) { + // fastpath is enabled by default. + // It can be disabled for troubleshooting purpose. + boolean disabled = + System.getProperty("jdk.system.module.finder.disabledFastPath") != null; - return new ModuleHashes.HashSupplier() { + // fast loading of ModuleDescriptor of system modules + if (isFastPathSupported() && !disabled) + return SystemModules.modules(); + + // if fast loading of ModuleDescriptors is disabled + // fallback to read module-info.class + ModuleDescriptor[] descriptors = new ModuleDescriptor[names.length]; + for (int i = 0; i < names.length; i++) { + String mn = names[i]; + ImageLocation loc = imageReader.findLocation(mn, "module-info.class"); + descriptors[i] = ModuleDescriptor.read(imageReader.getResourceBuffer(loc)); + + // add the recorded hashes of tied modules + Hashes.add(descriptors[i]); + } + return descriptors; + } + + private static boolean isFastPathSupported() { + return SystemModules.MODULE_NAMES.length > 0; + } + + private static String[] moduleNames() { + if (isFastPathSupported()) + // module names recorded at link time + return SystemModules.MODULE_NAMES; + + // this happens when java.base is patched with java.base + // from an exploded image + return imageReader.getModuleNames(); + } + + private static ModuleReference toModuleReference(ModuleDescriptor md, + HashSupplier hash) + { + String mn = md.name(); + URI uri = URI.create("jrt:/" + mn); + + Supplier readerSupplier = new Supplier<>() { @Override - public String generate(String algorithm) { - return hash; + public ModuleReader get() { + return new ImageModuleReader(mn, uri); } }; + + ModuleReference mref = + new ModuleReference(md, uri, readerSupplier, hash); + + // may need a reference to a patched module if -Xpatch specified + mref = ModulePatcher.interposeIfNeeded(mref); + + return mref; + } + + private static HashSupplier hashSupplier(int index, String name) { + if (isFastPathSupported()) { + return new HashSupplier() { + @Override + public String generate(String algorithm) { + return SystemModules.MODULES_TO_HASH[index]; + } + }; + } else { + return Hashes.hashFor(name); + } + } + + /* + * This helper class is only used when SystemModules is patched. + * It will get the recorded hashes from module-info.class. + */ + private static class Hashes { + static Map hashes = new HashMap<>(); + + static void add(ModuleDescriptor descriptor) { + Optional ohashes = descriptor.hashes(); + if (ohashes.isPresent()) { + hashes.putAll(ohashes.get().hashes()); + } + } + + static HashSupplier hashFor(String name) { + if (!hashes.containsKey(name)) + return null; + + return new HashSupplier() { + @Override + public String generate(String algorithm) { + return hashes.get(name); + } + }; + } } SystemModuleFinder() { } diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java b/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java index 0ca75a874c4..34dae522d6f 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Layer.java @@ -77,7 +77,7 @@ import sun.security.util.SecurityConstants; * #boot() boot} layer, that is created when the Java virtual machine is * started. The system modules, including {@code java.base}, are in * the boot layer. The modules in the boot layer are mapped to the bootstrap - * class loader and other class loaders that are built-in into the ava virtual + * class loader and other class loaders that are built-in into the Java virtual * machine. The boot layer will often be the {@link #parent() parent} when * creating additional layers.

    * @@ -105,7 +105,7 @@ import sun.security.util.SecurityConstants; * Layer parent = Layer.boot(); * * Configuration cf = parent.configuration() - * .resolveRequires(finder, ModuleFinder.empty(), Set.of("myapp")); + * .resolveRequires(finder, ModuleFinder.of(), Set.of("myapp")); * * ClassLoader scl = ClassLoader.getSystemClassLoader(); * diff --git a/jdk/src/java.base/share/classes/java/math/BigDecimal.java b/jdk/src/java.base/share/classes/java/math/BigDecimal.java index 557c5cc2e35..dce4300c77a 100644 --- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java +++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java @@ -128,6 +128,7 @@ import java.util.Arrays; * Subtractmax(minuend.scale(), subtrahend.scale()) * Multiplymultiplier.scale() + multiplicand.scale() * Dividedividend.scale() - divisor.scale() + * Square rootradicand.scale()/2 * * * These scales are the ones used by the methods which return exact @@ -346,6 +347,16 @@ public class BigDecimal extends Number implements Comparable { public static final BigDecimal TEN = ZERO_THROUGH_TEN[10]; + /** + * The value 0.1, with a scale of 1. + */ + private static final BigDecimal ONE_TENTH = valueOf(1L, 1); + + /** + * The value 0.5, with a scale of 1. + */ + private static final BigDecimal ONE_HALF = valueOf(5L, 1); + // Constructors /** @@ -1995,6 +2006,295 @@ public class BigDecimal extends Number implements Comparable { return result; } + /** + * Returns an approximation to the square root of {@code this} + * with rounding according to the context settings. + * + *

    The preferred scale of the returned result is equal to + * {@code this.scale()/2}. The value of the returned result is + * always within one ulp of the exact decimal value for the + * precision in question. If the rounding mode is {@link + * RoundingMode#HALF_UP HALF_UP}, {@link RoundingMode#HALF_DOWN + * HALF_DOWN}, or {@link RoundingMode#HALF_EVEN HALF_EVEN}, the + * result is within one half an ulp of the exact decimal value. + * + *

    Special case: + *

      + *
    • The square root of a number numerically equal to {@code + * ZERO} is numerically equal to {@code ZERO} with a preferred + * scale according to the general rule above. In particular, for + * {@code ZERO}}, {@code ZERO.sqrt(mc).equals(ZERO)} is true with + * any {@code MathContext} as an argument. + *
    + * + * @param mc the context to use. + * @return the square root of {@code this}. + * @throws ArithmeticException if {@code this} is less than zero. + * @throws ArithmeticException if an exact result is requested + * ({@code mc.getPrecision()==0}) and there is no finite decimal + * expansion of the exact result + * @throws ArithmeticException if + * {@code (mc.getRoundingMode()==RoundingMode.UNNECESSARY}) and + * the exact result cannot fit in {@code mc.getPrecision()} + * digits. + * @since 9 + */ + public BigDecimal sqrt(MathContext mc) { + int signum = signum(); + if (signum == 1) { + /* + * The following code draws on the algorithm presented in + * "Properly Rounded Variable Precision Square Root," Hull and + * Abrham, ACM Transactions on Mathematical Software, Vol 11, + * No. 3, September 1985, Pages 229-237. + * + * The BigDecimal computational model differs from the one + * presented in the paper in several ways: first BigDecimal + * numbers aren't necessarily normalized, second many more + * rounding modes are supported, including UNNECESSARY, and + * exact results can be requested. + * + * The main steps of the algorithm below are as follows, + * first argument reduce the value to the numerical range + * [1, 10) using the following relations: + * + * x = y * 10 ^ exp + * sqrt(x) = sqrt(y) * 10^(exp / 2) if exp is even + * sqrt(x) = sqrt(y/10) * 10 ^((exp+1)/2) is exp is odd + * + * Then use Newton's iteration on the reduced value to compute + * the numerical digits of the desired result. + * + * Finally, scale back to the desired exponent range and + * perform any adjustment to get the preferred scale in the + * representation. + */ + + // The code below favors relative simplicity over checking + // for special cases that could run faster. + + int preferredScale = this.scale()/2; + BigDecimal zeroWithFinalPreferredScale = valueOf(0L, preferredScale); + + // First phase of numerical normalization, strip trailing + // zeros and check for even powers of 10. + BigDecimal stripped = this.stripTrailingZeros(); + int strippedScale = stripped.scale(); + + // Numerically sqrt(10^2N) = 10^N + if (stripped.isPowerOfTen() && + strippedScale % 2 == 0) { + BigDecimal result = valueOf(1L, strippedScale/2); + if (result.scale() != preferredScale) { + // Adjust to requested precision and preferred + // scale as appropriate. + result = result.add(zeroWithFinalPreferredScale, mc); + } + return result; + } + + // After stripTrailingZeros, the representation is normalized as + // + // unscaledValue * 10^(-scale) + // + // where unscaledValue is an integer with the mimimum + // precision for the cohort of the numerical value. To + // allow binary floating-point hardware to be used to get + // approximately a 15 digit approximation to the square + // root, it is helpful to instead normalize this so that + // the significand portion is to right of the decimal + // point by roughly (scale() - precision() +1). + + // Now the precision / scale adjustment + int scaleAdjust = 0; + int scale = stripped.scale() - stripped.precision() + 1; + if (scale % 2 == 0) { + scaleAdjust = scale; + } else { + scaleAdjust = scale - 1; + } + + BigDecimal working = stripped.scaleByPowerOfTen(scaleAdjust); + + assert // Verify 0.1 <= working < 10 + ONE_TENTH.compareTo(working) <= 0 && working.compareTo(TEN) < 0; + + // Use good ole' Math.sqrt to get the initial guess for + // the Newton iteration, good to at least 15 decimal + // digits. This approach does incur the cost of a + // + // BigDecimal -> double -> BigDecimal + // + // conversion cycle, but it avoids the need for several + // Newton iterations in BigDecimal arithmetic to get the + // working answer to 15 digits of precision. If many fewer + // than 15 digits were needed, it might be faster to do + // the loop entirely in BigDecimal arithmetic. + // + // (A double value might have as much many as 17 decimal + // digits of precision; it depends on the relative density + // of binary and decimal numbers at different regions of + // the number line.) + // + // (It would be possible to check for certain special + // cases to avoid doing any Newton iterations. For + // example, if the BigDecimal -> double conversion was + // known to be exact and the rounding mode had a + // low-enough precision, the post-Newton rounding logic + // could be applied directly.) + + BigDecimal guess = new BigDecimal(Math.sqrt(working.doubleValue())); + int guessPrecision = 15; + int originalPrecision = mc.getPrecision(); + int targetPrecision; + + // If an exact value is requested, it must only need about + // half of the input digits to represent since multiplying + // an N digit number by itself yield a 2N-1 digit or 2N + // digit result. + if (originalPrecision == 0) { + targetPrecision = stripped.precision()/2 + 1; + } else { + targetPrecision = originalPrecision; + } + + // When setting the precision to use inside the Newton + // iteration loop, take care to avoid the case where the + // precision of the input exceeds the requested precision + // and rounding the input value too soon. + BigDecimal approx = guess; + int workingPrecision = working.precision(); + do { + int tmpPrecision = Math.max(Math.max(guessPrecision, targetPrecision + 2), + workingPrecision); + MathContext mcTmp = new MathContext(tmpPrecision, RoundingMode.HALF_EVEN); + // approx = 0.5 * (approx + fraction / approx) + approx = ONE_HALF.multiply(approx.add(working.divide(approx, mcTmp), mcTmp)); + guessPrecision *= 2; + } while (guessPrecision < targetPrecision + 2); + + BigDecimal result; + RoundingMode targetRm = mc.getRoundingMode(); + if (targetRm == RoundingMode.UNNECESSARY || originalPrecision == 0) { + RoundingMode tmpRm = + (targetRm == RoundingMode.UNNECESSARY) ? RoundingMode.DOWN : targetRm; + MathContext mcTmp = new MathContext(targetPrecision, tmpRm); + result = approx.scaleByPowerOfTen(-scaleAdjust/2).round(mcTmp); + + // If result*result != this numerically, the square + // root isn't exact + if (this.subtract(result.multiply(result)).compareTo(ZERO) != 0) { + throw new ArithmeticException("Computed square root not exact."); + } + } else { + result = approx.scaleByPowerOfTen(-scaleAdjust/2).round(mc); + } + + if (result.scale() != preferredScale) { + // The preferred scale of an add is + // max(addend.scale(), augend.scale()). Therefore, if + // the scale of the result is first minimized using + // stripTrailingZeros(), adding a zero of the + // preferred scale rounding the correct precision will + // perform the proper scale vs precision tradeoffs. + result = result.stripTrailingZeros(). + add(zeroWithFinalPreferredScale, + new MathContext(originalPrecision, RoundingMode.UNNECESSARY)); + } + assert squareRootResultAssertions(result, mc); + return result; + } else { + switch (signum) { + case -1: + throw new ArithmeticException("Attempted square root " + + "of negative BigDecimal"); + case 0: + return valueOf(0L, scale()/2); + + default: + throw new AssertionError("Bad value from signum"); + } + } + } + + private boolean isPowerOfTen() { + return BigInteger.ONE.equals(this.unscaledValue()); + } + + /** + * For nonzero values, check numerical correctness properties of + * the computed result for the chosen rounding mode. + * + * For the directed roundings, for DOWN and FLOOR, result^2 must + * be {@code <=} the input and (result+ulp)^2 must be {@code >} the + * input. Conversely, for UP and CEIL, result^2 must be {@code >=} the + * input and (result-ulp)^2 must be {@code <} the input. + */ + private boolean squareRootResultAssertions(BigDecimal result, MathContext mc) { + if (result.signum() == 0) { + return squareRootZeroResultAssertions(result, mc); + } else { + RoundingMode rm = mc.getRoundingMode(); + BigDecimal ulp = result.ulp(); + BigDecimal neighborUp = result.add(ulp); + // Make neighbor down accurate even for powers of ten + if (this.isPowerOfTen()) { + ulp = ulp.divide(TEN); + } + BigDecimal neighborDown = result.subtract(ulp); + + // Both the starting value and result should be nonzero and positive. + if (result.signum() != 1 || + this.signum() != 1) { + return false; + } + + switch (rm) { + case DOWN: + case FLOOR: + return + result.multiply(result).compareTo(this) <= 0 && + neighborUp.multiply(neighborUp).compareTo(this) > 0; + + case UP: + case CEILING: + return + result.multiply(result).compareTo(this) >= 0 && + neighborDown.multiply(neighborDown).compareTo(this) < 0; + + case HALF_DOWN: + case HALF_EVEN: + case HALF_UP: + BigDecimal err = result.multiply(result).subtract(this).abs(); + BigDecimal errUp = neighborUp.multiply(neighborUp).subtract(this); + BigDecimal errDown = this.subtract(neighborDown.multiply(neighborDown)); + // All error values should be positive so don't need to + // compare absolute values. + + int err_comp_errUp = err.compareTo(errUp); + int err_comp_errDown = err.compareTo(errDown); + + return + errUp.signum() == 1 && + errDown.signum() == 1 && + + err_comp_errUp <= 0 && + err_comp_errDown <= 0 && + + ((err_comp_errUp == 0 ) ? err_comp_errDown < 0 : true) && + ((err_comp_errDown == 0 ) ? err_comp_errUp < 0 : true); + // && could check for digit conditions for ties too + + default: // Definition of UNNECESSARY already verified. + return true; + } + } + } + + private boolean squareRootZeroResultAssertions(BigDecimal result, MathContext mc) { + return this.compareTo(ZERO) == 0; + } + /** * Returns a {@code BigDecimal} whose value is * (thisn), The power is computed exactly, to diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java index a295d862ada..4945713e228 100644 --- a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java +++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java @@ -87,27 +87,22 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl return isReusePortAvailable; } - private static volatile Set> socketOptions; - /** - * Returns a set of SocketOptions supported by this impl - * and by this impl's socket (Socket or ServerSocket) + * Returns a set of SocketOptions supported by this impl and by this impl's + * socket (Socket or ServerSocket) * * @return a Set of SocketOptions */ @Override protected Set> supportedOptions() { - Set> options = socketOptions; - if (options == null) { - if (isReusePortAvailable()) { - options = new HashSet<>(); - options.addAll(super.supportedOptions()); - options.add(StandardSocketOptions.SO_REUSEPORT); - options = Collections.unmodifiableSet(options); - } else { - options = super.supportedOptions(); - } - socketOptions = options; + Set> options; + if (isReusePortAvailable()) { + options = new HashSet<>(); + options.addAll(super.supportedOptions()); + options.add(StandardSocketOptions.SO_REUSEPORT); + options = Collections.unmodifiableSet(options); + } else { + options = super.supportedOptions(); } return options; } diff --git a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java index c9afa2657a2..465ec01cc37 100644 --- a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java +++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java @@ -104,27 +104,22 @@ abstract class AbstractPlainSocketImpl extends SocketImpl return isReusePortAvailable; } - private static volatile Set> socketOptions; - - /** - * Returns a set of SocketOptions supported by this impl - * and by this impl's socket (Socket or ServerSocket) - * - * @return a Set of SocketOptions - */ + /** + * Returns a set of SocketOptions supported by this impl and by this impl's + * socket (Socket or ServerSocket) + * + * @return a Set of SocketOptions + */ @Override protected Set> supportedOptions() { - Set> options = socketOptions; - if (options == null) { - if (isReusePortAvailable()) { - options = new HashSet<>(); - options.addAll(super.supportedOptions()); - options.add(StandardSocketOptions.SO_REUSEPORT); - options = Collections.unmodifiableSet(options); - } else { - options = super.supportedOptions(); - } - socketOptions = options; + Set> options; + if (isReusePortAvailable()) { + options = new HashSet<>(); + options.addAll(super.supportedOptions()); + options.add(StandardSocketOptions.SO_REUSEPORT); + options = Collections.unmodifiableSet(options); + } else { + options = super.supportedOptions(); } return options; } diff --git a/jdk/src/java.base/share/classes/java/net/MulticastSocket.java b/jdk/src/java.base/share/classes/java/net/MulticastSocket.java index 365092b1e07..9c9e4b8f53a 100644 --- a/jdk/src/java.base/share/classes/java/net/MulticastSocket.java +++ b/jdk/src/java.base/share/classes/java/net/MulticastSocket.java @@ -26,7 +26,9 @@ package java.net; import java.io.IOException; +import java.util.Collections; import java.util.Enumeration; +import java.util.Set; /** * The multicast datagram socket class is useful for sending @@ -716,4 +718,24 @@ class MulticastSocket extends DatagramSocket { } // synch p } //synch ttl } //method + + private static Set> options; + private static boolean optionsSet = false; + + @Override + public Set> supportedOptions() { + synchronized (MulticastSocket.class) { + if (optionsSet) { + return options; + } + try { + DatagramSocketImpl impl = getImpl(); + options = Collections.unmodifiableSet(impl.supportedOptions()); + } catch (SocketException ex) { + options = Collections.emptySet(); + } + optionsSet = true; + return options; + } + } } diff --git a/jdk/src/java.base/share/classes/java/nio/Buffer.java b/jdk/src/java.base/share/classes/java/nio/Buffer.java index d534fb3ae73..1f6bef17960 100644 --- a/jdk/src/java.base/share/classes/java/nio/Buffer.java +++ b/jdk/src/java.base/share/classes/java/nio/Buffer.java @@ -111,7 +111,7 @@ import java.util.Spliterator; * to zero. * * - *

    Clearing, flipping, and rewinding

    + *

    Additional operations

    * *

    In addition to methods for accessing the position, limit, and capacity * values and for marking and resetting, this class also defines the following @@ -131,6 +131,12 @@ import java.util.Spliterator; * it already contains: It leaves the limit unchanged and sets the position * to zero.

  • * + *
  • {@link #slice} creates a subsequence of a buffer: It leaves the + * limit and the position unchanged.

  • + * + *
  • {@link #duplicate} creates a shallow copy of a buffer: It leaves + * the limit and the position unchanged.

  • + * *
* * @@ -567,6 +573,46 @@ public abstract class Buffer { */ public abstract boolean isDirect(); + /** + * Creates a new buffer whose content is a shared subsequence of + * this buffer's content. + * + *

The content of the new buffer will start at this buffer's current + * position. Changes to this buffer's content will be visible in the new + * buffer, and vice versa; the two buffers' position, limit, and mark + * values will be independent. + * + *

The new buffer's position will be zero, its capacity and its limit + * will be the number of elements remaining in this buffer, its mark will be + * undefined. The new buffer will be direct if, and only if, this buffer is + * direct, and it will be read-only if, and only if, this buffer is + * read-only.

+ * + * @return The new buffer + * + * @since 9 + */ + public abstract Buffer slice(); + + /** + * Creates a new buffer that shares this buffer's content. + * + *

The content of the new buffer will be that of this buffer. Changes + * to this buffer's content will be visible in the new buffer, and vice + * versa; the two buffers' position, limit, and mark values will be + * independent. + * + *

The new buffer's capacity, limit, position and mark values will be + * identical to those of this buffer. The new buffer will be direct if, and + * only if, this buffer is direct, and it will be read-only if, and only if, + * this buffer is read-only.

+ * + * @return The new buffer + * + * @since 9 + */ + public abstract Buffer duplicate(); + // -- Package-private methods for bounds checking, etc. -- diff --git a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template index 104f504b551..1292ca458c6 100644 --- a/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template +++ b/jdk/src/java.base/share/classes/java/nio/X-Buffer.java.template @@ -70,8 +70,7 @@ import java.util.stream.$Streamtype$Stream; * #end[byte] * - *
  • Methods for {@link #compact compacting}, {@link - * #duplicate duplicating}, and {@link #slice slicing} + *

  • A method for {@link #compact compacting} * $a$ $type$ buffer.

  • * * @@ -535,6 +534,7 @@ public abstract class $Type$Buffer * @see #alignedSlice(int) #end[byte] */ + @Override public abstract $Type$Buffer slice(); /** @@ -557,6 +557,7 @@ public abstract class $Type$Buffer * * @return The new $type$ buffer */ + @Override public abstract $Type$Buffer duplicate(); /** diff --git a/jdk/src/java.base/share/classes/java/security/DrbgParameters.java b/jdk/src/java.base/share/classes/java/security/DrbgParameters.java index 50fa82e0313..ed62514bdf9 100644 --- a/jdk/src/java.base/share/classes/java/security/DrbgParameters.java +++ b/jdk/src/java.base/share/classes/java/security/DrbgParameters.java @@ -216,10 +216,9 @@ import java.util.Objects; *

    * If a DRBG is not instantiated with a {@link DrbgParameters.Instantiation} * object explicitly, this implementation instantiates it with a default - * requested strength of 128 bits (112 bits for CTR_DRBG with 3KeyTDEA), - * no prediction resistance request, and no personalization string. - * These default instantiation parameters can also be customized with - * the {@code securerandom.drbg.config} security property. + * requested strength of 128 bits, no prediction resistance request, and + * no personalization string. These default instantiation parameters can also + * be customized with the {@code securerandom.drbg.config} security property. *

    * This implementation reads fresh entropy from the system default entropy * source determined by the security property {@code securerandom.source}. diff --git a/jdk/src/java.base/share/classes/java/security/Provider.java b/jdk/src/java.base/share/classes/java/security/Provider.java index 9ecc8ffe6ba..de09dc49240 100644 --- a/jdk/src/java.base/share/classes/java/security/Provider.java +++ b/jdk/src/java.base/share/classes/java/security/Provider.java @@ -569,7 +569,8 @@ public abstract class Provider extends Properties { * @since 1.8 */ @Override - public synchronized void replaceAll(BiFunction function) { + public synchronized void replaceAll(BiFunction function) { check("putProviderProperty." + name); if (debug != null) { @@ -597,8 +598,8 @@ public abstract class Provider extends Properties { * @since 1.8 */ @Override - public synchronized Object compute(Object key, - BiFunction remappingFunction) { + public synchronized Object compute(Object key, BiFunction remappingFunction) { check("putProviderProperty." + name); check("removeProviderProperty" + name); @@ -628,7 +629,8 @@ public abstract class Provider extends Properties { * @since 1.8 */ @Override - public synchronized Object computeIfAbsent(Object key, Function mappingFunction) { + public synchronized Object computeIfAbsent(Object key, Function mappingFunction) { check("putProviderProperty." + name); check("removeProviderProperty" + name); @@ -657,7 +659,8 @@ public abstract class Provider extends Properties { * @since 1.8 */ @Override - public synchronized Object computeIfPresent(Object key, BiFunction remappingFunction) { + public synchronized Object computeIfPresent(Object key, BiFunction remappingFunction) { check("putProviderProperty." + name); check("removeProviderProperty" + name); @@ -689,7 +692,8 @@ public abstract class Provider extends Properties { * @since 1.8 */ @Override - public synchronized Object merge(Object key, Object value, BiFunction remappingFunction) { + public synchronized Object merge(Object key, Object value, BiFunction remappingFunction) { check("putProviderProperty." + name); check("removeProviderProperty" + name); @@ -868,18 +872,21 @@ public abstract class Provider extends Properties { } @SuppressWarnings("unchecked") // Function must actually operate over strings - private void implReplaceAll(BiFunction function) { + private void implReplaceAll(BiFunction function) { legacyChanged = true; if (legacyStrings == null) { legacyStrings = new LinkedHashMap<>(); } else { - legacyStrings.replaceAll((BiFunction) function); + legacyStrings.replaceAll((BiFunction) function); } super.replaceAll(function); } @SuppressWarnings("unchecked") // Function must actually operate over strings - private Object implMerge(Object key, Object value, BiFunction remappingFunction) { + private Object implMerge(Object key, Object value, BiFunction remappingFunction) { if ((key instanceof String) && (value instanceof String)) { if (!checkLegacy(key)) { return null; @@ -891,7 +898,8 @@ public abstract class Provider extends Properties { } @SuppressWarnings("unchecked") // Function must actually operate over strings - private Object implCompute(Object key, BiFunction remappingFunction) { + private Object implCompute(Object key, BiFunction remappingFunction) { if (key instanceof String) { if (!checkLegacy(key)) { return null; @@ -903,7 +911,8 @@ public abstract class Provider extends Properties { } @SuppressWarnings("unchecked") // Function must actually operate over strings - private Object implComputeIfAbsent(Object key, Function mappingFunction) { + private Object implComputeIfAbsent(Object key, Function mappingFunction) { if (key instanceof String) { if (!checkLegacy(key)) { return null; @@ -915,7 +924,8 @@ public abstract class Provider extends Properties { } @SuppressWarnings("unchecked") // Function must actually operate over strings - private Object implComputeIfPresent(Object key, BiFunction remappingFunction) { + private Object implComputeIfPresent(Object key, BiFunction remappingFunction) { if (key instanceof String) { if (!checkLegacy(key)) { return null; diff --git a/jdk/src/java.base/share/classes/java/time/Instant.java b/jdk/src/java.base/share/classes/java/time/Instant.java index 84056b75461..7f526e68c6b 100644 --- a/jdk/src/java.base/share/classes/java/time/Instant.java +++ b/jdk/src/java.base/share/classes/java/time/Instant.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -342,7 +342,7 @@ public final class Instant */ public static Instant ofEpochMilli(long epochMilli) { long secs = Math.floorDiv(epochMilli, 1000); - int mos = (int)Math.floorMod(epochMilli, 1000); + int mos = Math.floorMod(epochMilli, 1000); return create(secs, mos * 1000_000); } diff --git a/jdk/src/java.base/share/classes/java/time/LocalDate.java b/jdk/src/java.base/share/classes/java/time/LocalDate.java index 940f21f0f1e..62db9872bcf 100644 --- a/jdk/src/java.base/share/classes/java/time/LocalDate.java +++ b/jdk/src/java.base/share/classes/java/time/LocalDate.java @@ -826,7 +826,7 @@ public final class LocalDate * @return the day-of-week, not null */ public DayOfWeek getDayOfWeek() { - int dow0 = (int)Math.floorMod(toEpochDay() + 3, 7); + int dow0 = Math.floorMod(toEpochDay() + 3, 7); return DayOfWeek.of(dow0 + 1); } @@ -1329,7 +1329,7 @@ public final class LocalDate long monthCount = year * 12L + (month - 1); long calcMonths = monthCount + monthsToAdd; // safe overflow int newYear = YEAR.checkValidIntValue(Math.floorDiv(calcMonths, 12)); - int newMonth = (int)Math.floorMod(calcMonths, 12) + 1; + int newMonth = Math.floorMod(calcMonths, 12) + 1; return resolvePreviousValid(newYear, newMonth, day); } diff --git a/jdk/src/java.base/share/classes/java/time/LocalDateTime.java b/jdk/src/java.base/share/classes/java/time/LocalDateTime.java index 2195cae5154..0366333638d 100644 --- a/jdk/src/java.base/share/classes/java/time/LocalDateTime.java +++ b/jdk/src/java.base/share/classes/java/time/LocalDateTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -418,7 +418,7 @@ public final class LocalDateTime NANO_OF_SECOND.checkValidValue(nanoOfSecond); long localSecond = epochSecond + offset.getTotalSeconds(); // overflow caught later long localEpochDay = Math.floorDiv(localSecond, SECONDS_PER_DAY); - int secsOfDay = (int)Math.floorMod(localSecond, SECONDS_PER_DAY); + int secsOfDay = Math.floorMod(localSecond, SECONDS_PER_DAY); LocalDate date = LocalDate.ofEpochDay(localEpochDay); LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + nanoOfSecond); return new LocalDateTime(date, time); diff --git a/jdk/src/java.base/share/classes/java/time/LocalTime.java b/jdk/src/java.base/share/classes/java/time/LocalTime.java index b951c877680..4b0456adea0 100644 --- a/jdk/src/java.base/share/classes/java/time/LocalTime.java +++ b/jdk/src/java.base/share/classes/java/time/LocalTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -361,7 +361,7 @@ public final class LocalTime Objects.requireNonNull(zone, "zone"); ZoneOffset offset = zone.getRules().getOffset(instant); long localSecond = instant.getEpochSecond() + offset.getTotalSeconds(); - int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY); + int secsOfDay = Math.floorMod(localSecond, SECONDS_PER_DAY); return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano()); } diff --git a/jdk/src/java.base/share/classes/java/time/OffsetTime.java b/jdk/src/java.base/share/classes/java/time/OffsetTime.java index cbfeb19e4d4..65cf560f2bb 100644 --- a/jdk/src/java.base/share/classes/java/time/OffsetTime.java +++ b/jdk/src/java.base/share/classes/java/time/OffsetTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -258,7 +258,7 @@ public final class OffsetTime ZoneRules rules = zone.getRules(); ZoneOffset offset = rules.getOffset(instant); long localSecond = instant.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later - int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY); + int secsOfDay = Math.floorMod(localSecond, SECONDS_PER_DAY); LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano()); return new OffsetTime(time, offset); } diff --git a/jdk/src/java.base/share/classes/java/time/YearMonth.java b/jdk/src/java.base/share/classes/java/time/YearMonth.java index 2fbd95b6ff5..31c6a5a46eb 100644 --- a/jdk/src/java.base/share/classes/java/time/YearMonth.java +++ b/jdk/src/java.base/share/classes/java/time/YearMonth.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -850,7 +850,7 @@ public final class YearMonth long monthCount = year * 12L + (month - 1); long calcMonths = monthCount + monthsToAdd; // safe overflow int newYear = YEAR.checkValidIntValue(Math.floorDiv(calcMonths, 12)); - int newMonth = (int)Math.floorMod(calcMonths, 12) + 1; + int newMonth = Math.floorMod(calcMonths, 12) + 1; return with(newYear, newMonth); } diff --git a/jdk/src/java.base/share/classes/java/time/chrono/HijrahDate.java b/jdk/src/java.base/share/classes/java/time/chrono/HijrahDate.java index 9d5059eba20..60d0529f791 100644 --- a/jdk/src/java.base/share/classes/java/time/chrono/HijrahDate.java +++ b/jdk/src/java.base/share/classes/java/time/chrono/HijrahDate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -497,7 +497,7 @@ public final class HijrahDate * @return the day-of-week; computed from the epochday */ private int getDayOfWeek() { - int dow0 = (int)Math.floorMod(toEpochDay() + 3, 7); + int dow0 = Math.floorMod(toEpochDay() + 3, 7); return dow0 + 1; } diff --git a/jdk/src/java.base/share/classes/java/util/Currency.java b/jdk/src/java.base/share/classes/java/util/Currency.java index cea4cdc4f3c..6c9bbb62654 100644 --- a/jdk/src/java.base/share/classes/java/util/Currency.java +++ b/jdk/src/java.base/share/classes/java/util/Currency.java @@ -153,33 +153,13 @@ public final class Currency implements Serializable { // - bits 0-4: final char for currency code for simple country, or ID of special case // - special case IDs: // - 0: country has no currency - // - other: index into sc* arrays + 1 - // - scCutOverTimes: cut-over time in millis as returned by - // System.currentTimeMillis for special case countries that are changing - // currencies; Long.MAX_VALUE for countries that are not changing currencies - // - scOldCurrencies: old currencies for special case countries - // - scNewCurrencies: new currencies for special case countries that are - // changing currencies; null for others - // - scOldCurrenciesDFD: default fraction digits for old currencies - // - scNewCurrenciesDFD: default fraction digits for new currencies, 0 for - // countries that are not changing currencies - // - otherCurrencies: concatenation of all currency codes that are not the - // main currency of a simple country, separated by "-" - // - otherCurrenciesDFD: decimal format digits for currencies in otherCurrencies, same order + // - other: index into specialCasesList static int formatVersion; static int dataVersion; static int[] mainTable; - static long[] scCutOverTimes; - static String[] scOldCurrencies; - static String[] scNewCurrencies; - static int[] scOldCurrenciesDFD; - static int[] scNewCurrenciesDFD; - static int[] scOldCurrenciesNumericCode; - static int[] scNewCurrenciesNumericCode; - static String otherCurrencies; - static int[] otherCurrenciesDFD; - static int[] otherCurrenciesNumericCode; + static List specialCasesList; + static List otherCurrenciesList; // handy constants - must match definitions in GenerateCurrencyData // magic number @@ -214,7 +194,7 @@ public final class Currency implements Serializable { private static final int NUMERIC_CODE_SHIFT = 10; // Currency data format version - private static final int VALID_FORMAT_VERSION = 2; + private static final int VALID_FORMAT_VERSION = 3; static { AccessController.doPrivileged(new PrivilegedAction<>() { @@ -236,17 +216,9 @@ public final class Currency implements Serializable { dataVersion = dis.readInt(); mainTable = readIntArray(dis, A_TO_Z * A_TO_Z); int scCount = dis.readInt(); - scCutOverTimes = readLongArray(dis, scCount); - scOldCurrencies = readStringArray(dis, scCount); - scNewCurrencies = readStringArray(dis, scCount); - scOldCurrenciesDFD = readIntArray(dis, scCount); - scNewCurrenciesDFD = readIntArray(dis, scCount); - scOldCurrenciesNumericCode = readIntArray(dis, scCount); - scNewCurrenciesNumericCode = readIntArray(dis, scCount); + specialCasesList = readSpecialCases(dis, scCount); int ocCount = dis.readInt(); - otherCurrencies = dis.readUTF(); - otherCurrenciesDFD = readIntArray(dis, ocCount); - otherCurrenciesNumericCode = readIntArray(dis, ocCount); + otherCurrenciesList = readOtherCurrencies(dis, ocCount); } } catch (IOException e) { throw new InternalError(e); @@ -329,6 +301,7 @@ public final class Currency implements Serializable { // Currency code not internally generated, need to verify first // A currency code must have 3 characters and exist in the main table // or in the list of other currencies. + boolean found = false; if (currencyCode.length() != 3) { throw new IllegalArgumentException(); } @@ -340,17 +313,23 @@ public final class Currency implements Serializable { && currencyCode.charAt(2) - 'A' == (tableEntry & SIMPLE_CASE_COUNTRY_FINAL_CHAR_MASK)) { defaultFractionDigits = (tableEntry & SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_MASK) >> SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT; numericCode = (tableEntry & NUMERIC_CODE_MASK) >> NUMERIC_CODE_SHIFT; - } else { - // Check for '-' separately so we don't get false hits in the table. - if (currencyCode.charAt(2) == '-') { + found = true; + } else { //special case + int[] fractionAndNumericCode = SpecialCaseEntry.findEntry(currencyCode); + if (fractionAndNumericCode != null) { + defaultFractionDigits = fractionAndNumericCode[0]; + numericCode = fractionAndNumericCode[1]; + found = true; + } + } + + if (!found) { + OtherCurrencyEntry ocEntry = OtherCurrencyEntry.findEntry(currencyCode); + if (ocEntry == null) { throw new IllegalArgumentException(); } - int index = otherCurrencies.indexOf(currencyCode); - if (index == -1) { - throw new IllegalArgumentException(); - } - defaultFractionDigits = otherCurrenciesDFD[index / 4]; - numericCode = otherCurrenciesNumericCode[index / 4]; + defaultFractionDigits = ocEntry.fraction; + numericCode = ocEntry.numericCode; } } @@ -410,13 +389,17 @@ public final class Currency implements Serializable { if (tableEntry == COUNTRY_WITHOUT_CURRENCY_ENTRY) { return null; } else { - int index = (tableEntry & SPECIAL_CASE_COUNTRY_INDEX_MASK) - SPECIAL_CASE_COUNTRY_INDEX_DELTA; - if (scCutOverTimes[index] == Long.MAX_VALUE || System.currentTimeMillis() < scCutOverTimes[index]) { - return getInstance(scOldCurrencies[index], scOldCurrenciesDFD[index], - scOldCurrenciesNumericCode[index]); + int index = SpecialCaseEntry.toIndex(tableEntry); + SpecialCaseEntry scEntry = specialCasesList.get(index); + if (scEntry.cutOverTime == Long.MAX_VALUE + || System.currentTimeMillis() < scEntry.cutOverTime) { + return getInstance(scEntry.oldCurrency, + scEntry.oldCurrencyFraction, + scEntry.oldCurrencyNumericCode); } else { - return getInstance(scNewCurrencies[index], scNewCurrenciesDFD[index], - scNewCurrenciesNumericCode[index]); + return getInstance(scEntry.newCurrency, + scEntry.newCurrencyFraction, + scEntry.newCurrencyNumericCode); } } } @@ -451,14 +434,29 @@ public final class Currency implements Serializable { sb.append(c2); sb.append(finalChar); available.add(getInstance(sb.toString(), defaultFractionDigits, numericCode)); + } else if ((tableEntry & COUNTRY_TYPE_MASK) == SPECIAL_CASE_COUNTRY_MASK + && tableEntry != INVALID_COUNTRY_ENTRY + && tableEntry != COUNTRY_WITHOUT_CURRENCY_ENTRY) { + int index = SpecialCaseEntry.toIndex(tableEntry); + SpecialCaseEntry scEntry = specialCasesList.get(index); + + if (scEntry.cutOverTime == Long.MAX_VALUE + || System.currentTimeMillis() < scEntry.cutOverTime) { + available.add(getInstance(scEntry.oldCurrency, + scEntry.oldCurrencyFraction, + scEntry.oldCurrencyNumericCode)); + } else { + available.add(getInstance(scEntry.newCurrency, + scEntry.newCurrencyFraction, + scEntry.newCurrencyNumericCode)); + } } } } // Now add other currencies - StringTokenizer st = new StringTokenizer(otherCurrencies, "-"); - while (st.hasMoreElements()) { - available.add(getInstance((String)st.nextElement())); + for (OtherCurrencyEntry entry : otherCurrenciesList) { + available.add(getInstance(entry.currencyCode)); } } } @@ -521,15 +519,15 @@ public final class Currency implements Serializable { } /** - * Gets the default number of fraction digits used with this currency. - * Note that the number of fraction digits is the same as ISO 4217's - * minor unit for the currency. - * For example, the default number of fraction digits for the Euro is 2, - * while for the Japanese Yen it's 0. - * In the case of pseudo-currencies, such as IMF Special Drawing Rights, - * -1 is returned. - * - * @return the default number of fraction digits used with this currency + * Gets the default number of fraction digits used with this currency. + * Note that the number of fraction digits is the same as ISO 4217's + * minor unit for the currency. + * For example, the default number of fraction digits for the Euro is 2, + * while for the Japanese Yen it's 0. + * In the case of pseudo-currencies, such as IMF Special Drawing Rights, + * -1 is returned. + * + * @return the default number of fraction digits used with this currency */ public int getDefaultFractionDigits() { return defaultFractionDigits; @@ -693,22 +691,55 @@ public final class Currency implements Serializable { return ret; } - private static long[] readLongArray(DataInputStream dis, int count) throws IOException { - long[] ret = new long[count]; - for (int i = 0; i < count; i++) { - ret[i] = dis.readLong(); - } + private static List readSpecialCases(DataInputStream dis, + int count) + throws IOException { - return ret; + List list = new ArrayList<>(count); + long cutOverTime; + String oldCurrency; + String newCurrency; + int oldCurrencyFraction; + int newCurrencyFraction; + int oldCurrencyNumericCode; + int newCurrencyNumericCode; + + for (int i = 0; i < count; i++) { + cutOverTime = dis.readLong(); + oldCurrency = dis.readUTF(); + newCurrency = dis.readUTF(); + oldCurrencyFraction = dis.readInt(); + newCurrencyFraction = dis.readInt(); + oldCurrencyNumericCode = dis.readInt(); + newCurrencyNumericCode = dis.readInt(); + SpecialCaseEntry sc = new SpecialCaseEntry(cutOverTime, + oldCurrency, newCurrency, + oldCurrencyFraction, newCurrencyFraction, + oldCurrencyNumericCode, newCurrencyNumericCode); + list.add(sc); + } + return list; } - private static String[] readStringArray(DataInputStream dis, int count) throws IOException { - String[] ret = new String[count]; - for (int i = 0; i < count; i++) { - ret[i] = dis.readUTF(); - } + private static List readOtherCurrencies(DataInputStream dis, + int count) + throws IOException { - return ret; + List list = new ArrayList<>(count); + String currencyCode; + int fraction; + int numericCode; + + for (int i = 0; i < count; i++) { + currencyCode = dis.readUTF(); + fraction = dis.readInt(); + numericCode = dis.readInt(); + OtherCurrencyEntry oc = new OtherCurrencyEntry(currencyCode, + fraction, + numericCode); + list.add(oc); + } + return list; } /** @@ -766,21 +797,27 @@ public final class Currency implements Serializable { return; } - int index; - for (index = 0; index < scOldCurrencies.length; index++) { - if (scOldCurrencies[index].equals(code)) { - break; - } + int index = SpecialCaseEntry.indexOf(code, fraction, numeric); + + /* if a country switches from simple case to special case or + * one special case to other special case which is not present + * in the sc arrays then insert the new entry in special case arrays + */ + if (index == -1 && (ctry.charAt(0) != code.charAt(0) + || ctry.charAt(1) != code.charAt(1))) { + + specialCasesList.add(new SpecialCaseEntry(code, fraction, numeric)); + index = specialCasesList.size() - 1; } - if (index == scOldCurrencies.length) { + if (index == -1) { // simple case - entry |= (fraction << SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT) | - (code.charAt(2) - 'A'); + entry |= (fraction << SIMPLE_CASE_COUNTRY_DEFAULT_DIGITS_SHIFT) + | (code.charAt(2) - 'A'); } else { // special case - entry |= SPECIAL_CASE_COUNTRY_MASK | - (index + SPECIAL_CASE_COUNTRY_INDEX_DELTA); + entry = SPECIAL_CASE_COUNTRY_MASK + | (index + SPECIAL_CASE_COUNTRY_INDEX_DELTA); } setMainTableEntry(ctry.charAt(0), ctry.charAt(1), entry); } @@ -814,5 +851,128 @@ public final class Currency implements Serializable { } } } + + /* Used to represent a special case currency entry + * - cutOverTime: cut-over time in millis as returned by + * System.currentTimeMillis for special case countries that are changing + * currencies; Long.MAX_VALUE for countries that are not changing currencies + * - oldCurrency: old currencies for special case countries + * - newCurrency: new currencies for special case countries that are + * changing currencies; null for others + * - oldCurrencyFraction: default fraction digits for old currencies + * - newCurrencyFraction: default fraction digits for new currencies, 0 for + * countries that are not changing currencies + * - oldCurrencyNumericCode: numeric code for old currencies + * - newCurrencyNumericCode: numeric code for new currencies, 0 for countries + * that are not changing currencies + */ + private static class SpecialCaseEntry { + + final private long cutOverTime; + final private String oldCurrency; + final private String newCurrency; + final private int oldCurrencyFraction; + final private int newCurrencyFraction; + final private int oldCurrencyNumericCode; + final private int newCurrencyNumericCode; + + private SpecialCaseEntry(long cutOverTime, String oldCurrency, String newCurrency, + int oldCurrencyFraction, int newCurrencyFraction, + int oldCurrencyNumericCode, int newCurrencyNumericCode) { + this.cutOverTime = cutOverTime; + this.oldCurrency = oldCurrency; + this.newCurrency = newCurrency; + this.oldCurrencyFraction = oldCurrencyFraction; + this.newCurrencyFraction = newCurrencyFraction; + this.oldCurrencyNumericCode = oldCurrencyNumericCode; + this.newCurrencyNumericCode = newCurrencyNumericCode; + } + + private SpecialCaseEntry(String currencyCode, int fraction, + int numericCode) { + this(Long.MAX_VALUE, currencyCode, "", fraction, 0, numericCode, 0); + } + + //get the index of the special case entry + private static int indexOf(String code, int fraction, int numeric) { + int size = specialCasesList.size(); + for (int index = 0; index < size; index++) { + SpecialCaseEntry scEntry = specialCasesList.get(index); + if (scEntry.oldCurrency.equals(code) + && scEntry.oldCurrencyFraction == fraction + && scEntry.oldCurrencyNumericCode == numeric + && scEntry.cutOverTime == Long.MAX_VALUE) { + return index; + } + } + return -1; + } + + // get the fraction and numericCode of the sc currencycode + private static int[] findEntry(String code) { + int[] fractionAndNumericCode = null; + int size = specialCasesList.size(); + for (int index = 0; index < size; index++) { + SpecialCaseEntry scEntry = specialCasesList.get(index); + if (scEntry.oldCurrency.equals(code) && (scEntry.cutOverTime == Long.MAX_VALUE + || System.currentTimeMillis() < scEntry.cutOverTime)) { + //consider only when there is no new currency or cutover time is not passed + fractionAndNumericCode = new int[2]; + fractionAndNumericCode[0] = scEntry.oldCurrencyFraction; + fractionAndNumericCode[1] = scEntry.oldCurrencyNumericCode; + break; + } else if (scEntry.newCurrency.equals(code) + && System.currentTimeMillis() >= scEntry.cutOverTime) { + //consider only if the cutover time is passed + fractionAndNumericCode = new int[2]; + fractionAndNumericCode[0] = scEntry.newCurrencyFraction; + fractionAndNumericCode[1] = scEntry.newCurrencyNumericCode; + break; + } + } + return fractionAndNumericCode; + } + + // convert the special case entry to sc arrays index + private static int toIndex(int tableEntry) { + return (tableEntry & SPECIAL_CASE_COUNTRY_INDEX_MASK) - SPECIAL_CASE_COUNTRY_INDEX_DELTA; + } + + } + + /* Used to represent Other currencies + * - currencyCode: currency codes that are not the main currency + * of a simple country + * - otherCurrenciesDFD: decimal format digits for other currencies + * - otherCurrenciesNumericCode: numeric code for other currencies + */ + private static class OtherCurrencyEntry { + + final private String currencyCode; + final private int fraction; + final private int numericCode; + + private OtherCurrencyEntry(String currencyCode, int fraction, + int numericCode) { + this.currencyCode = currencyCode; + this.fraction = fraction; + this.numericCode = numericCode; + } + + //get the instance of the other currency code + private static OtherCurrencyEntry findEntry(String code) { + int size = otherCurrenciesList.size(); + for (int index = 0; index < size; index++) { + OtherCurrencyEntry ocEntry = otherCurrenciesList.get(index); + if (ocEntry.currencyCode.equalsIgnoreCase(code)) { + return ocEntry; + } + } + return null; + } + + } + } + diff --git a/jdk/src/java.base/share/classes/java/util/Hashtable.java b/jdk/src/java.base/share/classes/java/util/Hashtable.java index 6ad2f3a933c..b541ca12a06 100644 --- a/jdk/src/java.base/share/classes/java/util/Hashtable.java +++ b/jdk/src/java.base/share/classes/java/util/Hashtable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 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 @@ -229,6 +229,14 @@ public class Hashtable putAll(t); } + /** + * A constructor chained from {@link Properties} keeps Hashtable fields + * uninitialized since they are not used. + * + * @param dummy a dummy parameter + */ + Hashtable(Void dummy) {} + /** * Returns the number of keys in this hashtable. * @@ -549,18 +557,23 @@ public class Hashtable * @return a clone of the hashtable */ public synchronized Object clone() { + Hashtable t = cloneHashtable(); + t.table = new Entry[table.length]; + for (int i = table.length ; i-- > 0 ; ) { + t.table[i] = (table[i] != null) + ? (Entry) table[i].clone() : null; + } + t.keySet = null; + t.entrySet = null; + t.values = null; + t.modCount = 0; + return t; + } + + /** Calls super.clone() */ + final Hashtable cloneHashtable() { try { - Hashtable t = (Hashtable)super.clone(); - t.table = new Entry[table.length]; - for (int i = table.length ; i-- > 0 ; ) { - t.table[i] = (table[i] != null) - ? (Entry) table[i].clone() : null; - } - t.keySet = null; - t.entrySet = null; - t.values = null; - t.modCount = 0; - return t; + return (Hashtable)super.clone(); } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(e); @@ -1189,6 +1202,15 @@ public class Hashtable */ private void writeObject(java.io.ObjectOutputStream s) throws IOException { + writeHashtable(s); + } + + /** + * Perform serialization of the Hashtable to an ObjectOutputStream. + * The Properties class overrides this method. + */ + void writeHashtable(java.io.ObjectOutputStream s) + throws IOException { Entry entryStack = null; synchronized (this) { @@ -1218,12 +1240,30 @@ public class Hashtable } } + /** + * Called by Properties to write out a simulated threshold and loadfactor. + */ + final void defaultWriteHashtable(java.io.ObjectOutputStream s, int length, + float loadFactor) throws IOException { + this.threshold = (int)Math.min(length * loadFactor, MAX_ARRAY_SIZE + 1); + this.loadFactor = loadFactor; + s.defaultWriteObject(); + } + /** * Reconstitute the Hashtable from a stream (i.e., deserialize it). */ private void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException - { + throws IOException, ClassNotFoundException { + readHashtable(s); + } + + /** + * Perform deserialization of the Hashtable from an ObjectInputStream. + * The Properties class overrides this method. + */ + void readHashtable(java.io.ObjectInputStream s) + throws IOException, ClassNotFoundException { // Read in the threshold and loadFactor s.defaultReadObject(); diff --git a/jdk/src/java.base/share/classes/java/util/Objects.java b/jdk/src/java.base/share/classes/java/util/Objects.java index 28b39d08969..dad583b9206 100644 --- a/jdk/src/java.base/share/classes/java/util/Objects.java +++ b/jdk/src/java.base/share/classes/java/util/Objects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -25,10 +25,9 @@ package java.util; -import jdk.internal.HotSpotIntrinsicCandidate; +import jdk.internal.util.Preconditions; +import jdk.internal.vm.annotation.ForceInline; -import java.util.function.BiFunction; -import java.util.function.Function; import java.util.function.Supplier; /** @@ -348,172 +347,6 @@ public final class Objects { return obj; } - /** - * Maps out-of-bounds values to a runtime exception. - * - * @param checkKind the kind of bounds check, whose name may correspond - * to the name of one of the range check methods, checkIndex, - * checkFromToIndex, checkFromIndexSize - * @param args the out-of-bounds arguments that failed the range check. - * If the checkKind corresponds a the name of a range check method - * then the bounds arguments are those that can be passed in order - * to the method. - * @param oobef the exception formatter that when applied with a checkKind - * and a list out-of-bounds arguments returns a runtime exception. - * If {@code null} then, it is as if an exception formatter was - * supplied that returns {@link IndexOutOfBoundsException} for any - * given arguments. - * @return the runtime exception - */ - private static RuntimeException outOfBounds( - BiFunction, ? extends RuntimeException> oobef, - String checkKind, - Integer... args) { - List largs = List.of(args); - RuntimeException e = oobef == null - ? null : oobef.apply(checkKind, largs); - return e == null - ? new IndexOutOfBoundsException(outOfBoundsMessage(checkKind, largs)) : e; - } - - // Specific out-of-bounds exception producing methods that avoid - // the varargs-based code in the critical methods there by reducing their - // the byte code size, and therefore less likely to peturb inlining - - private static RuntimeException outOfBoundsCheckIndex( - BiFunction, ? extends RuntimeException> oobe, - int index, int length) { - return outOfBounds(oobe, "checkIndex", index, length); - } - - private static RuntimeException outOfBoundsCheckFromToIndex( - BiFunction, ? extends RuntimeException> oobe, - int fromIndex, int toIndex, int length) { - return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length); - } - - private static RuntimeException outOfBoundsCheckFromIndexSize( - BiFunction, ? extends RuntimeException> oobe, - int fromIndex, int size, int length) { - return outOfBounds(oobe, "checkFromIndexSize", fromIndex, size, length); - } - - /** - * Returns an out-of-bounds exception formatter from an given exception - * factory. The exception formatter is a function that formats an - * out-of-bounds message from its arguments and applies that message to the - * given exception factory to produce and relay an exception. - * - *

    The exception formatter accepts two arguments: a {@code String} - * describing the out-of-bounds range check that failed, referred to as the - * check kind; and a {@code List} containing the - * out-of-bound integer values that failed the check. The list of - * out-of-bound values is not modified. - * - *

    Three check kinds are supported {@code checkIndex}, - * {@code checkFromToIndex} and {@code checkFromIndexSize} corresponding - * respectively to the specified application of an exception formatter as an - * argument to the out-of-bounds range check methods - * {@link #checkIndex(int, int, BiFunction) checkIndex}, - * {@link #checkFromToIndex(int, int, int, BiFunction) checkFromToIndex}, and - * {@link #checkFromIndexSize(int, int, int, BiFunction) checkFromIndexSize}. - * Thus a supported check kind corresponds to a method name and the - * out-of-bound integer values correspond to method argument values, in - * order, preceding the exception formatter argument (similar in many - * respects to the form of arguments required for a reflective invocation of - * such a range check method). - * - *

    Formatter arguments conforming to such supported check kinds will - * produce specific exception messages describing failed out-of-bounds - * checks. Otherwise, more generic exception messages will be produced in - * any of the following cases: the check kind is supported but fewer - * or more out-of-bounds values are supplied, the check kind is not - * supported, the check kind is {@code null}, or the list of out-of-bound - * values is {@code null}. - * - * @apiNote - * This method produces an out-of-bounds exception formatter that can be - * passed as an argument to any of the supported out-of-bounds range check - * methods declared by {@code Objects}. For example, a formatter producing - * an {@code ArrayIndexOutOfBoundsException} may be produced and stored on a - * {@code static final} field as follows: - *

    {@code
    -     * static final
    -     * BiFunction, ArrayIndexOutOfBoundsException> AIOOBEF =
    -     *     outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new);
    -     * }
    - * The formatter instance {@code AIOOBEF} may be passed as an argument to an - * out-of-bounds range check method, such as checking if an {@code index} - * is within the bounds of a {@code limit}: - *
    {@code
    -     * checkIndex(index, limit, AIOOBEF);
    -     * }
    - * If the bounds check fails then the range check method will throw an - * {@code ArrayIndexOutOfBoundsException} with an appropriate exception - * message that is a produced from {@code AIOOBEF} as follows: - *
    {@code
    -     * AIOOBEF.apply("checkIndex", List.of(index, limit));
    -     * }
    - * - * @param f the exception factory, that produces an exception from a message - * where the message is produced and formatted by the returned - * exception formatter. If this factory is stateless and side-effect - * free then so is the returned formatter. - * Exceptions thrown by the factory are relayed to the caller - * of the returned formatter. - * @param the type of runtime exception to be returned by the given - * exception factory and relayed by the exception formatter - * @return the out-of-bounds exception formatter - */ - public static - BiFunction, X> outOfBoundsExceptionFormatter(Function f) { - // Use anonymous class to avoid bootstrap issues if this method is - // used early in startup - return new BiFunction, X>() { - @Override - public X apply(String checkKind, List args) { - return f.apply(outOfBoundsMessage(checkKind, args)); - } - }; - } - - private static String outOfBoundsMessage(String checkKind, List args) { - if (checkKind == null && args == null) { - return String.format("Range check failed"); - } else if (checkKind == null) { - return String.format("Range check failed: %s", args); - } else if (args == null) { - return String.format("Range check failed: %s", checkKind); - } - - int argSize = 0; - switch (checkKind) { - case "checkIndex": - argSize = 2; - break; - case "checkFromToIndex": - case "checkFromIndexSize": - argSize = 3; - break; - default: - } - - // Switch to default if fewer or more arguments than required are supplied - switch ((args.size() != argSize) ? "" : checkKind) { - case "checkIndex": - return String.format("Index %d out-of-bounds for length %d", - args.get(0), args.get(1)); - case "checkFromToIndex": - return String.format("Range [%d, %d) out-of-bounds for length %d", - args.get(0), args.get(1), args.get(2)); - case "checkFromIndexSize": - return String.format("Range [%d, %{@code length < 0}, which is implied from the former inequalities * * - *

    This method behaves as if {@link #checkIndex(int, int, BiFunction)} - * was called with same out-of-bounds arguments and an exception formatter - * argument produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may - * be more efficient). - * * @param index the index * @param length the upper-bound (exclusive) of the range * @return {@code index} if it is within bounds of the range * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds * @since 9 */ + @ForceInline public static int checkIndex(int index, int length) { - return checkIndex(index, length, null); - } - - /** - * Checks if the {@code index} is within the bounds of the range from - * {@code 0} (inclusive) to {@code length} (exclusive). - * - *

    The {@code index} is defined to be out-of-bounds if any of the - * following inequalities is true: - *

      - *
    • {@code index < 0}
    • - *
    • {@code index >= length}
    • - *
    • {@code length < 0}, which is implied from the former inequalities
    • - *
    - * - *

    If the {@code index} is out-of-bounds, then a runtime exception is - * thrown that is the result of applying the following arguments to the - * exception formatter: the name of this method, {@code checkIndex}; - * and an unmodifiable list integers whose values are, in order, the - * out-of-bounds arguments {@code index} and {@code length}. - * - * @param the type of runtime exception to throw if the arguments are - * out-of-bounds - * @param index the index - * @param length the upper-bound (exclusive) of the range - * @param oobef the exception formatter that when applied with this - * method name and out-of-bounds arguments returns a runtime - * exception. If {@code null} or returns {@code null} then, it is as - * if an exception formatter produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used - * instead (though it may be more efficient). - * Exceptions thrown by the formatter are relayed to the caller. - * @return {@code index} if it is within bounds of the range - * @throws X if the {@code index} is out-of-bounds and the exception - * formatter is non-{@code null} - * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds - * and the exception formatter is {@code null} - * @since 9 - * - * @implNote - * This method is made intrinsic in optimizing compilers to guide them to - * perform unsigned comparisons of the index and length when it is known the - * length is a non-negative value (such as that of an array length or from - * the upper bound of a loop) - */ - @HotSpotIntrinsicCandidate - public static - int checkIndex(int index, int length, - BiFunction, X> oobef) { - if (index < 0 || index >= length) - throw outOfBoundsCheckIndex(oobef, index, length); - return index; + return Preconditions.checkIndex(index, length, null); } /** @@ -608,12 +385,6 @@ public final class Objects { *

  • {@code length < 0}, which is implied from the former inequalities
  • * * - *

    This method behaves as if {@link #checkFromToIndex(int, int, int, BiFunction)} - * was called with same out-of-bounds arguments and an exception formatter - * argument produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may - * be more efficient). - * * @param fromIndex the lower-bound (inclusive) of the sub-range * @param toIndex the upper-bound (exclusive) of the sub-range * @param length the upper-bound (exclusive) the range @@ -623,54 +394,7 @@ public final class Objects { */ public static int checkFromToIndex(int fromIndex, int toIndex, int length) { - return checkFromToIndex(fromIndex, toIndex, length, null); - } - - /** - * Checks if the sub-range from {@code fromIndex} (inclusive) to - * {@code toIndex} (exclusive) is within the bounds of range from {@code 0} - * (inclusive) to {@code length} (exclusive). - * - *

    The sub-range is defined to be out-of-bounds if any of the following - * inequalities is true: - *

      - *
    • {@code fromIndex < 0}
    • - *
    • {@code fromIndex > toIndex}
    • - *
    • {@code toIndex > length}
    • - *
    • {@code length < 0}, which is implied from the former inequalities
    • - *
    - * - *

    If the sub-range is out-of-bounds, then a runtime exception is - * thrown that is the result of applying the following arguments to the - * exception formatter: the name of this method, {@code checkFromToIndex}; - * and an unmodifiable list integers whose values are, in order, the - * out-of-bounds arguments {@code fromIndex}, {@code toIndex}, and {@code length}. - * - * @param the type of runtime exception to throw if the arguments are - * out-of-bounds - * @param fromIndex the lower-bound (inclusive) of the sub-range - * @param toIndex the upper-bound (exclusive) of the sub-range - * @param length the upper-bound (exclusive) the range - * @param oobef the exception formatter that when applied with this - * method name and out-of-bounds arguments returns a runtime - * exception. If {@code null} or returns {@code null} then, it is as - * if an exception formatter produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used - * instead (though it may be more efficient). - * Exceptions thrown by the formatter are relayed to the caller. - * @return {@code fromIndex} if the sub-range within bounds of the range - * @throws X if the sub-range is out-of-bounds and the exception factory - * function is non-{@code null} - * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and - * the exception factory function is {@code null} - * @since 9 - */ - public static - int checkFromToIndex(int fromIndex, int toIndex, int length, - BiFunction, X> oobef) { - if (fromIndex < 0 || fromIndex > toIndex || toIndex > length) - throw outOfBoundsCheckFromToIndex(oobef, fromIndex, toIndex, length); - return fromIndex; + return Preconditions.checkFromToIndex(fromIndex, toIndex, length, null); } /** @@ -687,12 +411,6 @@ public final class Objects { *

  • {@code length < 0}, which is implied from the former inequalities
  • * * - *

    This method behaves as if {@link #checkFromIndexSize(int, int, int, BiFunction)} - * was called with same out-of-bounds arguments and an exception formatter - * argument produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} (though it may - * be more efficient). - * * @param fromIndex the lower-bound (inclusive) of the sub-interval * @param size the size of the sub-range * @param length the upper-bound (exclusive) of the range @@ -702,54 +420,7 @@ public final class Objects { */ public static int checkFromIndexSize(int fromIndex, int size, int length) { - return checkFromIndexSize(fromIndex, size, length, null); + return Preconditions.checkFromIndexSize(fromIndex, size, length, null); } - /** - * Checks if the sub-range from {@code fromIndex} (inclusive) to - * {@code fromIndex + size} (exclusive) is within the bounds of range from - * {@code 0} (inclusive) to {@code length} (exclusive). - * - *

    The sub-range is defined to be out-of-bounds if any of the following - * inequalities is true: - *

      - *
    • {@code fromIndex < 0}
    • - *
    • {@code size < 0}
    • - *
    • {@code fromIndex + size > length}, taking into account integer overflow
    • - *
    • {@code length < 0}, which is implied from the former inequalities
    • - *
    - * - *

    If the sub-range is out-of-bounds, then a runtime exception is - * thrown that is the result of applying the following arguments to the - * exception formatter: the name of this method, {@code checkFromIndexSize}; - * and an unmodifiable list integers whose values are, in order, the - * out-of-bounds arguments {@code fromIndex}, {@code size}, and - * {@code length}. - * - * @param the type of runtime exception to throw if the arguments are - * out-of-bounds - * @param fromIndex the lower-bound (inclusive) of the sub-interval - * @param size the size of the sub-range - * @param length the upper-bound (exclusive) of the range - * @param oobef the exception formatter that when applied with this - * method name and out-of-bounds arguments returns a runtime - * exception. If {@code null} or returns {@code null} then, it is as - * if an exception formatter produced from an invocation of - * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used - * instead (though it may be more efficient). - * Exceptions thrown by the formatter are relayed to the caller. - * @return {@code fromIndex} if the sub-range within bounds of the range - * @throws X if the sub-range is out-of-bounds and the exception factory - * function is non-{@code null} - * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and - * the exception factory function is {@code null} - * @since 9 - */ - public static - int checkFromIndexSize(int fromIndex, int size, int length, - BiFunction, X> oobef) { - if ((length | fromIndex | size) < 0 || size > length - fromIndex) - throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length); - return fromIndex; - } } diff --git a/jdk/src/java.base/share/classes/java/util/Properties.java b/jdk/src/java.base/share/classes/java/util/Properties.java index 1eddbab3740..c2b93d250bf 100644 --- a/jdk/src/java.base/share/classes/java/util/Properties.java +++ b/jdk/src/java.base/share/classes/java/util/Properties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -34,6 +34,13 @@ import java.io.Reader; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.BufferedWriter; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.StreamCorruptedException; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Function; import jdk.internal.util.xml.PropertiesDefaultHandler; @@ -60,6 +67,13 @@ import jdk.internal.util.xml.PropertiesDefaultHandler; * object that contains a non-{@code String} key. * *

    + * The iterators returned by the {@code iterator} method of this class's + * "collection views" (that is, {@code entrySet()}, {@code keySet()}, and + * {@code values()}) may not fail-fast (unlike the Hashtable implementation). + * These iterators are guaranteed to traverse elements as they existed upon + * construction exactly once, and may (but are not guaranteed to) reflect any + * modifications subsequent to construction. + *

    * The {@link #load(java.io.Reader) load(Reader)} {@code /} * {@link #store(java.io.Writer, java.lang.String) store(Writer, String)} * methods load and store properties from and to a character based stream @@ -127,6 +141,15 @@ class Properties extends Hashtable { */ protected Properties defaults; + /** + * Properties does not store values in its inherited Hashtable, but instead + * in an internal ConcurrentHashMap. Synchronization is omitted from + * simple read operations. Writes and bulk operations remain synchronized, + * as in Hashtable. + */ + private transient ConcurrentHashMap map = + new ConcurrentHashMap<>(8); + /** * Creates an empty property list with no default values. */ @@ -140,6 +163,9 @@ class Properties extends Hashtable { * @param defaults the defaults. */ public Properties(Properties defaults) { + // use package-private constructor to + // initialize unused fields with dummy values + super((Void) null); this.defaults = defaults; } @@ -826,9 +852,9 @@ class Properties extends Hashtable { bw.write("#" + new Date().toString()); bw.newLine(); synchronized (this) { - for (Enumeration e = keys(); e.hasMoreElements();) { - String key = (String)e.nextElement(); - String val = (String)get(key); + for (Map.Entry e : entrySet()) { + String key = (String)e.getKey(); + String val = (String)e.getValue(); key = saveConvert(key, true, escUnicode); /* No need to escape embedded and trailing spaces for value, hence * pass false to flag. @@ -967,7 +993,7 @@ class Properties extends Hashtable { * @see #defaults */ public String getProperty(String key) { - Object oval = super.get(key); + Object oval = map.get(key); String sval = (oval instanceof String) ? (String)oval : null; return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval; } @@ -1029,7 +1055,7 @@ class Properties extends Hashtable { * @since 1.6 */ public Set stringPropertyNames() { - Hashtable h = new Hashtable<>(); + Map h = new HashMap<>(); enumerateStringProperties(h); return h.keySet(); } @@ -1044,11 +1070,11 @@ class Properties extends Hashtable { */ public void list(PrintStream out) { out.println("-- listing properties --"); - Hashtable h = new Hashtable<>(); + Map h = new HashMap<>(); enumerate(h); - for (Enumeration e = h.keys() ; e.hasMoreElements() ;) { - String key = e.nextElement(); - String val = (String)h.get(key); + for (Map.Entry e : h.entrySet()) { + String key = e.getKey(); + String val = (String)e.getValue(); if (val.length() > 40) { val = val.substring(0, 37) + "..."; } @@ -1072,11 +1098,11 @@ class Properties extends Hashtable { */ public void list(PrintWriter out) { out.println("-- listing properties --"); - Hashtable h = new Hashtable<>(); + Map h = new HashMap<>(); enumerate(h); - for (Enumeration e = h.keys() ; e.hasMoreElements() ;) { - String key = e.nextElement(); - String val = (String)h.get(key); + for (Map.Entry e : h.entrySet()) { + String key = e.getKey(); + String val = (String)e.getValue(); if (val.length() > 40) { val = val.substring(0, 37) + "..."; } @@ -1085,33 +1111,33 @@ class Properties extends Hashtable { } /** - * Enumerates all key/value pairs in the specified hashtable. - * @param h the hashtable + * Enumerates all key/value pairs into the specified Map. + * @param h the Map * @throws ClassCastException if any of the property keys * is not of String type. */ - private synchronized void enumerate(Hashtable h) { + private void enumerate(Map h) { if (defaults != null) { defaults.enumerate(h); } - for (Enumeration e = keys() ; e.hasMoreElements() ;) { - String key = (String)e.nextElement(); - h.put(key, get(key)); + for (Map.Entry e : entrySet()) { + String key = (String)e.getKey(); + h.put(key, e.getValue()); } } /** - * Enumerates all key/value pairs in the specified hashtable + * Enumerates all key/value pairs into the specified Map * and omits the property if the key or value is not a string. - * @param h the hashtable + * @param h the Map */ - private synchronized void enumerateStringProperties(Hashtable h) { + private void enumerateStringProperties(Map h) { if (defaults != null) { defaults.enumerateStringProperties(h); } - for (Enumeration e = keys() ; e.hasMoreElements() ;) { - Object k = e.nextElement(); - Object v = get(k); + for (Map.Entry e : entrySet()) { + Object k = e.getKey(); + Object v = e.getValue(); if (k instanceof String && v instanceof String) { h.put((String) k, (String) v); } @@ -1130,4 +1156,283 @@ class Properties extends Hashtable { private static final char[] hexDigit = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; + + // + // Hashtable methods overridden and delegated to a ConcurrentHashMap instance + + @Override + public int size() { + return map.size(); + } + + @Override + public boolean isEmpty() { + return map.isEmpty(); + } + + @Override + public Enumeration keys() { + // CHM.keys() returns Iterator w/ remove() - instead wrap keySet() + return Collections.enumeration(map.keySet()); + } + + @Override + public Enumeration elements() { + // CHM.elements() returns Iterator w/ remove() - instead wrap values() + return Collections.enumeration(map.values()); + } + + @Override + public boolean contains(Object value) { + return map.contains(value); + } + + @Override + public boolean containsValue(Object value) { + return map.containsValue(value); + } + + @Override + public boolean containsKey(Object key) { + return map.containsKey(key); + } + + @Override + public Object get(Object key) { + return map.get(key); + } + + @Override + public synchronized Object put(Object key, Object value) { + return map.put(key, value); + } + + @Override + public synchronized Object remove(Object key) { + return map.remove(key); + } + + @Override + public synchronized void putAll(Map t) { + map.putAll(t); + } + + @Override + public synchronized void clear() { + map.clear(); + } + + @Override + public synchronized String toString() { + return map.toString(); + } + + @Override + public Set keySet() { + return Collections.synchronizedSet(map.keySet(), this); + } + + @Override + public Collection values() { + return Collections.synchronizedCollection(map.values(), this); + } + + @Override + public Set> entrySet() { + return Collections.synchronizedSet(new EntrySet(map.entrySet()), this); + } + + /* + * Properties.entrySet() should not support add/addAll, however + * ConcurrentHashMap.entrySet() provides add/addAll. This class wraps the + * Set returned from CHM, changing add/addAll to throw UOE. + */ + private static class EntrySet implements Set> { + private Set> entrySet; + + private EntrySet(Set> entrySet) { + this.entrySet = entrySet; + } + + @Override public int size() { return entrySet.size(); } + @Override public boolean isEmpty() { return entrySet.isEmpty(); } + @Override public boolean contains(Object o) { return entrySet.contains(o); } + @Override public Object[] toArray() { return entrySet.toArray(); } + @Override public T[] toArray(T[] a) { return entrySet.toArray(a); } + @Override public void clear() { entrySet.clear(); } + @Override public boolean remove(Object o) { return entrySet.remove(o); } + + @Override + public boolean add(Map.Entry e) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean addAll(Collection> c) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean containsAll(Collection c) { + return entrySet.containsAll(c); + } + + @Override + public boolean removeAll(Collection c) { + return entrySet.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return entrySet.retainAll(c); + } + + @Override + public Iterator> iterator() { + return entrySet.iterator(); + } + } + + @Override + public synchronized boolean equals(Object o) { + return map.equals(o); + } + + @Override + public synchronized int hashCode() { + return map.hashCode(); + } + + @Override + public Object getOrDefault(Object key, Object defaultValue) { + return map.getOrDefault(key, defaultValue); + } + + @Override + public synchronized void forEach(BiConsumer action) { + map.forEach(action); + } + + @Override + public synchronized void replaceAll(BiFunction function) { + map.replaceAll(function); + } + + @Override + public synchronized Object putIfAbsent(Object key, Object value) { + return map.putIfAbsent(key, value); + } + + @Override + public synchronized boolean remove(Object key, Object value) { + return map.remove(key, value); + } + + /** @hidden */ + @Override + public synchronized boolean replace(Object key, Object oldValue, Object newValue) { + return map.replace(key, oldValue, newValue); + } + + @Override + public synchronized Object replace(Object key, Object value) { + return map.replace(key, value); + } + + @Override + public synchronized Object computeIfAbsent(Object key, + Function mappingFunction) { + return map.computeIfAbsent(key, mappingFunction); + } + + @Override + public synchronized Object computeIfPresent(Object key, + BiFunction remappingFunction) { + return map.computeIfPresent(key, remappingFunction); + } + + @Override + public synchronized Object compute(Object key, + BiFunction remappingFunction) { + return map.compute(key, remappingFunction); + } + + @Override + public synchronized Object merge(Object key, Object value, + BiFunction remappingFunction) { + return map.merge(key, value, remappingFunction); + } + + // + // Special Hashtable methods + + @Override + protected void rehash() { /* no-op */ } + + @Override + public synchronized Object clone() { + Properties clone = (Properties) cloneHashtable(); + clone.map = new ConcurrentHashMap<>(map); + return clone; + } + + // + // Hashtable serialization overrides + // (these should emit and consume Hashtable-compatible stream) + + @Override + void writeHashtable(ObjectOutputStream s) throws IOException { + List entryStack = new ArrayList<>(map.size() * 2); // an estimate + + for (Map.Entry entry : map.entrySet()) { + entryStack.add(entry.getValue()); + entryStack.add(entry.getKey()); + } + + // Write out the simulated threshold, loadfactor + float loadFactor = 0.75f; + int count = entryStack.size() / 2; + int length = (int)(count / loadFactor) + (count / 20) + 3; + if (length > count && (length & 1) == 0) { + length--; + } + synchronized (map) { // in case of multiple concurrent serializations + defaultWriteHashtable(s, length, loadFactor); + } + + // Write out simulated length and real count of elements + s.writeInt(length); + s.writeInt(count); + + // Write out the key/value objects from the stacked entries + for (int i = entryStack.size() - 1; i >= 0; i--) { + s.writeObject(entryStack.get(i)); + } + } + + @Override + void readHashtable(ObjectInputStream s) throws IOException, + ClassNotFoundException { + // Read in the threshold and loadfactor + s.defaultReadObject(); + + // Read the original length of the array and number of elements + int origlength = s.readInt(); + int elements = s.readInt(); + + // Validate # of elements + if (elements < 0) { + throw new StreamCorruptedException("Illegal # of Elements: " + elements); + } + + // create CHM of appropriate capacity + map = new ConcurrentHashMap<>(elements); + + // Read all the key/value objects + for (; elements > 0; elements--) { + Object key = s.readObject(); + Object value = s.readObject(); + map.put(key, value); + } + } } diff --git a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java index 5f08db7b1c4..aab2474fd66 100644 --- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -153,7 +153,7 @@ class JarFile extends ZipFile { SharedSecrets.setJavaUtilJarAccess(new JavaUtilJarAccessImpl()); BASE_VERSION = 8; // one less than lowest version for versioned entries - int runtimeVersion = jdk.Version.current().major(); + int runtimeVersion = Runtime.version().major(); String jarVersion = GetPropertyAction.privilegedGetProperty("jdk.util.jar.version"); if (jarVersion != null) { @@ -357,7 +357,7 @@ class JarFile extends ZipFile { } private boolean runtimeVersionExists() { - int version = jdk.Version.current().major(); + int version = Runtime.version().major(); try { Release.valueOf(version); return true; diff --git a/jdk/src/java.base/share/classes/java/util/regex/CharPredicates.java b/jdk/src/java.base/share/classes/java/util/regex/CharPredicates.java index 0a873c774a9..238fc6e7aeb 100644 --- a/jdk/src/java.base/share/classes/java/util/regex/CharPredicates.java +++ b/jdk/src/java.base/share/classes/java/util/regex/CharPredicates.java @@ -302,7 +302,8 @@ class CharPredicates { defCategory("C", ((1< spliterator; /** Target leaf size, common to all tasks in a computation */ - protected long targetSize; // may be laziliy initialized + protected long targetSize; // may be lazily initialized /** * The left child. diff --git a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java index 9d25d902bb4..ad250753673 100644 --- a/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java +++ b/jdk/src/java.base/share/classes/java/util/stream/DoubleStream.java @@ -211,6 +211,11 @@ public interface DoubleStream extends BaseStream { * .sum(); * } * + *

    In cases where the stream implementation is able to optimize away the + * production of some or all the elements (such as with short-circuiting + * operations like {@code findFirst}, or in the example described in + * {@link #count}), the action will not be invoked for those elements. + * * @param action a * non-interfering action to perform on the elements as * they are consumed from the stream diff --git a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java index 115a782937f..9c729772c0c 100644 --- a/jdk/src/java.base/share/classes/java/util/stream/IntStream.java +++ b/jdk/src/java.base/share/classes/java/util/stream/IntStream.java @@ -209,6 +209,11 @@ public interface IntStream extends BaseStream { * .sum(); * } * + *

    In cases where the stream implementation is able to optimize away the + * production of some or all the elements (such as with short-circuiting + * operations like {@code findFirst}, or in the example described in + * {@link #count}), the action will not be invoked for those elements. + * * @param action a * non-interfering action to perform on the elements as * they are consumed from the stream diff --git a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java index f987820c5a8..7965bfd06a6 100644 --- a/jdk/src/java.base/share/classes/java/util/stream/LongStream.java +++ b/jdk/src/java.base/share/classes/java/util/stream/LongStream.java @@ -209,6 +209,11 @@ public interface LongStream extends BaseStream { * .sum(); * } * + *

    In cases where the stream implementation is able to optimize away the + * production of some or all the elements (such as with short-circuiting + * operations like {@code findFirst}, or in the example described in + * {@link #count}), the action will not be invoked for those elements. + * * @param action a * non-interfering action to perform on the elements as * they are consumed from the stream diff --git a/jdk/src/java.base/share/classes/java/util/stream/Stream.java b/jdk/src/java.base/share/classes/java/util/stream/Stream.java index 1dd1d43f91d..7ab71a50aee 100644 --- a/jdk/src/java.base/share/classes/java/util/stream/Stream.java +++ b/jdk/src/java.base/share/classes/java/util/stream/Stream.java @@ -82,6 +82,19 @@ import java.util.function.UnaryOperator; * terminal operation is initiated, and source elements are consumed only * as needed. * + *

    A stream implementation is permitted significant latitude in optimizing + * the computation of the result. For example, a stream implementation is free + * to elide operations (or entire stages) from a stream pipeline -- and + * therefore elide invocation of behavioral parameters -- if it can prove that + * it would not affect the result of the computation. This means that + * side-effects of behavioral parameters may not always be executed and should + * not be relied upon, unless otherwise specified (such as by the terminal + * operations {@code forEach} and {@code forEachOrdered}). (For a specific + * example of such an optimization, see the API note documented on the + * {@link #count} operation. For more detail, see the + * side-effects section of the + * stream package documentation.) + * *

    Collections and streams, while bearing some superficial similarities, * have different goals. Collections are primarily concerned with the efficient * management of, and access to, their elements. By contrast, streams do not @@ -415,6 +428,11 @@ public interface Stream extends BaseStream> { * .collect(Collectors.toList()); * } * + *

    In cases where the stream implementation is able to optimize away the + * production of some or all the elements (such as with short-circuiting + * operations like {@code findFirst}, or in the example described in + * {@link #count}), the action will not be invoked for those elements. + * * @param action a * non-interfering action to perform on the elements as * they are consumed from the stream diff --git a/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java b/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java index cb92b2ebfad..8236255d5ef 100644 --- a/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java +++ b/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java @@ -28,7 +28,6 @@ import java.util.Comparator; import java.util.Objects; import java.util.Spliterator; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ForkJoinPool; import java.util.concurrent.atomic.AtomicLong; import java.util.function.BooleanSupplier; import java.util.function.Consumer; @@ -104,7 +103,7 @@ class StreamSpliterators { T_BUFFER buffer; /** - * True if full traversal has occurred (with possible cancelation). + * True if full traversal has occurred (with possible cancellation). * If doing a partial traversal, there may be still elements in buffer. */ boolean finished; diff --git a/jdk/src/java.base/share/classes/java/util/stream/package-info.java b/jdk/src/java.base/share/classes/java/util/stream/package-info.java index 2850e21bbbd..f580d8fb372 100644 --- a/jdk/src/java.base/share/classes/java/util/stream/package-info.java +++ b/jdk/src/java.base/share/classes/java/util/stream/package-info.java @@ -287,18 +287,35 @@ * statelessness requirement, as well as other thread-safety hazards. * *

    If the behavioral parameters do have side-effects, unless explicitly - * stated, there are no guarantees as to the - * visibility - * of those side-effects to other threads, nor are there any guarantees that - * different operations on the "same" element within the same stream pipeline - * are executed in the same thread. Further, the ordering of those effects - * may be surprising. Even when a pipeline is constrained to produce a - * result that is consistent with the encounter order of the stream - * source (for example, {@code IntStream.range(0,5).parallel().map(x -> x*2).toArray()} + * stated, there are no guarantees as to: + *

      + *
    • the + * visibility of those side-effects to other threads;
    • + *
    • that different operations on the "same" element within the same stream + * pipeline are executed in the same thread; and
    • + *
    • that behavioral parameters are always invoked, since a stream + * implementation is free to elide operations (or entire stages) from a + * stream pipeline if it can prove that it would not affect the result of the + * computation. + *
    • + *
    + *

    The ordering of side-effects may be surprising. Even when a pipeline is + * constrained to produce a result that is consistent with the + * encounter order of the stream source (for example, + * {@code IntStream.range(0,5).parallel().map(x -> x*2).toArray()} * must produce {@code [0, 2, 4, 6, 8]}), no guarantees are made as to the order * in which the mapper function is applied to individual elements, or in what * thread any behavioral parameter is executed for a given element. * + *

    The eliding of side-effects may also be surprising. With the exception of + * terminal operations {@link java.util.stream.Stream#forEach forEach} and + * {@link java.util.stream.Stream#forEachOrdered forEachOrdered}, side-effects + * of behavioral parameters may not always be executed when the stream + * implementation can optimize away the execution of behavioral parameters + * without affecting the result of the computation. (For a specific example + * see the API note documented on the {@link java.util.stream.Stream#count count} + * operation.) + * *

    Many computations where one might be tempted to use side effects can be more * safely and efficiently expressed without side-effects, such as using * reduction instead of mutable diff --git a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java index 1cba038d6e5..cc9153608e2 100644 --- a/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java +++ b/jdk/src/java.base/share/classes/java/util/zip/ZipFile.java @@ -54,6 +54,8 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; import jdk.internal.misc.JavaUtilZipFileAccess; import jdk.internal.misc.SharedSecrets; +import jdk.internal.misc.JavaIORandomAccessFileAccess; +import jdk.internal.misc.VM; import jdk.internal.perf.PerfCounter; import static java.util.zip.ZipConstants.*; @@ -462,9 +464,13 @@ class ZipFile implements ZipConstants, Closeable { private class ZipEntryIterator implements Enumeration, Iterator { private int i = 0; + private final int entryCount; public ZipEntryIterator() { - ensureOpen(); + synchronized (ZipFile.this) { + ensureOpen(); + this.entryCount = zsrc.total; + } } public boolean hasMoreElements() { @@ -472,10 +478,7 @@ class ZipFile implements ZipConstants, Closeable { } public boolean hasNext() { - synchronized (ZipFile.this) { - ensureOpen(); - return i < zsrc.total; - } + return i < entryCount; } public ZipEntry nextElement() { @@ -485,7 +488,7 @@ class ZipFile implements ZipConstants, Closeable { public ZipEntry next() { synchronized (ZipFile.this) { ensureOpen(); - if (i >= zsrc.total) { + if (!hasNext()) { throw new NoSuchElementException(); } // each "entry" has 3 ints in table entries @@ -526,34 +529,34 @@ class ZipFile implements ZipConstants, Closeable { /* Checks ensureOpen() before invoke this method */ private ZipEntry getZipEntry(String name, int pos) { byte[] cen = zsrc.cen; - ZipEntry e = new ZipEntry(); int nlen = CENNAM(cen, pos); int elen = CENEXT(cen, pos); int clen = CENCOM(cen, pos); - e.flag = CENFLG(cen, pos); // get the flag first - if (name != null) { - e.name = name; - } else { - if (!zc.isUTF8() && (e.flag & EFS) != 0) { - e.name = zc.toStringUTF8(cen, pos + CENHDR, nlen); + int flag = CENFLG(cen, pos); + if (name == null) { + if (!zc.isUTF8() && (flag & EFS) != 0) { + name = zc.toStringUTF8(cen, pos + CENHDR, nlen); } else { - e.name = zc.toString(cen, pos + CENHDR, nlen); + name = zc.toString(cen, pos + CENHDR, nlen); } } + ZipEntry e = new ZipEntry(name); + e.flag = flag; e.xdostime = CENTIM(cen, pos); e.crc = CENCRC(cen, pos); e.size = CENLEN(cen, pos); e.csize = CENSIZ(cen, pos); e.method = CENHOW(cen, pos); if (elen != 0) { - e.setExtra0(Arrays.copyOfRange(cen, pos + CENHDR + nlen, - pos + CENHDR + nlen + elen), true); + int start = pos + CENHDR + nlen; + e.setExtra0(Arrays.copyOfRange(cen, start, start + elen), true); } if (clen != 0) { - if (!zc.isUTF8() && (e.flag & EFS) != 0) { - e.comment = zc.toStringUTF8(cen, pos + CENHDR + nlen + elen, clen); + int start = pos + CENHDR + nlen + elen; + if (!zc.isUTF8() && (flag & EFS) != 0) { + e.comment = zc.toStringUTF8(cen, start, clen); } else { - e.comment = zc.toString(cen, pos + CENHDR + nlen + elen, clen); + e.comment = zc.toString(cen, start, clen); } } return e; @@ -804,6 +807,30 @@ class ZipFile implements ZipConstants, Closeable { } } + /** + * Returns the names of all non-directory entries that begin with + * "META-INF/" (case ignored). This method is used in JarFile, via + * SharedSecrets, as an optimization when looking up manifest and + * signature file entries. Returns null if no entries were found. + */ + private String[] getMetaInfEntryNames() { + synchronized (this) { + ensureOpen(); + if (zsrc.metanames == null) { + return null; + } + String[] names = new String[zsrc.metanames.length]; + byte[] cen = zsrc.cen; + for (int i = 0; i < names.length; i++) { + int pos = zsrc.metanames[i]; + names[i] = new String(cen, pos + CENHDR, CENNAM(cen, pos), + StandardCharsets.UTF_8); + } + return names; + } + } + + private static boolean isWindows; static { SharedSecrets.setJavaUtilZipFileAccess( new JavaUtilZipFileAccess() { @@ -815,30 +842,7 @@ class ZipFile implements ZipConstants, Closeable { } } ); - } - - /* - * Returns an array of strings representing the names of all entries - * that begin with "META-INF/" (case ignored). This method is used - * in JarFile, via SharedSecrets, as an optimization when looking up - * manifest and signature file entries. Returns null if no entries - * were found. - */ - private String[] getMetaInfEntryNames() { - synchronized (this) { - ensureOpen(); - if (zsrc.metanames.size() == 0) { - return null; - } - String[] names = new String[zsrc.metanames.size()]; - byte[] cen = zsrc.cen; - for (int i = 0; i < names.length; i++) { - int pos = zsrc.metanames.get(i); - names[i] = new String(cen, pos + CENHDR, CENNAM(cen, pos), - StandardCharsets.UTF_8); - } - return names; - } + isWindows = VM.getSavedProperty("os.name").contains("Windows"); } private static class Source { @@ -850,7 +854,7 @@ class ZipFile implements ZipConstants, Closeable { private long locpos; // position of first LOC header (usually 0) private byte[] comment; // zip file comment // list of meta entries in META-INF dir - private ArrayList metanames = new ArrayList<>(); + private int[] metanames; private final boolean startsWithLoc; // true, if zip file starts with LOCSIG (usually true) // A Hashmap for all entries. @@ -955,9 +959,16 @@ class ZipFile implements ZipConstants, Closeable { private Source(Key key, boolean toDelete) throws IOException { this.key = key; - this.zfile = new RandomAccessFile(key.file, "r"); if (toDelete) { - key.file.delete(); + if (isWindows) { + this.zfile = SharedSecrets.getJavaIORandomAccessFileAccess() + .openAndDelete(key.file, "r"); + } else { + this.zfile = new RandomAccessFile(key.file, "r"); + key.file.delete(); + } + } else { + this.zfile = new RandomAccessFile(key.file, "r"); } try { initCEN(-1); @@ -1159,7 +1170,7 @@ class ZipFile implements ZipConstants, Closeable { int next = -1; // list for all meta entries - metanames = new ArrayList<>(); + ArrayList metanamesList = null; // Iterate through the entries in the central directory int i = 0; @@ -1194,13 +1205,21 @@ class ZipFile implements ZipConstants, Closeable { idx = addEntry(idx, hash, next, pos); // Adds name to metanames. if (isMetaName(cen, pos + CENHDR, nlen)) { - metanames.add(pos); + if (metanamesList == null) + metanamesList = new ArrayList<>(4); + metanamesList.add(pos); } // skip ext and comment pos += (CENHDR + nlen + elen + clen); i++; } total = i; + if (metanamesList != null) { + metanames = new int[metanamesList.size()]; + for (int j = 0, len = metanames.length; j < len; j++) { + metanames[j] = metanamesList.get(j); + } + } if (pos + ENDHDR != cen.length) { zerror("invalid CEN header (bad header size)"); } @@ -1265,44 +1284,38 @@ class ZipFile implements ZipConstants, Closeable { } } - private static byte[] metainf = new byte[] { - 'M', 'E', 'T', 'A', '-', 'I' , 'N', 'F', '/', - }; - - /* - * Returns true if the specified entry's name begins with the string - * "META-INF/" irrespective of case. + /** + * Returns true if the bytes represent a non-directory name + * beginning with "META-INF/", disregarding ASCII case. */ - private static boolean isMetaName(byte[] name, int off, int len) { - if (len < 9 || (name[off] != 'M' && name[off] != 'm')) { // sizeof("META-INF/") - 1 - return false; - } - off++; - for (int i = 1; i < metainf.length; i++) { - byte c = name[off++]; - // Avoid toupper; it's locale-dependent - if (c >= 'a' && c <= 'z') { - c += 'A' - 'a'; - } - if (metainf[i] != c) { - return false; - } - } - return true; + private static boolean isMetaName(byte[] name, int off, int len) { + // Use the "oldest ASCII trick in the book" + return len > 9 // "META-INF/".length() + && name[off + len - 1] != '/' // non-directory + && (name[off++] | 0x20) == 'm' + && (name[off++] | 0x20) == 'e' + && (name[off++] | 0x20) == 't' + && (name[off++] | 0x20) == 'a' + && (name[off++] ) == '-' + && (name[off++] | 0x20) == 'i' + && (name[off++] | 0x20) == 'n' + && (name[off++] | 0x20) == 'f' + && (name[off] ) == '/'; } - /* - * Counts the number of CEN headers in a central directory extending - * from BEG to END. Might return a bogus answer if the zip file is - * corrupt, but will not crash. + /** + * Returns the number of CEN headers in a central directory. + * Will not throw, even if the zip file is corrupt. + * + * @param cen copy of the bytes in a zip file's central directory + * @param size number of bytes in central directory */ - static int countCENHeaders(byte[] cen, int end) { + private static int countCENHeaders(byte[] cen, int size) { int count = 0; - int pos = 0; - while (pos + CENHDR <= end) { + for (int p = 0; + p + CENHDR <= size; + p += CENHDR + CENNAM(cen, p) + CENEXT(cen, p) + CENCOM(cen, p)) count++; - pos += (CENHDR + CENNAM(cen, pos) + CENEXT(cen, pos) + CENCOM(cen, pos)); - } return count; } } diff --git a/jdk/src/java.base/share/classes/jdk/Version.java b/jdk/src/java.base/share/classes/jdk/Version.java deleted file mode 100644 index 8afccfba6a8..00000000000 --- a/jdk/src/java.base/share/classes/jdk/Version.java +++ /dev/null @@ -1,603 +0,0 @@ -/* - * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package jdk; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import sun.security.action.GetPropertyAction; - -/** - * A representation of the JDK version-string which contains a version - * number optionally followed by pre-release and build information. - * - *

    Version numbers

    - * - * A version number, {@code $VNUM}, is a non-empty sequence of - * non-negative integer numerals, without leading or trailing zeroes, - * separated by period characters (U+002E); i.e., it matches the regular - * expression {@code ^[1-9][0-9]*(((\.0)*\.[1-9][0-9]*)*)*$}. The sequence may - * be of arbitrary length but the first three elements are assigned specific - * meanings, as follows: - * - *
    - *     $MAJOR.$MINOR.$SECURITY
    - * 
    - * - *
      - * - *
    • {@code $MAJOR} --- The major version number, - * incremented for a major release that contains significant new features as - * specified in a new edition of the Java SE Platform Specification, - * e.g., JSR 337 - * for Java SE 8. Features may be removed in a major release, given - * advance notice at least one major release ahead of time, and incompatible - * changes may be made when justified. The {@code $MAJOR} version number of - * JDK 8 was {@code 8}; the {@code $MAJOR} version number of JDK 9 - * is {@code 9}.

    • - * - *
    • {@code $MINOR} --- The minor version number, - * incremented for a minor update release that may contain compatible bug - * fixes, revisions to standard APIs mandated by a Maintenance Release of - * the relevant Platform Specification, and implementation features outside - * the scope of that Specification such as new JDK-specific APIs, additional - * service providers, new garbage collectors, and ports to new hardware - * architectures. {@code $MINOR} is reset to zero when {@code $MAJOR} is - * incremented.

    • - * - *
    • {@code $SECURITY} --- The security level, - * incremented for a security-update release that contains critical fixes - * including those necessary to improve security. {@code $SECURITY} is reset - * to zero only when {@code $MAJOR} is incremented. A higher - * value of {@code $SECURITY} for a given {@code $MAJOR} value, therefore, - * always indicates a more secure release, regardless of the value of {@code - * $MINOR}.

    • - * - *
    - * - *

    The fourth and later elements of a version number are free for use by - * downstream consumers of the JDK code base. Such a consumer may, - * e.g., use the fourth element to identify patch releases which - * contain a small number of critical non-security fixes in addition to the - * security fixes in the corresponding security release.

    - * - *

    The version number does not include trailing zero elements; - * i.e., {@code $SECURITY} is omitted if it has the value zero, and - * {@code $MINOR} is omitted if both {@code $MINOR} and {@code $SECURITY} have - * the value zero.

    - * - *

    The sequence of numerals in a version number is compared to another - * such sequence in numerical, pointwise fashion; e.g., {@code 9.9.1} - * is less than {@code 9.10.0}. If one sequence is shorter than another then - * the missing elements of the shorter sequence are considered to be zero; - * e.g., {@code 9.1.2} is equal to {@code 9.1.2.0} but less than - * {@code 9.1.2.1}.

    - * - *

    Version strings

    - * - *

    A version string {@code $VSTR} consists of a version number - * {@code $VNUM}, as described above, optionally followed by pre-release and - * build information, in the format

    - * - *
    - *     $VNUM(-$PRE)?(\+($BUILD)?(-$OPT)?)?
    - * 
    - * - *

    where:

    - * - *
      - * - *
    • {@code $PRE}, matching {@code ([a-zA-Z0-9]+)} --- - * A pre-release identifier. Typically {@code ea}, for an early-access - * release that's under active development and potentially unstable, or {@code - * internal}, for an internal developer build. - * - *

    • {@code $BUILD}, matching {@code - * (0|[1-9][0-9]*)} --- The build number, incremented for each promoted build. - * {@code $BUILD} is reset to {@code 1} when any portion of {@code $VNUM} is - * incremented.

      - * - *
    • {@code $OPT}, matching {@code ([-a-zA-Z0-9\.]+)} - * --- Additional build information, if desired. In the case of an {@code - * internal} build this will often contain the date and time of the - * build.

      - * - *
    - * - *

    When comparing two version strings the value of {@code $OPT}, if - * present, may or may not be significant depending on the chosen comparison - * method. The comparison methods {@link #compareTo(Version) compareTo()} and - * {@link #compareToIgnoreOpt(Version) compareToIgnoreOpt{}} should be used - * consistently with the corresponding methods {@link #equals(Object) equals()} - * and {@link #equalsIgnoreOpt(Object) equalsIgnoreOpt()}.

    - * - *

    A short version string ({@code $SVSTR}), often useful in less - * formal contexts, is simply {@code $VNUM} optionally ended with {@code - * -$PRE}.

    - * - * @since 9 - */ -public final class Version - implements Comparable -{ - private final List version; - private final Optional pre; - private final Optional build; - private final Optional optional; - - private static Version current; - - // $VNUM(-$PRE)?(\+($BUILD)?(\-$OPT)?)? - // RE limits the format of version strings - // ([1-9][0-9]*(?:(?:\.0)*\.[1-9][0-9]*)*)(?:-([a-zA-Z0-9]+))?(?:(\+)(0|[1-9][0-9]*)?)?(?:-([-a-zA-Z0-9.]+))? - - private static final String VNUM - = "(?[1-9][0-9]*(?:(?:\\.0)*\\.[1-9][0-9]*)*)"; - private static final String VNUM_GROUP = "VNUM"; - - private static final String PRE = "(?:-(?
    [a-zA-Z0-9]+))?";
    -    private static final String PRE_GROUP   = "PRE";
    -
    -    private static final String BUILD
    -        = "(?:(?\\+)(?0|[1-9][0-9]*)?)?";
    -    private static final String PLUS_GROUP  = "PLUS";
    -    private static final String BUILD_GROUP = "BUILD";
    -
    -    private static final String OPT      = "(?:-(?[-a-zA-Z0-9.]+))?";
    -    private static final String OPT_GROUP   = "OPT";
    -
    -    private static final String VSTR_FORMAT
    -        = "^" + VNUM + PRE + BUILD + OPT + "$";
    -    private static final Pattern VSTR_PATTERN = Pattern.compile(VSTR_FORMAT);
    -
    -    /**
    -     * Constructs a valid JDK version string containing a
    -     * version number followed by pre-release and build
    -     * information.
    -     *
    -     * @param  s
    -     *         A string to be interpreted as a version
    -     *
    -     * @throws  IllegalArgumentException
    -     *          If the given string cannot be interpreted a valid version
    -     *
    -     * @throws  NullPointerException
    -     *          If {@code s} is {@code null}
    -     *
    -     * @throws  NumberFormatException
    -     *          If an element of the version number or the build number cannot
    -     *          be represented as an {@link Integer}
    -     */
    -    private Version(String s) {
    -        if (s == null)
    -            throw new NullPointerException();
    -
    -        Matcher m = VSTR_PATTERN.matcher(s);
    -        if (!m.matches())
    -            throw new IllegalArgumentException("Invalid version string: '"
    -                                               + s + "'");
    -
    -        // $VNUM is a dot-separated list of integers of arbitrary length
    -        List list = new ArrayList<>();
    -        for (String i : m.group(VNUM_GROUP).split("\\."))
    -            list.add(Integer.parseInt(i));
    -        version = Collections.unmodifiableList(list);
    -
    -        pre = Optional.ofNullable(m.group(PRE_GROUP));
    -
    -        String b = m.group(BUILD_GROUP);
    -        // $BUILD is an integer
    -        build = (b == null)
    -             ? Optional.empty()
    -             : Optional.ofNullable(Integer.parseInt(b));
    -
    -        optional = Optional.ofNullable(m.group(OPT_GROUP));
    -
    -        // empty '+'
    -        if ((m.group(PLUS_GROUP) != null) && !build.isPresent()) {
    -            if (optional.isPresent()) {
    -                if (pre.isPresent())
    -                    throw new IllegalArgumentException("'+' found with"
    -                        + " pre-release and optional components:'" + s + "'");
    -            } else {
    -                throw new IllegalArgumentException("'+' found with neither"
    -                    + " build or optional components: '" + s + "'");
    -            }
    -        }
    -    }
    -
    -    /**
    -     * Parses the given string as a valid JDK version string containing a version number followed by pre-release and
    -     * build information.
    -     *
    -     * @param  s
    -     *         A string to interpret as a version
    -     *
    -     * @throws  IllegalArgumentException
    -     *          If the given string cannot be interpreted a valid version
    -     *
    -     * @throws  NullPointerException
    -     *          If the given string is {@code null}
    -     *
    -     * @throws  NumberFormatException
    -     *          If an element of the version number or the build number cannot
    -     *          be represented as an {@link Integer}
    -     *
    -     * @return  This version
    -     */
    -    public static Version parse(String s) {
    -        return new Version(s);
    -    }
    -
    -    /**
    -     * Returns {@code System.getProperty("java.version")} as a Version.
    -     *
    -     * @throws  SecurityException
    -     *          If a security manager exists and its {@link
    -     *          SecurityManager#checkPropertyAccess(String)
    -     *          checkPropertyAccess} method does not allow access to the
    -     *          system property "java.version"
    -     *
    -     * @return  {@code System.getProperty("java.version")} as a Version
    -     */
    -    public static Version current() {
    -        if (current == null) {
    -            current = parse(
    -                    GetPropertyAction.privilegedGetProperty("java.version"));
    -        }
    -        return current;
    -    }
    -
    -    /**
    -     * Returns the major version number.
    -     *
    -     * @return  The major version number
    -     */
    -    public int major() {
    -        return version.get(0);
    -    }
    -
    -    /**
    -     * Returns the minor version number or zero if it was
    -     * not set.
    -     *
    -     * @return  The minor version number or zero if it was not set
    -     */
    -    public int minor() {
    -        return (version.size() > 1 ? version.get(1) : 0);
    -    }
    -
    -    /**
    -     * Returns the security version number or zero if
    -     * it was not set.
    -     *
    -     * @return  The security version number or zero if it was not set
    -     */
    -    public int security() {
    -        return (version.size() > 2 ? version.get(2) : 0);
    -    }
    -
    -    /**
    -     * Returns an unmodifiable {@link java.util.List List} of the
    -     * integer numerals contained in the version
    -     * number.  The {@code List} always contains at least one
    -     * element corresponding to the major version
    -     * number.
    -     *
    -     * @return  An unmodifiable list of the integer numerals
    -     *          contained in the version number
    -     */
    -    public List version() {
    -        return version;
    -    }
    -
    -    /**
    -     * Returns the optional pre-release information.
    -     *
    -     * @return  The optional pre-release information as a String
    -     */
    -    public Optional pre() {
    -        return pre;
    -    }
    -
    -    /**
    -     * Returns the build number.
    -     *
    -     * @return The optional build number.
    -     */
    -    public Optional build() {
    -        return build;
    -    }
    -
    -    /**
    -     * Returns optional additional identifying build
    -     * information.
    -     *
    -     * @return  Additional build information as a String
    -     */
    -    public Optional optional() {
    -        return optional;
    -    }
    -
    -    /**
    -     * Compares this version to another.
    -     *
    -     * 

    Each of the components in the version is - * compared in the follow order of precedence: version numbers, - * pre-release identifiers, build numbers, optional build information.

    - * - *

    Comparison begins by examining the sequence of version numbers. If - * one sequence is shorter than another, then the missing elements of the - * shorter sequence are considered to be zero.

    - * - *

    A version with a pre-release identifier is always considered to be - * less than a version without one. Pre-release identifiers are compared - * numerically when they consist only of digits, and lexicographically - * otherwise. Numeric identifiers are considered to be less than - * non-numeric identifiers.

    - * - *

    A version without a build number is always less than one with a - * build number; otherwise build numbers are compared numerically.

    - * - *

    The optional build information is compared lexicographically. - * During this comparison, a version with optional build information is - * considered to be greater than a version without one.

    - * - *

    A version is not comparable to any other type of object. - * - * @param ob - * The object to be compared - * - * @return A negative integer, zero, or a positive integer if this - * {@code Version} is less than, equal to, or greater than the - * given {@code Version} - * - * @throws NullPointerException - * If the given object is {@code null} - */ - @Override - public int compareTo(Version ob) { - return compare(ob, false); - } - - /** - * Compares this version to another disregarding optional build - * information. - * - *

    Two versions are compared by examining the version string as - * described in {@link #compareTo(Version)} with the exception that the - * optional build information is always ignored.

    - * - *

    A version is not comparable to any other type of object. - * - * @param ob - * The object to be compared - * - * @return A negative integer, zero, or a positive integer if this - * {@code Version} is less than, equal to, or greater than the - * given {@code Version} - * - * @throws NullPointerException - * If the given object is {@code null} - */ - public int compareToIgnoreOpt(Version ob) { - return compare(ob, true); - } - - private int compare(Version ob, boolean ignoreOpt) { - if (ob == null) - throw new NullPointerException("Invalid argument"); - - int ret = compareVersion(ob); - if (ret != 0) - return ret; - - ret = comparePre(ob); - if (ret != 0) - return ret; - - ret = compareBuild(ob); - if (ret != 0) - return ret; - - if (!ignoreOpt) - return compareOpt(ob); - - return 0; - } - - private int compareVersion(Version ob) { - int size = version.size(); - int oSize = ob.version().size(); - int min = Math.min(size, oSize); - for (int i = 0; i < min; i++) { - Integer val = version.get(i); - Integer oVal = ob.version().get(i); - if (val != oVal) - return val - oVal; - } - if (size != oSize) - return size - oSize; - return 0; - } - - private int comparePre(Version ob) { - Optional oPre = ob.pre(); - if (!pre.isPresent()) { - if (oPre.isPresent()) - return 1; - } else { - if (!oPre.isPresent()) - return -1; - String val = pre.get(); - String oVal = oPre.get(); - if (val.matches("\\d+")) { - return (oVal.matches("\\d+") - ? (new BigInteger(val)).compareTo(new BigInteger(oVal)) - : -1); - } else { - return (oVal.matches("\\d+") - ? 1 - : val.compareTo(oVal)); - } - } - return 0; - } - - private int compareBuild(Version ob) { - Optional oBuild = ob.build(); - if (oBuild.isPresent()) { - return (build.isPresent() - ? build.get().compareTo(oBuild.get()) - : 1); - } else if (build.isPresent()) { - return -1; - } - return 0; - } - - private int compareOpt(Version ob) { - Optional oOpt = ob.optional(); - if (!optional.isPresent()) { - if (oOpt.isPresent()) - return -1; - } else { - if (!oOpt.isPresent()) - return 1; - return optional.get().compareTo(oOpt.get()); - } - return 0; - } - - /** - * Returns a string representation of this version. - * - * @return The version string - */ - @Override - public String toString() { - StringBuilder sb - = new StringBuilder(version.stream() - .map(Object::toString) - .collect(Collectors.joining("."))); - pre.ifPresent(v -> sb.append("-").append(v)); - - if (build.isPresent()) { - sb.append("+").append(build.get()); - if (optional.isPresent()) - sb.append("-").append(optional.get()); - } else { - if (optional.isPresent()) { - sb.append(pre.isPresent() ? "-" : "+-"); - sb.append(optional.get()); - } - } - - return sb.toString(); - } - - /** - * Determines whether this {@code Version} is equal to another object. - * - *

    Two {@code Version}s are equal if and only if they represent the - * same version string. - * - *

    This method satisfies the general contract of the {@link - * Object#equals(Object) Object.equals} method.

    - * - * @param ob - * The object to which this {@code Version} is to be compared - * - * @return {@code true} if, and only if, the given object is a {@code - * Version} that is identical to this {@code Version} - * - */ - @Override - public boolean equals(Object ob) { - boolean ret = equalsIgnoreOpt(ob); - if (!ret) - return false; - - Version that = (Version)ob; - return (this.optional().equals(that.optional())); - } - - /** - * Determines whether this {@code Version} is equal to another - * disregarding optional build information. - * - *

    Two {@code Version}s are equal if and only if they represent the - * same version string disregarding the optional build information. - * - * @param ob - * The object to which this {@code Version} is to be compared - * - * @return {@code true} if, and only if, the given object is a {@code - * Version} that is identical to this {@code Version} - * ignoring the optinal build information - * - */ - public boolean equalsIgnoreOpt(Object ob) { - if (this == ob) - return true; - if (!(ob instanceof Version)) - return false; - - Version that = (Version)ob; - return (this.version().equals(that.version()) - && this.pre().equals(that.pre()) - && this.build().equals(that.build())); - } - - /** - * Returns the hash code of this version. - * - *

    This method satisfies the general contract of the {@link - * Object#hashCode Object.hashCode} method. - * - * @return The hashcode of this version - */ - @Override - public int hashCode() { - int h = 1; - int p = 17; - - h = p * h + version.hashCode(); - h = p * h + pre.hashCode(); - h = p * h + build.hashCode(); - h = p * h + optional.hashCode(); - - return h; - } -} diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java index 9b21fb6c1be..68b076784f5 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java +++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java @@ -27,6 +27,8 @@ package jdk.internal.jimage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; @@ -98,8 +100,34 @@ public class BasicImageReader implements AutoCloseable { } // Open the file only if no memory map yet or is 32 bit jvm - channel = map != null && MAP_ALL ? null : - FileChannel.open(imagePath, StandardOpenOption.READ); + if (map != null && MAP_ALL) { + channel = null; + } else { + channel = FileChannel.open(imagePath, StandardOpenOption.READ); + // No lambdas during bootstrap + AccessController.doPrivileged(new PrivilegedAction() { + @Override + public Void run() { + if (BasicImageReader.class.getClassLoader() == null) { + try { + Class fileChannelImpl = + Class.forName("sun.nio.ch.FileChannelImpl"); + Method setUninterruptible = + fileChannelImpl.getMethod("setUninterruptible"); + setUninterruptible.invoke(channel); + } catch (ClassNotFoundException | + NoSuchMethodException | + IllegalAccessException | + InvocationTargetException ex) { + // fall thru - will only happen on JDK-8 systems where this code + // is only used by tools using jrt-fs (non-critical.) + } + } + + return null; + } + }); + } // If no memory map yet and 64 bit jvm then memory map entire file if (MAP_ALL && map == null) { diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java index 2c78ea9e5d5..a747ea8aa7b 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java +++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java @@ -149,6 +149,17 @@ public final class ImageReader implements AutoCloseable { return reader.getEntryNames(); } + public String[] getModuleNames() { + Objects.requireNonNull(reader, "image file closed"); + int off = "/modules/".length(); + return reader.findNode("/modules") + .getChildren() + .stream() + .map(Node::getNameString) + .map(s -> s.substring(off, s.length())) + .toArray(String[]::new); + } + public long[] getAttributes(int offset) { Objects.requireNonNull(reader, "image file closed"); return reader.getAttributes(offset); diff --git a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java index 7a946099fdf..bc2396f10c3 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java +++ b/jdk/src/java.base/share/classes/jdk/internal/loader/ClassLoaders.java @@ -68,13 +68,14 @@ public class ClassLoaders { if (s != null && s.length() > 0) bcp = toURLClassPath(s); - // we have a class path if -cp is specified or -m is not specified + // we have a class path if -cp is specified or -m is not specified. + // If neither is specified then default to -cp . URLClassPath ucp = null; String mainMid = System.getProperty("jdk.module.main"); String cp = System.getProperty("java.class.path"); - if (mainMid == null && (cp == null || cp.length() == 0)) - cp = "."; - if (cp != null && cp.length() > 0) + if (mainMid == null && cp == null) + cp = ""; + if (cp != null) ucp = toURLClassPath(cp); @@ -197,7 +198,7 @@ public class ClassLoaders { * @see java.lang.instrument.Instrumentation#appendToSystemClassLoaderSearch */ void appendToClassPathForInstrumentation(String path) { - appendToUCP(path, ucp); + addClassPathToUCP(path, ucp); } /** @@ -224,7 +225,7 @@ public class ClassLoaders { */ private static URLClassPath toURLClassPath(String cp) { URLClassPath ucp = new URLClassPath(new URL[0]); - appendToUCP(cp, ucp); + addClassPathToUCP(cp, ucp); return ucp; } @@ -232,20 +233,28 @@ public class ClassLoaders { * Converts the elements in the given class path to file URLs and adds * them to the given URLClassPath. */ - private static void appendToUCP(String cp, URLClassPath ucp) { - String[] elements = cp.split(File.pathSeparator); - if (elements.length == 0) { - // contains path separator(s) only, default to current directory - // to be compatible with long standing behavior - elements = new String[] { "" }; + private static void addClassPathToUCP(String cp, URLClassPath ucp) { + int off = 0; + int next; + while ((next = cp.indexOf(File.pathSeparator, off)) != -1) { + addURLToUCP(cp.substring(off, next), ucp); + off = next + 1; } - for (String s: elements) { - try { - URL url = Paths.get(s).toRealPath().toUri().toURL(); - ucp.addURL(url); - } catch (InvalidPathException | IOException ignore) { - // malformed path string or class path element does not exist - } + + // remaining + addURLToUCP(cp.substring(off), ucp); + } + + /** + * Attempts to convert to the given string to a file URL and adds it + * to the given URLClassPath. + */ + private static void addURLToUCP(String s, URLClassPath ucp) { + try { + URL url = Paths.get(s).toRealPath().toUri().toURL(); + ucp.addURL(url); + } catch (InvalidPathException | IOException ignore) { + // malformed path string or class path element does not exist } } diff --git a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PluginContext.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaIORandomAccessFileAccess.java similarity index 82% rename from jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PluginContext.java rename to jdk/src/java.base/share/classes/jdk/internal/misc/JavaIORandomAccessFileAccess.java index 9e5a4a7df61..db15bacd0b7 100644 --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PluginContext.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaIORandomAccessFileAccess.java @@ -22,16 +22,14 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package jdk.tools.jlink.plugin; -import java.util.Properties; +package jdk.internal.misc; -/** - * Interface to plugin (container) context. - */ -public interface PluginContext { - /** - * Returns 'release' properties - */ - public Properties getReleaseProperties(); +import java.io.File; +import java.io.IOException; +import java.io.RandomAccessFile; + +public interface JavaIORandomAccessFileAccess { + public RandomAccessFile openAndDelete(File file, String mode) + throws IOException; } diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java index 24dc4ce43a7..5e3fb126b58 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java @@ -30,6 +30,7 @@ import java.util.jar.JarFile; import java.io.Console; import java.io.FileDescriptor; import java.io.ObjectInputStream; +import java.io.RandomAccessFile; import java.security.ProtectionDomain; import java.security.AccessController; @@ -64,6 +65,7 @@ public class SharedSecrets { private static JavaAWTFontAccess javaAWTFontAccess; private static JavaBeansAccess javaBeansAccess; private static JavaObjectInputStreamAccess javaObjectInputStreamAccess; + private static JavaIORandomAccessFileAccess javaIORandomAccessFileAccess; public static JavaUtilJarAccess javaUtilJarAccess() { if (javaUtilJarAccess == null) { @@ -274,4 +276,15 @@ public class SharedSecrets { public static void setJavaObjectInputStreamAccess(JavaObjectInputStreamAccess access) { javaObjectInputStreamAccess = access; } + + public static void setJavaIORandomAccessFileAccess(JavaIORandomAccessFileAccess jirafa) { + javaIORandomAccessFileAccess = jirafa; + } + + public static JavaIORandomAccessFileAccess getJavaIORandomAccessFileAccess() { + if (javaIORandomAccessFileAccess == null) { + unsafe.ensureClassInitialized(RandomAccessFile.class); + } + return javaIORandomAccessFileAccess; + } } diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java index 735d1b86143..bc7aaa5a6f3 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java @@ -33,6 +33,7 @@ import jdk.internal.reflect.Reflection; import jdk.internal.misc.VM; import jdk.internal.HotSpotIntrinsicCandidate; +import jdk.internal.vm.annotation.ForceInline; /** @@ -209,46 +210,103 @@ public final class Unsafe { /** @see #getInt(Object, long) */ @HotSpotIntrinsicCandidate public native boolean getBoolean(Object o, long offset); + /** @see #putInt(Object, long, int) */ @HotSpotIntrinsicCandidate public native void putBoolean(Object o, long offset, boolean x); + /** @see #getInt(Object, long) */ @HotSpotIntrinsicCandidate public native byte getByte(Object o, long offset); + /** @see #putInt(Object, long, int) */ @HotSpotIntrinsicCandidate public native void putByte(Object o, long offset, byte x); + /** @see #getInt(Object, long) */ @HotSpotIntrinsicCandidate public native short getShort(Object o, long offset); + /** @see #putInt(Object, long, int) */ @HotSpotIntrinsicCandidate public native void putShort(Object o, long offset, short x); + /** @see #getInt(Object, long) */ @HotSpotIntrinsicCandidate public native char getChar(Object o, long offset); + /** @see #putInt(Object, long, int) */ @HotSpotIntrinsicCandidate public native void putChar(Object o, long offset, char x); + /** @see #getInt(Object, long) */ @HotSpotIntrinsicCandidate public native long getLong(Object o, long offset); + /** @see #putInt(Object, long, int) */ @HotSpotIntrinsicCandidate public native void putLong(Object o, long offset, long x); + /** @see #getInt(Object, long) */ @HotSpotIntrinsicCandidate public native float getFloat(Object o, long offset); + /** @see #putInt(Object, long, int) */ @HotSpotIntrinsicCandidate public native void putFloat(Object o, long offset, float x); + /** @see #getInt(Object, long) */ @HotSpotIntrinsicCandidate public native double getDouble(Object o, long offset); + /** @see #putInt(Object, long, int) */ @HotSpotIntrinsicCandidate public native void putDouble(Object o, long offset, double x); + /** + * Fetches a native pointer from a given memory address. If the address is + * zero, or does not point into a block obtained from {@link + * #allocateMemory}, the results are undefined. + * + *

    If the native pointer is less than 64 bits wide, it is extended as + * an unsigned number to a Java long. The pointer may be indexed by any + * given byte offset, simply by adding that offset (as a simple integer) to + * the long representing the pointer. The number of bytes actually read + * from the target address may be determined by consulting {@link + * #addressSize}. + * + * @see #allocateMemory + * @see #getInt(Object, long) + */ + @ForceInline + public long getAddress(Object o, long offset) { + if (ADDRESS_SIZE == 4) { + return Integer.toUnsignedLong(getInt(o, offset)); + } else { + return getLong(o, offset); + } + } + + /** + * Stores a native pointer into a given memory address. If the address is + * zero, or does not point into a block obtained from {@link + * #allocateMemory}, the results are undefined. + * + *

    The number of bytes actually written at the target address may be + * determined by consulting {@link #addressSize}. + * + * @see #allocateMemory + * @see #putInt(Object, long, int) + */ + @ForceInline + public void putAddress(Object o, long offset, long x) { + if (ADDRESS_SIZE == 4) { + putInt(o, offset, (int)x); + } else { + putLong(o, offset, x); + } + } + // These read VM internal data. /** @@ -287,8 +345,10 @@ public final class Unsafe { * * @see #allocateMemory */ - @HotSpotIntrinsicCandidate - public native byte getByte(long address); + @ForceInline + public byte getByte(long address) { + return getByte(null, address); + } /** * Stores a value into a given memory address. If the address is zero, or @@ -297,75 +357,94 @@ public final class Unsafe { * * @see #getByte(long) */ - @HotSpotIntrinsicCandidate - public native void putByte(long address, byte x); + @ForceInline + public void putByte(long address, byte x) { + putByte(null, address, x); + } /** @see #getByte(long) */ - @HotSpotIntrinsicCandidate - public native short getShort(long address); - /** @see #putByte(long, byte) */ - @HotSpotIntrinsicCandidate - public native void putShort(long address, short x); - /** @see #getByte(long) */ - @HotSpotIntrinsicCandidate - public native char getChar(long address); - /** @see #putByte(long, byte) */ - @HotSpotIntrinsicCandidate - public native void putChar(long address, char x); - /** @see #getByte(long) */ - @HotSpotIntrinsicCandidate - public native int getInt(long address); - /** @see #putByte(long, byte) */ - @HotSpotIntrinsicCandidate - public native void putInt(long address, int x); - /** @see #getByte(long) */ - @HotSpotIntrinsicCandidate - public native long getLong(long address); - /** @see #putByte(long, byte) */ - @HotSpotIntrinsicCandidate - public native void putLong(long address, long x); - /** @see #getByte(long) */ - @HotSpotIntrinsicCandidate - public native float getFloat(long address); - /** @see #putByte(long, byte) */ - @HotSpotIntrinsicCandidate - public native void putFloat(long address, float x); - /** @see #getByte(long) */ - @HotSpotIntrinsicCandidate - public native double getDouble(long address); - /** @see #putByte(long, byte) */ - @HotSpotIntrinsicCandidate - public native void putDouble(long address, double x); + @ForceInline + public short getShort(long address) { + return getShort(null, address); + } - /** - * Fetches a native pointer from a given memory address. If the address is - * zero, or does not point into a block obtained from {@link - * #allocateMemory}, the results are undefined. - * - *

    If the native pointer is less than 64 bits wide, it is extended as - * an unsigned number to a Java long. The pointer may be indexed by any - * given byte offset, simply by adding that offset (as a simple integer) to - * the long representing the pointer. The number of bytes actually read - * from the target address may be determined by consulting {@link - * #addressSize}. - * - * @see #allocateMemory - */ - @HotSpotIntrinsicCandidate - public native long getAddress(long address); + /** @see #putByte(long, byte) */ + @ForceInline + public void putShort(long address, short x) { + putShort(null, address, x); + } - /** - * Stores a native pointer into a given memory address. If the address is - * zero, or does not point into a block obtained from {@link - * #allocateMemory}, the results are undefined. - * - *

    The number of bytes actually written at the target address may be - * determined by consulting {@link #addressSize}. - * - * @see #getAddress(long) - */ - @HotSpotIntrinsicCandidate - public native void putAddress(long address, long x); + /** @see #getByte(long) */ + @ForceInline + public char getChar(long address) { + return getChar(null, address); + } + + /** @see #putByte(long, byte) */ + @ForceInline + public void putChar(long address, char x) { + putChar(null, address, x); + } + + /** @see #getByte(long) */ + @ForceInline + public int getInt(long address) { + return getInt(null, address); + } + + /** @see #putByte(long, byte) */ + @ForceInline + public void putInt(long address, int x) { + putInt(null, address, x); + } + + /** @see #getByte(long) */ + @ForceInline + public long getLong(long address) { + return getLong(null, address); + } + + /** @see #putByte(long, byte) */ + @ForceInline + public void putLong(long address, long x) { + putLong(null, address, x); + } + + /** @see #getByte(long) */ + @ForceInline + public float getFloat(long address) { + return getFloat(null, address); + } + + /** @see #putByte(long, byte) */ + @ForceInline + public void putFloat(long address, float x) { + putFloat(null, address, x); + } + + /** @see #getByte(long) */ + @ForceInline + public double getDouble(long address) { + return getDouble(null, address); + } + + /** @see #putByte(long, byte) */ + @ForceInline + public void putDouble(long address, double x) { + putDouble(null, address, x); + } + + /** @see #getAddress(Object, long) */ + @ForceInline + public long getAddress(long address) { + return getAddress(null, address); + } + + /** @see #putAddress(Object, long, long) */ + @ForceInline + public void putAddress(long address, long x) { + putAddress(null, address, x); + } @@ -1271,6 +1350,13 @@ public final class Unsafe { return compareAndSwapObject(o, offset, expected, x); } + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapObjectVolatile(Object o, long offset, + Object expected, + Object x) { + return compareAndSwapObject(o, offset, expected, x); + } + /** * Atomically updates Java variable to {@code x} if it is currently * holding {@code expected}. @@ -1325,6 +1411,13 @@ public final class Unsafe { return compareAndSwapInt(o, offset, expected, x); } + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapIntVolatile(Object o, long offset, + int expected, + int x) { + return compareAndSwapInt(o, offset, expected, x); + } + /** * Atomically updates Java variable to {@code x} if it is currently * holding {@code expected}. @@ -1379,6 +1472,13 @@ public final class Unsafe { return compareAndSwapLong(o, offset, expected, x); } + @HotSpotIntrinsicCandidate + public final boolean weakCompareAndSwapLongVolatile(Object o, long offset, + long expected, + long x) { + return compareAndSwapLong(o, offset, expected, x); + } + /** * Fetches a reference value from a given Java variable, with volatile * load semantics. Otherwise identical to {@link #getObject(Object, long)} diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java index f2f7e02598c..52d951250d4 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleBootstrap.java @@ -341,7 +341,7 @@ public final class ModuleBootstrap { // resolve all root modules Configuration cf = Configuration.empty() .resolveRequires(finder, - ModuleFinder.empty(), + ModuleFinder.of(), roots); // module name -> reference diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java index 1fb433b9f7c..c86416e1dab 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/ModuleInfoWriter.java @@ -54,7 +54,7 @@ public final class ModuleInfoWriter { ClassWriter cw = new ClassWriter(0); String name = md.name().replace('.', '/') + "/module-info"; - cw.visit(Opcodes.V1_8, ACC_MODULE, name, null, null, null); + cw.visit(Opcodes.V1_9, ACC_MODULE, name, null, null, null); cw.visitAttribute(new ModuleAttribute(md)); cw.visitAttribute(new ConcealedPackagesAttribute(md.conceals())); diff --git a/jdk/src/java.base/share/classes/jdk/internal/module/SystemModules.java b/jdk/src/java.base/share/classes/jdk/internal/module/SystemModules.java index 43de2cda9f7..78619f09f4d 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/module/SystemModules.java +++ b/jdk/src/java.base/share/classes/jdk/internal/module/SystemModules.java @@ -46,12 +46,12 @@ public final class SystemModules { * and read module-info.class from the run-time image instead of * the fastpath. */ - public static final String[] MODULE_NAMES = new String[1]; + public static final String[] MODULE_NAMES = new String[0]; /** * Hash of system modules. */ - public static String[] MODULES_TO_HASH = new String[1]; + public static String[] MODULES_TO_HASH = new String[0]; /** * Number of packages in the boot layer from the installed modules. @@ -67,7 +67,7 @@ public final class SystemModules { * When running an exploded image it returns an empty array. */ public static ModuleDescriptor[] modules() { - return new ModuleDescriptor[0]; + throw new InternalError("should not reach here"); } } diff --git a/jdk/src/java.base/share/classes/jdk/internal/util/Preconditions.java b/jdk/src/java.base/share/classes/jdk/internal/util/Preconditions.java new file mode 100644 index 00000000000..cb1b748f620 --- /dev/null +++ b/jdk/src/java.base/share/classes/jdk/internal/util/Preconditions.java @@ -0,0 +1,346 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.internal.util; + +import jdk.internal.HotSpotIntrinsicCandidate; + +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Function; + +/** + * Utility methods to check if state or arguments are correct. + * + */ +public class Preconditions { + + /** + * Maps out-of-bounds values to a runtime exception. + * + * @param checkKind the kind of bounds check, whose name may correspond + * to the name of one of the range check methods, checkIndex, + * checkFromToIndex, checkFromIndexSize + * @param args the out-of-bounds arguments that failed the range check. + * If the checkKind corresponds a the name of a range check method + * then the bounds arguments are those that can be passed in order + * to the method. + * @param oobef the exception formatter that when applied with a checkKind + * and a list out-of-bounds arguments returns a runtime exception. + * If {@code null} then, it is as if an exception formatter was + * supplied that returns {@link IndexOutOfBoundsException} for any + * given arguments. + * @return the runtime exception + */ + private static RuntimeException outOfBounds( + BiFunction, ? extends RuntimeException> oobef, + String checkKind, + Integer... args) { + List largs = List.of(args); + RuntimeException e = oobef == null + ? null : oobef.apply(checkKind, largs); + return e == null + ? new IndexOutOfBoundsException(outOfBoundsMessage(checkKind, largs)) : e; + } + + private static RuntimeException outOfBoundsCheckIndex( + BiFunction, ? extends RuntimeException> oobe, + int index, int length) { + return outOfBounds(oobe, "checkIndex", index, length); + } + + private static RuntimeException outOfBoundsCheckFromToIndex( + BiFunction, ? extends RuntimeException> oobe, + int fromIndex, int toIndex, int length) { + return outOfBounds(oobe, "checkFromToIndex", fromIndex, toIndex, length); + } + + private static RuntimeException outOfBoundsCheckFromIndexSize( + BiFunction, ? extends RuntimeException> oobe, + int fromIndex, int size, int length) { + return outOfBounds(oobe, "checkFromIndexSize", fromIndex, size, length); + } + + /** + * Returns an out-of-bounds exception formatter from an given exception + * factory. The exception formatter is a function that formats an + * out-of-bounds message from its arguments and applies that message to the + * given exception factory to produce and relay an exception. + * + *

    The exception formatter accepts two arguments: a {@code String} + * describing the out-of-bounds range check that failed, referred to as the + * check kind; and a {@code List} containing the + * out-of-bound integer values that failed the check. The list of + * out-of-bound values is not modified. + * + *

    Three check kinds are supported {@code checkIndex}, + * {@code checkFromToIndex} and {@code checkFromIndexSize} corresponding + * respectively to the specified application of an exception formatter as an + * argument to the out-of-bounds range check methods + * {@link #checkIndex(int, int, BiFunction) checkIndex}, + * {@link #checkFromToIndex(int, int, int, BiFunction) checkFromToIndex}, and + * {@link #checkFromIndexSize(int, int, int, BiFunction) checkFromIndexSize}. + * Thus a supported check kind corresponds to a method name and the + * out-of-bound integer values correspond to method argument values, in + * order, preceding the exception formatter argument (similar in many + * respects to the form of arguments required for a reflective invocation of + * such a range check method). + * + *

    Formatter arguments conforming to such supported check kinds will + * produce specific exception messages describing failed out-of-bounds + * checks. Otherwise, more generic exception messages will be produced in + * any of the following cases: the check kind is supported but fewer + * or more out-of-bounds values are supplied, the check kind is not + * supported, the check kind is {@code null}, or the list of out-of-bound + * values is {@code null}. + * + * @apiNote + * This method produces an out-of-bounds exception formatter that can be + * passed as an argument to any of the supported out-of-bounds range check + * methods declared by {@code Objects}. For example, a formatter producing + * an {@code ArrayIndexOutOfBoundsException} may be produced and stored on a + * {@code static final} field as follows: + *

    {@code
    +     * static final
    +     * BiFunction, ArrayIndexOutOfBoundsException> AIOOBEF =
    +     *     outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new);
    +     * }
    + * The formatter instance {@code AIOOBEF} may be passed as an argument to an + * out-of-bounds range check method, such as checking if an {@code index} + * is within the bounds of a {@code limit}: + *
    {@code
    +     * checkIndex(index, limit, AIOOBEF);
    +     * }
    + * If the bounds check fails then the range check method will throw an + * {@code ArrayIndexOutOfBoundsException} with an appropriate exception + * message that is a produced from {@code AIOOBEF} as follows: + *
    {@code
    +     * AIOOBEF.apply("checkIndex", List.of(index, limit));
    +     * }
    + * + * @param f the exception factory, that produces an exception from a message + * where the message is produced and formatted by the returned + * exception formatter. If this factory is stateless and side-effect + * free then so is the returned formatter. + * Exceptions thrown by the factory are relayed to the caller + * of the returned formatter. + * @param the type of runtime exception to be returned by the given + * exception factory and relayed by the exception formatter + * @return the out-of-bounds exception formatter + */ + public static + BiFunction, X> outOfBoundsExceptionFormatter(Function f) { + // Use anonymous class to avoid bootstrap issues if this method is + // used early in startup + return new BiFunction, X>() { + @Override + public X apply(String checkKind, List args) { + return f.apply(outOfBoundsMessage(checkKind, args)); + } + }; + } + + private static String outOfBoundsMessage(String checkKind, List args) { + if (checkKind == null && args == null) { + return String.format("Range check failed"); + } else if (checkKind == null) { + return String.format("Range check failed: %s", args); + } else if (args == null) { + return String.format("Range check failed: %s", checkKind); + } + + int argSize = 0; + switch (checkKind) { + case "checkIndex": + argSize = 2; + break; + case "checkFromToIndex": + case "checkFromIndexSize": + argSize = 3; + break; + default: + } + + // Switch to default if fewer or more arguments than required are supplied + switch ((args.size() != argSize) ? "" : checkKind) { + case "checkIndex": + return String.format("Index %d out-of-bounds for length %d", + args.get(0), args.get(1)); + case "checkFromToIndex": + return String.format("Range [%d, %d) out-of-bounds for length %d", + args.get(0), args.get(1), args.get(2)); + case "checkFromIndexSize": + return String.format("Range [%d, %The {@code index} is defined to be out-of-bounds if any of the + * following inequalities is true: + *
      + *
    • {@code index < 0}
    • + *
    • {@code index >= length}
    • + *
    • {@code length < 0}, which is implied from the former inequalities
    • + *
    + * + *

    If the {@code index} is out-of-bounds, then a runtime exception is + * thrown that is the result of applying the following arguments to the + * exception formatter: the name of this method, {@code checkIndex}; + * and an unmodifiable list integers whose values are, in order, the + * out-of-bounds arguments {@code index} and {@code length}. + * + * @param the type of runtime exception to throw if the arguments are + * out-of-bounds + * @param index the index + * @param length the upper-bound (exclusive) of the range + * @param oobef the exception formatter that when applied with this + * method name and out-of-bounds arguments returns a runtime + * exception. If {@code null} or returns {@code null} then, it is as + * if an exception formatter produced from an invocation of + * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used + * instead (though it may be more efficient). + * Exceptions thrown by the formatter are relayed to the caller. + * @return {@code index} if it is within bounds of the range + * @throws X if the {@code index} is out-of-bounds and the exception + * formatter is non-{@code null} + * @throws IndexOutOfBoundsException if the {@code index} is out-of-bounds + * and the exception formatter is {@code null} + * @since 9 + * + * @implNote + * This method is made intrinsic in optimizing compilers to guide them to + * perform unsigned comparisons of the index and length when it is known the + * length is a non-negative value (such as that of an array length or from + * the upper bound of a loop) + */ + @HotSpotIntrinsicCandidate + public static + int checkIndex(int index, int length, + BiFunction, X> oobef) { + if (index < 0 || index >= length) + throw outOfBoundsCheckIndex(oobef, index, length); + return index; + } + + /** + * Checks if the sub-range from {@code fromIndex} (inclusive) to + * {@code toIndex} (exclusive) is within the bounds of range from {@code 0} + * (inclusive) to {@code length} (exclusive). + * + *

    The sub-range is defined to be out-of-bounds if any of the following + * inequalities is true: + *

      + *
    • {@code fromIndex < 0}
    • + *
    • {@code fromIndex > toIndex}
    • + *
    • {@code toIndex > length}
    • + *
    • {@code length < 0}, which is implied from the former inequalities
    • + *
    + * + *

    If the sub-range is out-of-bounds, then a runtime exception is + * thrown that is the result of applying the following arguments to the + * exception formatter: the name of this method, {@code checkFromToIndex}; + * and an unmodifiable list integers whose values are, in order, the + * out-of-bounds arguments {@code fromIndex}, {@code toIndex}, and {@code length}. + * + * @param the type of runtime exception to throw if the arguments are + * out-of-bounds + * @param fromIndex the lower-bound (inclusive) of the sub-range + * @param toIndex the upper-bound (exclusive) of the sub-range + * @param length the upper-bound (exclusive) the range + * @param oobef the exception formatter that when applied with this + * method name and out-of-bounds arguments returns a runtime + * exception. If {@code null} or returns {@code null} then, it is as + * if an exception formatter produced from an invocation of + * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used + * instead (though it may be more efficient). + * Exceptions thrown by the formatter are relayed to the caller. + * @return {@code fromIndex} if the sub-range within bounds of the range + * @throws X if the sub-range is out-of-bounds and the exception factory + * function is non-{@code null} + * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and + * the exception factory function is {@code null} + * @since 9 + */ + public static + int checkFromToIndex(int fromIndex, int toIndex, int length, + BiFunction, X> oobef) { + if (fromIndex < 0 || fromIndex > toIndex || toIndex > length) + throw outOfBoundsCheckFromToIndex(oobef, fromIndex, toIndex, length); + return fromIndex; + } + + /** + * Checks if the sub-range from {@code fromIndex} (inclusive) to + * {@code fromIndex + size} (exclusive) is within the bounds of range from + * {@code 0} (inclusive) to {@code length} (exclusive). + * + *

    The sub-range is defined to be out-of-bounds if any of the following + * inequalities is true: + *

      + *
    • {@code fromIndex < 0}
    • + *
    • {@code size < 0}
    • + *
    • {@code fromIndex + size > length}, taking into account integer overflow
    • + *
    • {@code length < 0}, which is implied from the former inequalities
    • + *
    + * + *

    If the sub-range is out-of-bounds, then a runtime exception is + * thrown that is the result of applying the following arguments to the + * exception formatter: the name of this method, {@code checkFromIndexSize}; + * and an unmodifiable list integers whose values are, in order, the + * out-of-bounds arguments {@code fromIndex}, {@code size}, and + * {@code length}. + * + * @param the type of runtime exception to throw if the arguments are + * out-of-bounds + * @param fromIndex the lower-bound (inclusive) of the sub-interval + * @param size the size of the sub-range + * @param length the upper-bound (exclusive) of the range + * @param oobef the exception formatter that when applied with this + * method name and out-of-bounds arguments returns a runtime + * exception. If {@code null} or returns {@code null} then, it is as + * if an exception formatter produced from an invocation of + * {@code outOfBoundsExceptionFormatter(IndexOutOfBounds::new)} is used + * instead (though it may be more efficient). + * Exceptions thrown by the formatter are relayed to the caller. + * @return {@code fromIndex} if the sub-range within bounds of the range + * @throws X if the sub-range is out-of-bounds and the exception factory + * function is non-{@code null} + * @throws IndexOutOfBoundsException if the sub-range is out-of-bounds and + * the exception factory function is {@code null} + * @since 9 + */ + public static + int checkFromIndexSize(int fromIndex, int size, int length, + BiFunction, X> oobef) { + if ((length | fromIndex | size) < 0 || size > length - fromIndex) + throw outOfBoundsCheckFromIndexSize(oobef, fromIndex, size, length); + return fromIndex; + } +} diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 9d9fe8ec11f..a1b13336fa2 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -81,9 +81,6 @@ module java.base { exports javax.security.auth.x500; exports javax.security.cert; - // see JDK-8144062 - exports jdk; - // the service types defined by the APIs in this module diff --git a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties index 6390b9792d4..32aa8ec65b3 100644 --- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties +++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties @@ -100,7 +100,6 @@ java.launcher.X.usage=\ \ -Xdiag show additional diagnostic messages\n\ \ -Xdiag:resolver show resolver diagnostic messages\n\ \ -Xnoclassgc disable class garbage collection\n\ -\ -Xincgc enable incremental garbage collection\n\ \ -Xloggc: log GC status to a file with time stamps\n\ \ -Xbatch disable background compilation\n\ \ -Xms set initial Java heap size\n\ diff --git a/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java b/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java index deefc8529f9..df9364a11d8 100644 --- a/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java +++ b/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java @@ -40,7 +40,6 @@ import java.nio.channels.OverlappingFileLockException; import java.nio.channels.ReadableByteChannel; import java.nio.channels.SelectableChannel; import java.nio.channels.WritableByteChannel; -import java.security.AccessController; import java.util.ArrayList; import java.util.List; @@ -83,6 +82,9 @@ public class FileChannelImpl // Lock for operations involving position and size private final Object positionLock = new Object(); + // Positional-read is not interruptible + private volatile boolean uninterruptible; + private FileChannelImpl(FileDescriptor fd, String path, boolean readable, boolean writable, Object parent) { @@ -108,6 +110,10 @@ public class FileChannelImpl throw new ClosedChannelException(); } + public void setUninterruptible() { + uninterruptible = true; + } + // -- Standard channel operations -- protected void implCloseChannel() throws IOException { @@ -733,8 +739,10 @@ public class FileChannelImpl assert !nd.needsPositionLock() || Thread.holdsLock(positionLock); int n = 0; int ti = -1; + + boolean interruptible = !uninterruptible; try { - begin(); + if (interruptible) begin(); ti = threads.add(); if (!isOpen()) return -1; @@ -744,7 +752,7 @@ public class FileChannelImpl return IOStatus.normalize(n); } finally { threads.remove(ti); - end(n > 0); + if (interruptible) end(n > 0); assert IOStatus.check(n); } } diff --git a/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java b/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java index 9082670609e..971c4930b7e 100644 --- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java +++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java @@ -650,12 +650,29 @@ public final class ProviderList { } } + /* Defined Groups for jdk.security.provider.preferred */ + private static final String SHA2Group[] = { "SHA-224", "SHA-256", + "SHA-384", "SHA-512", "SHA-512/224", "SHA-512/256" }; + private static final String HmacSHA2Group[] = { "HmacSHA224", + "HmacSHA256", "HmacSHA384", "HmacSHA512"}; + private static final String SHA2RSAGroup[] = { "SHA224withRSA", + "SHA256withRSA", "SHA384withRSA", "SHA512withRSA"}; + private static final String SHA2DSAGroup[] = { "SHA224withDSA", + "SHA256withDSA", "SHA384withDSA", "SHA512withDSA"}; + private static final String SHA2ECDSAGroup[] = { "SHA224withECDSA", + "SHA256withECDSA", "SHA384withECDSA", "SHA512withECDSA"}; + private static final String SHA3Group[] = { "SHA3-224", "SHA3-256", + "SHA3-384", "SHA3-512" }; + private static final String HmacSHA3Group[] = { "HmacSHA3-224", + "HmacSHA3-256", "HmacSHA3-384", "HmacSHA3-512"}; + // Individual preferred property entry from jdk.security.provider.preferred - private class PreferredEntry { - String type = null; - String algorithm; - String provider; - String alternateName = null; + private static class PreferredEntry { + private String type = null; + private String algorithm; + private String provider; + private String alternateNames[] = null; + private boolean group = false; PreferredEntry(String t, String p) { int i = t.indexOf('.'); @@ -667,47 +684,83 @@ public final class ProviderList { } provider = p; - if (algorithm.compareToIgnoreCase("SHA1") == 0) { - alternateName = "SHA-1"; + // Group definitions + if (type != null && type.compareToIgnoreCase("Group") == 0) { + // Currently intrinsic algorithm groups + if (algorithm.compareToIgnoreCase("SHA2") == 0) { + alternateNames = SHA2Group; + } else if (algorithm.compareToIgnoreCase("HmacSHA2") == 0) { + alternateNames = HmacSHA2Group; + } else if (algorithm.compareToIgnoreCase("SHA2RSA") == 0) { + alternateNames = SHA2RSAGroup; + } else if (algorithm.compareToIgnoreCase("SHA2DSA") == 0) { + alternateNames = SHA2DSAGroup; + } else if (algorithm.compareToIgnoreCase("SHA2ECDSA") == 0) { + alternateNames = SHA2ECDSAGroup; + } else if (algorithm.compareToIgnoreCase("SHA3") == 0) { + alternateNames = SHA3Group; + } else if (algorithm.compareToIgnoreCase("HmacSHA3") == 0) { + alternateNames = HmacSHA3Group; + } + if (alternateNames != null) { + group = true; + } + + // If the algorithm name given is SHA1 + } else if (algorithm.compareToIgnoreCase("SHA1") == 0) { + alternateNames = new String[] { "SHA-1" }; } else if (algorithm.compareToIgnoreCase("SHA-1") == 0) { - alternateName = "SHA1"; + alternateNames = new String[] { "SHA1" }; } } boolean match(String t, String a) { if (debug != null) { - debug.println("Config match: " + toString() + " == [" + t + - ", " + a + "]"); + debug.println("Config check: " + toString() + " == " + + print(t, a, null)); } // Compare service type if configured - if (type != null && type.compareToIgnoreCase(t) != 0) { + if (type != null && !group && type.compareToIgnoreCase(t) != 0) { return false; } // Compare the algorithm string. - if (a.compareToIgnoreCase(algorithm) == 0) { + if (!group && a.compareToIgnoreCase(algorithm) == 0) { if (debug != null) { - debug.println("Config entry found: " + toString()); + debug.println("Config entry matched: " + toString()); } return true; } - if (alternateName != null && - a.compareToIgnoreCase(alternateName) == 0) { - if (debug != null) { - debug.println("Config entry found (alternateName): " + - toString()); + if (alternateNames != null) { + for (String alt : alternateNames) { + if (debug != null) { + debug.println("AltName check: " + print(type, alt, + provider)); + } + if (a.compareToIgnoreCase(alt) == 0) { + if (debug != null) { + debug.println("AltName entry matched: " + + provider); + } + return true; + } } - return true; } // No match return false; } + // Print debugging output of PreferredEntry + private String print(String t, String a, String p) { + return "[" + ((t != null) ? t : "" ) + ", " + a + + ((p != null) ? " : " + p : "" ) + "] "; + } + public String toString() { - return "[" + type + ", " + algorithm + " : " + provider + "] "; + return print(type, algorithm, provider); } } diff --git a/jdk/src/java.base/share/classes/sun/security/provider/CtrDrbg.java b/jdk/src/java.base/share/classes/sun/security/provider/CtrDrbg.java index 4182383e6da..1d234172c95 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/CtrDrbg.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/CtrDrbg.java @@ -471,7 +471,7 @@ public class CtrDrbg extends AbstractDrbg { @Override public String toString() { - return super.toString() + "/" + return super.toString() + "," + (usedf ? "use_df" : "no_df"); } } diff --git a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java index 5861b6c7a85..861fa692471 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -259,14 +259,10 @@ public class PolicyFile extends java.security.Policy { private static final Debug debug = Debug.getInstance("policy"); - private static final String NONE = "NONE"; - private static final String P11KEYSTORE = "PKCS11"; - private static final String SELF = "${{self}}"; private static final String X500PRINCIPAL = "javax.security.auth.x500.X500Principal"; private static final String POLICY = "java.security.policy"; - private static final String SECURITY_MANAGER = "java.security.manager"; private static final String POLICY_URL = "policy.url."; private static final String AUTH_POLICY = "java.security.auth.policy"; private static final String AUTH_POLICY_URL = "auth.policy.url."; @@ -287,6 +283,17 @@ public class PolicyFile extends java.security.Policy { private static final Class[] PARAMS1 = { String.class }; private static final Class[] PARAMS2 = { String.class, String.class }; + /** + * When a policy file has a syntax error, the exception code may generate + * another permission check and this can cause the policy file to be parsed + * repeatedly, leading to a StackOverflowError or ClassCircularityError. + * To avoid this, this set is populated with policy files that have been + * previously parsed and have syntax errors, so that they can be + * subsequently ignored. + */ + private static AtomicReference> badPolicyURLs = + new AtomicReference<>(new HashSet<>()); + /** * Initializes the Policy object and reads the default policy * configuration file(s) into the Policy object. @@ -580,6 +587,16 @@ public class PolicyFile extends java.security.Policy { * @param policyFile the policy Reader object. */ private boolean init(URL policy, PolicyInfo newInfo) { + + // skip parsing policy file if it has been previously parsed and + // has syntax errors + if (badPolicyURLs.get().contains(policy)) { + if (debug != null) { + debug.println("skipping bad policy file: " + policy); + } + return false; + } + boolean success = false; PolicyParser pp = new PolicyParser(expandProperties); InputStreamReader isr = null; @@ -622,13 +639,18 @@ public class PolicyFile extends java.security.Policy { addGrantEntry(ge, keyStore, newInfo); } } catch (PolicyParser.ParsingException pe) { + // record bad policy file to avoid later reparsing it + badPolicyURLs.updateAndGet(k -> { + k.add(policy); + return k; + }); MessageFormat form = new MessageFormat(ResourcesMgr.getString (POLICY + ".error.parsing.policy.message")); Object[] source = {policy, pe.getLocalizedMessage()}; System.err.println(form.format(source)); - if (debug != null) + if (debug != null) { pe.printStackTrace(); - + } } catch (Exception e) { if (debug != null) { debug.println("error parsing "+policy); diff --git a/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java b/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java index ba8ed750254..f8aa620fc77 100644 --- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java +++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -213,7 +213,9 @@ public class PolicyParser { new MessageFormat(ResourcesMgr.getString( "duplicate.keystore.domain.name")); Object[] source = {domainName}; - throw new ParsingException(form.format(source)); + String msg = "duplicate keystore domain name: " + + domainName; + throw new ParsingException(msg, form, source); } } } else { @@ -743,7 +745,8 @@ public class PolicyParser { ResourcesMgr.getString ("expected.expect.read.end.of.file.")); Object[] source = {expect}; - throw new ParsingException(form.format(source)); + String msg = "expected [" + expect + "], read [end of file]"; + throw new ParsingException(msg, form, source); case StreamTokenizer.TT_WORD: if (expect.equalsIgnoreCase(st.sval)) { lookahead = st.nextToken(); @@ -1244,7 +1247,8 @@ public class PolicyParser { MessageFormat form = new MessageFormat(ResourcesMgr.getString( "duplicate.keystore.name")); Object[] source = {keystoreName}; - throw new ParsingException(form.format(source)); + String msg = "duplicate keystore name: " + keystoreName; + throw new ParsingException(msg, form, source); } } @@ -1316,6 +1320,8 @@ public class PolicyParser { private static final long serialVersionUID = -4330692689482574072L; private String i18nMessage; + private MessageFormat form; + private Object[] source; /** * Constructs a ParsingException with the specified @@ -1330,26 +1336,34 @@ public class PolicyParser { i18nMessage = msg; } + public ParsingException(String msg, MessageFormat form, + Object[] source) { + super(msg); + this.form = form; + this.source = source; + } + public ParsingException(int line, String msg) { super("line " + line + ": " + msg); - MessageFormat form = new MessageFormat - (ResourcesMgr.getString("line.number.msg")); - Object[] source = {line, msg}; - i18nMessage = form.format(source); + // don't call form.format unless getLocalizedMessage is called + // to avoid unnecessary permission checks + form = new MessageFormat(ResourcesMgr.getString("line.number.msg")); + source = new Object[] {line, msg}; } public ParsingException(int line, String expect, String actual) { super("line " + line + ": expected [" + expect + "], found [" + actual + "]"); - MessageFormat form = new MessageFormat(ResourcesMgr.getString + // don't call form.format unless getLocalizedMessage is called + // to avoid unnecessary permission checks + form = new MessageFormat(ResourcesMgr.getString ("line.number.expected.expect.found.actual.")); - Object[] source = {line, expect, actual}; - i18nMessage = form.format(source); + source = new Object[] {line, expect, actual}; } @Override public String getLocalizedMessage() { - return i18nMessage; + return i18nMessage != null ? i18nMessage : form.format(source); } } diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/RandomCookie.java b/jdk/src/java.base/share/classes/sun/security/ssl/RandomCookie.java index 5ba6b47da3e..a8df0eab5a6 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/RandomCookie.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/RandomCookie.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,21 +41,8 @@ final class RandomCookie { byte[] random_bytes; // exactly 32 bytes RandomCookie(SecureRandom generator) { - long temp = System.currentTimeMillis() / 1000; - int gmt_unix_time; - if (temp < Integer.MAX_VALUE) { - gmt_unix_time = (int) temp; - } else { - gmt_unix_time = Integer.MAX_VALUE; // Whoops! - } - random_bytes = new byte[32]; generator.nextBytes(random_bytes); - - random_bytes[0] = (byte)(gmt_unix_time >> 24); - random_bytes[1] = (byte)(gmt_unix_time >> 16); - random_bytes[2] = (byte)(gmt_unix_time >> 8); - random_bytes[3] = (byte)gmt_unix_time; } RandomCookie(HandshakeInStream m) throws IOException { @@ -68,22 +55,15 @@ final class RandomCookie { } void print(PrintStream s) { - int i, gmt_unix_time; - - gmt_unix_time = ((random_bytes[0] & 0xFF) << 24) | - ((random_bytes[1] & 0xFF) << 16) | - ((random_bytes[2] & 0xFF) << 8) | - (random_bytes[3] & 0xFF); - - s.print("GMT: " + gmt_unix_time + " "); - s.print("bytes = { "); - - for (i = 4; i < 32; i++) { - if (i != 4) { - s.print(", "); + s.print("random_bytes = {"); + for (int i = 0; i < 32; i++) { + int k = random_bytes[i] & 0xFF; + if (i != 0) { + s.print(' '); } - s.print(random_bytes[i] & 0x0ff); + s.print(Utilities.hexDigits[k >>> 4]); + s.print(Utilities.hexDigits[k & 0xf]); } - s.println(" }"); + s.println("}"); } } diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/Utilities.java b/jdk/src/java.base/share/classes/sun/security/ssl/Utilities.java index aefb02c9a19..9b267f6e13f 100644 --- a/jdk/src/java.base/share/classes/sun/security/ssl/Utilities.java +++ b/jdk/src/java.base/share/classes/sun/security/ssl/Utilities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -33,6 +33,11 @@ import sun.net.util.IPAddressUtil; * A utility class to share the static methods. */ final class Utilities { + /** + * hex digits + */ + static final char[] hexDigits = "0123456789ABCDEF".toCharArray(); + /** * Puts {@code hostname} into the {@code serverNames} list. *

    diff --git a/jdk/src/java.base/share/classes/sun/security/tools/keytool/CertAndKeyGen.java b/jdk/src/java.base/share/classes/sun/security/tools/keytool/CertAndKeyGen.java index e2b4cfbb823..85037622c1b 100644 --- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/CertAndKeyGen.java +++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/CertAndKeyGen.java @@ -67,7 +67,9 @@ public final class CertAndKeyGen { * * @param keyType type of key, e.g. "RSA", "DSA" * @param sigAlg name of the signature algorithm, e.g. "MD5WithRSA", - * "MD2WithRSA", "SHAwithDSA". + * "MD2WithRSA", "SHAwithDSA". If set to null, a default + * algorithm matching the private key will be chosen after + * the first keypair is generated. * @exception NoSuchAlgorithmException on unrecognized algorithms. */ public CertAndKeyGen (String keyType, String sigAlg) @@ -83,7 +85,9 @@ public final class CertAndKeyGen { * * @param keyType type of key, e.g. "RSA", "DSA" * @param sigAlg name of the signature algorithm, e.g. "MD5WithRSA", - * "MD2WithRSA", "SHAwithDSA". + * "MD2WithRSA", "SHAwithDSA". If set to null, a default + * algorithm matching the private key will be chosen after + * the first keypair is generated. * @param providerName name of the provider * @exception NoSuchAlgorithmException on unrecognized algorithms. * @exception NoSuchProviderException on unrecognized providers. @@ -161,8 +165,16 @@ public final class CertAndKeyGen { throw new IllegalArgumentException("Public key format is " + publicKey.getFormat() + ", must be X.509"); } - } + if (sigAlg == null) { + sigAlg = AlgorithmId.getDefaultSigAlgForKey(privateKey); + if (sigAlg == null) { + throw new IllegalArgumentException( + "Cannot derive signature algorithm from " + + privateKey.getAlgorithm()); + } + } + } /** * Returns the public key of the generated key pair if it is of type diff --git a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java index 94969b84196..3a3d5cfe91d 100644 --- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java +++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java @@ -54,7 +54,6 @@ import java.text.MessageFormat; import java.util.*; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import java.lang.reflect.Constructor; import java.math.BigInteger; import java.net.URI; import java.net.URL; @@ -1238,7 +1237,7 @@ public final class Main { PrivateKey privateKey = (PrivateKey)recoverKey(alias, storePass, keyPass).fst; if (sigAlgName == null) { - sigAlgName = getCompatibleSigAlgName(privateKey.getAlgorithm()); + sigAlgName = getCompatibleSigAlgName(privateKey); } Signature signature = Signature.getInstance(sigAlgName); signature.initSign(privateKey); @@ -1328,7 +1327,7 @@ public final class Main { PrivateKey privateKey = (PrivateKey)recoverKey(alias, storePass, keyPass).fst; if (sigAlgName == null) { - sigAlgName = getCompatibleSigAlgName(privateKey.getAlgorithm()); + sigAlgName = getCompatibleSigAlgName(privateKey); } X509CRLEntry[] badCerts = new X509CRLEntry[ids.size()]; @@ -1387,7 +1386,7 @@ public final class Main { // Construct a Signature object, so that we can sign the request if (sigAlgName == null) { - sigAlgName = getCompatibleSigAlgName(privKey.getAlgorithm()); + sigAlgName = getCompatibleSigAlgName(privKey); } Signature signature = Signature.getInstance(sigAlgName); @@ -1619,19 +1618,17 @@ public final class Main { * If no signature algorithm was specified at the command line, * we choose one that is compatible with the selected private key */ - private static String getCompatibleSigAlgName(String keyAlgName) + private static String getCompatibleSigAlgName(PrivateKey key) throws Exception { - if ("DSA".equalsIgnoreCase(keyAlgName)) { - return "SHA256WithDSA"; - } else if ("RSA".equalsIgnoreCase(keyAlgName)) { - return "SHA256WithRSA"; - } else if ("EC".equalsIgnoreCase(keyAlgName)) { - return "SHA256withECDSA"; + String result = AlgorithmId.getDefaultSigAlgForKey(key); + if (result != null) { + return result; } else { throw new Exception(rb.getString ("Cannot.derive.signature.algorithm")); } } + /** * Creates a new key pair and self-signed certificate. */ @@ -1658,9 +1655,6 @@ public final class Main { throw new Exception(form.format(source)); } - if (sigAlgName == null) { - sigAlgName = getCompatibleSigAlgName(keyAlgName); - } CertAndKeyGen keypair = new CertAndKeyGen(keyAlgName, sigAlgName, providerName); @@ -2526,7 +2520,7 @@ public final class Main { // Determine the signature algorithm if (sigAlgName == null) { - sigAlgName = getCompatibleSigAlgName(privKey.getAlgorithm()); + sigAlgName = getCompatibleSigAlgName(privKey); } // Get the old certificate diff --git a/jdk/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java b/jdk/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java index 20e66d561fb..0bf5fcbe1fc 100644 --- a/jdk/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java +++ b/jdk/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java @@ -145,11 +145,10 @@ public class SignatureFileVerifier { */ public static boolean isBlockOrSF(String s) { // we currently only support DSA and RSA PKCS7 blocks - if (s.endsWith(".SF") || s.endsWith(".DSA") || - s.endsWith(".RSA") || s.endsWith(".EC")) { - return true; - } - return false; + return s.endsWith(".SF") + || s.endsWith(".DSA") + || s.endsWith(".RSA") + || s.endsWith(".EC"); } /** diff --git a/jdk/src/java.base/share/conf/security/java.policy b/jdk/src/java.base/share/conf/security/java.policy index 0400ebfd546..32d31472394 100644 --- a/jdk/src/java.base/share/conf/security/java.policy +++ b/jdk/src/java.base/share/conf/security/java.policy @@ -80,6 +80,10 @@ grant codeBase "jrt:/jdk.naming.dns" { permission java.security.AllPermission; }; +grant codeBase "jrt:/java.scripting" { + permission java.security.AllPermission; +}; + grant codeBase "jrt:/jdk.scripting.nashorn" { permission java.security.AllPermission; }; diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security index 6fa0d301d33..caf94448f25 100644 --- a/jdk/src/java.base/share/conf/security/java.security +++ b/jdk/src/java.base/share/conf/security/java.security @@ -105,15 +105,30 @@ security.provider.tbd=SunPKCS11 # The provider is the name of the provider. Any provider that does not # also appear in the registered list will be ignored. # +# There is a special serviceType for this property only to group a set of +# algorithms together. The type is "Group" and is followed by an algorithm +# keyword. Groups are to simplify and lessen the entries on the property +# line. Current groups are: +# Group.SHA2 = SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, SHA-512/256 +# Group.HmacSHA2 = HmacSHA224, HmacSHA256, HmacSHA384, HmacSHA512 +# Group.SHA2RSA = SHA224withRSA, SHA256withRSA, SHA384withRSA, SHA512withRSA +# Group.SHA2DSA = SHA224withDSA, SHA256withDSA, SHA384withDSA, SHA512withDSA +# Group.SHA2ECDSA = SHA224withECDSA, SHA256withECDSA, SHA384withECDSA, \ +# SHA512withECDSA +# Group.SHA3 = SHA3-224, SHA3-256, SHA3-384, SHA3-512 +# Group.HmacSHA3 = HmacSHA3-224, HmacSHA3-256, HmacSHA3-384, HmacSHA3-512 +# # Example: # jdk.security.provider.preferred=AES/GCM/NoPadding:SunJCE, \ -# MessageDigest.SHA-256:SUN +# MessageDigest.SHA-256:SUN, Group.HmacSHA2:SunJCE #ifdef solaris-sparc -jdk.security.provider.preferred=AES:SunJCE, SHA1:SUN, SHA-224:SUN, \ - SHA-256:SUN, SHA-384:SUN, SHA-512:SUN +jdk.security.provider.preferred=AES:SunJCE, SHA1:SUN, Group.SHA2:SUN, \ + HmacSHA1:SunJCE, Group.HmacSHA2:SunJCE #endif #ifdef solaris-x86 -jdk.security.provider.preferred=AES:SunJCE, RSA:SunRsaSign +jdk.security.provider.preferred=AES:SunJCE, SHA1:SUN, Group.SHA2:SUN, \ + HmacSHA1:SunJCE, Group.HmacSHA2:SunJCE, RSA:SunRsaSign, \ + SHA1withRSA:SunRsaSign, Group.SHA2RSA:SunRsaSign #endif @@ -613,14 +628,14 @@ krb5.kdc.bad.policy = tryLast # "CertConstraint" specifies additional constraints for # certificates that contain algorithms that are restricted: # -#   "jdkCA" prohibits the specified algorithm only if the algorithm is used -#     in a certificate chain that terminates at a marked trust anchor in the -#     lib/security/cacerts keystore.  All other chains are not affected. -#     If the jdkCA constraint is not set, then all chains using the -#     specified algorithm are restricted. jdkCA may only be used once in +# "jdkCA" prohibits the specified algorithm only if the algorithm is used +# in a certificate chain that terminates at a marked trust anchor in the +# lib/security/cacerts keystore.  All other chains are not affected. +# If the jdkCA constraint is not set, then all chains using the +# specified algorithm are restricted. jdkCA may only be used once in # a DisabledAlgorithm expression. -#     Example:  To apply this constraint to SHA-1 certificates, include -#     the following:  "SHA1 jdkCA" +# Example:  To apply this constraint to SHA-1 certificates, include +# the following:  "SHA1 jdkCA" # # When an algorithm must satisfy more than one constraint, it must be # delimited by an ampersand '&'. For example, to restrict certificates in a @@ -713,6 +728,12 @@ jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024 # See SSL/TLS specifications and "Java Cryptography Architecture Standard # Algorithm Name Documentation" for information about the algorithm names. # +# Note: If a legacy algorithm is also restricted through the +# jdk.tls.disabledAlgorithms property or the +# java.security.AlgorithmConstraints API (See +# javax.net.ssl.SSLParameters.setAlgorithmConstraints()), +# then the algorithm is completely disabled and will not be negotiated. +# # Note: This property is currently used by Oracle's JSSE implementation. # It is not guaranteed to be examined and used by other implementations. # There is no guarantee the property will continue to exist or be of the diff --git a/jdk/src/java.base/share/native/include/jvmti.h b/jdk/src/java.base/share/native/include/jvmti.h index 684fd2d7046..5f8835c0baa 100644 --- a/jdk/src/java.base/share/native/include/jvmti.h +++ b/jdk/src/java.base/share/native/include/jvmti.h @@ -704,7 +704,8 @@ typedef struct { unsigned int can_generate_resource_exhaustion_heap_events : 1; unsigned int can_generate_resource_exhaustion_threads_events : 1; unsigned int can_generate_early_vmstart : 1; - unsigned int : 6; + unsigned int can_generate_early_class_hook_events : 1; + unsigned int : 5; unsigned int : 16; unsigned int : 16; unsigned int : 16; diff --git a/jdk/src/java.base/share/native/libjava/RandomAccessFile.c b/jdk/src/java.base/share/native/libjava/RandomAccessFile.c index 4c02741f415..d20dfe869a7 100644 --- a/jdk/src/java.base/share/native/libjava/RandomAccessFile.c +++ b/jdk/src/java.base/share/native/libjava/RandomAccessFile.c @@ -60,6 +60,10 @@ Java_java_io_RandomAccessFile_open0(JNIEnv *env, else if (mode & java_io_RandomAccessFile_O_DSYNC) flags |= O_DSYNC; } +#ifdef WIN32 + if (mode & java_io_RandomAccessFile_O_TEMPORARY) + flags |= O_TEMPORARY; +#endif fileOpen(env, this, path, raf_fd, flags); } diff --git a/jdk/src/java.base/unix/native/launcher/jexec.c b/jdk/src/java.base/unix/native/launcher/jexec.c index 179ae4f893c..d2888234674 100644 --- a/jdk/src/java.base/unix/native/launcher/jexec.c +++ b/jdk/src/java.base/unix/native/launcher/jexec.c @@ -331,6 +331,7 @@ const char * isJar(const char * path) { off_t end = start + xlen; if (end <= count) { + end -= 4; // make sure there are 4 bytes to read at start while (start < end) { off_t xhid = SH(buf, start); off_t xdlen = SH(buf, start + 2); diff --git a/jdk/src/java.base/unix/native/libnet/net_util_md.c b/jdk/src/java.base/unix/native/libnet/net_util_md.c index abad413e39c..6d623c800a7 100644 --- a/jdk/src/java.base/unix/native/libnet/net_util_md.c +++ b/jdk/src/java.base/unix/native/libnet/net_util_md.c @@ -353,6 +353,7 @@ jint IPv6_supported() if (getsockname(0, (struct sockaddr *)&sa, &sa_len) == 0) { struct sockaddr *saP = (struct sockaddr *)&sa; if (saP->sa_family != AF_INET6) { + close(fd); return JNI_FALSE; } } diff --git a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java index 91e1e4e8c39..eaade120e04 100644 --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaFileChooserUI.java @@ -112,7 +112,7 @@ public class AquaFileChooserUI extends FileChooserUI { private AncestorListener ancestorListener = null; private DropTarget dragAndDropTarget = null; - private final AcceptAllFileFilter acceptAllFileFilter = new AcceptAllFileFilter(); + private static final AcceptAllFileFilter acceptAllFileFilter = new AcceptAllFileFilter(); private AquaFileSystemModel model; @@ -997,7 +997,7 @@ public class AquaFileChooserUI extends FileChooserUI { // ***************************************** // ***** default AcceptAll file filter ***** // ***************************************** - protected class AcceptAllFileFilter extends FileFilter { + private static class AcceptAllFileFilter extends FileFilter { public AcceptAllFileFilter() { } @@ -1305,6 +1305,8 @@ public class AquaFileChooserUI extends FileChooserUI { protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener { protected FileFilter[] filters; + Object oldFileFilter = getFileChooser().getFileFilter(); + protected FilterComboBoxModel() { super(); filters = getFileChooser().getChoosableFileFilters(); @@ -1321,12 +1323,17 @@ public class AquaFileChooserUI extends FileChooserUI { } public void setSelectedItem(Object filter) { - if (filter != null && !containsFileFilter(filter)) { + if (filter != null && !isSelectedFileFilterInModel(filter)) { + oldFileFilter = filter; getFileChooser().setFileFilter((FileFilter) filter); fireContentsChanged(this, -1, -1); } } + private boolean isSelectedFileFilterInModel(Object filter) { + return Objects.equals(filter, oldFileFilter); + } + public Object getSelectedItem() { // Ensure that the current filter is in the list. // NOTE: we shouldnt' have to do this, since JFileChooser adds diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m index 9b8e370a938..e57074ee74c 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTEvent.m @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -282,11 +282,19 @@ const nsKeyToJavaModifierTable[] = //kCGSFlagsMaskAppleLeftAlternateKey, //kCGSFlagsMaskAppleRightAlternateKey, 58, - 61, + 0, java_awt_event_InputEvent_ALT_DOWN_MASK, java_awt_event_InputEvent_ALT_MASK, java_awt_event_KeyEvent_VK_ALT }, + { + NSAlternateKeyMask, + 0, + 61, + java_awt_event_InputEvent_ALT_DOWN_MASK | java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK, + java_awt_event_InputEvent_ALT_MASK | java_awt_event_InputEvent_ALT_GRAPH_MASK, + java_awt_event_KeyEvent_VK_ALT + }, { NSCommandKeyMask, //kCGSFlagsMaskAppleLeftCommandKey, @@ -310,6 +318,8 @@ const nsKeyToJavaModifierTable[] = {0, 0, 0, 0, 0, 0} }; +static BOOL leftAltKeyPressed; + /* * Almost all unicode characters just go from NS to Java with no translation. * For the few exceptions, we handle it here with this small table. @@ -523,13 +533,17 @@ NsKeyModifiersToJavaKeyInfo(NSUInteger nsFlags, unsigned short eventKeyCode, // *javaKeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_RIGHT; //} if (eventKeyCode == cur->leftKeyCode) { + leftAltKeyPressed = YES; *javaKeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_LEFT; } else if (eventKeyCode == cur->rightKeyCode) { *javaKeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_RIGHT; + } else if (cur->nsMask == NSAlternateKeyMask) { + leftAltKeyPressed = NO; + continue; } *javaKeyType = (cur->nsMask & nsFlags) ? - java_awt_event_KeyEvent_KEY_PRESSED : - java_awt_event_KeyEvent_KEY_RELEASED; + java_awt_event_KeyEvent_KEY_PRESSED : + java_awt_event_KeyEvent_KEY_RELEASED; break; } } @@ -545,7 +559,11 @@ jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods) for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) { if ((cur->nsMask & nsFlags) != 0) { - javaModifiers |= isExtMods? cur->javaExtMask : cur->javaMask; + javaModifiers |= isExtMods ? cur->javaExtMask : cur->javaMask; + if (cur->nsMask == NSAlternateKeyMask && leftAltKeyPressed == NO) { + continue; + } + break; } } diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m index 28e4f386d78..e6b7e21bccb 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CMenuItem.m @@ -25,7 +25,6 @@ #import #include - #import "CMenuItem.h" #import "CMenu.h" #import "AWTEvent.h" @@ -64,42 +63,6 @@ - (BOOL) worksWhenModal { return YES; } -// This is a method written using Carbon framework methods to remove -// All modifiers including "Shift" modifier. -// Example 1: Shortcut set is "Command Shift m" returns "m" -// Example 2: Shortcut set is "Command m" returns "m" -// Example 3: Shortcut set is "Alt Shift ," returns "," - -CFStringRef createStringForKey(CGKeyCode keyCode) -{ - TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource(); -// currentKeyboard now contains the current input source - CFDataRef layoutData = - TISGetInputSourceProperty(currentKeyboard, - kTISPropertyUnicodeKeyLayoutData); -// the UNICODE keyLayout is fetched from currentKeyboard in layoutData - const UCKeyboardLayout *keyboardLayout = - (const UCKeyboardLayout *)CFDataGetBytePtr(layoutData); -// A read-only data pointer is fetched from layoutData - UInt32 keysDown = 0; - UniChar chars[4]; - UniCharCount realLength; - - UCKeyTranslate(keyboardLayout, - keyCode, - kUCKeyActionDisplay, - 0, - LMGetKbdType(), - kUCKeyTranslateNoDeadKeysBit, - &keysDown, - sizeof(chars) / sizeof(chars[0]), - &realLength, - chars); - CFRelease(currentKeyboard); -// Converts keyCode, modifier and dead-key state into UNICODE characters - return CFStringCreateWithCharacters(kCFAllocatorDefault, chars, 1); -} - // Events - (void)handleAction:(NSMenuItem *)sender { AWT_ASSERT_APPKIT_THREAD; @@ -116,35 +79,6 @@ CFStringRef createStringForKey(CGKeyCode keyCode) // from this "frameless" menu, because there are no active windows. This // means we have to handle it here. NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent]; - if ([currEvent type] == NSKeyDown) { - NSString *menuKey = [sender keyEquivalent]; -// If shortcut is "Command Shift ," the menuKey gets the value "," -// But [currEvent charactersIgnoringModifiers]; returns "<" and not "," -// because the charactersIgnoreingModifiers does not ignore "Shift" -// So a shortcut like "Command Shift m" will return "M" where as the -// MenuKey will have the value "m". To remove this issue the below -// createStringForKey is used. - NSString *eventKey = createStringForKey([currEvent keyCode]); - -// Apple uses characters from private Unicode range for some of the -// keys, so we need to do the same translation here that we do -// for the regular key down events - if ([eventKey length] == 1) { - unichar origChar = [eventKey characterAtIndex:0]; - unichar newChar = NsCharToJavaChar(origChar, 0); - if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) { - newChar = origChar; - } - - eventKey = [NSString stringWithCharacters: &newChar length: 1]; - } - - NSWindow *keyWindow = [NSApp keyWindow]; - if ([menuKey isEqualToString:eventKey] && keyWindow != nil) { - return; - } - } - if (fIsCheckbox) { static JNF_CLASS_CACHE(jc_CCheckboxMenuItem, "sun/lwawt/macosx/CCheckboxMenuItem"); static JNF_MEMBER_CACHE(jm_ckHandleAction, jc_CCheckboxMenuItem, "handleAction", "(Z)V"); @@ -154,16 +88,47 @@ CFStringRef createStringForKey(CGKeyCode keyCode) NSInteger state = [sender state]; jboolean newState = (state == NSOnState ? JNI_FALSE : JNI_TRUE); JNFCallVoidMethod(env, fPeer, jm_ckHandleAction, newState); - } else { - static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem"); - static JNF_MEMBER_CACHE(jm_handleAction, jc_CMenuItem, "handleAction", "(JI)V"); // AWT_THREADING Safe (event) - - NSUInteger modifiers = [currEvent modifierFlags]; - jint javaModifiers = NsKeyModifiersToJavaModifiers(modifiers, NO); - - JNFCallVoidMethod(env, fPeer, jm_handleAction, UTC(currEvent), javaModifiers); // AWT_THREADING Safe (event) + } + else { + if ([currEvent type] == NSKeyDown) { + + // Event available through sender variable hence NSApplication + // not needed for checking the keyboard input sans the modifier keys + // Also, the method used to fetch eventKey earlier would be locale dependent + // With earlier implementation, if MenuKey: e EventKey: ा ; if input method + // is not U.S. (Devanagari in this case) + // With current implementation, EventKey = MenuKey = e irrespective of + // input method + + NSString *eventKey = [sender keyEquivalent]; + // Apple uses characters from private Unicode range for some of the + // keys, so we need to do the same translation here that we do + // for the regular key down events + if ([eventKey length] == 1) { + unichar origChar = [eventKey characterAtIndex:0]; + unichar newChar = NsCharToJavaChar(origChar, 0); + if (newChar == java_awt_event_KeyEvent_CHAR_UNDEFINED) { + newChar = origChar; + } + eventKey = [NSString stringWithCharacters: &newChar length: 1]; + } + NSWindow *keyWindow = [NSApp keyWindow]; + if (keyWindow != nil) { + return; + } + else { + static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem"); + static JNF_MEMBER_CACHE(jm_handleAction, jc_CMenuItem, "handleAction", "(JI)V"); // AWT_THREADING Safe (event) + + NSUInteger modifiers = [currEvent modifierFlags]; + jint javaModifiers = NsKeyModifiersToJavaModifiers(modifiers, NO); + + JNFCallVoidMethod(env, fPeer, jm_handleAction, UTC(currEvent), javaModifiers); // AWT_THREADING Safe (event) + } + } } JNF_COCOA_EXIT(env); + } - (void) setJavaLabel:(NSString *)theLabel shortcut:(NSString *)theKeyEquivalent modifierMask:(jint)modifiers { diff --git a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m index b740d05895c..0ad123bf600 100644 --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/JavaComponentAccessibility.m @@ -25,7 +25,7 @@ // External Java Accessibility links: // -// +// // // (Sun's mailing list for Java accessibility) @@ -1030,7 +1030,7 @@ static NSObject *sAttributeNamesLOCK = nil; // Element's value (id) // note that the appKit meaning of "accessibilityValue" is different from the java // meaning of "accessibleValue", which is specific to numerical values -// (http://java.sun.com/j2se/1.3/docs/api/javax/accessibility/AccessibleValue.html#setCurrentAccessibleValue(java.lang.Number)) +// (https://docs.oracle.com/javase/8/docs/api/javax/accessibility/AccessibleValue.html#setCurrentAccessibleValue-java.lang.Number-) - (id)accessibilityValueAttribute { static JNF_STATIC_MEMBER_CACHE(jm_getCurrentAccessibleValue, sjc_CAccessibility, "getCurrentAccessibleValue", "(Ljavax/accessibility/AccessibleValue;Ljava/awt/Component;)Ljava/lang/Number;"); diff --git a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SimpleCMYKColorSpace.java b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SimpleCMYKColorSpace.java index a1097b3853e..db96e67bb1d 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SimpleCMYKColorSpace.java +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/common/SimpleCMYKColorSpace.java @@ -31,7 +31,7 @@ import java.awt.color.ColorSpace; * color space. */ public final class SimpleCMYKColorSpace extends ColorSpace { - private static final long serialVersionUID = 666L; // XXX Revise UID value + private static final long serialVersionUID = 5387117338644522424L; private static ColorSpace theInstance = null; private ColorSpace csRGB; diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java index 8d5e7f07468..010bd3d4b56 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, 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 @@ -25,17 +25,14 @@ package com.sun.media.sound; -import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; - /** * AIFF file format. * * @author Jan Borgersen */ - -final class AiffFileFormat extends AudioFileFormat { +final class AiffFileFormat extends StandardFileFormat { static final int AIFF_MAGIC = 1179603533; @@ -70,11 +67,8 @@ final class AiffFileFormat extends AudioFileFormat { /** FVER chunk size in bytes, inclusive magic and length field */ private final int fverChunkSize=0; - AiffFileFormat( AudioFileFormat aff ) { - this( aff.getType(), aff.getByteLength(), aff.getFormat(), aff.getFrameLength() ); - } - - AiffFileFormat(Type type, int byteLength, AudioFormat format, int frameLength) { + AiffFileFormat(final Type type, final long byteLength, + final AudioFormat format, final long frameLength) { super(type, byteLength, format, frameLength); } diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java index c0ac8bf6d40..20dc68409ff 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AiffFileReader.java @@ -45,7 +45,7 @@ import javax.sound.sampled.UnsupportedAudioFileException; public final class AiffFileReader extends SunFileReader { @Override - AudioFileFormat getAudioFileFormatImpl(final InputStream stream) + StandardFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { DataInputStream dis = new DataInputStream(stream); @@ -60,11 +60,11 @@ public final class AiffFileReader extends SunFileReader { throw new UnsupportedAudioFileException("not an AIFF file"); } - int frameLength = 0; + long /* unsigned 32bit */ frameLength = 0; int length = dis.readInt(); int iffType = dis.readInt(); - int totallength; + final long totallength; if(length <= 0 ) { length = AudioSystem.NOT_SPECIFIED; totallength = AudioSystem.NOT_SPECIFIED; @@ -106,12 +106,7 @@ public final class AiffFileReader extends SunFileReader { if (channels <= 0) { throw new UnsupportedAudioFileException("Invalid number of channels"); } - frameLength = dis.readInt(); // numSampleFrames - if (frameLength < 0) { - // AiffFileFormat uses int, unlike AIS which uses long - //TODO this (negative) value should be passed as long to AIS - frameLength = AudioSystem.NOT_SPECIFIED; - } + frameLength = dis.readInt() & 0xffffffffL; // numSampleFrames int sampleSizeInBits = dis.readUnsignedShort(); if (sampleSizeInBits < 1 || sampleSizeInBits > 32) { diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileFormat.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileFormat.java index 7a91bfc0a75..dc425e40a65 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileFormat.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileFormat.java @@ -33,7 +33,7 @@ import javax.sound.sampled.AudioFormat; * * @author Jan Borgersen */ -final class AuFileFormat extends AudioFileFormat { +final class AuFileFormat extends StandardFileFormat { // magic numbers static final int AU_SUN_MAGIC = 0x2e736e64; // ".snd" @@ -55,11 +55,18 @@ final class AuFileFormat extends AudioFileFormat { static final int AU_HEADERSIZE = 24; + /** + * According the specification of AU file format this is the value for + * length field if length is not known. This is a maximum possible value for + * the unsigned int. + */ + static final long /*unsigned int */ UNKNOWN_SIZE = 0xffffffffL; + private int auType; - AuFileFormat(AudioFileFormat.Type type, int lengthInBytes, AudioFormat format, int lengthInFrames) { - - super(type,lengthInBytes,format,lengthInFrames); + AuFileFormat(final AudioFileFormat.Type type, final long byteLength, + final AudioFormat format, final long frameLength) { + super(type, byteLength, format, frameLength); AudioFormat.Encoding encoding = format.getEncoding(); diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java index 876c3b78e80..097b64b4746 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/AuFileReader.java @@ -29,7 +29,6 @@ import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; -import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFileFormat.Type; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; @@ -45,7 +44,7 @@ import javax.sound.sampled.UnsupportedAudioFileException; public final class AuFileReader extends SunFileReader { @Override - public AudioFileFormat getAudioFileFormatImpl(final InputStream stream) + public StandardFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { final DataInputStream dis = new DataInputStream(stream); final int magic = dis.readInt(); @@ -56,7 +55,7 @@ public final class AuFileReader extends SunFileReader { } final int headerSize = dis.readInt(); - final int dataSize = dis.readInt(); + final long /* unsigned int */ dataSize = dis.readInt() & 0xffffffffL; final int auType = dis.readInt(); final int sampleRate = dis.readInt(); final int channels = dis.readInt(); @@ -120,21 +119,21 @@ public final class AuFileReader extends SunFileReader { // unsupported filetype, throw exception throw new UnsupportedAudioFileException("not a valid AU file"); } + // now seek past the header + dis.skipBytes(headerSize - AuFileFormat.AU_HEADERSIZE); final int frameSize = calculatePCMFrameSize(sampleSizeInBits, channels); //$$fb 2002-11-02: fix for 4629669: AU file reader: problems with empty files - final int length; - if (dataSize < 0) { - length = AudioSystem.NOT_SPECIFIED; - } else { - //$$fb 2003-10-20: fix for 4940459: AudioInputStream.getFrameLength() returns 0 instead of NOT_SPECIFIED - length = dataSize / frameSize; + //$$fb 2003-10-20: fix for 4940459: AudioInputStream.getFrameLength() returns 0 instead of NOT_SPECIFIED + long frameLength = AudioSystem.NOT_SPECIFIED; + long byteLength = AudioSystem.NOT_SPECIFIED; + if (dataSize != AuFileFormat.UNKNOWN_SIZE) { + frameLength = dataSize / frameSize; + byteLength = dataSize + headerSize; } - // now seek past the header - dis.skipBytes(headerSize - AuFileFormat.AU_HEADERSIZE); final AudioFormat format = new AudioFormat(encoding, sampleRate, sampleSizeInBits, channels, frameSize, sampleRate, true); - return new AuFileFormat(Type.AU, dataSize + headerSize, format, length); + return new AuFileFormat(Type.AU, byteLength, format, frameLength); } } diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java index 715cfcf9e76..b573b16d935 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SoftMidiAudioFileReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,6 @@ import javax.sound.midi.MidiUnavailableException; import javax.sound.midi.Receiver; import javax.sound.midi.Sequence; import javax.sound.midi.Track; -import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFileFormat.Type; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; @@ -56,10 +55,10 @@ public final class SoftMidiAudioFileReader extends SunFileReader { private static final AudioFormat format = new AudioFormat(44100, 16, 2, true, false); - private static AudioFileFormat getAudioFileFormat(final Sequence seq) { + private static StandardFileFormat getAudioFileFormat(final Sequence seq) { long totallen = seq.getMicrosecondLength() / 1000000; long len = (long) (format.getFrameRate() * (totallen + 4)); - return new AudioFileFormat(MIDI, format, (int) len); + return new StandardFileFormat(MIDI, format, len); } private AudioInputStream getAudioInputStream(final Sequence seq) @@ -140,7 +139,7 @@ public final class SoftMidiAudioFileReader extends SunFileReader { } @Override - AudioFileFormat getAudioFileFormatImpl(final InputStream stream) + StandardFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { try { return getAudioFileFormat(MidiSystem.getSequence(stream)); diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardFileFormat.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardFileFormat.java new file mode 100644 index 00000000000..5be7149929c --- /dev/null +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/StandardFileFormat.java @@ -0,0 +1,114 @@ +/* + * 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.media.sound; + +import javax.sound.sampled.AudioFileFormat; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioSystem; + +/** + * An instance of the {@code StandardFileFormat} describes the file's length in + * bytes and the length in sample frames as longs. This will provide an + * additional precision unlike the {@code AudioFileFormat}. + */ +class StandardFileFormat extends AudioFileFormat { + + /** + * File length in bytes stored as long. + */ + private final long byteLength; + + /** + * Audio data length in sample frames stored as long. + */ + private final long frameLength; + + /** + * Constructs {@code StandardFileFormat} object. + * + * @param type the type of the audio file + * @param format the format of the audio data contained in the file + * @param frameLength the audio data length in sample frames, or + * {@code AudioSystem.NOT_SPECIFIED} + */ + StandardFileFormat(final Type type, final AudioFormat format, + final long frameLength) { + this(type, AudioSystem.NOT_SPECIFIED, format, frameLength); + } + + /** + * Constructs {@code StandardFileFormat} object. + * + * @param type the type of the audio file + * @param byteLength the length of the file in bytes, or + * {@code AudioSystem.NOT_SPECIFIED} + * @param format the format of the audio data contained in the file + * @param frameLength the audio data length in sample frames, or + * {@code AudioSystem.NOT_SPECIFIED} + */ + StandardFileFormat(final Type type, final long byteLength, + final AudioFormat format, final long frameLength) { + super(type, clip(byteLength), format, clip(frameLength)); + this.byteLength = byteLength; + this.frameLength = frameLength; + } + + /** + * Replaces the passed value to {@code AudioSystem.NOT_SPECIFIED} if the + * value is greater than {@code Integer.MAX_VALUE}. + * + * @param value which should be clipped + * @return the clipped value + */ + private static int clip(final long value) { + if (value > Integer.MAX_VALUE) { + return AudioSystem.NOT_SPECIFIED; + } + return (int) value; + } + + /** + * Obtains the length of the audio data contained in the file, expressed in + * sample frames. The long precision is used. + * + * @return the number of sample frames of audio data in the file + * @see AudioSystem#NOT_SPECIFIED + */ + public final long getLongFrameLength() { + return frameLength; + } + + /** + * Obtains the size in bytes of the entire audio file (not just its audio + * data). The long precision is used. + * + * @return the audio file length in bytes + * @see AudioSystem#NOT_SPECIFIED + */ + public final long getLongByteLength() { + return byteLength; + } +} diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java index a9e40ff33c5..01307d59514 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/SunFileReader.java @@ -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 @@ -47,7 +47,7 @@ import javax.sound.sampled.spi.AudioFileReader; abstract class SunFileReader extends AudioFileReader { @Override - public final AudioFileFormat getAudioFileFormat(final InputStream stream) + public final StandardFileFormat getAudioFileFormat(final InputStream stream) throws UnsupportedAudioFileException, IOException { stream.mark(200); // The biggest value which was historically used try { @@ -87,11 +87,11 @@ abstract class SunFileReader extends AudioFileReader { throws UnsupportedAudioFileException, IOException { stream.mark(200); // The biggest value which was historically used try { - final AudioFileFormat fileFormat = getAudioFileFormatImpl(stream); + final StandardFileFormat format = getAudioFileFormatImpl(stream); // we've got everything, the stream is supported and it is at the // beginning of the audio data, so return an AudioInputStream - return new AudioInputStream(stream, fileFormat.getFormat(), - fileFormat.getFrameLength()); + return new AudioInputStream(stream, format.getFormat(), + format.getLongFrameLength()); } catch (UnsupportedAudioFileException | EOFException ignored) { // stream is unsupported or the header is less than was expected stream.reset(); @@ -140,7 +140,7 @@ abstract class SunFileReader extends AudioFileReader { * UnsupportedAudioFileException if the header is less than was * expected */ - abstract AudioFileFormat getAudioFileFormatImpl(InputStream stream) + abstract StandardFileFormat getAudioFileFormatImpl(InputStream stream) throws UnsupportedAudioFileException, IOException; // HELPER METHODS diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java index 7d6ec18239b..5066ba29ea5 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveExtensibleFileReader.java @@ -34,7 +34,6 @@ import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFormat.Encoding; import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; /** @@ -167,7 +166,7 @@ public final class WaveExtensibleFileReader extends SunFileReader { } @Override - AudioFileFormat getAudioFileFormatImpl(final InputStream stream) + StandardFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { RIFFReader riffiterator = new RIFFReader(stream); @@ -249,19 +248,17 @@ public final class WaveExtensibleFileReader extends SunFileReader { } else { throw new UnsupportedAudioFileException(); } - long frameLength = dataSize / audioformat.getFrameSize(); - if (frameLength > Integer.MAX_VALUE) { - frameLength = AudioSystem.NOT_SPECIFIED; - } - return new AudioFileFormat(AudioFileFormat.Type.WAVE, audioformat, - (int) frameLength); + return new StandardFileFormat(AudioFileFormat.Type.WAVE, audioformat, + dataSize / audioformat.getFrameSize()); } @Override public AudioInputStream getAudioInputStream(final InputStream stream) throws UnsupportedAudioFileException, IOException { - final AudioFileFormat format = getAudioFileFormat(stream); + final StandardFileFormat format = getAudioFileFormat(stream); + final AudioFormat af = format.getFormat(); + final long length = format.getLongFrameLength(); // we've got everything, the stream is supported and it is at the // beginning of the header, so find the data chunk again and return an // AudioInputStream @@ -269,8 +266,6 @@ public final class WaveExtensibleFileReader extends SunFileReader { while (riffiterator.hasNextChunk()) { RIFFReader chunk = riffiterator.nextChunk(); if (chunk.getFormat().equals("data")) { - final AudioFormat af = format.getFormat(); - final long length = chunk.getSize() / af.getFrameSize(); return new AudioInputStream(chunk, af, length); } } diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java index 9bf8c9200ad..bf3abbf684a 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileFormat.java @@ -33,7 +33,7 @@ import javax.sound.sampled.AudioFormat; * * @author Jan Borgersen */ -final class WaveFileFormat extends AudioFileFormat { +final class WaveFileFormat extends StandardFileFormat { /** * Wave format type. @@ -73,9 +73,9 @@ final class WaveFileFormat extends AudioFileFormat { static final int WAVE_FORMAT_SX7383 = 0x1C07; static final int WAVE_FORMAT_EXTENSIBLE= 0xFFFE; - WaveFileFormat(AudioFileFormat.Type type, int lengthInBytes, AudioFormat format, int lengthInFrames) { - - super(type,lengthInBytes,format,lengthInFrames); + WaveFileFormat(final AudioFileFormat.Type type, final long byteLength, + final AudioFormat format, final long frameLength) { + super(type, byteLength, format, frameLength); AudioFormat.Encoding encoding = format.getEncoding(); diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileReader.java index 96a4bd7cd1f..7295b180ed1 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFileReader.java @@ -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 @@ -45,7 +45,7 @@ import javax.sound.sampled.UnsupportedAudioFileException; public final class WaveFileReader extends SunFileReader { @Override - AudioFileFormat getAudioFileFormatImpl(final InputStream stream) + StandardFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { // assumes sream is rewound @@ -64,9 +64,9 @@ public final class WaveFileReader extends SunFileReader { DataInputStream dis = new DataInputStream( stream ); int magic = dis.readInt(); - int fileLength = rllong(dis); + long /* unsigned int */ fileLength = rllong(dis) & 0xffffffffL; int waveMagic = dis.readInt(); - int totallength; + long totallength; if (fileLength <= 0) { fileLength = AudioSystem.NOT_SPECIFIED; totallength = AudioSystem.NOT_SPECIFIED; @@ -186,19 +186,18 @@ public final class WaveFileReader extends SunFileReader { } } // this is the length of the data chunk - int dataLength = rllong(dis); nread += 4; + long /* unsigned int */ dataLength = rllong(dis) & 0xffffffffL; nread += 4; // now build the new AudioFileFormat and return - + final int frameSize = calculatePCMFrameSize(sampleSizeInBits, channels); AudioFormat format = new AudioFormat(encoding, (float)sampleRate, sampleSizeInBits, channels, - calculatePCMFrameSize(sampleSizeInBits, channels), + frameSize, (float)sampleRate, false); - return new WaveFileFormat(AudioFileFormat.Type.WAVE, - totallength, - format, - dataLength / format.getFrameSize()); + long frameLength = dataLength / format.getFrameSize(); + return new WaveFileFormat(AudioFileFormat.Type.WAVE, totallength, + format, frameLength); } } diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java index 284877d1599..2c3be1507fc 100644 --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/WaveFloatFileReader.java @@ -32,7 +32,6 @@ import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFormat.Encoding; import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; /** @@ -43,7 +42,7 @@ import javax.sound.sampled.UnsupportedAudioFileException; public final class WaveFloatFileReader extends SunFileReader { @Override - AudioFileFormat getAudioFileFormatImpl(final InputStream stream) + StandardFileFormat getAudioFileFormatImpl(final InputStream stream) throws UnsupportedAudioFileException, IOException { RIFFReader riffiterator = new RIFFReader(stream); @@ -88,20 +87,17 @@ public final class WaveFloatFileReader extends SunFileReader { AudioFormat audioformat = new AudioFormat( Encoding.PCM_FLOAT, samplerate, bits, channels, framesize, samplerate, false); - long frameLength = dataSize / audioformat.getFrameSize(); - if (frameLength > Integer.MAX_VALUE) { - frameLength = AudioSystem.NOT_SPECIFIED; - } - - return new AudioFileFormat(AudioFileFormat.Type.WAVE, audioformat, - (int) frameLength); + return new StandardFileFormat(AudioFileFormat.Type.WAVE, audioformat, + dataSize / audioformat.getFrameSize()); } @Override public AudioInputStream getAudioInputStream(final InputStream stream) throws UnsupportedAudioFileException, IOException { - final AudioFileFormat format = getAudioFileFormat(stream); + final StandardFileFormat format = getAudioFileFormat(stream); + final AudioFormat af = format.getFormat(); + final long length = format.getLongFrameLength(); // we've got everything, the stream is supported and it is at the // beginning of the header, so find the data chunk again and return an // AudioInputStream @@ -109,8 +105,6 @@ public final class WaveFloatFileReader extends SunFileReader { while (riffiterator.hasNextChunk()) { RIFFReader chunk = riffiterator.nextChunk(); if (chunk.getFormat().equals("data")) { - final AudioFormat af = format.getFormat(); - final long length = chunk.getSize() / af.getFrameSize(); return new AudioInputStream(chunk, af, length); } } diff --git a/jdk/src/java.desktop/share/classes/java/applet/Applet.java b/jdk/src/java.desktop/share/classes/java/applet/Applet.java index 0e02c9cb054..a8430a76e99 100644 --- a/jdk/src/java.desktop/share/classes/java/applet/Applet.java +++ b/jdk/src/java.desktop/share/classes/java/applet/Applet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -46,7 +46,13 @@ import javax.accessibility.*; * @author Arthur van Hoff * @author Chris Warth * @since 1.0 + * + * @deprecated The Applet API is deprecated. See the + * java.applet package documentation + * for further information. */ + +@Deprecated(since = "9") public class Applet extends Panel { /** diff --git a/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java b/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java index 7caae99949d..3863aedb0e3 100644 --- a/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java +++ b/jdk/src/java.desktop/share/classes/java/applet/AppletContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -44,7 +44,13 @@ import java.util.Iterator; * * @author Arthur van Hoff * @since 1.0 + * + * @deprecated The Applet API is deprecated. See the + * java.applet package documentation + * for further information. */ + +@Deprecated(since = "9") public interface AppletContext { /** * Creates an audio clip. diff --git a/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java b/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java index 7a7e614536a..1f4e39b8060 100644 --- a/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java +++ b/jdk/src/java.desktop/share/classes/java/applet/AppletStub.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -36,7 +36,13 @@ import java.net.URL; * @author Arthur van Hoff * @see java.applet.Applet#setStub(java.applet.AppletStub) * @since 1.0 + * + * @deprecated The Applet API is deprecated. See the + * java.applet package documentation + * for further information. */ + +@Deprecated(since = "9") public interface AppletStub { /** * Determines if the applet is active. An applet is active just diff --git a/jdk/src/java.desktop/share/classes/java/applet/AudioClip.java b/jdk/src/java.desktop/share/classes/java/applet/AudioClip.java index f935fa4965b..6436ccbcc5d 100644 --- a/jdk/src/java.desktop/share/classes/java/applet/AudioClip.java +++ b/jdk/src/java.desktop/share/classes/java/applet/AudioClip.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -33,7 +33,13 @@ package java.applet; * * @author Arthur van Hoff * @since 1.0 + * + * @deprecated The Applet API is deprecated. See the + * java.applet package documentation + * for further information. */ + +@Deprecated(since = "9") public interface AudioClip { /** * Starts playing this audio clip. Each time this method is called, diff --git a/jdk/src/java.desktop/share/classes/java/applet/package.html b/jdk/src/java.desktop/share/classes/java/applet/package.html index 3315f292594..a95395b900e 100644 --- a/jdk/src/java.desktop/share/classes/java/applet/package.html +++ b/jdk/src/java.desktop/share/classes/java/applet/package.html @@ -39,6 +39,11 @@ The applet context is an application that is responsible for loading and running applets. For example, the applet context could be a Web browser or an applet development environment.

    +The APIs in this package are all deprecated. Alternative technologies such as Java Web Start +or installable applications should be used instead. See JEP 289 +and the Oracle White Paper +"Migrating from Java Applets to plugin-free Java technologies" for more information. +

    - - - - - - - - -

    Button2DragTest
    Bug ID: 4955110

    - -

    This is an AUTOMATIC test, simply wait for completion

    - - - - diff --git a/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java b/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java index 33bb5058706..c5045ed7fa7 100644 --- a/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java +++ b/jdk/test/java/awt/dnd/Button2DragTest/Button2DragTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -21,45 +21,52 @@ * questions. */ -/* - test - @bug 4955110 - @summary tests that a drag ends on button2 release - @author Alexander.Gerasimov area=dnd - @library ../../regtesthelpers - @build Util - @run applet/othervm Button2DragTest.html -*/ +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.StringSelection; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.event.InputEvent; - -/** - * Button2DragTest.java - * - * summary: tests that DragSourceDragEvent.getDropAction() accords to its new spec - * (does not depend on the user drop action) - * - */ - -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import java.awt.datatransfer.*; -import java.awt.dnd.*; import test.java.awt.regtesthelpers.Util; - -public class Button2DragTest extends Applet { +/** + * @test + * @bug 4955110 + * @summary tests that DragSourceDragEvent.getDropAction() accords to its new + * spec (does not depend on the user drop action) + * @library ../../regtesthelpers + * @build Util + * @run main/othervm Button2DragTest + * @author Alexander.Gerasimov area=dnd + */ +public final class Button2DragTest { private volatile boolean dropSuccess; - private Frame frame; + private static Frame frame; + public static void main(final String[] args) { + Button2DragTest test = new Button2DragTest(); + try { + test.run(); + } finally { + if (frame != null) { + frame.dispose(); + } + } + } - public void init() { - // Set up the environment -- set the layout manager, add - // buttons, etc. - setLayout(new BorderLayout()); - + public void run() { frame = new Frame(); final DragSourceListener dragSourceListener = new DragSourceAdapter() { @@ -84,20 +91,13 @@ public class Button2DragTest extends Applet { } }; new DropTarget(frame, dropTargetListener); - } - - - public void start() { - //Get things going. Request focus, set size, et cetera - setSize(200,200); - setVisible(true); - validate(); //What would normally go into main() will probably go here. //Use System.out.println for diagnostic messages that you want //to read after the test is done. - + frame.setUndecorated(true); frame.setBounds(100, 100, 200, 200); + frame.setLocationRelativeTo(null); frame.setVisible(true); Robot robot = Util.createRobot(); diff --git a/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java b/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java index 92dcc214376..11cd886d598 100644 --- a/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java +++ b/jdk/test/java/awt/event/MouseEvent/AltGraphModifierTest/AltGraphModifierTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -44,13 +44,9 @@ public class AltGraphModifierTest { = { "This test is for verifying Alt-Gr modifier of an event.", "Windows :-", - "1. Please check if Alt-Gr key is present on keyboard.", - "2. If present, press the Alt-Gr key and perform", - " mouse click on the TestWindow.", - "3. If Alt-Gr key is not present, press Ctrl+Alt keys &", - " perform mouse click on the TestWindow.", - "4. Test will exit by itself with appropriate result.", - "", + "1. Click Pass.", + "2. Alt-Gr modifier is tested under Robot tests.", + " ", "Linux :-", "1. Please check if Alt-Gr key is present on keyboard.", "2. If present, press the Alt-Gr key and perform", @@ -63,10 +59,11 @@ public class AltGraphModifierTest { "6. Press Right Alt Key & perform mouse click on the", " TestWindow", "7. Test will exit by itself with appropriate result.", - "", + " ", "Mac :-", - " Mac fix is under progress, & will be fixed soon.", - " Please click Fail" + "1. Press Right Option key on the keyboard and mouse click", + " on the TestWindow", + "3. Test will exit by itself with appropriate result.", }; Sysout.createDialog(); @@ -77,7 +74,7 @@ public class AltGraphModifierTest { public static void initTestWindow() { mainFrame = new Frame(); mainFrame.setTitle("TestWindow"); - mainFrame.setSize(300, 200); + mainFrame.setBounds(700, 10, 300, 300); mainFrame.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { diff --git a/jdk/test/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.html b/jdk/test/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.html deleted file mode 100644 index 9973c033612..00000000000 --- a/jdk/test/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - -RestoreActiveWindowTest - - - -

    RestoreActiveWindowTest
    Bug ID: 6365992

    - -

    See the dialog box (usually in upper left corner) for instructions

    - - - - diff --git a/jdk/test/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java b/jdk/test/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java index 66e4148931c..8d29dbb5849 100644 --- a/jdk/test/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java +++ b/jdk/test/java/awt/print/Dialog/RestoreActiveWindowTest/RestoreActiveWindowTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,210 +22,194 @@ */ /* - test - @bug 6365992 6379599 - @summary REG: Showing and disposing a native print dialog makes the main frame inactive, Win32 - @author Dmitry.Cherepanov@SUN.COM area=awt.printdialog - @run applet/manual=yesno RestoreActiveWindowTest.html -*/ - -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; -import java.awt.print.*; -import javax.print.attribute.*; - -public class RestoreActiveWindowTest extends Applet -{ - Button showBtn1 = new Button("show a native print dialog"); - Button showBtn2 = new Button("show a native page dialog"); - - public void init() - { - showBtn1.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent ae) { - PrinterJob.getPrinterJob().printDialog(); - } - }); - showBtn2.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent ae){ - PrinterJob.getPrinterJob().pageDialog(new PageFormat()); - } - }); - - add(showBtn1); - add(showBtn2); - - String[] instructions = { - "1.1) Click on 'show a native print dialog'. A native print dialog will come up.", - "1.2) Click on the 'close'(X) button. The dialog will be closed.", - "1.3) After the dialog closing another window should become the active window.", - "1.4) If there no any active window then the test failed.", - "2.1) Click on 'show a native page dialog'. A native page dialog will come up.", - "2.2) Click on the 'close'(X) button. The dialog will be closed.", - "2.3) After the dialog closing another window should become the active window.", - "2.4) If there no any active window then the test failed.", - "3) Test Passed." - }; - - Sysout.createDialogWithInstructions( instructions ); - - }//End init() - - public void start () - { - //Get things going. Request focus, set size, et cetera - setSize (200,200); - show(); - - }// start() - - //The rest of this class is the actions which perform the test... - - //Use Sysout.println to communicate with the user NOT System.out!! - //Sysout.println ("Something Happened!"); - -}// class ManualYesNoTest - -/* Place other classes related to the test after this line */ - - - - - -/**************************************************** - Standard Test Machinery - DO NOT modify anything below -- it's a standard - chunk of code whose purpose is to make user - interaction uniform, and thereby make it simpler - to read and understand someone else's test. - ****************************************************/ - -/** - This is part of the standard test machinery. - It creates a dialog (with the instructions), and is the interface - for sending text messages to the user. - To print the instructions, send an array of strings to Sysout.createDialog - WithInstructions method. Put one line of instructions per array entry. - To display a message for the tester to see, simply call Sysout.println - with the string to be displayed. - This mimics System.out.println but works within the test harness as well - as standalone. + * @test + * @bug 6365992 6379599 8137137 + * @summary REG: Showing and disposing a native print dialog makes the main + * frame inactive, Win32 + * @run main/manual RestoreActiveWindowTest */ +import java.awt.Frame; +import java.awt.Button; +import java.awt.GridBagLayout; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.GridLayout; +import java.awt.GridBagConstraints; +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.print.PrinterJob; +import java.awt.print.PageFormat; -class Sysout -{ - private static TestDialog dialog; +public class RestoreActiveWindowTest implements ActionListener { - public static void createDialogWithInstructions( String[] instructions ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - dialog.printInstructions( instructions ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); + private static Frame mainFrame; + private static Button printDialogButton; + private static Button pageDialogButton; + private static Frame instructionFrame; + private static GridBagLayout layout; + private static Panel mainControlPanel; + private static Panel resultButtonPanel; + private static TextArea instructionTextArea; + private static Button passButton; + private static Button failButton; + private static Thread mainThread = null; + private static boolean testPassed = false; + private static boolean isInterrupted = false; + private static final int testTimeOut = 300000; + private static String testFailMessage; + + public void createAndShowGUI() { + mainFrame = new Frame("Test"); + mainFrame.setSize(200, 200); + mainFrame.setLocationRelativeTo(null); + mainFrame.setLayout(new GridLayout(2, 1)); + + printDialogButton = new Button("show a native print dialog"); + pageDialogButton = new Button("show a native page dialog"); + printDialogButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ae) { + PrinterJob.getPrinterJob().printDialog(); + setButtonEnable(true); + testFailMessage = "Print dialog test failed."; + } + }); + pageDialogButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ae) { + PrinterJob.getPrinterJob().pageDialog(new PageFormat()); + setButtonEnable(true); + testFailMessage = "Page dialog test failed."; + } + }); + + mainFrame.add(printDialogButton); + mainFrame.add(pageDialogButton); + mainFrame.setVisible(true); + + mainFrame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + cleanUp(); + throw new RuntimeException("User has closed the test window " + + "without clicking Pass or Fail."); + } + }); } - public static void createDialog( ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - String[] defInstr = { "Instructions will appear here. ", "" } ; - dialog.printInstructions( defInstr ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); + private void createInstructionUI() { + instructionFrame = new Frame("Native Print Dialog and Page Dialog"); + layout = new GridBagLayout(); + mainControlPanel = new Panel(layout); + resultButtonPanel = new Panel(layout); + + GridBagConstraints gbc = new GridBagConstraints(); + String instructions + = "\nINSTRUCTIONS:\n" + + "\n 1. Click on the 'show a native print dialog' button. A " + + "native print dialog will come up." + + "\n 2. Click on the 'Cancel' button on Mac OS X or " + + "'close'(X) on other paltforms. Dialog will be closed." + + "\n 3. After the dialog is closed another window should " + + "become the active window." + + "\n 4. If there no any active window then the test has " + + "failed. Click on 'Fail' Button." + + "\n 5. Click on the 'show a native page dialog' button. A " + + "native page dialog will come up." + + "\n 6. Click on the 'Cancel' button on Mac OS X or " + + "'close'(X) on other paltforms. Dialog will be closed." + + "\n 7. After the dialog is closed another window should " + + "become the active window." + + "\n 8. If there no any active window then the test has " + + "failed. Click on 'Fail' Button." + + "\n 9. Test Passed. Click on 'Pass' Button."; + + instructionTextArea = new TextArea(13, 80); + instructionTextArea.setText(instructions); + instructionTextArea.setEnabled(false); + instructionTextArea.setBackground(Color.white); + + gbc.gridx = 0; + gbc.gridy = 0; + gbc.weightx = 0.5; + gbc.fill = GridBagConstraints.HORIZONTAL; + mainControlPanel.add(instructionTextArea, gbc); + + passButton = new Button("Pass"); + passButton.setName("Pass"); + passButton.addActionListener((ActionListener) this); + + failButton = new Button("Fail"); + failButton.setName("Fail"); + failButton.addActionListener((ActionListener) this); + + setButtonEnable(false); + + gbc.gridx = 0; + gbc.gridy = 0; + resultButtonPanel.add(passButton, gbc); + gbc.gridx = 1; + gbc.gridy = 0; + resultButtonPanel.add(failButton, gbc); + gbc.gridx = 0; + gbc.gridy = 1; + mainControlPanel.add(resultButtonPanel, gbc); + + instructionFrame.add(mainControlPanel); + instructionFrame.pack(); + instructionFrame.setVisible(true); } - - public static void printInstructions( String[] instructions ) - { - dialog.printInstructions( instructions ); + @Override + public void actionPerformed(ActionEvent ae) { + if (ae.getSource() instanceof Button) { + Button btn = (Button) ae.getSource(); + switch (btn.getName()) { + case "Pass": + testPassed = true; + isInterrupted = true; + mainThread.interrupt(); + break; + case "Fail": + testPassed = false; + isInterrupted = true; + mainThread.interrupt(); + break; + } + } } - - public static void println( String messageIn ) - { - dialog.displayMessage( messageIn ); + private static void setButtonEnable(boolean status) { + passButton.setEnabled(status); + failButton.setEnabled(status); } -}// Sysout class - -/** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ -class TestDialog extends Dialog -{ - - TextArea instructionsText; - TextArea messageText; - int maxStringLength = 80; - - //DO NOT call this directly, go through Sysout - public TestDialog( Frame frame, String name ) - { - super( frame, name ); - int scrollBoth = TextArea.SCROLLBARS_BOTH; - instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); - add( "North", instructionsText ); - - messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); - add("Center", messageText); - - pack(); - - setVisible(true); - }// TestDialog() - - //DO NOT call this directly, go through Sysout - public void printInstructions( String[] instructions ) - { - //Clear out any current instructions - instructionsText.setText( "" ); - - //Go down array of instruction strings - - String printStr, remainingStr; - for( int i=0; i < instructions.length; i++ ) - { - //chop up each into pieces maxSringLength long - remainingStr = instructions[ i ]; - while( remainingStr.length() > 0 ) - { - //if longer than max then chop off first max chars to print - if( remainingStr.length() >= maxStringLength ) - { - //Try to chop on a word boundary - int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); - - if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; - - printStr = remainingStr.substring( 0, posOfSpace + 1 ); - remainingStr = remainingStr.substring( posOfSpace + 1 ); - } - //else just print - else - { - printStr = remainingStr; - remainingStr = ""; - } - - instructionsText.append( printStr + "\n" ); - - }// while - - }// for - - }//printInstructions() - - //DO NOT call this directly, go through Sysout - public void displayMessage( String messageIn ) - { - messageText.append( messageIn + "\n" ); - System.out.println(messageIn); + private static void cleanUp() { + mainFrame.dispose(); + instructionFrame.dispose(); } -}// TestDialog class + public static void main(String args[]) { + RestoreActiveWindowTest printDialogs = new RestoreActiveWindowTest(); + printDialogs.createInstructionUI(); + printDialogs.createAndShowGUI(); + + mainThread = Thread.currentThread(); + try { + mainThread.sleep(testTimeOut); + } catch (InterruptedException ex) { + if (!testPassed) { + throw new RuntimeException(testFailMessage); + } + } finally { + cleanUp(); + } + + if (!isInterrupted) { + throw new RuntimeException("Test Timed out after " + + testTimeOut / 1000 + " seconds"); + } + } +} diff --git a/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java b/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java index a8ec7d49188..b5fc3667b94 100644 --- a/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java +++ b/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java @@ -33,7 +33,7 @@ import java.util.Arrays; /** * @test - * @bug 8132973 8132732 8155013 + * @bug 8132973 8132732 8155013 8154958 * @summary Some check for BeanProperty annotation * @author a.stepanov * @run main AnonymousClassBeanPropertyTest @@ -62,6 +62,10 @@ public class AnonymousClassBeanPropertyTest { // ---------- test cases (interfaces) ---------- + public interface IPublic { + double getX(); + } + private interface IGet { double getX(); } @@ -113,6 +117,10 @@ public class AnonymousClassBeanPropertyTest { void setX(double a[]); } + private interface IIs { + boolean isX(); + } + // ---------- checks ---------- @@ -124,7 +132,7 @@ public class AnonymousClassBeanPropertyTest { return ok; } - private static boolean checkInfo(Class c, String what) { + private static boolean checkInfo(Class c, String what, boolean checkVals) { BeanInfo i; try { i = Introspector.getBeanInfo(c, Object.class); } @@ -154,6 +162,8 @@ public class AnonymousClassBeanPropertyTest { ok &= check("visualUpdate", (boolean) d.getValue("visualUpdate"), UPDATE); + if (!checkVals) { return ok; } + Object vals[] = (Object[]) d.getValue("enumerationValues"); if (vals == null) { System.out.println("null enumerationValues"); @@ -210,8 +220,10 @@ public class AnonymousClassBeanPropertyTest { (boolean) d.getValue("visualUpdate"), !UPDATE); Object vals[] = (Object[]) d.getValue("enumerationValues"); - if (vals != null || vals.length > 0) { - System.out.println("non-empty enumerationValues"); + if (vals != null && vals.length > 0) { + System.out.println("non-empty enumerationValues:"); + for (Object v: vals) { System.out.print(v.toString()); } + System.out.println(); return false; } @@ -228,6 +240,31 @@ public class AnonymousClassBeanPropertyTest { //---------------------------------------------------------------------- + // TODO: please uncomment/update after 8154958 fix + /* + IPublic testPublic = new IPublic() { + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public double getX() { return X; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + }; + ok = checkInfo(testPublic.getClass(), "IPublic", true); + System.out.println("OK = " + ok); + passed = passed && ok; + */ + + //---------------------------------------------------------------------- + IGet testGet = new IGet() { @BeanProperty( description = DESCRIPTION, @@ -244,7 +281,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGet.getClass(), "IGet"); + ok = checkInfo(testGet.getClass(), "IGet", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -269,7 +306,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testSet.getClass(), "ISet"); + ok = checkInfo(testSet.getClass(), "ISet", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -294,7 +331,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetByIndex.getClass(), "IGetByIndex"); + ok = checkInfo(testGetByIndex.getClass(), "IGetByIndex", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -319,7 +356,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testSetByIndex.getClass(), "ISetByIndex"); + ok = checkInfo(testSetByIndex.getClass(), "ISetByIndex", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -346,7 +383,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetArray.getClass(), "IGetArray"); + ok = checkInfo(testGetArray.getClass(), "IGetArray", true); System.out.println("OK = " + ok); passed = passed && ok; */ @@ -374,7 +411,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testSetArray.getClass(), "ISetArray"); + ok = checkInfo(testSetArray.getClass(), "ISetArray", true); System.out.println("OK = " + ok); passed = passed && ok; */ @@ -402,7 +439,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetBoth_1.getClass(), "IGetBoth-1"); + ok = checkInfo(testGetBoth_1.getClass(), "IGetBoth-1", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -429,7 +466,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetBoth_2.getClass(), "IGetBoth-2"); + ok = checkInfo(testGetBoth_2.getClass(), "IGetBoth-2", true); System.out.println("OK = " + ok); passed = passed && ok; */ @@ -465,11 +502,11 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetBoth_3.getClass(), "IGetBoth-3"); + ok = checkInfo(testGetBoth_3.getClass(), "IGetBoth-3", true); System.out.println("OK = " + ok); ok2 = checkAlternativeInfo(testGetBoth_3.getClass(), "IGetBoth-3"); System.out.println("OK = " + ok2); - passed = passed && ok && ok2; + passed = passed && (ok || ok2); */ //---------------------------------------------------------------------- @@ -495,7 +532,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testSetBoth_1.getClass(), "ISetBoth-1"); + ok = checkInfo(testSetBoth_1.getClass(), "ISetBoth-1", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -522,7 +559,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testSetBoth_2.getClass(), "ISetBoth-2"); + ok = checkInfo(testSetBoth_2.getClass(), "ISetBoth-2", true); System.out.println("OK = " + ok); passed = passed && ok; */ @@ -558,11 +595,11 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testSetBoth_3.getClass(), "ISetBoth-3"); + ok = checkInfo(testSetBoth_3.getClass(), "ISetBoth-3", true); System.out.println("OK = " + ok); ok2 = checkAlternativeInfo(testSetBoth_3.getClass(), "ISetBoth-3"); System.out.println("OK = " + ok2); - passed = passed && ok && ok2; + passed = passed && (ok || ok2); */ //---------------------------------------------------------------------- @@ -588,7 +625,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSet_1.getClass(), "IGetSet-1"); + ok = checkInfo(testGetSet_1.getClass(), "IGetSet-1", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -614,7 +651,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSet_2.getClass(), "IGetSet-2"); + ok = checkInfo(testGetSet_2.getClass(), "IGetSet-2", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -649,11 +686,11 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSet_3.getClass(), "IGetSet-3"); + ok = checkInfo(testGetSet_3.getClass(), "IGetSet-3", true); System.out.println("OK = " + ok); ok2 = checkAlternativeInfo(testGetSet_3.getClass(), "IGetSet-3"); System.out.println("OK = " + ok2); - passed = passed && ok && ok2; + passed = passed && (ok || ok2); */ //---------------------------------------------------------------------- @@ -679,7 +716,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSetByIndex_1.getClass(), "IGetSetByIndex-1"); + ok = checkInfo(testGetSetByIndex_1.getClass(), "IGetSetByIndex-1", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -705,7 +742,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSetByIndex_2.getClass(), "IGetSetByIndex-2"); + ok = checkInfo(testGetSetByIndex_2.getClass(), "IGetSetByIndex-2", true); System.out.println("OK = " + ok); passed = passed && ok; @@ -744,12 +781,12 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSetByIndex_3.getClass(), "IGetSetByIndex-3"); + ok = checkInfo(testGetSetByIndex_3.getClass(), "IGetSetByIndex-3", true); System.out.println("OK = " + ok); ok2 = checkAlternativeInfo( testGetSetByIndex_3.getClass(), "IGetSetByIndex-3"); System.out.println("OK = " + ok2); - passed = passed && ok && ok2; + passed = passed && (ok || ok2); */ //---------------------------------------------------------------------- @@ -781,7 +818,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSetBoth_1.getClass(), "IGetSetBoth-1"); + ok = checkInfo(testGetSetBoth_1.getClass(), "IGetSetBoth-1", true); System.out.println("OK = " + ok); passed = passed && ok; */ @@ -813,7 +850,7 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSetBoth_2.getClass(), "IGetSetBoth-2"); + ok = checkInfo(testGetSetBoth_2.getClass(), "IGetSetBoth-2", true); System.out.println("OK = " + ok); passed = passed && ok; */ @@ -853,14 +890,135 @@ public class AnonymousClassBeanPropertyTest { public void addPropertyChangeListener(PropertyChangeListener l) {} public void removePropertyChangeListener(PropertyChangeListener l) {} }; - ok = checkInfo(testGetSetBoth_3.getClass(), "IGetSetBoth-3"); + ok = checkInfo(testGetSetBoth_3.getClass(), "IGetSetBoth-3", true); System.out.println("OK = " + ok); ok2 = checkAlternativeInfo( testGetSetBoth_3.getClass(), "IGetSetBoth-3"); System.out.println("OK = " + ok2); - passed = passed && ok && ok2; + passed = passed && (ok || ok2); */ + //---------------------------------------------------------------------- + + IIs testIs_1 = new IIs() { + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + @Override + public boolean isX() { return false; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + }; + ok = checkInfo(testIs_1.getClass(), "IIs-1", false); + System.out.println("OK = " + ok); + passed = passed && ok; + + + IIs testIs_2 = new IIs() { + + private boolean b; + + @Override + public boolean isX() { return b; } + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + public void setX(boolean v) { b = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + }; + ok = checkInfo(testIs_2.getClass(), "IIs-2", false); + System.out.println("OK = " + ok); + passed = passed && ok; + + + IIs testIs_3 = new IIs() { + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + @Override + public boolean isX() { return false; } + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public boolean getX() { return false; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + }; + ok = checkInfo(testIs_3.getClass(), "IIs-3", false); + System.out.println("OK = " + ok); + ok2 = checkAlternativeInfo(testIs_3.getClass(), "IIs-3"); + System.out.println("OK = " + ok2); + passed = passed && (ok || ok2); + + // TODO: please uncomment/update after 8132973 fix + /* + IIs testIs_4 = new IIs() { + + private boolean b; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + @Override + public boolean isX() { return b; } + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public void setX(boolean v) { b = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + }; + ok = checkInfo(testIs_4.getClass(), "IIs-4", false); + System.out.println("OK = " + ok); + ok2 = checkAlternativeInfo(testIs_4.getClass(), "IIs-4"); + System.out.println("OK = " + ok2); + passed = passed && (ok || ok2); + */ + + + //---------------------------------------------------------------------- + + if (!passed) { throw new RuntimeException("test failed"); } System.out.println("\ntest passed"); } diff --git a/jdk/test/java/beans/Introspector/BeanPropertyTest.java b/jdk/test/java/beans/Introspector/BeanPropertyTest.java index 6f957074c6e..5e84aaaed4e 100644 --- a/jdk/test/java/beans/Introspector/BeanPropertyTest.java +++ b/jdk/test/java/beans/Introspector/BeanPropertyTest.java @@ -33,7 +33,7 @@ import java.util.Arrays; /** * @test - * @bug 8132703 8132163 8132732 8132973 8154756 8132888 + * @bug 8132703 8132163 8132732 8132973 8154756 8132888 8155103 * @summary Some check for BeanProperty annotation * @author a.stepanov * @run main BeanPropertyTest @@ -853,6 +853,64 @@ public class BeanPropertyTest { public void removePropertyChangeListener(PropertyChangeListener l) {} } + // JDK-8155103 + public static enum E { + + ONE, + TWO { + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public void setX(int v) {} + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + }; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public void setX(int v) {} + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + + } + + private static enum EB { + + TRUE(true), FALSE(false); + + private boolean b; + private EB(boolean v) { b = v; } + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + public boolean isTrue() { return true; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + + } + // ---------- checks ---------- @@ -953,7 +1011,7 @@ public class BeanPropertyTest { } private static boolean ignoreVals(Class c) { - return (c.equals(Self.class) || c.equals(SelfArr.class)); + return (c.equals(Self.class) || c.equals(SelfArr.class)) || c.equals(EB.class); } @@ -1003,6 +1061,29 @@ public class BeanPropertyTest { passed = passed && ok; } + // enums + + Class enumCases[] = { + + // TODO: uncomment/update after 8155103 fix + //E.class, E.TWO.getClass(), EB.class + }; + + int ne = 1; + for (Class c: enumCases) { + + System.out.println("\nEnum-" + ne + ":"); + ne++; + + BeanInfo i; + try { i = Introspector.getBeanInfo(c, Object.class); } + catch (IntrospectionException e) { throw new RuntimeException(e); } + boolean ok = checkInfo(i, !ignoreVals(c)); + System.out.println(ok ? "OK" : "NOK"); + passed = passed && ok; + } + + if (!passed) { throw new RuntimeException("test failed"); } System.out.println("\ntest passed"); } diff --git a/jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java b/jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java new file mode 100644 index 00000000000..e42fa6228f3 --- /dev/null +++ b/jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java @@ -0,0 +1,1281 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.beans.BeanInfo; +import java.beans.BeanProperty; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyChangeListener; +import java.beans.PropertyDescriptor; + +import java.util.Arrays; + + +/** + * @test + * @bug 8132565 8155013 + * @summary Some inheritance check for BeanProperty annotation + * @author a.stepanov + * @run main InheritanceBeanPropertyTest + */ + + +public class InheritanceBeanPropertyTest { + + private final static String DESCRIPTION = "TEST"; + private final static boolean BOUND = true; + private final static boolean EXPERT = false; + private final static boolean HIDDEN = true; + private final static boolean PREFERRED = false; + private final static boolean REQUIRED = true; + private final static boolean UPDATE = false; + + private final static double X = java.lang.Math.PI; + + private final static String + V_NAME = "java.lang.Math.PI", + V_SHORT = "PI", + V = Double.toString(X); + + private final static String DESCRIPTION_2 = "XYZ"; + + + // ---------- test cases ---------- + + public static class BaseGet { + + private final static String TESTCASE = "base getter"; + + public double getX() { return X; } + } + + public static class OverloadGet extends BaseGet { + + private final static String TESTCASE = "overload getter"; + + private final double x[] = {X, X, X}; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public double getX(int i) { return x[i]; } // indexed + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class BaseSet { + + private final static String TESTCASE = "base setter"; + + double u; + public void setX(double v) { u = v; } + } + + public static class OverloadSet extends BaseSet { + + private final static String TESTCASE = "overload setter"; + + private final double x[] = {X, X, X}; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public void setX(int i, double v) { x[i] = v; } // indexed + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class BaseIGet { + + protected final double x[] = {X, X, X}; + public double[] getX() { return x; } + } + + public static class OverloadIGet extends BaseIGet { + + private final static String TESTCASE = "overload indexed getter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public double getX(int i) { return x[i]; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class BaseISet { + + protected double x[] = {X, X, X}; + public void setX(double a[]) { x = Arrays.copyOf(a, a.length); } + } + + public static class OverloadISet extends BaseISet { + + private final static String TESTCASE = "overload indexed setter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public void setX(int i, double v) { x[i] = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class BoolGet { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public boolean getX() { return false; } + } + + public static class BoolGetIs extends BoolGet { + + private final static String TESTCASE = "base boolean getter + is"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + public boolean isX() { return false; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + // ---------- + + public static class BoolIs { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public boolean isX() { return false; } + } + + public static class BoolIsGet extends BoolIs { + + private final static String TESTCASE = "base is + boolean getter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + public boolean getX() { return false; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class AnnotatedGet { + + private final static String TESTCASE = "annotated super getter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public double getX() { return 0.; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public static class OverrideAnnotatedGet extends AnnotatedGet { + + private final static String TESTCASE = "override annotated getter"; + + @Override + public double getX() { return X; } + } + + // ---------- + + public static class AnnotatedIs { + + private final static String TESTCASE = "annotated super is"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public boolean isX() { return false; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public static class OverrideAnnotatedIs extends AnnotatedIs { + + private final static String TESTCASE = "override annotated is"; + + @Override + public boolean isX() { return false; } + } + + // ---------- + + public static class AnnotatedSet { + + private final static String TESTCASE = "annotated super set"; + + protected double x; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public void setX(double v) { x = -v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public static class OverrideAnnotatedSet extends AnnotatedSet { + + private final static String TESTCASE = "override annotated setter"; + + @Override + public void setX(double v) { x = v; } + } + + // ---------- + + public static class AnnotatedGet2 { + + protected double x; + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public double getX() { return 0.; } + } + + public static class OverrideAnnotatedGet2 extends AnnotatedGet2 { + + private final static String TESTCASE = "override annotated getter - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public double getX() { return X; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public static class AnnotatedGet2Ext extends AnnotatedGet2 { + + private final static String TESTCASE = "extend annotated getter - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public void setX(double v) { x = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class AnnotatedIs2 { + + protected boolean b = false; + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public boolean isX() { return false; } + } + + public static class OverrideAnnotatedIs2 extends AnnotatedIs2 { + + private final static String TESTCASE = "override annotated is - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + @Override + public boolean isX() { return b; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public static class AnnotatedIs2Ext extends AnnotatedIs2 { + + private final static String TESTCASE = "extend annotated is - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + public void setX(boolean v) { b = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class AnnotatedSet2 { + + protected double x; + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public void setX(double v) { x = -v; } + } + + public static class OverrideAnnotatedSet2 extends AnnotatedSet2 { + + private final static String TESTCASE = "override annotated setter - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public void setX(double v) { x = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public static class AnnotatedSet2Ext extends AnnotatedSet2 { + + private final static String TESTCASE = "extend annotated setter - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public double getX() { return x; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public abstract static class AbstractGet { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public abstract double getX(); + } + + public static class OverrideAbstractGet extends AbstractGet { + + private final static String TESTCASE = + "override abstract annotated getter"; + + @Override + public double getX() { return X; } + } + + public static class OverrideAbstractGet2 extends AbstractGet { + + private final static String TESTCASE = + "override abstract annotated getter - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public double getX() { return X; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public abstract static class AbstractGetExt extends AbstractGet { + + private final static String TESTCASE = + "extend abstract annotated getter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public abstract void setX(double v); + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public abstract static class AbstractIs { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public abstract boolean isX(); + } + + public static class OverrideAbstractIs extends AbstractIs { + + private final static String TESTCASE = + "override abstract annotated is"; + + @Override + public boolean isX() { return true; } + } + + public static class OverrideAbstractIs2 extends AbstractIs { + + private final static String TESTCASE = + "override abstract annotated is - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + @Override + public boolean isX() { return true; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + + public abstract static class AbstractIsExt extends AbstractIs { + + private final static String TESTCASE = + "extend abstract annotated is"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + public abstract boolean getX(); + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public abstract static class AbstractSet { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public abstract void setX(double v); + } + + public static class OverrideAbstractSet extends AbstractSet { + + private final static String TESTCASE = + "override abstract annotated setter"; + + private double x; + + @Override + public void setX(double v) { x = v; } + } + + public static class OverrideAbstractSet2 extends AbstractSet { + + private final static String TESTCASE = + "override abstract annotated setter - 2"; + + private double x; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public void setX(double v) { x = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public abstract static class AbstractSetExt extends AbstractSet { + + private final static String TESTCASE = + "extend abstract annotated setter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public abstract void setX(double v[]); + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static abstract class AbstractGet2 { + + private final static String TESTCASE = "abstract super getter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public abstract double getX(); + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public static abstract class AbstractGet2Ext extends AbstractGet2 { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public abstract void setX(double a[]); + } + + // ---------- + + public static interface IGet { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + double getX(); + } + + public static class IGetImpl implements IGet { + + private final static String TESTCASE = "implement getter interface"; + + @Override + public double getX() { return X; } + } + + public static class IGetImpl2 implements IGet { + + private final static String TESTCASE = "implement getter interface - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public double getX() { return X; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public abstract static class IGetImpl3 implements IGet { + + private final static String TESTCASE = "implement getter interface - 3"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public abstract void setX(double v); + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static interface IIs { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public boolean isX(); + } + + public static class IIsImpl implements IIs { + + private final static String TESTCASE = "implement is interface"; + + @Override + public boolean isX() { return true; } + } + + public static class IIsImpl2 implements IIs { + + private final static String TESTCASE = "implement is interface - 2"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + @Override + public boolean isX() { return true; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public abstract static class IIsImpl3 implements IIs { + + private final static String TESTCASE = "implement is interface - 3"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE) + public abstract void setX(boolean v); + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static interface ISet { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public void setX(double v); + } + + public static class ISetImpl implements ISet { + + private final static String TESTCASE = "implement getter interface"; + + private double x; + + @Override + public void setX(double v) { x = v; } + } + + public static class ISetImpl2 implements ISet { + + private final static String TESTCASE = "implement getter interface - 2"; + + private double x; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public void setX(double v) { x = v; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + public abstract static class ISetImpl3 implements ISet { + + private final static String TESTCASE = "implement getter interface - 3"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public abstract double getX(); + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static interface ISet2 { + + final static String TESTCASE = "super interface - setter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public void setX(double v); + + public void addPropertyChangeListener(PropertyChangeListener l); + public void removePropertyChangeListener(PropertyChangeListener l); + } + + public static class ISet2Impl implements ISet2 { + + private double x; + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + @Override + public void setX(double v) { x = v; } + + @Override + public void addPropertyChangeListener(PropertyChangeListener l) {} + @Override + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static interface IGet2 { + + final static String TESTCASE = "super interface - indexed getter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + public double[] getX(); + + public void addPropertyChangeListener(PropertyChangeListener l); + public void removePropertyChangeListener(PropertyChangeListener l); + } + + public static class IGet2Impl implements IGet2 { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + @Override + public double[] getX() { return new double[]{X, X}; } + + @Override + public void addPropertyChangeListener(PropertyChangeListener l) {} + @Override + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + public static class ProtectedGet { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + protected double getX() { return 0.; } + } + + public static class OverrideProtectedGet extends ProtectedGet { + + final static String TESTCASE = "override protected getter"; + + @BeanProperty( + description = DESCRIPTION, + bound = BOUND, + expert = EXPERT, + hidden = HIDDEN, + preferred = PREFERRED, + required = REQUIRED, + visualUpdate = UPDATE, + enumerationValues = {V_NAME}) + @Override + public double getX() { return X; } + + public void addPropertyChangeListener(PropertyChangeListener l) {} + public void removePropertyChangeListener(PropertyChangeListener l) {} + } + + // ---------- + + // static getter - see also JDK-8154938 + public static class StaticGet { + + @BeanProperty( + description = DESCRIPTION_2, + bound = !BOUND, + expert = !EXPERT, + hidden = !HIDDEN, + preferred = !PREFERRED, + required = !REQUIRED, + visualUpdate = !UPDATE) + public static double getProp() { return 0.; } + } + + public static class HideStaticGet extends StaticGet { + + final static String TESTCASE = "hide static getter"; + + public double getX() { return X; } // add to get the "default" info + public static double getProp() { return X; } + } + + // TODO: if 8154938 is considered to be a real issue, + // create one more test case "HideStaticGet2 extends StaticGet" with an + // annotated getter and check the correctness of the corresponding bean info + + // ---------- checks ---------- + + private static boolean check(String what, boolean v, boolean ref) { + + boolean ok = (v == ref); + if (!ok) { System.out.println( + "invalid " + what + ": " + v + ", expected: " + ref); } + return ok; + } + + private static boolean checkInfo(BeanInfo i, boolean ignoreValsCheck) { + + System.out.println("checking info..."); + + PropertyDescriptor descriptors[] = i.getPropertyDescriptors(); + int nd = descriptors.length; + if (nd != 1) { + System.out.println("invalid number of descriptors: " + nd); + return false; + } + + PropertyDescriptor d = descriptors[0]; + + String descr = d.getShortDescription(); + boolean ok = descr.equals(DESCRIPTION); + if (!ok) { System.out.println("invalid description: " + descr + + ", expected: " + DESCRIPTION); } + + ok &= check("isBound", d.isBound(), BOUND); + ok &= check("isExpert", d.isExpert(), EXPERT); + ok &= check("isHidden", d.isHidden(), HIDDEN); + ok &= check("isPreferred", d.isPreferred(), PREFERRED); + ok &= check("required", (boolean) d.getValue("required"), REQUIRED); + ok &= check("visualUpdate", + (boolean) d.getValue("visualUpdate"), UPDATE); + + if (ignoreValsCheck) { return ok; } + + Object vals[] = (Object[]) d.getValue("enumerationValues"); + if (vals == null) { + System.out.println("null enumerationValues"); + return false; + } + + boolean okVals = ( + (vals.length == 3) && + vals[0].toString().equals(V_SHORT) && + vals[1].toString().equals(V) && + vals[2].toString().equals(V_NAME)); + + if (!okVals) { System.out.println("invalid enumerationValues"); } + + return (ok && okVals); + } + + private static boolean checkDefault(BeanInfo i) { + + System.out.println("checking default info..."); + + PropertyDescriptor descriptors[] = i.getPropertyDescriptors(); + int nd = descriptors.length; + if (nd != 1) { + System.out.println("invalid number of descriptors: " + nd); + return false; + } + + PropertyDescriptor d = descriptors[0]; + + String descr = d.getShortDescription(); + boolean ok = descr.equals("x"); + if (!ok) { System.out.println("invalid description: " + descr + + ", expected: x"); } + + ok &= check("isBound", d.isBound(), false); + ok &= check("isExpert", d.isExpert(), false); + ok &= check("isHidden", d.isHidden(), false); + ok &= check("isPreferred", d.isPreferred(), false); + ok &= check("required", (boolean) d.getValue("required"), false); + ok &= check("visualUpdate", + (boolean) d.getValue("visualUpdate"), false); + + Object vals[] = (Object[]) d.getValue("enumerationValues"); + if (vals != null && vals.length > 0) { + System.out.println("non-empty enumerationValues"); + ok = false; + } + + return ok; + } + + // do not check enumerationValues for these classes + private static boolean ignoreVals(Class c) { + return ( + c.equals(BoolGetIs.class) || + c.equals(BoolIsGet.class) || + c.equals(AnnotatedIs.class) || + c.equals(OverrideAnnotatedIs2.class) || + c.equals(AnnotatedIs2Ext.class) || + c.equals(OverrideAbstractIs.class) || + c.equals(OverrideAbstractIs2.class) || + c.equals(AbstractIsExt.class) || + c.equals(OverrideAbstractIs.class) || + c.equals(IIsImpl.class) || + c.equals(IIsImpl2.class) || + c.equals(IIsImpl3.class) + ); + } + + // default property descriptor data are expected for these classes + private static boolean isDefault(Class c) { + return ( + c.equals(OverrideAnnotatedGet.class) || + c.equals(OverrideAnnotatedIs.class ) || + c.equals(OverrideAnnotatedSet.class) || + c.equals(OverrideAbstractGet.class) || + c.equals(OverrideAbstractIs.class) || + c.equals(OverrideAbstractSet.class) || + c.equals(IGetImpl.class) || + c.equals(IIsImpl.class) || + c.equals(ISetImpl.class) || + c.equals(BaseGet.class) || + c.equals(BaseSet.class) || + c.equals(HideStaticGet.class) + ); + } + + + // ---------- run test ---------- + + public static void main(String[] args) throws Exception { + + Class + ic1 = ISet2Impl.class.getInterfaces()[0], + ic2 = IGet2Impl.class.getInterfaces()[0]; + + Class cases[] = { + + OverloadGet.class, + OverloadGet.class.getSuperclass(), + OverloadSet.class, + OverloadSet.class.getSuperclass(), + OverloadIGet.class, + OverloadISet.class, + + // TODO: uncomment/update after 8132565 fix + //BoolGetIs.class, + //BoolIsGet.class, + //OverrideAnnotatedGet.class, + //OverrideAnnotatedIs.class, + //OverrideAnnotatedSet.class, + //OverrideAnnotatedGet2.class, + //AnnotatedGet2Ext.class, + //OverrideAnnotatedIs2.class + //AnnotatedIs2Ext.class, + //OverrideAnnotatedSet2.class, + //AnnotatedSet2Ext.class, + + OverrideAnnotatedGet.class.getSuperclass(), + OverrideAnnotatedIs.class.getSuperclass(), + OverrideAnnotatedSet.class.getSuperclass(), + + // TODO: uncomment/update after 8132565 fix + //OverrideAbstractGet.class, + //OverrideAbstractGet2.class, + //AbstractGetExt.class, + //OverrideAbstractIs.class, + //OverrideAbstractIs2.class, + //AbstractIsExt.class + //OverrideAbstractSet.class, + //OverrideAbstractSet2.class, + //AbstractSetExt.class, + + AbstractGet2Ext.class.getSuperclass(), + IGetImpl.class, + IGetImpl2.class, + IGetImpl3.class, + IIsImpl.class, + IIsImpl2.class, + IIsImpl3.class, + ISetImpl.class, + ISetImpl2.class, + ISetImpl3.class, + ic1, + // ic2, // TODO: uncomment/update after 8155013 fix + OverrideProtectedGet.class, + HideStaticGet.class + }; + + boolean passed = true; + + for (Class c: cases) { + + java.lang.reflect.Field f = c.getDeclaredField("TESTCASE"); + f.setAccessible(true); + String descr = f.get(c).toString(); + + System.out.println("\n" + c.getSimpleName() + " (" + descr + "):"); + BeanInfo i; + try { + i = Introspector.getBeanInfo(c, + (c.equals(ic1) || c.equals(ic2)) ? null : Object.class); + } + catch (IntrospectionException e) { throw new RuntimeException(e); } + + boolean ok; + + if (isDefault(c)) { + ok = checkDefault(i); + } else { + ok = checkInfo(i, ignoreVals(c)); + } + System.out.println(ok ? "OK" : "NOK"); + passed = passed && ok; + } + + if (!passed) { throw new RuntimeException("test failed"); } + System.out.println("\ntest passed"); + } +} diff --git a/jdk/test/java/beans/XMLEncoder/Test4625418.java b/jdk/test/java/beans/XMLEncoder/Test4625418.java index 0f9203e864d..a8a23aced37 100644 --- a/jdk/test/java/beans/XMLEncoder/Test4625418.java +++ b/jdk/test/java/beans/XMLEncoder/Test4625418.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -26,332 +26,338 @@ * @bug 4625418 * @summary Tests XML encoding * @author Sergey Malenkov - * - * @run main Test4625418 ASCII - * @run main Test4625418 Big5 - * ?run main Test4625418 Big5-HKSCS - * ?run main Test4625418 Big5_HKSCS - * @run main Test4625418 Big5_Solaris - * ?run main Test4625418 Cp037 - * @run main Test4625418 Cp1006 - * ?run main Test4625418 Cp1025 - * -run main Test4625418 Cp1026 - * @run main Test4625418 Cp1046 - * @run main Test4625418 Cp1047 - * @run main Test4625418 Cp1097 - * @run main Test4625418 Cp1098 - * ?run main Test4625418 Cp1112 - * ?run main Test4625418 Cp1122 - * ?run main Test4625418 Cp1123 - * @run main Test4625418 Cp1124 - * ?run main Test4625418 Cp1140 - * ?run main Test4625418 Cp1141 - * ?run main Test4625418 Cp1142 - * ?run main Test4625418 Cp1143 - * ?run main Test4625418 Cp1144 - * ?run main Test4625418 Cp1145 - * ?run main Test4625418 Cp1146 - * ?run main Test4625418 Cp1147 - * ?run main Test4625418 Cp1148 - * ?run main Test4625418 Cp1149 - * @run main Test4625418 Cp1250 - * @run main Test4625418 Cp1251 - * @run main Test4625418 Cp1252 - * @run main Test4625418 Cp1253 - * @run main Test4625418 Cp1254 - * @run main Test4625418 Cp1255 - * @run main Test4625418 Cp1256 - * @run main Test4625418 Cp1257 - * @run main Test4625418 Cp1258 - * ?run main Test4625418 Cp1381 - * ?run main Test4625418 Cp1383 - * ?run main Test4625418 Cp273 - * ?run main Test4625418 Cp277 - * ?run main Test4625418 Cp278 - * ?run main Test4625418 Cp280 - * ?run main Test4625418 Cp284 - * ?run main Test4625418 Cp285 - * ?run main Test4625418 Cp297 - * ?run main Test4625418 Cp33722 - * ?run main Test4625418 Cp420 - * ?run main Test4625418 Cp424 - * @run main Test4625418 Cp437 - * ?run main Test4625418 Cp500 - * ?run main Test4625418 Cp50220 - * ?run main Test4625418 Cp50221 - * @run main Test4625418 Cp737 - * @run main Test4625418 Cp775 - * -run main Test4625418 Cp834 - * ?run main Test4625418 Cp838 - * @run main Test4625418 Cp850 - * @run main Test4625418 Cp852 - * @run main Test4625418 Cp855 - * @run main Test4625418 Cp856 - * @run main Test4625418 Cp857 - * @run main Test4625418 Cp858 - * @run main Test4625418 Cp860 - * @run main Test4625418 Cp861 - * @run main Test4625418 Cp862 - * @run main Test4625418 Cp863 - * @run main Test4625418 Cp864 - * @run main Test4625418 Cp865 - * @run main Test4625418 Cp866 - * @run main Test4625418 Cp868 - * @run main Test4625418 Cp869 - * ?run main Test4625418 Cp870 - * ?run main Test4625418 Cp871 - * @run main Test4625418 Cp874 - * ?run main Test4625418 Cp875 - * ?run main Test4625418 Cp918 - * @run main Test4625418 Cp921 - * @run main Test4625418 Cp922 - * -run main Test4625418 Cp930 - * @run main Test4625418 Cp933 - * ?run main Test4625418 Cp935 - * ?run main Test4625418 Cp937 - * ?run main Test4625418 Cp939 - * ?run main Test4625418 Cp942 - * ?run main Test4625418 Cp942C - * @run main Test4625418 Cp943 - * ?run main Test4625418 Cp943C - * @run main Test4625418 Cp948 - * @run main Test4625418 Cp949 - * ?run main Test4625418 Cp949C - * @run main Test4625418 Cp950 - * @run main Test4625418 Cp964 - * ?run main Test4625418 Cp970 - * ?run main Test4625418 EUC-JP - * @run main Test4625418 EUC-KR - * @run main Test4625418 EUC_CN - * ?run main Test4625418 EUC_JP - * ?run main Test4625418 EUC_JP_LINUX - * ?run main Test4625418 EUC_JP_Solaris - * @run main Test4625418 EUC_KR - * ?run main Test4625418 EUC_TW - * @run main Test4625418 GB18030 - * @run main Test4625418 GB2312 - * @run main Test4625418 GBK - * ?run main Test4625418 IBM-Thai - * @run main Test4625418 IBM00858 - * ?run main Test4625418 IBM01140 - * ?run main Test4625418 IBM01141 - * ?run main Test4625418 IBM01142 - * ?run main Test4625418 IBM01143 - * ?run main Test4625418 IBM01144 - * ?run main Test4625418 IBM01145 - * ?run main Test4625418 IBM01146 - * ?run main Test4625418 IBM01147 - * ?run main Test4625418 IBM01148 - * ?run main Test4625418 IBM01149 - * ?run main Test4625418 IBM037 - * -run main Test4625418 IBM1026 - * @run main Test4625418 IBM1047 - * ?run main Test4625418 IBM273 - * ?run main Test4625418 IBM277 - * ?run main Test4625418 IBM278 - * ?run main Test4625418 IBM280 - * ?run main Test4625418 IBM284 - * ?run main Test4625418 IBM285 - * ?run main Test4625418 IBM297 - * ?run main Test4625418 IBM420 - * ?run main Test4625418 IBM424 - * @run main Test4625418 IBM437 - * ?run main Test4625418 IBM500 - * @run main Test4625418 IBM775 - * @run main Test4625418 IBM850 - * @run main Test4625418 IBM852 - * @run main Test4625418 IBM855 - * @run main Test4625418 IBM857 - * @run main Test4625418 IBM860 - * @run main Test4625418 IBM861 - * @run main Test4625418 IBM862 - * @run main Test4625418 IBM863 - * @run main Test4625418 IBM864 - * @run main Test4625418 IBM865 - * @run main Test4625418 IBM866 - * @run main Test4625418 IBM868 - * @run main Test4625418 IBM869 - * ?run main Test4625418 IBM870 - * ?run main Test4625418 IBM871 - * ?run main Test4625418 IBM918 - * ?run main Test4625418 ISCII91 - * -run main Test4625418 ISO-2022-CN - * @run main Test4625418 ISO-2022-JP - * @run main Test4625418 ISO-2022-KR - * @run main Test4625418 ISO-8859-1 - * @run main Test4625418 ISO-8859-13 - * @run main Test4625418 ISO-8859-15 - * @run main Test4625418 ISO-8859-2 - * @run main Test4625418 ISO-8859-3 - * @run main Test4625418 ISO-8859-4 - * @run main Test4625418 ISO-8859-5 - * @run main Test4625418 ISO-8859-6 - * @run main Test4625418 ISO-8859-7 - * @run main Test4625418 ISO-8859-8 - * @run main Test4625418 ISO-8859-9 - * -run main Test4625418 ISO2022CN - * @run main Test4625418 ISO2022JP - * @run main Test4625418 ISO2022KR - * -run main Test4625418 ISO2022_CN_CNS - * -run main Test4625418 ISO2022_CN_GB - * @run main Test4625418 ISO8859_1 - * @run main Test4625418 ISO8859_13 - * @run main Test4625418 ISO8859_15 - * @run main Test4625418 ISO8859_2 - * @run main Test4625418 ISO8859_3 - * @run main Test4625418 ISO8859_4 - * @run main Test4625418 ISO8859_5 - * @run main Test4625418 ISO8859_6 - * @run main Test4625418 ISO8859_7 - * @run main Test4625418 ISO8859_8 - * @run main Test4625418 ISO8859_9 - * -run main Test4625418 JISAutoDetect - * ?run main Test4625418 JIS_X0201 - * -run main Test4625418 JIS_X0212-1990 - * @run main Test4625418 KOI8-R - * @run main Test4625418 KOI8-U - * @run main Test4625418 KOI8_R - * @run main Test4625418 KOI8_U - * @run main Test4625418 MS874 - * ?run main Test4625418 MS932 - * ?run main Test4625418 MS936 - * @run main Test4625418 MS949 - * @run main Test4625418 MS950 - * ?run main Test4625418 MS950_HKSCS - * @run main Test4625418 MacArabic - * @run main Test4625418 MacCentralEurope - * @run main Test4625418 MacCroatian - * @run main Test4625418 MacCyrillic - * -run main Test4625418 MacDingbat - * @run main Test4625418 MacGreek - * @run main Test4625418 MacHebrew - * @run main Test4625418 MacIceland - * @run main Test4625418 MacRoman - * @run main Test4625418 MacRomania - * -run main Test4625418 MacSymbol - * @run main Test4625418 MacThai - * @run main Test4625418 MacTurkish - * @run main Test4625418 MacUkraine - * ?run main Test4625418 PCK - * ?run main Test4625418 SJIS - * ?run main Test4625418 Shift_JIS - * @run main Test4625418 TIS-620 - * @run main Test4625418 TIS620 - * @run main Test4625418 US-ASCII - * @run main Test4625418 UTF-16 - * @run main Test4625418 UTF-16BE - * @run main Test4625418 UTF-16LE - * @run main Test4625418 UTF-32 - * @run main Test4625418 UTF-32BE - * @run main Test4625418 UTF-32LE - * @run main Test4625418 UTF-8 - * @run main Test4625418 UTF8 - * @run main Test4625418 UTF_32 - * @run main Test4625418 UTF_32BE - * -run main Test4625418 UTF_32BE_BOM - * @run main Test4625418 UTF_32LE - * -run main Test4625418 UTF_32LE_BOM - * @run main Test4625418 UnicodeBig - * @run main Test4625418 UnicodeBigUnmarked - * @run main Test4625418 UnicodeLittle - * @run main Test4625418 UnicodeLittleUnmarked - * @run main Test4625418 windows-1250 - * @run main Test4625418 windows-1251 - * @run main Test4625418 windows-1252 - * @run main Test4625418 windows-1253 - * @run main Test4625418 windows-1254 - * @run main Test4625418 windows-1255 - * @run main Test4625418 windows-1256 - * @run main Test4625418 windows-1257 - * @run main Test4625418 windows-1258 - * ?run main Test4625418 windows-31j - * -run main Test4625418 x-Big5_Solaris - * ?run main Test4625418 x-EUC-TW - * @run main Test4625418 x-IBM1006 - * ?run main Test4625418 x-IBM1025 - * @run main Test4625418 x-IBM1046 - * @run main Test4625418 x-IBM1097 - * @run main Test4625418 x-IBM1098 - * ?run main Test4625418 x-IBM1112 - * ?run main Test4625418 x-IBM1122 - * ?run main Test4625418 x-IBM1123 - * @run main Test4625418 x-IBM1124 - * ?run main Test4625418 x-IBM1381 - * ?run main Test4625418 x-IBM1383 - * ?run main Test4625418 x-IBM33722 - * @run main Test4625418 x-IBM737 - * -run main Test4625418 x-IBM834 - * @run main Test4625418 x-IBM856 - * @run main Test4625418 x-IBM874 - * ?run main Test4625418 x-IBM875 - * @run main Test4625418 x-IBM921 - * @run main Test4625418 x-IBM922 - * -run main Test4625418 x-IBM930 - * @run main Test4625418 x-IBM933 - * ?run main Test4625418 x-IBM935 - * ?run main Test4625418 x-IBM937 - * ?run main Test4625418 x-IBM939 - * ?run main Test4625418 x-IBM942 - * ?run main Test4625418 x-IBM942C - * @run main Test4625418 x-IBM943 - * ?run main Test4625418 x-IBM943C - * @run main Test4625418 x-IBM948 - * @run main Test4625418 x-IBM949 - * ?run main Test4625418 x-IBM949C - * @run main Test4625418 x-IBM950 - * @run main Test4625418 x-IBM964 - * ?run main Test4625418 x-IBM970 - * ?run main Test4625418 x-ISCII91 - * -run main Test4625418 x-ISO2022-CN-CNS - * -run main Test4625418 x-ISO2022-CN-GB - * -run main Test4625418 x-JIS0208 - * -run main Test4625418 x-JISAutoDetect - * @run main Test4625418 x-Johab - * ?run main Test4625418 x-MS950-HKSCS - * @run main Test4625418 x-MacArabic - * @run main Test4625418 x-MacCentralEurope - * @run main Test4625418 x-MacCroatian - * @run main Test4625418 x-MacCyrillic - * -run main Test4625418 x-MacDingbat - * @run main Test4625418 x-MacGreek - * @run main Test4625418 x-MacHebrew - * @run main Test4625418 x-MacIceland - * @run main Test4625418 x-MacRoman - * @run main Test4625418 x-MacRomania - * -run main Test4625418 x-MacSymbol - * @run main Test4625418 x-MacThai - * @run main Test4625418 x-MacTurkish - * @run main Test4625418 x-MacUkraine - * ?run main Test4625418 x-PCK - * @run main Test4625418 x-UTF-16LE-BOM - * -run main Test4625418 x-UTF-32BE-BOM - * -run main Test4625418 x-UTF-32LE-BOM - * ?run main Test4625418 x-euc-jp-linux - * ?run main Test4625418 x-eucJP-Open - * @run main Test4625418 x-iso-8859-11 - * @run main Test4625418 x-mswin-936 - * ?run main Test4625418 x-windows-50220 - * ?run main Test4625418 x-windows-50221 - * @run main Test4625418 x-windows-874 - * @run main Test4625418 x-windows-949 - * @run main Test4625418 x-windows-950 - * ?run main Test4625418 x-windows-iso2022jp + * @run main/timeout=360 Test4625418 */ import java.beans.ExceptionListener; import java.beans.XMLDecoder; import java.beans.XMLEncoder; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; public final class Test4625418 implements ExceptionListener { - public static void main(String[] args) { - new Test4625418(args[0]).test(createString(0x10000)); - System.out.println("Test passed: " + args[0]); + + private static final String[] encodings = { + "ASCII", + "Big5", + //"Big5-HKSCS", + //"Big5_HKSCS", + "Big5_Solaris", + //"Cp037", + "Cp1006", + //"Cp1025", + //"Cp1026", + "Cp1046", + "Cp1047", + "Cp1097", + "Cp1098", + //"Cp1112", + //"Cp1122", + //"Cp1123", + "Cp1124", + //"Cp1140", + //"Cp1141", + //"Cp1142", + //"Cp1143", + //"Cp1144", + //"Cp1145", + //"Cp1146", + //"Cp1147", + //"Cp1148", + //"Cp1149", + "Cp1250", + "Cp1251", + "Cp1252", + "Cp1253", + "Cp1254", + "Cp1255", + "Cp1256", + "Cp1257", + "Cp1258", + //"Cp1381", + //"Cp1383", + //"Cp273", + //"Cp277", + //"Cp278", + //"Cp280", + //"Cp284", + //"Cp285", + //"Cp297", + //"Cp33722", + //"Cp420", + //"Cp424", + "Cp437", + //"Cp500", + //"Cp50220", + //"Cp50221", + "Cp737", + "Cp775", + //"Cp834", + //"Cp838", + "Cp850", + "Cp852", + "Cp855", + "Cp856", + "Cp857", + "Cp858", + "Cp860", + "Cp861", + "Cp862", + "Cp863", + "Cp864", + "Cp865", + "Cp866", + "Cp868", + "Cp869", + //"Cp870", + //"Cp871", + "Cp874", + //"Cp875", + //"Cp918", + "Cp921", + "Cp922", + //"Cp930", + "Cp933", + //"Cp935", + //"Cp937", + //"Cp939", + //"Cp942", + //"Cp942C", + "Cp943", + //"Cp943C", + "Cp948", + "Cp949", + //"Cp949C", + "Cp950", + "Cp964", + //"Cp970", + //"EUC-JP", + "EUC-KR", + "EUC_CN", + //"EUC_JP", + //"EUC_JP_LINUX", + //"EUC_JP_Solaris", + "EUC_KR", + //"EUC_TW", + "GB18030", + "GB2312", + "GBK", + //"IBM-Thai", + "IBM00858", + //"IBM01140", + //"IBM01141", + //"IBM01142", + //"IBM01143", + //"IBM01144", + //"IBM01145", + //"IBM01146", + //"IBM01147", + //"IBM01148", + //"IBM01149", + //"IBM037", + //"IBM1026", + "IBM1047", + //"IBM273", + //"IBM277", + //"IBM278", + //"IBM280", + //"IBM284", + //"IBM285", + //"IBM297", + //"IBM420", + //"IBM424", + "IBM437", + //"IBM500", + "IBM775", + "IBM850", + "IBM852", + "IBM855", + "IBM857", + "IBM860", + "IBM861", + "IBM862", + "IBM863", + "IBM864", + "IBM865", + "IBM866", + "IBM868", + "IBM869", + //"IBM870", + //"IBM871", + //"IBM918", + //"ISCII91", + //"ISO-2022-CN", + "ISO-2022-JP", + "ISO-2022-KR", + "ISO-8859-1", + "ISO-8859-13", + "ISO-8859-15", + "ISO-8859-2", + "ISO-8859-3", + "ISO-8859-4", + "ISO-8859-5", + "ISO-8859-6", + "ISO-8859-7", + "ISO-8859-8", + "ISO-8859-9", + //"ISO2022CN", + "ISO2022JP", + "ISO2022KR", + //"ISO2022_CN_CNS", + //"ISO2022_CN_GB", + "ISO8859_1", + "ISO8859_13", + "ISO8859_15", + "ISO8859_2", + "ISO8859_3", + "ISO8859_4", + "ISO8859_5", + "ISO8859_6", + "ISO8859_7", + "ISO8859_8", + "ISO8859_9", + //"JISAutoDetect", + //"JIS_X0201", + //"JIS_X0212-1990", + "KOI8-R", + "KOI8-U", + "KOI8_R", + "KOI8_U", + "MS874", + //"MS932", + //"MS936", + "MS949", + "MS950", + //"MS950_HKSCS", + "MacArabic", + "MacCentralEurope", + "MacCroatian", + "MacCyrillic", + //"MacDingbat", + "MacGreek", + "MacHebrew", + "MacIceland", + "MacRoman", + "MacRomania", + //"MacSymbol", + "MacThai", + "MacTurkish", + "MacUkraine", + //"PCK", + //"SJIS", + //"Shift_JIS", + "TIS-620", + "TIS620", + "US-ASCII", + "UTF-16", + "UTF-16BE", + "UTF-16LE", + "UTF-32", + "UTF-32BE", + "UTF-32LE", + "UTF-8", + "UTF8", + "UTF_32", + "UTF_32BE", + //"UTF_32BE_BOM", + "UTF_32LE", + //"UTF_32LE_BOM", + "UnicodeBig", + "UnicodeBigUnmarked", + "UnicodeLittle", + "UnicodeLittleUnmarked", + "windows-1250", + "windows-1251", + "windows-1252", + "windows-1253", + "windows-1254", + "windows-1255", + "windows-1256", + "windows-1257", + "windows-1258", + //"windows-31j", + //"x-Big5_Solaris", + //"x-EUC-TW", + "x-IBM1006", + //"x-IBM1025", + "x-IBM1046", + "x-IBM1097", + "x-IBM1098", + //"x-IBM1112", + //"x-IBM1122", + //"x-IBM1123", + "x-IBM1124", + //"x-IBM1381", + //"x-IBM1383", + //"x-IBM33722", + "x-IBM737", + //"x-IBM834", + "x-IBM856", + "x-IBM874", + //"x-IBM875", + "x-IBM921", + "x-IBM922", + //"x-IBM930", + "x-IBM933", + //"x-IBM935", + //"x-IBM937", + //"x-IBM939", + //"x-IBM942", + //"x-IBM942C", + "x-IBM943", + //"x-IBM943C", + "x-IBM948", + "x-IBM949", + //"x-IBM949C", + "x-IBM950", + "x-IBM964", + //"x-IBM970", + //"x-ISCII91", + //"x-ISO2022-CN-CNS", + //"x-ISO2022-CN-GB", + //"x-JIS0208", + //"x-JISAutoDetect", + "x-Johab", + //"x-MS950-HKSCS", + "x-MacArabic", + "x-MacCentralEurope", + "x-MacCroatian", + "x-MacCyrillic", + //"x-MacDingbat", + "x-MacGreek", + "x-MacHebrew", + "x-MacIceland", + "x-MacRoman", + "x-MacRomania", + //"x-MacSymbol", + "x-MacThai", + "x-MacTurkish", + "x-MacUkraine", + //"x-PCK", + "x-UTF-16LE-BOM", + //"x-UTF-32BE-BOM", + //"x-UTF-32LE-BOM", + //"x-euc-jp-linux", + //"x-eucJP-Open", + "x-iso-8859-11", + "x-mswin-936", + //"x-windows-50220", + //"x-windows-50221", + "x-windows-874", + "x-windows-949", + "x-windows-950", + //"x-windows-iso2022jp", + }; + + public static void main(final String[] args) { + final String string = createString(0x10000); + for (String encoding : encodings) { + System.out.println("Test encoding: " + encoding); + new Test4625418(encoding).test(string); + } } private static String createString(int length) { @@ -364,33 +370,27 @@ public final class Test4625418 implements ExceptionListener { private final String encoding; - private Test4625418(String encoding) { + private Test4625418(final String encoding) { this.encoding = encoding; } private void test(String string) { try { - File file = new File("4625418." + this.encoding + ".xml"); - - FileOutputStream output = new FileOutputStream(file); + ByteArrayOutputStream output = new ByteArrayOutputStream(); XMLEncoder encoder = new XMLEncoder(output, this.encoding, true, 0); encoder.setExceptionListener(this); encoder.writeObject(string); encoder.close(); - FileInputStream input = new FileInputStream(file); + InputStream input = new ByteArrayInputStream(output.toByteArray()); XMLDecoder decoder = new XMLDecoder(input); decoder.setExceptionListener(this); Object object = decoder.readObject(); decoder.close(); - if (!string.equals(object)) + if (!string.equals(object)) { throw new Error(this.encoding + " - can't read properly"); - - file.delete(); - } - catch (FileNotFoundException exception) { - throw new Error(this.encoding + " - file not found", exception); + } } catch (IllegalCharsetNameException exception) { throw new Error(this.encoding + " - illegal charset name", exception); diff --git a/jdk/test/java/lang/Class/forName/modules/TestLayer.java b/jdk/test/java/lang/Class/forName/modules/TestLayer.java index 8a01cb18b51..645e04d7e9b 100644 --- a/jdk/test/java/lang/Class/forName/modules/TestLayer.java +++ b/jdk/test/java/lang/Class/forName/modules/TestLayer.java @@ -46,7 +46,7 @@ public class TestLayer { ModuleFinder finder = ModuleFinder.of(MODS_DIR); Configuration parent = Layer.boot().configuration(); - Configuration cf = parent.resolveRequiresAndUses(ModuleFinder.empty(), + Configuration cf = parent.resolveRequiresAndUses(ModuleFinder.of(), finder, modules); diff --git a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java index 902e92d7c00..618b2fde67a 100644 --- a/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java +++ b/jdk/test/java/lang/Class/forName/modules/src/m3/p3/NoAccess.java @@ -51,7 +51,7 @@ public class NoAccess { Configuration parent = bootLayer.configuration(); Configuration cf = parent.resolveRequiresAndUses(finder, - ModuleFinder.empty(), + ModuleFinder.of(), Set.of("m1", "m2")); ClassLoader scl = ClassLoader.getSystemClassLoader(); diff --git a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java index a162debb3f8..9052737aad5 100644 --- a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java +++ b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java @@ -228,12 +228,18 @@ public class FieldSetAccessibleTest { } static boolean test(String s, boolean addExports) { + String clsName = s.replace('/', '.').substring(0, s.length() - 6); try { + System.out.println("Loading " + clsName); final Class c = Class.forName( - s.replace('/', '.').substring(0, s.length() - 6), + clsName, false, systemClassLoader); return test(c, addExports); + } catch (VerifyError ve) { + System.err.println("VerifyError for " + clsName); + ve.printStackTrace(System.err); + failed.add(s); } catch (Exception t) { t.printStackTrace(System.err); failed.add(s); diff --git a/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java b/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java index a1a1b4e1730..26fbe3dd586 100644 --- a/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java +++ b/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -28,7 +28,7 @@ import java.io.IOException; import java.net.URL; /* @test - * @bug 6977738 + * @bug 6977738 8029891 * @summary Test ClassLoader.getResource() that should not deadlock # if another thread is holding the system properties object * @@ -70,10 +70,6 @@ public class GetResource { go.await(); // wait until t1 holds the lock of the system properties URL u1 = Thread.currentThread().getContextClassLoader().getResource("unknownresource"); - URL u2 = Thread.currentThread().getContextClassLoader().getResource("sun/util/resources/CalendarData.class"); - if (u2 == null) { - throw new RuntimeException("Test failed: resource not found"); - } done.await(); } catch (InterruptedException e) { throw new RuntimeException(e); diff --git a/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh b/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh index 3872f813ffd..a00c14077d6 100644 --- a/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh +++ b/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh @@ -106,7 +106,7 @@ done # run test ${TESTJAVA}${FS}bin${FS}java \ ${TESTVMOPTS} \ - -verbose:class -Xlog:classload -cp . \ + -verbose:class -Xlog:class+load -cp . \ -Dtest.classes=${TESTCLASSES} \ Starter cross # -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \ diff --git a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh index 198cd70827a..1289b4c861e 100644 --- a/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh +++ b/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.sh @@ -102,7 +102,7 @@ done # run test ${TESTJAVA}${FS}bin${FS}java \ ${TESTVMOPTS} \ - -verbose:class -Xlog:classload -cp . \ + -verbose:class -Xlog:class+load -cp . \ -Dtest.classes=${TESTCLASSES} \ Starter one-way # -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \ diff --git a/jdk/test/java/lang/Math/DivModTests.java b/jdk/test/java/lang/Math/DivModTests.java index fbd98e62c8a..772bb1c91f1 100644 --- a/jdk/test/java/lang/Math/DivModTests.java +++ b/jdk/test/java/lang/Math/DivModTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -184,7 +184,7 @@ public class DivModTests { } /** - * Test the integer floorDiv and floorMod methods. + * Test the long floorDiv and floorMod methods. * Math and StrictMath are tested and the same results are expected for both. */ static void testLongFloorDivMod(long x, long y, Object divExpected, Object modExpected) { @@ -252,6 +252,110 @@ public class DivModTests { } } + /** + * Test the floorDiv and floorMod methods for mixed long and int. + */ + static void testLongIntFloorDivMod() { + testLongIntFloorDivMod(4L, 0, new ArithmeticException(), new ArithmeticException()); // Should throw ArithmeticException + testLongIntFloorDivMod(4L, 3, 1L, 1); + testLongIntFloorDivMod(3L, 3, 1L, 0); + testLongIntFloorDivMod(2L, 3, 0L, 2); + testLongIntFloorDivMod(1L, 3, 0L, 1); + testLongIntFloorDivMod(0L, 3, 0L, 0); + testLongIntFloorDivMod(4L, -3, -2L, -2); + testLongIntFloorDivMod(3L, -3, -1L, 0); + testLongIntFloorDivMod(2L, -3, -1L, -1); + testLongIntFloorDivMod(1L, -3, -1L, -2); + testLongIntFloorDivMod(0L, -3, 0L, 0); + testLongIntFloorDivMod(-1L, 3, -1L, 2); + testLongIntFloorDivMod(-2L, 3, -1L, 1); + testLongIntFloorDivMod(-3L, 3, -1L, 0); + testLongIntFloorDivMod(-4L, 3, -2L, 2); + testLongIntFloorDivMod(-1L, -3, 0L, -1); + testLongIntFloorDivMod(-2L, -3, 0L, -2); + testLongIntFloorDivMod(-3L, -3, 1L, 0); + testLongIntFloorDivMod(-4L, -3, 1L, -1); + + testLongIntFloorDivMod(Long.MAX_VALUE, 1, Long.MAX_VALUE, 0L); + testLongIntFloorDivMod(Long.MAX_VALUE, -1, -Long.MAX_VALUE, 0L); + testLongIntFloorDivMod(Long.MAX_VALUE, 3, Long.MAX_VALUE / 3L, 1L); + testLongIntFloorDivMod(Long.MAX_VALUE - 1L, 3, (Long.MAX_VALUE - 1L) / 3L, 0L); + testLongIntFloorDivMod(Long.MIN_VALUE, 3, Long.MIN_VALUE / 3L - 1L, 1L); + testLongIntFloorDivMod(Long.MIN_VALUE + 1L, 3, Long.MIN_VALUE / 3L - 1L, 2L); + testLongIntFloorDivMod(Long.MIN_VALUE + 1, -1, Long.MAX_VALUE, 0L); + // Special case of integer overflow + testLongIntFloorDivMod(Long.MIN_VALUE, -1, Long.MIN_VALUE, 0L); + } + + /** + * Test the integer floorDiv and floorMod methods. + * Math and StrictMath are tested and the same results are expected for both. + */ + static void testLongIntFloorDivMod(long x, int y, Object divExpected, Object modExpected) { + testLongIntFloorDiv(x, y, divExpected); + testLongIntFloorMod(x, y, modExpected); + } + + /** + * Test FloorDiv with long arguments against expected value. + * The expected value is usually a Long but in some cases is + * an ArithmeticException. + * + * @param x dividend + * @param y modulus + * @param expected expected value, + */ + static void testLongIntFloorDiv(long x, int y, Object expected) { + Object result = doFloorDiv(x, y); + if (!resultEquals(result, expected)) { + fail("FAIL: long Math.floorDiv(%d, %d) = %s; expected %s%n", x, y, result, expected); + } + + Object strict_result = doStrictFloorDiv(x, y); + if (!resultEquals(strict_result, expected)) { + fail("FAIL: long StrictMath.floorDiv(%d, %d) = %s; expected %s%n", x, y, strict_result, expected); + } + } + + /** + * Test FloorMod of long arguments against expected value. + * The expected value is usually a Long but in some cases is + * an ArithmeticException. + * + * @param x dividend + * @param y modulus + * @param expected expected value + */ + static void testLongIntFloorMod(long x, int y, Object expected) { + Object result = doFloorMod(x, y); + if (!resultEquals(result, expected)) { + fail("FAIL: long Math.floorMod(%d, %d) = %s; expected %s%n", x, y, result, expected); + } + + Object strict_result = doStrictFloorMod(x, y); + if (!resultEquals(strict_result, expected)) { + fail("FAIL: long StrictMath.floorMod(%d, %d) = %s; expected %s%n", x, y, strict_result, expected); + } + + try { + // Verify the result against BigDecimal rounding mode. + BigDecimal xD = new BigDecimal(x); + BigDecimal yD = new BigDecimal(y); + BigDecimal resultD = xD.divide(yD, RoundingMode.FLOOR); + resultD = resultD.multiply(yD); + resultD = xD.subtract(resultD); + long fr = resultD.longValue(); + if (!result.equals(fr)) { + fail("FAIL: Long.floorMod(%d, %d) = %d is different than BigDecimal result: %d%n", x, y, result, fr); + + } + } catch (ArithmeticException ae) { + if (y != 0) { + fail("FAIL: long Math.floorMod(%d, %d); unexpected ArithmeticException from bigdecimal"); + } + } + } + /** * Invoke floorDiv and return the result or any exception. * @param x the x value @@ -266,6 +370,20 @@ public class DivModTests { } } + /** + * Invoke floorDiv and return the result or any exception. + * @param x the x value + * @param y the y value + * @return the result Integer or an exception. + */ + static Object doFloorDiv(long x, int y) { + try { + return Math.floorDiv(x, y); + } catch (ArithmeticException ae) { + return ae; + } + } + /** * Invoke floorDiv and return the result or any exception. * @param x the x value @@ -294,6 +412,20 @@ public class DivModTests { } } + /** + * Invoke floorDiv and return the result or any exception. + * @param x the x value + * @param y the y value + * @return the result Integer or an exception. + */ + static Object doFloorMod(long x, int y) { + try { + return Math.floorMod(x, y); + } catch (ArithmeticException ae) { + return ae; + } + } + /** * Invoke floorDiv and return the result or any exception. * @param x the x value @@ -322,6 +454,20 @@ public class DivModTests { } } + /** + * Invoke floorDiv and return the result or any exception. + * @param x the x value + * @param y the y value + * @return the result Integer or an exception. + */ + static Object doStrictFloorDiv(long x, int y) { + try { + return StrictMath.floorDiv(x, y); + } catch (ArithmeticException ae) { + return ae; + } + } + /** * Invoke floorDiv and return the result or any exception. * @param x the x value @@ -350,6 +496,20 @@ public class DivModTests { } } + /** + * Invoke floorDiv and return the result or any exception. + * @param x the x value + * @param y the y value + * @return the result Integer or an exception. + */ + static Object doStrictFloorMod(long x, int y) { + try { + return StrictMath.floorMod(x, y); + } catch (ArithmeticException ae) { + return ae; + } + } + /** * Invoke floorDiv and return the result or any exception. * @param x the x value diff --git a/jdk/test/java/lang/Math/ExactArithTests.java b/jdk/test/java/lang/Math/ExactArithTests.java index 709ea618cb0..37a8a1f009c 100644 --- a/jdk/test/java/lang/Math/ExactArithTests.java +++ b/jdk/test/java/lang/Math/ExactArithTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -43,6 +43,7 @@ public class ExactArithTests { public static void main(String[] args) { testIntegerExact(); testLongExact(); + testLongIntExact(); if (errors > 0) { throw new RuntimeException(errors + " errors found in ExactArithTests."); @@ -132,6 +133,7 @@ public class ExactArithTests { fail("FAIL: int Math.multiplyExact(" + x + " * " + y + ")" + "; Unexpected exception: " + ex); } } + try { // Test incrementExact int inc = Math.incrementExact(x); @@ -345,4 +347,60 @@ public class ExactArithTests { static boolean inLongRange(BigInteger value) { return value.bitLength() <= 63; } + + /** + * Test Math.multiplyExact method with {@code long} and {@code int} + * arguments. + */ + static void testLongIntExact() { + testLongIntExact(0, 0); + testLongIntExact(1, 1); + testLongIntExact(1, -1); + testLongIntExact(1000, 2000); + + testLongIntExact(Long.MIN_VALUE, Integer.MIN_VALUE); + testLongIntExact(Long.MAX_VALUE, Integer.MAX_VALUE); + testLongIntExact(Long.MIN_VALUE, 1); + testLongIntExact(Long.MAX_VALUE, 1); + testLongIntExact(Long.MIN_VALUE, 2); + testLongIntExact(Long.MAX_VALUE, 2); + testLongIntExact(Long.MIN_VALUE, -1); + testLongIntExact(Long.MAX_VALUE, -1); + testLongIntExact(Long.MIN_VALUE, -2); + testLongIntExact(Long.MAX_VALUE, -2); + testLongIntExact(Long.MIN_VALUE/2, 2); + testLongIntExact(Long.MAX_VALUE, 2); + testLongIntExact(Integer.MAX_VALUE, Integer.MAX_VALUE); + testLongIntExact(Integer.MAX_VALUE, -Integer.MAX_VALUE); + testLongIntExact((long)Integer.MAX_VALUE+1L, Integer.MAX_VALUE); + testLongIntExact((long)Integer.MAX_VALUE+1L, -Integer.MAX_VALUE+1); + testLongIntExact((long)Integer.MIN_VALUE-1L, Integer.MIN_VALUE); + testLongIntExact((long)Integer.MIN_VALUE-1, Integer.MAX_VALUE); + testLongIntExact(Integer.MIN_VALUE/2, 2); + } + + /** + * Test long-int exact arithmetic by comparing with the same operations using BigInteger + * and checking that the result is the same as the long truncation. + * Errors are reported with {@link fail}. + * + * @param x first parameter + * @param y second parameter + */ + static void testLongIntExact(long x, int y) { + BigInteger resultBig = null; + final BigInteger xBig = BigInteger.valueOf(x); + final BigInteger yBig = BigInteger.valueOf(y); + + try { + // Test multiplyExact + resultBig = xBig.multiply(yBig); + long product = Math.multiplyExact(x, y); + checkResult("long Math.multiplyExact", x, y, product, resultBig); + } catch (ArithmeticException ex) { + if (inLongRange(resultBig)) { + fail("FAIL: long Math.multiplyExact(" + x + " * " + y + ")" + "; Unexpected exception: " + ex); + } + } + } } diff --git a/jdk/test/java/lang/Math/MultiplicationTests.java b/jdk/test/java/lang/Math/MultiplicationTests.java new file mode 100644 index 00000000000..1a9c3da2a67 --- /dev/null +++ b/jdk/test/java/lang/Math/MultiplicationTests.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @library /lib/testlibrary/ + * @build jdk.testlibrary.* + * @run main MultiplicationTests + * @bug 5100935 + * @summary Tests for multiplication methods (use -Dseed=X to set PRNG seed) + * @key randomness + */ + +import java.math.BigInteger; +import jdk.testlibrary.RandomFactory; + +public class MultiplicationTests { + private MultiplicationTests(){} + + // Number of random products to test. + private static final int COUNT = 1 << 16; + + // Initialize shared random number generator + private static java.util.Random rnd = RandomFactory.getRandom(); + + // Calculate high 64 bits of 128 product using BigInteger. + private static long multiplyHighBigInt(long x, long y) { + return BigInteger.valueOf(x).multiply(BigInteger.valueOf(y)) + .shiftRight(64).longValue(); + } + + // Check Math.multiplyHigh(x,y) against multiplyHighBigInt(x,y) + private static boolean check(long x, long y) { + long p1 = multiplyHighBigInt(x, y); + long p2 = Math.multiplyHigh(x, y); + if (p1 != p2) { + System.err.printf("Error - x:%d y:%d p1:%d p2:%d\n", x, y, p1, p2); + return false; + } else { + return true; + } + } + + private static int testMultiplyHigh() { + int failures = 0; + + // check some boundary cases + long[][] v = new long[][]{ + {0L, 0L}, + {-1L, 0L}, + {0L, -1L}, + {1L, 0L}, + {0L, 1L}, + {-1L, -1L}, + {-1L, 1L}, + {1L, -1L}, + {1L, 1L}, + {Long.MAX_VALUE, Long.MAX_VALUE}, + {Long.MAX_VALUE, -Long.MAX_VALUE}, + {-Long.MAX_VALUE, Long.MAX_VALUE}, + {Long.MAX_VALUE, Long.MIN_VALUE}, + {Long.MIN_VALUE, Long.MAX_VALUE}, + {Long.MIN_VALUE, Long.MIN_VALUE} + }; + + for (long[] xy : v) { + if(!check(xy[0], xy[1])) { + failures++; + } + } + + // check some random values + for (int i = 0; i < COUNT; i++) { + if (!check(rnd.nextLong(), rnd.nextLong())) { + failures++; + } + } + + return failures; + } + + public static void main(String argv[]) { + int failures = testMultiplyHigh(); + + if (failures > 0) { + System.err.println("Multiplication testing encountered " + + failures + " failures."); + throw new RuntimeException(); + } else { + System.out.println("MultiplicationTests succeeded"); + } + } +} diff --git a/jdk/test/jdk/Version/Basic.java b/jdk/test/java/lang/Runtime/Version/Basic.java similarity index 96% rename from jdk/test/jdk/Version/Basic.java rename to jdk/test/java/lang/Runtime/Version/Basic.java index b94180c8daf..0a60ad256d6 100644 --- a/jdk/test/jdk/Version/Basic.java +++ b/jdk/test/java/lang/Runtime/Version/Basic.java @@ -23,12 +23,13 @@ /* * @test - * @summary Unit test for jdk.Version. - * @bug 8072379 + * @summary Unit test for java.lang.Runtime.Version. + * @bug 8072379 8144062 */ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.Runtime.Version; import java.math.BigInteger; import java.util.stream.Collectors; import java.util.Arrays; @@ -36,7 +37,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import jdk.Version; import static java.lang.System.out; public class Basic { @@ -116,8 +116,8 @@ public class Basic { tryCatch("1.4142+-", IAE); tryCatch("2.9979+-%", IAE); - //// Test for current() - testCurrent(); + //// Test for Runtime.version() + testVersion(); //// Test for equals{IgnoreOpt}?(), hashCode(), compareTo{IgnoreOpt}?() // compare: after "<" == -1, equal == 0, before ">" == 1 @@ -219,18 +219,19 @@ public class Basic { pass(); } - private static void testCurrent() { - Version current = Version.current(); - String javaVer = System.getProperty("java.version"); + private static void testVersion() { + Version current = Runtime.version(); + String javaVer = System.getProperty("java.runtime.version"); - // java.version == $VNUM(\-$PRE) - String [] ver = javaVer.split("-"); + // java.runtime.version == $VNUM(\-$PRE)?(\+$BUILD)?(-$OPT)? + String [] jv = javaVer.split("\\+"); + String [] ver = jv[0].split("-"); List javaVerVNum = Arrays.stream(ver[0].split("\\.")) .map(v -> Integer.parseInt(v)) .collect(Collectors.toList()); if (!javaVerVNum.equals(current.version())) { - fail("testCurrent() version()", javaVerVNum.toString(), + fail("Runtime.version()", javaVerVNum.toString(), current.version().toString()); } else { pass(); diff --git a/jdk/test/java/lang/StackWalker/CountLocalSlots.java b/jdk/test/java/lang/StackWalker/CountLocalSlots.java new file mode 100644 index 00000000000..c78a4cb7bf4 --- /dev/null +++ b/jdk/test/java/lang/StackWalker/CountLocalSlots.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8147039 + * @summary Confirm locals[] always has expected length, even for "dead" locals + * @compile LocalsAndOperands.java + * @run testng/othervm -Xcomp CountLocalSlots + */ + +import org.testng.annotations.Test; +import java.lang.StackWalker.StackFrame; + +public class CountLocalSlots { + final static boolean debug = true; + + @Test(dataProvider = "provider", dataProviderClass = LocalsAndOperands.class) + public void countLocalSlots(StackFrame... frames) { + for (StackFrame frame : frames) { + if (debug) { + System.out.println("Running countLocalSlots"); + LocalsAndOperands.dumpStackWithLocals(frames); + } + // Confirm expected number of locals + String methodName = frame.getMethodName(); + Integer expectedObj = (Integer) LocalsAndOperands.Tester.NUM_LOCALS.get(methodName); + if (expectedObj == null) { + if (!debug) { LocalsAndOperands.dumpStackWithLocals(frames); } + throw new RuntimeException("No NUM_LOCALS entry for " + + methodName + "(). Update test?"); + } + Object[] locals = (Object[]) LocalsAndOperands.invokeGetLocals(frame); + if (locals.length != expectedObj) { + if (!debug) { LocalsAndOperands.dumpStackWithLocals(frames); } + throw new RuntimeException(methodName + "(): number of locals (" + + locals.length + ") did not match expected (" + expectedObj + ")"); + } + } + } +} diff --git a/jdk/test/java/lang/StackWalker/LocalsAndOperands.java b/jdk/test/java/lang/StackWalker/LocalsAndOperands.java index 63a6731a164..b253ab27e81 100644 --- a/jdk/test/java/lang/StackWalker/LocalsAndOperands.java +++ b/jdk/test/java/lang/StackWalker/LocalsAndOperands.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,17 +23,20 @@ /* * @test - * @bug 8020968 - * @summary Sanity test for locals and operands - * @run main LocalsAndOperands + * @bug 8020968 8147039 + * @summary Tests for locals and operands + * @run testng LocalsAndOperands */ +import org.testng.annotations.*; import java.lang.StackWalker.StackFrame; import java.lang.reflect.*; -import java.util.List; -import java.util.stream.Collectors; +import java.util.*; +import java.util.stream.*; public class LocalsAndOperands { + static final boolean debug = true; + static Class liveStackFrameClass; static Class primitiveValueClass; static StackWalker extendedWalker; @@ -41,92 +44,319 @@ public class LocalsAndOperands { static Method getOperands; static Method getMonitors; static Method primitiveType; - public static void main(String... args) throws Exception { - liveStackFrameClass = Class.forName("java.lang.LiveStackFrame"); - primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveValue"); - getLocals = liveStackFrameClass.getDeclaredMethod("getLocals"); - getLocals.setAccessible(true); + static { + try { + liveStackFrameClass = Class.forName("java.lang.LiveStackFrame"); + primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveValue"); - getOperands = liveStackFrameClass.getDeclaredMethod("getStack"); - getOperands.setAccessible(true); + getLocals = liveStackFrameClass.getDeclaredMethod("getLocals"); + getLocals.setAccessible(true); - getMonitors = liveStackFrameClass.getDeclaredMethod("getMonitors"); - getMonitors.setAccessible(true); + getOperands = liveStackFrameClass.getDeclaredMethod("getStack"); + getOperands.setAccessible(true); - primitiveType = primitiveValueClass.getDeclaredMethod("type"); - primitiveType.setAccessible(true); + getMonitors = liveStackFrameClass.getDeclaredMethod("getMonitors"); + getMonitors.setAccessible(true); - Method method = liveStackFrameClass.getMethod("getStackWalker"); - method.setAccessible(true); - extendedWalker = (StackWalker) method.invoke(null); - new LocalsAndOperands(extendedWalker, true).test(); + primitiveType = primitiveValueClass.getDeclaredMethod("type"); + primitiveType.setAccessible(true); - // no access to local and operands. - new LocalsAndOperands(StackWalker.getInstance(), false).test(); + Method method = liveStackFrameClass.getMethod("getStackWalker"); + method.setAccessible(true); + extendedWalker = (StackWalker) method.invoke(null); + } catch (Throwable t) { throw new RuntimeException(t); } } - private final StackWalker walker; - private final boolean extended; - LocalsAndOperands(StackWalker walker, boolean extended) { - this.walker = walker; - this.extended = extended; + /** Helper method to return a StackFrame's locals */ + static Object[] invokeGetLocals(StackFrame arg) { + try { + return (Object[]) getLocals.invoke(arg); + } catch (Exception e) { throw new RuntimeException(e); } } - synchronized void test() throws Exception { - int x = 10; - char c = 'z'; - String hi = "himom"; - long l = 1000000L; - double d = 3.1415926; + /***************** + * DataProviders * + *****************/ - List frames = walker.walk(s -> s.collect(Collectors.toList())); - if (extended) { - for (StackWalker.StackFrame f : frames) { - System.out.println("frame: " + f); - Object[] locals = (Object[]) getLocals.invoke(f); + /** Calls testLocals() and provides LiveStackFrames for testLocals* methods */ + @DataProvider + public static StackFrame[][] provider() { + return new StackFrame[][] { + new Tester().testLocals() + }; + } + + /** + * Calls testLocalsKeepAlive() and provides LiveStackFrames for testLocals* methods. + * Local variables in testLocalsKeepAlive() are ensured to not become dead. + */ + @DataProvider + public static StackFrame[][] keepAliveProvider() { + return new StackFrame[][] { + new Tester().testLocalsKeepAlive() + }; + } + + /** + * Provides StackFrames from a StackWalker without the LOCALS_AND_OPERANDS + * option. + */ + @DataProvider + public static StackFrame[][] noLocalsProvider() { + // Use default StackWalker + return new StackFrame[][] { + new Tester(StackWalker.getInstance(), true).testLocals() + }; + } + + /** + * Calls testLocals() and provides LiveStackFrames for *all* called methods, + * including test infrastructure (jtreg, testng, etc) + * + */ + @DataProvider + public static StackFrame[][] unfilteredProvider() { + return new StackFrame[][] { + new Tester(extendedWalker, false).testLocals() + }; + } + + /**************** + * Test methods * + ****************/ + + /** + * Check for expected local values and types in the LiveStackFrame + */ + @Test(dataProvider = "keepAliveProvider") + public static void checkLocalValues(StackFrame... frames) { + if (debug) { + System.out.println("Running checkLocalValues"); + dumpStackWithLocals(frames); + } + Arrays.stream(frames).filter(f -> f.getMethodName() + .equals("testLocalsKeepAlive")) + .forEach( + f -> { + Object[] locals = invokeGetLocals(f); for (int i = 0; i < locals.length; i++) { - System.out.format(" local %d: %s type %s\n", i, locals[i], type(locals[i])); + // Value + String expected = Tester.LOCAL_VALUES[i]; + Object observed = locals[i]; + if (expected != null /* skip nulls in golden values */ && + !expected.equals(observed.toString())) { + System.err.println("Local value mismatch:"); + if (!debug) { dumpStackWithLocals(frames); } + throw new RuntimeException("local " + i + " value is " + + observed + ", expected " + expected); + } - // check for non-null locals in LocalsAndOperands.test() - if (f.getClassName().equals("LocalsAndOperands") && - f.getMethodName().equals("test")) { - if (locals[i] == null) { - throw new RuntimeException("kept-alive locals should not be null"); - } + // Type + expected = Tester.LOCAL_TYPES[i]; + observed = type(locals[i]); + if (expected != null /* skip nulls in golden values */ && + !expected.equals(observed)) { + System.err.println("Local type mismatch:"); + if (!debug) { dumpStackWithLocals(frames); } + throw new RuntimeException("local " + i + " type is " + + observed + ", expected " + expected); } } - - Object[] operands = (Object[]) getOperands.invoke(f); - for (int i = 0; i < operands.length; i++) { - System.out.format(" operand %d: %s type %s%n", i, operands[i], - type(operands[i])); - } - - Object[] monitors = (Object[]) getMonitors.invoke(f); - for (int i = 0; i < monitors.length; i++) { - System.out.format(" monitor %d: %s%n", i, monitors[i]); - } } - } else { - for (StackFrame f : frames) { - if (liveStackFrameClass.isInstance(f)) { - throw new RuntimeException("should not be LiveStackFrame"); - } - } - } - // Use local variables so they stay alive - System.out.println("Stayin' alive: "+x+" "+c+" "+hi+" "+l+" "+d); + ); } - String type(Object o) throws Exception { - if (o == null) { - return "null"; - } else if (primitiveValueClass.isInstance(o)) { - char c = (char)primitiveType.invoke(o); - return String.valueOf(c); - } else { - return o.getClass().getName(); + /** + * Basic sanity check for locals and operands + */ + @Test(dataProvider = "provider") + public static void sanityCheck(StackFrame... frames) { + if (debug) { + System.out.println("Running sanityCheck"); } + try { + Stream stream = Arrays.stream(frames); + if (debug) { + stream.forEach(LocalsAndOperands::printLocals); + } else { + System.out.println(stream.count() + " frames"); + } + } catch (Throwable t) { + dumpStackWithLocals(frames); + throw t; + } + } + + /** + * Sanity check for locals and operands, including testng/jtreg frames + */ + @Test(dataProvider = "unfilteredProvider") + public static void unfilteredSanityCheck(StackFrame... frames) { + if (debug) { + System.out.println("Running unfilteredSanityCheck"); + } + try { + Stream stream = Arrays.stream(frames); + if (debug) { + stream.forEach(f -> { System.out.println(f + ": " + + invokeGetLocals(f).length + " locals"); } ); + } else { + System.out.println(stream.count() + " frames"); + } + } catch (Throwable t) { + dumpStackWithLocals(frames); + throw t; + } + } + + /** + * Test that LiveStackFrames are not provided with the default StackWalker + * options. + */ + @Test(dataProvider = "noLocalsProvider") + public static void withoutLocalsAndOperands(StackFrame... frames) { + for (StackFrame frame : frames) { + if (liveStackFrameClass.isInstance(frame)) { + throw new RuntimeException("should not be LiveStackFrame"); + } + } + } + + static class Tester { + private StackWalker walker; + private boolean filter = true; // Filter out testng/jtreg/etc frames? + + Tester() { + this.walker = extendedWalker; + } + + Tester(StackWalker walker, boolean filter) { + this.walker = walker; + this.filter = filter; + } + + /** + * Perform stackwalk without keeping local variables alive and return an + * array of the collected StackFrames + */ + private synchronized StackFrame[] testLocals() { + // Unused local variables will become dead + int x = 10; + char c = 'z'; + String hi = "himom"; + long l = 1000000L; + double d = 3.1415926; + + if (filter) { + return walker.walk(s -> s.filter(f -> TEST_METHODS.contains(f + .getMethodName())).collect(Collectors.toList())) + .toArray(new StackFrame[0]); + } else { + return walker.walk(s -> s.collect(Collectors.toList())) + .toArray(new StackFrame[0]); + } + } + + /** + * Perform stackwalk, keeping local variables alive, and return a list of + * the collected StackFrames + */ + private synchronized StackFrame[] testLocalsKeepAlive() { + int x = 10; + char c = 'z'; + String hi = "himom"; + long l = 1000000L; + double d = 3.1415926; + + List frames; + if (filter) { + frames = walker.walk(s -> s.filter(f -> TEST_METHODS.contains(f + .getMethodName())).collect(Collectors.toList())); + } else { + frames = walker.walk(s -> s.collect(Collectors.toList())); + } + + // Use local variables so they stay alive + System.out.println("Stayin' alive: "+x+" "+c+" "+hi+" "+l+" "+d); + return frames.toArray(new StackFrame[0]); // FIXME: convert to Array here + } + + // Expected values for locals in testLocals() & testLocalsKeepAlive() + // TODO: use real values instead of Strings, rebuild doubles & floats, etc + private final static String[] LOCAL_VALUES = new String[] { + null, // skip, LocalsAndOperands$Tester@XXX identity is different each run + "10", + "122", + "himom", + "0", + null, // skip, fix in 8156073 + null, // skip, fix in 8156073 + null, // skip, fix in 8156073 + "0" + }; + + // Expected types for locals in testLocals() & testLocalsKeepAlive() + // TODO: use real types + private final static String[] LOCAL_TYPES = new String[] { + null, // skip + "I", + "I", + "java.lang.String", + "I", + "I", + "I", + "I", + "I" + }; + + final static Map NUM_LOCALS = Map.of("testLocals", 8, + "testLocalsKeepAlive", + LOCAL_VALUES.length); + private final static Collection TEST_METHODS = NUM_LOCALS.keySet(); + } + + /** + * Print stack trace with locals + */ + public static void dumpStackWithLocals(StackFrame...frames) { + Arrays.stream(frames).forEach(LocalsAndOperands::printLocals); + } + + /** + * Print the StackFrame and an indexed list of its locals + */ + public static void printLocals(StackWalker.StackFrame frame) { + try { + System.out.println(frame); + Object[] locals = (Object[]) getLocals.invoke(frame); + for (int i = 0; i < locals.length; i++) { + System.out.format(" local %d: %s type %s\n", i, locals[i], type(locals[i])); + } + + Object[] operands = (Object[]) getOperands.invoke(frame); + for (int i = 0; i < operands.length; i++) { + System.out.format(" operand %d: %s type %s%n", i, operands[i], + type(operands[i])); + } + + Object[] monitors = (Object[]) getMonitors.invoke(frame); + for (int i = 0; i < monitors.length; i++) { + System.out.format(" monitor %d: %s%n", i, monitors[i]); + } + } catch (Exception e) { throw new RuntimeException(e); } + } + + private static String type(Object o) { + try { + if (o == null) { + return "null"; + } else if (primitiveValueClass.isInstance(o)) { + char c = (char)primitiveType.invoke(o); + return String.valueOf(c); + } else { + return o.getClass().getName(); + } + } catch(Exception e) { throw new RuntimeException(e); } } } diff --git a/jdk/test/java/lang/StackWalker/LocalsCrash.java b/jdk/test/java/lang/StackWalker/LocalsCrash.java new file mode 100644 index 00000000000..b50dd263f00 --- /dev/null +++ b/jdk/test/java/lang/StackWalker/LocalsCrash.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8147039 + * @summary Test for -Xcomp crash that happened before 8147039 fix + * @run testng/othervm -Xcomp LocalsCrash + */ + +import org.testng.annotations.*; +import java.lang.reflect.*; +import java.util.List; +import java.util.stream.Collectors; + +public class LocalsCrash { + static Class liveStackFrameClass; + static Method getStackWalker; + + static { + try { + liveStackFrameClass = Class.forName("java.lang.LiveStackFrame"); + getStackWalker = liveStackFrameClass.getMethod("getStackWalker"); + getStackWalker.setAccessible(true); + } catch (Throwable t) { throw new RuntimeException(t); } + } + + private StackWalker walker; + + LocalsCrash() { + try { + walker = (StackWalker) getStackWalker.invoke(null); + } catch (Exception e) { throw new RuntimeException(e); } + } + + @Test + public void test00() { doStackWalk(); } + + @Test + public void test01() { doStackWalk(); } + + private synchronized List doStackWalk() { + try { + // Unused local variables will become dead + int x = 10; + char c = 'z'; + String hi = "himom"; + long l = 1000000L; + double d = 3.1415926; + + return walker.walk(s -> s.collect(Collectors.toList())); + } catch (Exception e) { throw new RuntimeException(e); } + } +} diff --git a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh index f5bb3b83179..b428a59bb28 100644 --- a/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh +++ b/jdk/test/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh @@ -80,5 +80,5 @@ $JAR ${TESTTOOLVMOPTS} -cfm "${TESTCLASSES}"/ClassUnloadTest.jar "${MANIFEST}" \ # Finally we run the test (cd "${TESTCLASSES}"; \ - $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:classunload \ + $JAVA ${TESTVMOPTS} -Xverify:none -Xlog:class+unload \ -javaagent:ClassUnloadTest.jar ClassUnloadTest "${OTHERDIR}" Bar.jar) diff --git a/jdk/test/java/lang/invoke/ArrayLengthTest.java b/jdk/test/java/lang/invoke/ArrayLengthTest.java new file mode 100644 index 00000000000..3eabf9789c2 --- /dev/null +++ b/jdk/test/java/lang/invoke/ArrayLengthTest.java @@ -0,0 +1,81 @@ +/* + * 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. 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. + */ + +/* @test + * @run testng/othervm -ea -esa test.java.lang.invoke.ArrayLengthTest + */ +package test.java.lang.invoke; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; + +import static org.testng.AssertJUnit.*; + +import org.testng.annotations.*; + +public class ArrayLengthTest { + + @DataProvider + Object[][] arrayClasses() { + return new Object[][] { + {int[].class}, + {long[].class}, + {float[].class}, + {double[].class}, + {boolean[].class}, + {byte[].class}, + {short[].class}, + {char[].class}, + {Object[].class}, + {StringBuffer[].class} + }; + } + + @Test(dataProvider = "arrayClasses") + public void testArrayLength(Class arrayClass) throws Throwable { + MethodHandle arrayLength = MethodHandles.arrayLength(arrayClass); + assertEquals(int.class, arrayLength.type().returnType()); + assertEquals(arrayClass, arrayLength.type().parameterType(0)); + Object array = MethodHandles.arrayConstructor(arrayClass).invoke(10); + assertEquals(10, arrayLength.invoke(array)); + } + + @Test(dataProvider = "arrayClasses", expectedExceptions = NullPointerException.class) + public void testArrayLengthInvokeNPE(Class arrayClass) throws Throwable { + MethodHandle arrayLength = MethodHandles.arrayLength(arrayClass); + arrayLength.invoke(null); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void testArrayLengthNoArray() { + MethodHandles.arrayLength(String.class); + } + + @Test(expectedExceptions = NullPointerException.class) + public void testArrayLengthNPE() { + MethodHandles.arrayLength(null); + } + +} diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java index 59737dbeb7b..b8cbc17784d 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java @@ -40,6 +40,7 @@ import static org.testng.Assert.*; abstract class VarHandleBaseTest { static final int ITERS = Integer.getInteger("iters", 1); + static final int WEAK_ATTEMPTS = Integer.getInteger("weakAttempts", 10); interface ThrowingRunnable { void run() throws Throwable; @@ -211,7 +212,6 @@ abstract class VarHandleBaseTest { } static MethodHandle findVirtual(VarHandle vh, TestAccessMode tam, MethodType mt) { - mt = vh.accessModeType(tam.toAccessMode()); MethodHandle mh; try { mh = MethodHandles.publicLookup(). @@ -221,36 +221,26 @@ abstract class VarHandleBaseTest { } catch (Exception e) { throw new RuntimeException(e); } - return bind(vh, tam, mh, mt); + return bind(vh, mh, mt); } - static MethodHandle varHandleInvokerWithAccessModeType(VarHandle vh, TestAccessMode tam, MethodType mt) { - mt = vh.accessModeType(tam.toAccessMode()); + static MethodHandle varHandleInvoker(VarHandle vh, TestAccessMode tam, MethodType mt) { MethodHandle mh = MethodHandles.varHandleInvoker( tam.toAccessMode(), mt); - return bind(vh, tam, mh, mt); + return bind(vh, mh, mt); } - static MethodHandle varHandleInvokerWithSymbolicTypeDescriptor(VarHandle vh, TestAccessMode tam, MethodType mt) { - MethodHandle mh = MethodHandles.varHandleInvoker( - tam.toAccessMode(), - mt); - - return bind(vh, tam, mh, mt); - } - - static MethodHandle varHandleExactInvokerWithAccessModeType(VarHandle vh, TestAccessMode tam, MethodType mt) { - mt = vh.accessModeType(tam.toAccessMode()); + static MethodHandle varHandleExactInvoker(VarHandle vh, TestAccessMode tam, MethodType mt) { MethodHandle mh = MethodHandles.varHandleExactInvoker( tam.toAccessMode(), mt); - return bind(vh, tam, mh, mt); + return bind(vh, mh, mt); } - private static MethodHandle bind(VarHandle vh, TestAccessMode testAccessMode, MethodHandle mh, MethodType emt) { + private static MethodHandle bind(VarHandle vh, MethodHandle mh, MethodType emt) { assertEquals(mh.type(), emt.insertParameterTypes(0, VarHandle.class), "MethodHandle type differs from access mode type"); @@ -268,33 +258,30 @@ abstract class VarHandleBaseTest { enum VarHandleToMethodHandle { VAR_HANDLE_TO_METHOD_HANDLE( "VarHandle.toMethodHandle", + true, VarHandleBaseTest::toMethodHandle), METHOD_HANDLES_LOOKUP_FIND_VIRTUAL( "Lookup.findVirtual", + false, VarHandleBaseTest::findVirtual), - METHOD_HANDLES_VAR_HANDLE_INVOKER_WITH_ACCESS_MODE_TYPE( - "MethodHandles.varHandleInvoker(accessModeType)", - VarHandleBaseTest::varHandleInvokerWithAccessModeType), - METHOD_HANDLES_VAR_HANDLE_INVOKER_WITH_SYMBOLIC_TYPE_DESCRIPTOR( - "MethodHandles.varHandleInvoker(symbolicTypeDescriptor)", - VarHandleBaseTest::varHandleInvokerWithSymbolicTypeDescriptor), - METHOD_HANDLES_VAR_HANDLE_EXACT_INVOKER_WITH_ACCESS_MODE_TYPE( - "MethodHandles.varHandleExactInvoker(accessModeType)", - VarHandleBaseTest::varHandleExactInvokerWithAccessModeType); + METHOD_HANDLES_VAR_HANDLE_INVOKER( + "MethodHandles.varHandleInvoker", + false, + VarHandleBaseTest::varHandleInvoker), + METHOD_HANDLES_VAR_HANDLE_EXACT_INVOKER( + "MethodHandles.varHandleExactInvoker", + true, + VarHandleBaseTest::varHandleExactInvoker); final String desc; + final boolean isExact; final TriFunction f; - final boolean exact; - VarHandleToMethodHandle(String desc, TriFunction f) { - this(desc, f, false); - } - - VarHandleToMethodHandle(String desc, TriFunction f, - boolean exact) { + VarHandleToMethodHandle(String desc, boolean isExact, + TriFunction f) { this.desc = desc; this.f = f; - this.exact = exact; + this.isExact = isExact; } MethodHandle apply(VarHandle vh, TestAccessMode am, MethodType mt) { @@ -363,6 +350,15 @@ abstract class VarHandleBaseTest { return amToHandle.computeIfAbsent( amt, k -> f.apply(vh, am, mt)); } + + Class getWMTEOOrOther(Class c) { + return f.isExact ? WrongMethodTypeException.class : c; + } + + void checkWMTEOrCCE(ThrowingRunnable r) { + checkWithThrowable(getWMTEOOrOther(ClassCastException.class), null, r); + } + } interface AccessTestAction { @@ -475,4 +471,4 @@ abstract class VarHandleBaseTest { assertEquals(mt.parameterType(mt.parameterCount() - 1), vh.varType()); } } -} \ No newline at end of file +} diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java index 021091484e6..9a02753d945 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java @@ -292,6 +292,10 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, true, false); }); + checkUOE(() -> { + boolean r = (boolean) vh.getAndSet(recv, true); + }); + checkUOE(() -> { boolean o = (boolean) vh.getAndAdd(recv, true); }); @@ -378,6 +382,10 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(true, false); }); + checkUOE(() -> { + boolean r = (boolean) vh.getAndSet(true); + }); + checkUOE(() -> { boolean o = (boolean) vh.getAndAdd(true); }); @@ -454,6 +462,10 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, true, false); }); + checkUOE(() -> { + boolean r = (boolean) vh.getAndSet(recv, true); + }); + checkUOE(() -> { boolean o = (boolean) vh.getAndAdd(recv, true); }); @@ -530,6 +542,10 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(true, false); }); + checkUOE(() -> { + boolean r = (boolean) vh.getAndSet(true); + }); + checkUOE(() -> { boolean o = (boolean) vh.getAndAdd(true); }); @@ -613,6 +629,10 @@ public class VarHandleTestAccessBoolean extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(array, i, true, false); }); + checkUOE(() -> { + boolean r = (boolean) vh.getAndSet(array, i, true); + }); + checkUOE(() -> { boolean o = (boolean) vh.getAndAdd(array, i, true); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java index e550815156c..17544907e8d 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java @@ -292,6 +292,10 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, (byte)1, (byte)2); }); + checkUOE(() -> { + byte r = (byte) vh.getAndSet(recv, (byte)1); + }); + checkUOE(() -> { byte o = (byte) vh.getAndAdd(recv, (byte)1); }); @@ -378,6 +382,10 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease((byte)1, (byte)2); }); + checkUOE(() -> { + byte r = (byte) vh.getAndSet((byte)1); + }); + checkUOE(() -> { byte o = (byte) vh.getAndAdd((byte)1); }); @@ -454,6 +462,10 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, (byte)1, (byte)2); }); + checkUOE(() -> { + byte r = (byte) vh.getAndSet(recv, (byte)1); + }); + checkUOE(() -> { byte o = (byte) vh.getAndAdd(recv, (byte)1); }); @@ -530,6 +542,10 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease((byte)1, (byte)2); }); + checkUOE(() -> { + byte r = (byte) vh.getAndSet((byte)1); + }); + checkUOE(() -> { byte o = (byte) vh.getAndAdd((byte)1); }); @@ -613,6 +629,10 @@ public class VarHandleTestAccessByte extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(array, i, (byte)1, (byte)2); }); + checkUOE(() -> { + byte r = (byte) vh.getAndSet(array, i, (byte)1); + }); + checkUOE(() -> { byte o = (byte) vh.getAndAdd(array, i, (byte)1); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java index 5c13c6d6677..88bad8475cb 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java @@ -292,6 +292,10 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, 'a', 'b'); }); + checkUOE(() -> { + char r = (char) vh.getAndSet(recv, 'a'); + }); + checkUOE(() -> { char o = (char) vh.getAndAdd(recv, 'a'); }); @@ -378,6 +382,10 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease('a', 'b'); }); + checkUOE(() -> { + char r = (char) vh.getAndSet('a'); + }); + checkUOE(() -> { char o = (char) vh.getAndAdd('a'); }); @@ -454,6 +462,10 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, 'a', 'b'); }); + checkUOE(() -> { + char r = (char) vh.getAndSet(recv, 'a'); + }); + checkUOE(() -> { char o = (char) vh.getAndAdd(recv, 'a'); }); @@ -530,6 +542,10 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease('a', 'b'); }); + checkUOE(() -> { + char r = (char) vh.getAndSet('a'); + }); + checkUOE(() -> { char o = (char) vh.getAndAdd('a'); }); @@ -613,6 +629,10 @@ public class VarHandleTestAccessChar extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(array, i, 'a', 'b'); }); + checkUOE(() -> { + char r = (char) vh.getAndSet(array, i, 'a'); + }); + checkUOE(() -> { char o = (char) vh.getAndAdd(array, i, 'a'); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java index 65125e3f62e..1861e5919dc 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java @@ -292,6 +292,10 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, 1.0d, 2.0d); }); + checkUOE(() -> { + double r = (double) vh.getAndSet(recv, 1.0d); + }); + checkUOE(() -> { double o = (double) vh.getAndAdd(recv, 1.0d); }); @@ -378,6 +382,10 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(1.0d, 2.0d); }); + checkUOE(() -> { + double r = (double) vh.getAndSet(1.0d); + }); + checkUOE(() -> { double o = (double) vh.getAndAdd(1.0d); }); @@ -454,6 +462,10 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, 1.0d, 2.0d); }); + checkUOE(() -> { + double r = (double) vh.getAndSet(recv, 1.0d); + }); + checkUOE(() -> { double o = (double) vh.getAndAdd(recv, 1.0d); }); @@ -530,6 +542,10 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(1.0d, 2.0d); }); + checkUOE(() -> { + double r = (double) vh.getAndSet(1.0d); + }); + checkUOE(() -> { double o = (double) vh.getAndAdd(1.0d); }); @@ -613,6 +629,10 @@ public class VarHandleTestAccessDouble extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(array, i, 1.0d, 2.0d); }); + checkUOE(() -> { + double r = (double) vh.getAndSet(array, i, 1.0d); + }); + checkUOE(() -> { double o = (double) vh.getAndAdd(array, i, 1.0d); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java index 8e7491ad45a..dce87f72755 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java @@ -292,6 +292,10 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, 1.0f, 2.0f); }); + checkUOE(() -> { + float r = (float) vh.getAndSet(recv, 1.0f); + }); + checkUOE(() -> { float o = (float) vh.getAndAdd(recv, 1.0f); }); @@ -378,6 +382,10 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(1.0f, 2.0f); }); + checkUOE(() -> { + float r = (float) vh.getAndSet(1.0f); + }); + checkUOE(() -> { float o = (float) vh.getAndAdd(1.0f); }); @@ -454,6 +462,10 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, 1.0f, 2.0f); }); + checkUOE(() -> { + float r = (float) vh.getAndSet(recv, 1.0f); + }); + checkUOE(() -> { float o = (float) vh.getAndAdd(recv, 1.0f); }); @@ -530,6 +542,10 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(1.0f, 2.0f); }); + checkUOE(() -> { + float r = (float) vh.getAndSet(1.0f); + }); + checkUOE(() -> { float o = (float) vh.getAndAdd(1.0f); }); @@ -613,6 +629,10 @@ public class VarHandleTestAccessFloat extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(array, i, 1.0f, 2.0f); }); + checkUOE(() -> { + float r = (float) vh.getAndSet(array, i, 1.0f); + }); + checkUOE(() -> { float o = (float) vh.getAndAdd(array, i, 1.0f); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java index bfcb5feec4c..1897821dc06 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java @@ -402,29 +402,41 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(recv, 1, 2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(recv, 1, 2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(recv); assertEquals(x, 2, "weakCompareAndSet int value"); } { - boolean r = vh.weakCompareAndSetAcquire(recv, 2, 1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(recv, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) vh.get(recv); assertEquals(x, 1, "weakCompareAndSetAcquire int"); } { - boolean r = vh.weakCompareAndSetRelease(recv, 1, 2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(recv, 1, 2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) vh.get(recv); assertEquals(x, 2, "weakCompareAndSetRelease int"); } { - boolean r = vh.weakCompareAndSetVolatile(recv, 2, 1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(recv, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetVolatile int"); int x = (int) vh.get(recv); assertEquals(x, 1, "weakCompareAndSetVolatile int value"); } @@ -543,36 +555,48 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { } { - boolean r = (boolean) vh.weakCompareAndSet(1, 2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(1, 2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(); assertEquals(x, 2, "weakCompareAndSet int value"); } { - boolean r = (boolean) vh.weakCompareAndSetAcquire(2, 1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(2, 1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) vh.get(); assertEquals(x, 1, "weakCompareAndSetAcquire int"); } { - boolean r = (boolean) vh.weakCompareAndSetRelease(1, 2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(1, 2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) vh.get(); assertEquals(x, 2, "weakCompareAndSetRelease int"); } { - boolean r = (boolean) vh.weakCompareAndSetVolatile(2, 1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(2, 1); + } + assertEquals(success, true, "weakCompareAndSetVolatile int"); int x = (int) vh.get(); - assertEquals(x, 1, "weakCompareAndSetVolatile int value"); + assertEquals(x, 1, "weakCompareAndSetVolatile int"); } // Compare set and get { - int o = (int) vh.getAndSet( 2); + int o = (int) vh.getAndSet(2); assertEquals(o, 1, "getAndSet int"); int x = (int) vh.get(); assertEquals(x, 2, "getAndSet int value"); @@ -687,31 +711,43 @@ public class VarHandleTestAccessInt extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(array, i, 1, 2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, 1, 2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, 2, "weakCompareAndSet int value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, 2, 1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); assertEquals(x, 1, "weakCompareAndSetAcquire int"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, 1, 2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, 1, 2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); assertEquals(x, 2, "weakCompareAndSetRelease int"); } { - boolean r = vh.weakCompareAndSetVolatile(array, i, 2, 1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(array, i, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetVolatile int"); int x = (int) vh.get(array, i); - assertEquals(x, 1, "weakCompareAndSetVolatile int value"); + assertEquals(x, 1, "weakCompareAndSetVolatile int"); } // Compare set and get diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java index 1f02bed9045..adea5ed82a1 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java @@ -402,29 +402,41 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(recv, 1L, 2L); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(recv, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(recv); assertEquals(x, 2L, "weakCompareAndSet long value"); } { - boolean r = vh.weakCompareAndSetAcquire(recv, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(recv, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) vh.get(recv); assertEquals(x, 1L, "weakCompareAndSetAcquire long"); } { - boolean r = vh.weakCompareAndSetRelease(recv, 1L, 2L); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(recv, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) vh.get(recv); assertEquals(x, 2L, "weakCompareAndSetRelease long"); } { - boolean r = vh.weakCompareAndSetVolatile(recv, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(recv, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetVolatile long"); long x = (long) vh.get(recv); assertEquals(x, 1L, "weakCompareAndSetVolatile long value"); } @@ -543,36 +555,48 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { } { - boolean r = (boolean) vh.weakCompareAndSet(1L, 2L); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(1L, 2L); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(); assertEquals(x, 2L, "weakCompareAndSet long value"); } { - boolean r = (boolean) vh.weakCompareAndSetAcquire(2L, 1L); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) vh.get(); assertEquals(x, 1L, "weakCompareAndSetAcquire long"); } { - boolean r = (boolean) vh.weakCompareAndSetRelease(1L, 2L); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(1L, 2L); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) vh.get(); assertEquals(x, 2L, "weakCompareAndSetRelease long"); } { - boolean r = (boolean) vh.weakCompareAndSetVolatile(2L, 1L); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetVolatile long"); long x = (long) vh.get(); - assertEquals(x, 1L, "weakCompareAndSetVolatile long value"); + assertEquals(x, 1L, "weakCompareAndSetVolatile long"); } // Compare set and get { - long o = (long) vh.getAndSet( 2L); + long o = (long) vh.getAndSet(2L); assertEquals(o, 1L, "getAndSet long"); long x = (long) vh.get(); assertEquals(x, 2L, "getAndSet long value"); @@ -687,31 +711,43 @@ public class VarHandleTestAccessLong extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(array, i, 1L, 2L); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, 2L, "weakCompareAndSet long value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) vh.get(array, i); assertEquals(x, 1L, "weakCompareAndSetAcquire long"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, 1L, 2L); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) vh.get(array, i); assertEquals(x, 2L, "weakCompareAndSetRelease long"); } { - boolean r = vh.weakCompareAndSetVolatile(array, i, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(array, i, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetVolatile long"); long x = (long) vh.get(array, i); - assertEquals(x, 1L, "weakCompareAndSetVolatile long value"); + assertEquals(x, 1L, "weakCompareAndSetVolatile long"); } // Compare set and get diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java index 822252f7a7d..a8091a838cb 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java @@ -292,6 +292,10 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, (short)1, (short)2); }); + checkUOE(() -> { + short r = (short) vh.getAndSet(recv, (short)1); + }); + checkUOE(() -> { short o = (short) vh.getAndAdd(recv, (short)1); }); @@ -378,6 +382,10 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease((short)1, (short)2); }); + checkUOE(() -> { + short r = (short) vh.getAndSet((short)1); + }); + checkUOE(() -> { short o = (short) vh.getAndAdd((short)1); }); @@ -454,6 +462,10 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(recv, (short)1, (short)2); }); + checkUOE(() -> { + short r = (short) vh.getAndSet(recv, (short)1); + }); + checkUOE(() -> { short o = (short) vh.getAndAdd(recv, (short)1); }); @@ -530,6 +542,10 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease((short)1, (short)2); }); + checkUOE(() -> { + short r = (short) vh.getAndSet((short)1); + }); + checkUOE(() -> { short o = (short) vh.getAndAdd((short)1); }); @@ -613,6 +629,10 @@ public class VarHandleTestAccessShort extends VarHandleBaseTest { boolean r = vh.weakCompareAndSetRelease(array, i, (short)1, (short)2); }); + checkUOE(() -> { + short r = (short) vh.getAndSet(array, i, (short)1); + }); + checkUOE(() -> { short o = (short) vh.getAndAdd(array, i, (short)1); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java index 9e4ec77768b..405206ef22c 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java @@ -416,29 +416,41 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(recv, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSet String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(recv, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(recv); assertEquals(x, "bar", "weakCompareAndSet String value"); } { - boolean r = vh.weakCompareAndSetAcquire(recv, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetAcquire String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(recv, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetAcquire String"); String x = (String) vh.get(recv); assertEquals(x, "foo", "weakCompareAndSetAcquire String"); } { - boolean r = vh.weakCompareAndSetRelease(recv, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSetRelease String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(recv, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSetRelease String"); String x = (String) vh.get(recv); assertEquals(x, "bar", "weakCompareAndSetRelease String"); } { - boolean r = vh.weakCompareAndSetVolatile(recv, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetVolatile String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(recv, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetVolatile String"); String x = (String) vh.get(recv); assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); } @@ -555,36 +567,48 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { } { - boolean r = (boolean) vh.weakCompareAndSet("foo", "bar"); - assertEquals(r, true, "weakCompareAndSet String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet("foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(); assertEquals(x, "bar", "weakCompareAndSet String value"); } { - boolean r = (boolean) vh.weakCompareAndSetAcquire("bar", "foo"); - assertEquals(r, true, "weakCompareAndSetAcquire String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire("bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetAcquire String"); String x = (String) vh.get(); assertEquals(x, "foo", "weakCompareAndSetAcquire String"); } { - boolean r = (boolean) vh.weakCompareAndSetRelease("foo", "bar"); - assertEquals(r, true, "weakCompareAndSetRelease String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease("foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSetRelease String"); String x = (String) vh.get(); assertEquals(x, "bar", "weakCompareAndSetRelease String"); } { - boolean r = (boolean) vh.weakCompareAndSetVolatile("bar", "foo"); - assertEquals(r, true, "weakCompareAndSetVolatile String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease("bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetVolatile String"); String x = (String) vh.get(); - assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); + assertEquals(x, "foo", "weakCompareAndSetVolatile String"); } // Compare set and get { - String o = (String) vh.getAndSet( "bar"); + String o = (String) vh.getAndSet("bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) vh.get(); assertEquals(x, "bar", "getAndSet String value"); @@ -697,31 +721,43 @@ public class VarHandleTestAccessString extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(array, i, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSet String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(array, i); assertEquals(x, "bar", "weakCompareAndSet String value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetAcquire String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetAcquire String"); String x = (String) vh.get(array, i); assertEquals(x, "foo", "weakCompareAndSetAcquire String"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSetRelease String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSetRelease String"); String x = (String) vh.get(array, i); assertEquals(x, "bar", "weakCompareAndSetRelease String"); } { - boolean r = vh.weakCompareAndSetVolatile(array, i, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetVolatile String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(array, i, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetVolatile String"); String x = (String) vh.get(array, i); - assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); + assertEquals(x, "foo", "weakCompareAndSetVolatile String"); } // Compare set and get diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java index 8159e16ff62..8038315e391 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java @@ -50,7 +50,7 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { static final char VALUE_2 = (char)0x1112; - static final char VALUE_3 = (char)0x2122; + static final char VALUE_3 = (char)0xFFFE; @Override @@ -253,6 +253,10 @@ public class VarHandleTestByteArrayAsChar extends VarHandleBaseByteArrayTest { checkROBE(() -> { vh.setOpaque(array, ci, VALUE_1); }); + checkUOE(() -> { + boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); + }); + checkUOE(() -> { char r = (char) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java index a327b00fb77..53db9cd239b 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java @@ -50,7 +50,7 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { static final double VALUE_2 = 0x1112131415161718L; - static final double VALUE_3 = 0x2122232425262728L; + static final double VALUE_3 = 0xFFFEFDFCFBFAF9F8L; @Override @@ -254,9 +254,7 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { checkROBE(() -> { double o = (double) vh.getAndSet(array, ci, VALUE_1); }); - checkUOE(() -> { - boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); - }); + checkUOE(() -> { double o = (double) vh.getAndAdd(array, ci, VALUE_1); @@ -700,22 +698,31 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet double value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire double"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease double"); } @@ -840,22 +847,31 @@ public class VarHandleTestByteArrayAsDouble extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet double value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire double"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease double"); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java index 196c8101723..d2688cf925a 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java @@ -50,7 +50,7 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { static final float VALUE_2 = 0x11121314; - static final float VALUE_3 = 0x21222324; + static final float VALUE_3 = 0xFFFEFDFC; @Override @@ -254,9 +254,7 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { checkROBE(() -> { float o = (float) vh.getAndSet(array, ci, VALUE_1); }); - checkUOE(() -> { - boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); - }); + checkUOE(() -> { float o = (float) vh.getAndAdd(array, ci, VALUE_1); @@ -700,22 +698,31 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet float value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire float"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease float"); } @@ -840,22 +847,31 @@ public class VarHandleTestByteArrayAsFloat extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet float value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire float"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease float"); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java index 400c20605c5..9e47532c20b 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java @@ -50,7 +50,7 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { static final int VALUE_2 = 0x11121314; - static final int VALUE_3 = 0x21222324; + static final int VALUE_3 = 0xFFFEFDFC; @Override @@ -247,9 +247,7 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { checkROBE(() -> { int o = (int) vh.getAndSet(array, ci, VALUE_1); }); - checkUOE(() -> { - boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); - }); + checkROBE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); @@ -714,22 +712,31 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet int value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire int"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease int"); } @@ -863,22 +870,31 @@ public class VarHandleTestByteArrayAsInt extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet int value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire int"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease int"); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java index a0cabc8653a..f9ed92f0e07 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java @@ -50,7 +50,7 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { static final long VALUE_2 = 0x1112131415161718L; - static final long VALUE_3 = 0x2122232425262728L; + static final long VALUE_3 = 0xFFFEFDFCFBFAF9F8L; @Override @@ -247,9 +247,7 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { checkROBE(() -> { long o = (long) vh.getAndSet(array, ci, VALUE_1); }); - checkUOE(() -> { - boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); - }); + checkROBE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); @@ -714,22 +712,31 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet long value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire long"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease long"); } @@ -863,22 +870,31 @@ public class VarHandleTestByteArrayAsLong extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet long value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire long"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease long"); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java index 2632b00bd23..0a9aa6e871c 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java @@ -50,7 +50,7 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { static final short VALUE_2 = (short)0x1112; - static final short VALUE_3 = (short)0x2122; + static final short VALUE_3 = (short)0xFFFE; @Override @@ -253,6 +253,10 @@ public class VarHandleTestByteArrayAsShort extends VarHandleBaseByteArrayTest { checkROBE(() -> { vh.setOpaque(array, ci, VALUE_1); }); + checkUOE(() -> { + boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); + }); + checkUOE(() -> { short r = (short) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1); }); diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java index 8ccf7983056..00f78a57159 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java @@ -208,31 +208,43 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1, 2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1, 2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, 2, "weakCompareAndSet int value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2, 1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, 1, "weakCompareAndSetAcquire int"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1, 2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1, 2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, 2, "weakCompareAndSetRelease int"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2, 1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetVolatile int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 1, "weakCompareAndSetVolatile int value"); + assertEquals(x, 1, "weakCompareAndSetVolatile int"); } // Compare set and get @@ -349,36 +361,48 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1, 2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1, 2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2, "weakCompareAndSet int value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2, 1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2, 1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 1, "weakCompareAndSetAcquire int"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1, 2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1, 2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2, "weakCompareAndSetRelease int"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2, 1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2, 1); + } + assertEquals(success, true, "weakCompareAndSetVolatile int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 1, "weakCompareAndSetVolatile int value"); + assertEquals(x, 1, "weakCompareAndSetVolatile int"); } // Compare set and get { - int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2); + int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2); assertEquals(o, 1, "getAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2, "getAndSet int value"); @@ -493,31 +517,43 @@ public class VarHandleTestMethodHandleAccessInt extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1, 2); - assertEquals(r, true, "weakCompareAndSet int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1, 2); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2, "weakCompareAndSet int value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2, 1); - assertEquals(r, true, "weakCompareAndSetAcquire int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetAcquire int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 1, "weakCompareAndSetAcquire int"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1, 2); - assertEquals(r, true, "weakCompareAndSetRelease int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1, 2); + } + assertEquals(success, true, "weakCompareAndSetRelease int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2, "weakCompareAndSetRelease int"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2, 1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2, 1); + } + assertEquals(success, true, "weakCompareAndSetVolatile int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 1, "weakCompareAndSetVolatile int value"); + assertEquals(x, 1, "weakCompareAndSetVolatile int"); } // Compare set and get diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java index 65493ec2b49..2bb8b9a1ee8 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java @@ -208,31 +208,43 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1L, 2L); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, 2L, "weakCompareAndSet long value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, 1L, "weakCompareAndSetAcquire long"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1L, 2L); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, 2L, "weakCompareAndSetRelease long"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetVolatile long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 1L, "weakCompareAndSetVolatile long value"); + assertEquals(x, 1L, "weakCompareAndSetVolatile long"); } // Compare set and get @@ -349,36 +361,48 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1L, 2L); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1L, 2L); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2L, "weakCompareAndSet long value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2L, 1L); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 1L, "weakCompareAndSetAcquire long"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1L, 2L); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(1L, 2L); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2L, "weakCompareAndSetRelease long"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2L, 1L); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetVolatile long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 1L, "weakCompareAndSetVolatile long value"); + assertEquals(x, 1L, "weakCompareAndSetVolatile long"); } // Compare set and get { - long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2L); + long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2L); assertEquals(o, 1L, "getAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2L, "getAndSet long value"); @@ -493,31 +517,43 @@ public class VarHandleTestMethodHandleAccessLong extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1L, 2L); - assertEquals(r, true, "weakCompareAndSet long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2L, "weakCompareAndSet long value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetAcquire long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetAcquire long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 1L, "weakCompareAndSetAcquire long"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1L, 2L); - assertEquals(r, true, "weakCompareAndSetRelease long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, 1L, 2L); + } + assertEquals(success, true, "weakCompareAndSetRelease long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2L, "weakCompareAndSetRelease long"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2L, 1L); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2L, 1L); + } + assertEquals(success, true, "weakCompareAndSetVolatile long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 1L, "weakCompareAndSetVolatile long value"); + assertEquals(x, 1L, "weakCompareAndSetVolatile long"); } // Compare set and get diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java index 5ae7c877854..dc6f8ec1861 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java @@ -208,31 +208,43 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSet String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, "bar", "weakCompareAndSet String value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetAcquire String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, "foo", "weakCompareAndSetAcquire String"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSetRelease String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSetRelease String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, "bar", "weakCompareAndSetRelease String"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetVolatile String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetVolatile String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); + assertEquals(x, "foo", "weakCompareAndSetVolatile String"); } // Compare set and get @@ -345,36 +357,48 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar"); - assertEquals(r, true, "weakCompareAndSet String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, "bar", "weakCompareAndSet String value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "foo"); - assertEquals(r, true, "weakCompareAndSetAcquire String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact("bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, "foo", "weakCompareAndSetAcquire String"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact("foo", "bar"); - assertEquals(r, true, "weakCompareAndSetRelease String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact("foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSetRelease String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, "bar", "weakCompareAndSetRelease String"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact("bar", "foo"); - assertEquals(r, true, "weakCompareAndSetVolatile String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact("bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetVolatile String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); + assertEquals(x, "foo", "weakCompareAndSetVolatile String"); } // Compare set and get { - String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact("bar"); + String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact( "bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, "bar", "getAndSet String value"); @@ -485,31 +509,43 @@ public class VarHandleTestMethodHandleAccessString extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSet String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, "bar", "weakCompareAndSet String value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetAcquire String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, "foo", "weakCompareAndSetAcquire String"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, "foo", "bar"); - assertEquals(r, true, "weakCompareAndSetRelease String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, "foo", "bar"); + } + assertEquals(success, true, "weakCompareAndSetRelease String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, "bar", "weakCompareAndSetRelease String"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, "bar", "foo"); - assertEquals(r, true, "weakCompareAndSetVolatile String"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, "bar", "foo"); + } + assertEquals(success, true, "weakCompareAndSetVolatile String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); + assertEquals(x, "foo", "weakCompareAndSetVolatile String"); } // Compare set and get diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java index 75ba7ae3dc2..df680146374 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeBoolean * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeBoolean */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeBoolean::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeBoolean::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeBoolean::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeBoolean::testArrayWrongMethodType, false)); } @@ -329,63 +331,63 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class)). - invoke(null); + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class)). + invokeExact((VarHandleTestMethodTypeBoolean) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeBoolean.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeBoolean.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, boolean.class)). - invoke(null, true); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact((VarHandleTestMethodTypeBoolean) null, true); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, boolean.class)). - invoke(Void.class, true); + invokeExact(Void.class, true); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, boolean.class)). - invoke(0, true); + invokeExact(0, true); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeBoolean.class, boolean.class, Class.class)). - invoke(recv, true, Void.class); + invokeExact(recv, true, Void.class); }); } @@ -513,32 +515,32 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > boolean x = (boolean) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, boolean.class, Class.class)). - invoke(true, Void.class); + invokeExact(true, Void.class); }); } @@ -783,71 +785,71 @@ public class VarHandleTestMethodTypeBoolean extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - boolean x = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class)). - invoke(null, 0); + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class)). + invokeExact((boolean[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, boolean[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class int x = (int) hs.get(am, methodType(int.class, boolean[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, boolean.class)). - invoke(null, 0, true); + hs.get(am, methodType(void.class, boolean[].class, int.class, boolean.class)). + invokeExact((boolean[]) null, 0, true); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, boolean.class)). - invoke(Void.class, 0, true); + invokeExact(Void.class, 0, true); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, boolean[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, boolean.class)). - invoke(0, 0, true); + invokeExact(0, 0, true); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, boolean[].class, Class.class, boolean.class)). - invoke(array, Void.class, true); + invokeExact(array, Void.class, true); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, boolean[].class, int.class, Class.class)). - invoke(array, 0, true, Void.class); + invokeExact(array, 0, true, Void.class); }); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java index b212bfc9d7d..0bfddc7ad27 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeByte * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeByte */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeByte::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeByte::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeByte::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeByte::testArrayWrongMethodType, false)); } @@ -329,63 +331,63 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - byte x = (byte) hs.get(am, methodType(byte.class, Void.class)). - invoke(null); + byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class)). + invokeExact((VarHandleTestMethodTypeByte) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class byte x = (byte) hs.get(am, methodType(byte.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class byte x = (byte) hs.get(am, methodType(byte.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 byte x = (byte) hs.get(am, methodType(byte.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, byte.class)). - invoke(null, (byte)1); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact((VarHandleTestMethodTypeByte) null, (byte)1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, byte.class)). - invoke(Void.class, (byte)1); + invokeExact(Void.class, (byte)1); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, byte.class)). - invoke(0, (byte)1); + invokeExact(0, (byte)1); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeByte.class, byte.class, Class.class)). - invoke(recv, (byte)1, Void.class); + invokeExact(recv, (byte)1, Void.class); }); } @@ -513,32 +515,32 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > byte x = (byte) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, byte.class, Class.class)). - invoke((byte)1, Void.class); + invokeExact((byte)1, Void.class); }); } @@ -783,71 +785,71 @@ public class VarHandleTestMethodTypeByte extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - byte x = (byte) hs.get(am, methodType(byte.class, Void.class, int.class)). - invoke(null, 0); + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class)). + invokeExact((byte[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 byte x = (byte) hs.get(am, methodType(byte.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, byte.class)). - invoke(null, 0, (byte)1); + hs.get(am, methodType(void.class, byte[].class, int.class, byte.class)). + invokeExact((byte[]) null, 0, (byte)1); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, byte.class)). - invoke(Void.class, 0, (byte)1); + invokeExact(Void.class, 0, (byte)1); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, byte.class)). - invoke(0, 0, (byte)1); + invokeExact(0, 0, (byte)1); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, byte[].class, Class.class, byte.class)). - invoke(array, Void.class, (byte)1); + invokeExact(array, Void.class, (byte)1); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, byte[].class, int.class, Class.class)). - invoke(array, 0, (byte)1, Void.class); + invokeExact(array, 0, (byte)1, Void.class); }); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java index 6ac8a0fed70..8d5166d8644 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeChar * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeChar */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeChar::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeChar::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeChar::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeChar::testArrayWrongMethodType, false)); } @@ -329,63 +331,63 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - char x = (char) hs.get(am, methodType(char.class, Void.class)). - invoke(null); + char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class)). + invokeExact((VarHandleTestMethodTypeChar) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class char x = (char) hs.get(am, methodType(char.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class char x = (char) hs.get(am, methodType(char.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeChar.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeChar.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 char x = (char) hs.get(am, methodType(char.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, char.class)). - invoke(null, 'a'); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact((VarHandleTestMethodTypeChar) null, 'a'); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, char.class)). - invoke(Void.class, 'a'); + invokeExact(Void.class, 'a'); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, char.class)). - invoke(0, 'a'); + invokeExact(0, 'a'); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeChar.class, char.class, Class.class)). - invoke(recv, 'a', Void.class); + invokeExact(recv, 'a', Void.class); }); } @@ -513,32 +515,32 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > char x = (char) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, char.class, Class.class)). - invoke('a', Void.class); + invokeExact('a', Void.class); }); } @@ -783,71 +785,71 @@ public class VarHandleTestMethodTypeChar extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - char x = (char) hs.get(am, methodType(char.class, Void.class, int.class)). - invoke(null, 0); + char x = (char) hs.get(am, methodType(char.class, char[].class, int.class)). + invokeExact((char[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class char x = (char) hs.get(am, methodType(char.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class char x = (char) hs.get(am, methodType(char.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class char x = (char) hs.get(am, methodType(char.class, char[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, char[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, char[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 char x = (char) hs.get(am, methodType(char.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, char.class)). - invoke(null, 0, 'a'); + hs.get(am, methodType(void.class, char[].class, int.class, char.class)). + invokeExact((char[]) null, 0, 'a'); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, char.class)). - invoke(Void.class, 0, 'a'); + invokeExact(Void.class, 0, 'a'); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, char[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, char.class)). - invoke(0, 0, 'a'); + invokeExact(0, 0, 'a'); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, char[].class, Class.class, char.class)). - invoke(array, Void.class, 'a'); + invokeExact(array, Void.class, 'a'); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, char[].class, int.class, Class.class)). - invoke(array, 0, 'a', Void.class); + invokeExact(array, 0, 'a', Void.class); }); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java index e5fc073d191..f3531016262 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeDouble * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeDouble */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeDouble::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeDouble::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeDouble::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeDouble::testArrayWrongMethodType, false)); } @@ -329,63 +331,63 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - double x = (double) hs.get(am, methodType(double.class, Void.class)). - invoke(null); + double x = (double) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class)). + invokeExact((VarHandleTestMethodTypeDouble) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class double x = (double) hs.get(am, methodType(double.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class double x = (double) hs.get(am, methodType(double.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeDouble.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeDouble.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 double x = (double) hs.get(am, methodType(double.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > double x = (double) hs.get(am, methodType(double.class, VarHandleTestMethodTypeDouble.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, double.class)). - invoke(null, 1.0d); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, double.class)). + invokeExact((VarHandleTestMethodTypeDouble) null, 1.0d); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, double.class)). - invoke(Void.class, 1.0d); + invokeExact(Void.class, 1.0d); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, double.class)). - invoke(0, 1.0d); + invokeExact(0, 1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeDouble.class, double.class, Class.class)). - invoke(recv, 1.0d, Void.class); + invokeExact(recv, 1.0d, Void.class); }); } @@ -513,32 +515,32 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > double x = (double) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, double.class, Class.class)). - invoke(1.0d, Void.class); + invokeExact(1.0d, Void.class); }); } @@ -783,71 +785,71 @@ public class VarHandleTestMethodTypeDouble extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - double x = (double) hs.get(am, methodType(double.class, Void.class, int.class)). - invoke(null, 0); + double x = (double) hs.get(am, methodType(double.class, double[].class, int.class)). + invokeExact((double[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class double x = (double) hs.get(am, methodType(double.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class double x = (double) hs.get(am, methodType(double.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class double x = (double) hs.get(am, methodType(double.class, double[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, double[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, double[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 double x = (double) hs.get(am, methodType(double.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > double x = (double) hs.get(am, methodType(double.class, double[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, double.class)). - invoke(null, 0, 1.0d); + hs.get(am, methodType(void.class, double[].class, int.class, double.class)). + invokeExact((double[]) null, 0, 1.0d); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, double.class)). - invoke(Void.class, 0, 1.0d); + invokeExact(Void.class, 0, 1.0d); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, double[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, double.class)). - invoke(0, 0, 1.0d); + invokeExact(0, 0, 1.0d); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, double[].class, Class.class, double.class)). - invoke(array, Void.class, 1.0d); + invokeExact(array, Void.class, 1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, double[].class, int.class, Class.class)). - invoke(array, 0, 1.0d, Void.class); + invokeExact(array, 0, 1.0d, Void.class); }); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java index c1bee039b73..b07049d64b0 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeFloat * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeFloat */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeFloat::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeFloat::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeFloat::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeFloat::testArrayWrongMethodType, false)); } @@ -329,63 +331,63 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - float x = (float) hs.get(am, methodType(float.class, Void.class)). - invoke(null); + float x = (float) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class)). + invokeExact((VarHandleTestMethodTypeFloat) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class float x = (float) hs.get(am, methodType(float.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class float x = (float) hs.get(am, methodType(float.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeFloat.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeFloat.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 float x = (float) hs.get(am, methodType(float.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > float x = (float) hs.get(am, methodType(float.class, VarHandleTestMethodTypeFloat.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, float.class)). - invoke(null, 1.0f); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, float.class)). + invokeExact((VarHandleTestMethodTypeFloat) null, 1.0f); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, float.class)). - invoke(Void.class, 1.0f); + invokeExact(Void.class, 1.0f); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, float.class)). - invoke(0, 1.0f); + invokeExact(0, 1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeFloat.class, float.class, Class.class)). - invoke(recv, 1.0f, Void.class); + invokeExact(recv, 1.0f, Void.class); }); } @@ -513,32 +515,32 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > float x = (float) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, float.class, Class.class)). - invoke(1.0f, Void.class); + invokeExact(1.0f, Void.class); }); } @@ -783,71 +785,71 @@ public class VarHandleTestMethodTypeFloat extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - float x = (float) hs.get(am, methodType(float.class, Void.class, int.class)). - invoke(null, 0); + float x = (float) hs.get(am, methodType(float.class, float[].class, int.class)). + invokeExact((float[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class float x = (float) hs.get(am, methodType(float.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class float x = (float) hs.get(am, methodType(float.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class float x = (float) hs.get(am, methodType(float.class, float[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, float[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, float[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 float x = (float) hs.get(am, methodType(float.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > float x = (float) hs.get(am, methodType(float.class, float[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, float.class)). - invoke(null, 0, 1.0f); + hs.get(am, methodType(void.class, float[].class, int.class, float.class)). + invokeExact((float[]) null, 0, 1.0f); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, float.class)). - invoke(Void.class, 0, 1.0f); + invokeExact(Void.class, 0, 1.0f); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, float[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, float.class)). - invoke(0, 0, 1.0f); + invokeExact(0, 0, 1.0f); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, float[].class, Class.class, float.class)). - invoke(array, Void.class, 1.0f); + invokeExact(array, Void.class, 1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, float[].class, int.class, Class.class)). - invoke(array, 0, 1.0f, Void.class); + invokeExact(array, 0, 1.0f, Void.class); }); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java index 13b6b0607b0..67fca94c49a 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeInt * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeInt */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeInt::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeInt::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeInt::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeInt::testArrayWrongMethodType, false)); } @@ -644,211 +646,211 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - int x = (int) hs.get(am, methodType(int.class, Void.class)). - invoke(null); + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class)). + invokeExact((VarHandleTestMethodTypeInt) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class int x = (int) hs.get(am, methodType(int.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class int x = (int) hs.get(am, methodType(int.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, int.class)). - invoke(null, 1); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact((VarHandleTestMethodTypeInt) null, 1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, int.class)). - invoke(Void.class, 1); + invokeExact(Void.class, 1); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class)). - invoke(0, 1); + invokeExact(0, 1); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)). - invoke(recv, 1, Void.class); + invokeExact(recv, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, int.class)). - invoke(null, 1, 1); + boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, int.class)). + invokeExact((VarHandleTestMethodTypeInt) null, 1, 1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, int.class)). - invoke(Void.class, 1, 1); + invokeExact(Void.class, 1, 1); }); checkWMTE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, Class.class, int.class)). - invoke(recv, Void.class, 1); + invokeExact(recv, Void.class, 1); }); checkWMTE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)). - invoke(recv, 1, Void.class); + invokeExact(recv, 1, Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , int.class, int.class)). - invoke(0, 1, 1); + invokeExact(0, 1, 1); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class, int.class, Class.class)). - invoke(recv, 1, 1, Void.class); + invokeExact(recv, 1, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { checkNPE(() -> { // null receiver - int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)). - invoke(null, 1, 1); + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, int.class)). + invokeExact((VarHandleTestMethodTypeInt) null, 1, 1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)). - invoke(Void.class, 1, 1); + invokeExact(Void.class, 1, 1); }); checkWMTE(() -> { // expected reference class int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class, int.class)). - invoke(recv, Void.class, 1); + invokeExact(recv, Void.class, 1); }); checkWMTE(() -> { // actual reference class int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, Class.class)). - invoke(recv, 1, Void.class); + invokeExact(recv, 1, Void.class); }); checkWMTE(() -> { // reciever primitive class int x = (int) hs.get(am, methodType(int.class, int.class , int.class, int.class)). - invoke(0, 1, 1); + invokeExact(0, 1, 1); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class , int.class, int.class)). - invoke(recv, 1, 1); + invokeExact(recv, 1, 1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class , int.class, int.class)). - invoke(recv, 1, 1); + invokeExact(recv, 1, 1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class, int.class, Class.class)). - invoke(recv, 1, 1, Void.class); + invokeExact(recv, 1, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { checkNPE(() -> { // null receiver - int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)). - invoke(null, 1); + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact((VarHandleTestMethodTypeInt) null, 1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)). - invoke(Void.class, 1); + invokeExact(Void.class, 1); }); checkWMTE(() -> { // value reference class int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class int x = (int) hs.get(am, methodType(int.class, int.class, int.class)). - invoke(0, 1); + invokeExact(0, 1); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)). - invoke(recv, 1); + invokeExact(recv, 1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)). - invoke(recv, 1); + invokeExact(recv, 1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). - invoke(recv, 1, Void.class); + invokeExact(recv, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { checkNPE(() -> { // null receiver - int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)). - invoke(null, 1); + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact((VarHandleTestMethodTypeInt) null, 1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)). - invoke(Void.class, 1); + invokeExact(Void.class, 1); }); checkWMTE(() -> { // value reference class int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class int x = (int) hs.get(am, methodType(int.class, int.class, int.class)). - invoke(0, 1); + invokeExact(0, 1); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)). - invoke(recv, 1); + invokeExact(recv, 1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)). - invoke(recv, 1); + invokeExact(recv, 1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). - invoke(recv, 1, Void.class); + invokeExact(recv, 1, Void.class); }); } } @@ -1190,52 +1192,52 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, int.class, Class.class)). - invoke(1, Void.class); + invokeExact(1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class)). - invoke(Void.class, 1); + invokeExact(Void.class, 1); }); checkWMTE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, Class.class)). - invoke(1, Void.class); + invokeExact(1, Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, Class.class)). - invoke(1, 1, Void.class); + invokeExact(1, 1, Void.class); }); } @@ -1243,29 +1245,29 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { // Incorrect argument types checkWMTE(() -> { // expected reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)). - invoke(Void.class, 1); + invokeExact(Void.class, 1); }); checkWMTE(() -> { // actual reference class int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)). - invoke(1, Void.class); + invokeExact(1, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, int.class, int.class)). - invoke(1, 1); + invokeExact(1, 1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class)). - invoke(1, 1); + invokeExact(1, 1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, int.class, int.class, Class.class)). - invoke(1, 1, Void.class); + invokeExact(1, 1, Void.class); }); } @@ -1273,25 +1275,25 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { // Incorrect argument types checkWMTE(() -> { // value reference class int x = (int) hs.get(am, methodType(int.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, int.class)). - invoke(1); + invokeExact(1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)). - invoke(1); + invokeExact(1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)). - invoke(1, Void.class); + invokeExact(1, Void.class); }); } @@ -1299,25 +1301,25 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { // Incorrect argument types checkWMTE(() -> { // value reference class int x = (int) hs.get(am, methodType(int.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, int.class)). - invoke(1); + invokeExact(1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)). - invoke(1); + invokeExact(1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)). - invoke(1, Void.class); + invokeExact(1, Void.class); }); } } @@ -1909,237 +1911,237 @@ public class VarHandleTestMethodTypeInt extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - int x = (int) hs.get(am, methodType(int.class, Void.class, int.class)). - invoke(null, 0); + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class)). + invokeExact((int[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class int x = (int) hs.get(am, methodType(int.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, int[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, int.class)). - invoke(null, 0, 1); + hs.get(am, methodType(void.class, int[].class, int.class, int.class)). + invokeExact((int[]) null, 0, 1); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, int.class)). - invoke(Void.class, 0, 1); + invokeExact(Void.class, 0, 1); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, int[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, int.class)). - invoke(0, 0, 1); + invokeExact(0, 0, 1); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, int[].class, Class.class, int.class)). - invoke(array, Void.class, 1); + invokeExact(array, Void.class, 1); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, int[].class, int.class, Class.class)). - invoke(array, 0, 1, Void.class); + invokeExact(array, 0, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, int.class, int.class)). - invoke(null, 0, 1, 1); + boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class)). + invokeExact((int[]) null, 0, 1, 1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, int.class, int.class)). - invoke(Void.class, 0, 1, 1); + invokeExact(Void.class, 0, 1, 1); }); checkWMTE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, Class.class, int.class)). - invoke(array, 0, Void.class, 1); + invokeExact(array, 0, Void.class, 1); }); checkWMTE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, Class.class)). - invoke(array, 0, 1, Void.class); + invokeExact(array, 0, 1, Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, int.class, int.class)). - invoke(0, 0, 1, 1); + invokeExact(0, 0, 1, 1); }); checkWMTE(() -> { // index reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, Class.class, int.class, int.class)). - invoke(array, Void.class, 1, 1); + invokeExact(array, Void.class, 1, 1); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class, Class.class)). - invoke(array, 0, 1, 1, Void.class); + invokeExact(array, 0, 1, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { // Incorrect argument types checkNPE(() -> { // null receiver - int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class, int.class)). - invoke(null, 0, 1, 1); + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, int.class)). + invokeExact((int[]) null, 0, 1, 1); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class, int.class)). - invoke(Void.class, 0, 1, 1); + invokeExact(Void.class, 0, 1, 1); }); checkWMTE(() -> { // expected reference class int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class, int.class)). - invoke(array, 0, Void.class, 1); + invokeExact(array, 0, Void.class, 1); }); checkWMTE(() -> { // actual reference class int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)). - invoke(array, 0, 1, Void.class); + invokeExact(array, 0, 1, Void.class); }); checkWMTE(() -> { // array primitive class int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class, int.class)). - invoke(0, 0, 1, 1); + invokeExact(0, 0, 1, 1); }); checkWMTE(() -> { // index reference class int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class, int.class)). - invoke(array, Void.class, 1, 1); + invokeExact(array, Void.class, 1, 1); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class, int.class)). - invoke(array, 0, 1, 1); + invokeExact(array, 0, 1, 1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class, int.class)). - invoke(array, 0, 1, 1); + invokeExact(array, 0, 1, 1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, int.class, Class.class)). - invoke(array, 0, 1, 1, Void.class); + invokeExact(array, 0, 1, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null array - int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)). - invoke(null, 0, 1); + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)). + invokeExact((int[]) null, 0, 1); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)). - invoke(Void.class, 0, 1); + invokeExact(Void.class, 0, 1); }); checkWMTE(() -> { // value reference class int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)). - invoke(0, 0, 1); + invokeExact(0, 0, 1); }); checkWMTE(() -> { // index reference class int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)). - invoke(array, Void.class, 1); + invokeExact(array, Void.class, 1); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)). - invoke(array, 0, 1); + invokeExact(array, 0, 1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)). - invoke(array, 0, 1); + invokeExact(array, 0, 1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)). - invoke(array, 0, 1, Void.class); + invokeExact(array, 0, 1, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { // Incorrect argument types checkNPE(() -> { // null array - int x = (int) hs.get(am, methodType(int.class, Void.class, int.class, int.class)). - invoke(null, 0, 1); + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)). + invokeExact((int[]) null, 0, 1); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)). - invoke(Void.class, 0, 1); + invokeExact(Void.class, 0, 1); }); checkWMTE(() -> { // value reference class int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)). - invoke(0, 0, 1); + invokeExact(0, 0, 1); }); checkWMTE(() -> { // index reference class int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)). - invoke(array, Void.class, 1); + invokeExact(array, Void.class, 1); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)). - invoke(array, 0, 1); + invokeExact(array, 0, 1); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)). - invoke(array, 0, 1); + invokeExact(array, 0, 1); }); // Incorrect arity checkWMTE(() -> { // 0 int x = (int) hs.get(am, methodType(int.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)). - invoke(array, 0, 1, Void.class); + invokeExact(array, 0, 1, Void.class); }); } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java index 44151683133..0972e663cc7 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeLong * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeLong */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeLong::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeLong::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeLong::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeLong::testArrayWrongMethodType, false)); } @@ -644,211 +646,211 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - long x = (long) hs.get(am, methodType(long.class, Void.class)). - invoke(null); + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class)). + invokeExact((VarHandleTestMethodTypeLong) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class long x = (long) hs.get(am, methodType(long.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class long x = (long) hs.get(am, methodType(long.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, long.class)). - invoke(null, 1L); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact((VarHandleTestMethodTypeLong) null, 1L); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, long.class)). - invoke(Void.class, 1L); + invokeExact(Void.class, 1L); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, long.class)). - invoke(0, 1L); + invokeExact(0, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)). - invoke(recv, 1L, Void.class); + invokeExact(recv, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, long.class, long.class)). - invoke(null, 1L, 1L); + boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, long.class)). + invokeExact((VarHandleTestMethodTypeLong) null, 1L, 1L); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, long.class, long.class)). - invoke(Void.class, 1L, 1L); + invokeExact(Void.class, 1L, 1L); }); checkWMTE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, Class.class, long.class)). - invoke(recv, Void.class, 1L); + invokeExact(recv, Void.class, 1L); }); checkWMTE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)). - invoke(recv, 1L, Void.class); + invokeExact(recv, 1L, Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , long.class, long.class)). - invoke(0, 1L, 1L); + invokeExact(0, 1L, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class, long.class, Class.class)). - invoke(recv, 1L, 1L, Void.class); + invokeExact(recv, 1L, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { checkNPE(() -> { // null receiver - long x = (long) hs.get(am, methodType(long.class, Void.class, long.class, long.class)). - invoke(null, 1L, 1L); + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, long.class)). + invokeExact((VarHandleTestMethodTypeLong) null, 1L, 1L); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class long x = (long) hs.get(am, methodType(long.class, Class.class, long.class, long.class)). - invoke(Void.class, 1L, 1L); + invokeExact(Void.class, 1L, 1L); }); checkWMTE(() -> { // expected reference class long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class, long.class)). - invoke(recv, Void.class, 1L); + invokeExact(recv, Void.class, 1L); }); checkWMTE(() -> { // actual reference class long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, Class.class)). - invoke(recv, 1L, Void.class); + invokeExact(recv, 1L, Void.class); }); checkWMTE(() -> { // reciever primitive class long x = (long) hs.get(am, methodType(long.class, int.class , long.class, long.class)). - invoke(0, 1L, 1L); + invokeExact(0, 1L, 1L); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class , long.class, long.class)). - invoke(recv, 1L, 1L); + invokeExact(recv, 1L, 1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class , long.class, long.class)). - invoke(recv, 1L, 1L); + invokeExact(recv, 1L, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class, long.class, Class.class)). - invoke(recv, 1L, 1L, Void.class); + invokeExact(recv, 1L, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { checkNPE(() -> { // null receiver - long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)). - invoke(null, 1L); + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact((VarHandleTestMethodTypeLong) null, 1L); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)). - invoke(Void.class, 1L); + invokeExact(Void.class, 1L); }); checkWMTE(() -> { // value reference class long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class long x = (long) hs.get(am, methodType(long.class, int.class, long.class)). - invoke(0, 1L); + invokeExact(0, 1L); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)). - invoke(recv, 1L); + invokeExact(recv, 1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)). - invoke(recv, 1L); + invokeExact(recv, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). - invoke(recv, 1L, Void.class); + invokeExact(recv, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { checkNPE(() -> { // null receiver - long x = (long) hs.get(am, methodType(long.class, Void.class, long.class)). - invoke(null, 1L); + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact((VarHandleTestMethodTypeLong) null, 1L); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)). - invoke(Void.class, 1L); + invokeExact(Void.class, 1L); }); checkWMTE(() -> { // value reference class long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class long x = (long) hs.get(am, methodType(long.class, int.class, long.class)). - invoke(0, 1L); + invokeExact(0, 1L); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)). - invoke(recv, 1L); + invokeExact(recv, 1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)). - invoke(recv, 1L); + invokeExact(recv, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). - invoke(recv, 1L, Void.class); + invokeExact(recv, 1L, Void.class); }); } } @@ -1190,52 +1192,52 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, long.class, Class.class)). - invoke(1L, Void.class); + invokeExact(1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkWMTE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, long.class)). - invoke(Void.class, 1L); + invokeExact(Void.class, 1L); }); checkWMTE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, long.class, Class.class)). - invoke(1L, Void.class); + invokeExact(1L, Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, long.class, long.class, Class.class)). - invoke(1L, 1L, Void.class); + invokeExact(1L, 1L, Void.class); }); } @@ -1243,29 +1245,29 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { // Incorrect argument types checkWMTE(() -> { // expected reference class long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)). - invoke(Void.class, 1L); + invokeExact(Void.class, 1L); }); checkWMTE(() -> { // actual reference class long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)). - invoke(1L, Void.class); + invokeExact(1L, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, long.class, long.class)). - invoke(1L, 1L); + invokeExact(1L, 1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class, long.class)). - invoke(1L, 1L); + invokeExact(1L, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, long.class, long.class, Class.class)). - invoke(1L, 1L, Void.class); + invokeExact(1L, 1L, Void.class); }); } @@ -1273,25 +1275,25 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { // Incorrect argument types checkWMTE(() -> { // value reference class long x = (long) hs.get(am, methodType(long.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, long.class)). - invoke(1L); + invokeExact(1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)). - invoke(1L); + invokeExact(1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)). - invoke(1L, Void.class); + invokeExact(1L, Void.class); }); } @@ -1299,25 +1301,25 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { // Incorrect argument types checkWMTE(() -> { // value reference class long x = (long) hs.get(am, methodType(long.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, long.class)). - invoke(1L); + invokeExact(1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)). - invoke(1L); + invokeExact(1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)). - invoke(1L, Void.class); + invokeExact(1L, Void.class); }); } } @@ -1909,237 +1911,237 @@ public class VarHandleTestMethodTypeLong extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - long x = (long) hs.get(am, methodType(long.class, Void.class, int.class)). - invoke(null, 0); + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class)). + invokeExact((long[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class long x = (long) hs.get(am, methodType(long.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class long x = (long) hs.get(am, methodType(long.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, long[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, long.class)). - invoke(null, 0, 1L); + hs.get(am, methodType(void.class, long[].class, int.class, long.class)). + invokeExact((long[]) null, 0, 1L); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, long.class)). - invoke(Void.class, 0, 1L); + invokeExact(Void.class, 0, 1L); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, long[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, long.class)). - invoke(0, 0, 1L); + invokeExact(0, 0, 1L); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, long[].class, Class.class, long.class)). - invoke(array, Void.class, 1L); + invokeExact(array, Void.class, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, long[].class, int.class, Class.class)). - invoke(array, 0, 1L, Void.class); + invokeExact(array, 0, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, long.class, long.class)). - invoke(null, 0, 1L, 1L); + boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class)). + invokeExact((long[]) null, 0, 1L, 1L); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, long.class, long.class)). - invoke(Void.class, 0, 1L, 1L); + invokeExact(Void.class, 0, 1L, 1L); }); checkWMTE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, Class.class, long.class)). - invoke(array, 0, Void.class, 1L); + invokeExact(array, 0, Void.class, 1L); }); checkWMTE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, Class.class)). - invoke(array, 0, 1L, Void.class); + invokeExact(array, 0, 1L, Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, long.class, long.class)). - invoke(0, 0, 1L, 1L); + invokeExact(0, 0, 1L, 1L); }); checkWMTE(() -> { // index reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, Class.class, long.class, long.class)). - invoke(array, Void.class, 1L, 1L); + invokeExact(array, Void.class, 1L, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class, Class.class)). - invoke(array, 0, 1L, 1L, Void.class); + invokeExact(array, 0, 1L, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { // Incorrect argument types checkNPE(() -> { // null receiver - long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class, long.class)). - invoke(null, 0, 1L, 1L); + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, long.class)). + invokeExact((long[]) null, 0, 1L, 1L); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class, long.class)). - invoke(Void.class, 0, 1L, 1L); + invokeExact(Void.class, 0, 1L, 1L); }); checkWMTE(() -> { // expected reference class long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class, long.class)). - invoke(array, 0, Void.class, 1L); + invokeExact(array, 0, Void.class, 1L); }); checkWMTE(() -> { // actual reference class long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)). - invoke(array, 0, 1L, Void.class); + invokeExact(array, 0, 1L, Void.class); }); checkWMTE(() -> { // array primitive class long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class, long.class)). - invoke(0, 0, 1L, 1L); + invokeExact(0, 0, 1L, 1L); }); checkWMTE(() -> { // index reference class long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class, long.class)). - invoke(array, Void.class, 1L, 1L); + invokeExact(array, Void.class, 1L, 1L); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class, long.class)). - invoke(array, 0, 1L, 1L); + invokeExact(array, 0, 1L, 1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class, long.class)). - invoke(array, 0, 1L, 1L); + invokeExact(array, 0, 1L, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, long.class, Class.class)). - invoke(array, 0, 1L, 1L, Void.class); + invokeExact(array, 0, 1L, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null array - long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)). - invoke(null, 0, 1L); + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)). + invokeExact((long[]) null, 0, 1L); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)). - invoke(Void.class, 0, 1L); + invokeExact(Void.class, 0, 1L); }); checkWMTE(() -> { // value reference class long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)). - invoke(0, 0, 1L); + invokeExact(0, 0, 1L); }); checkWMTE(() -> { // index reference class long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)). - invoke(array, Void.class, 1L); + invokeExact(array, Void.class, 1L); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)). - invoke(array, 0, 1L); + invokeExact(array, 0, 1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)). - invoke(array, 0, 1L); + invokeExact(array, 0, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)). - invoke(array, 0, 1L, Void.class); + invokeExact(array, 0, 1L, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { // Incorrect argument types checkNPE(() -> { // null array - long x = (long) hs.get(am, methodType(long.class, Void.class, int.class, long.class)). - invoke(null, 0, 1L); + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)). + invokeExact((long[]) null, 0, 1L); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)). - invoke(Void.class, 0, 1L); + invokeExact(Void.class, 0, 1L); }); checkWMTE(() -> { // value reference class long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)). - invoke(0, 0, 1L); + invokeExact(0, 0, 1L); }); checkWMTE(() -> { // index reference class long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)). - invoke(array, Void.class, 1L); + invokeExact(array, Void.class, 1L); }); // Incorrect return type checkWMTE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)). - invoke(array, 0, 1L); + invokeExact(array, 0, 1L); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)). - invoke(array, 0, 1L); + invokeExact(array, 0, 1L); }); // Incorrect arity checkWMTE(() -> { // 0 long x = (long) hs.get(am, methodType(long.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)). - invoke(array, 0, 1L, Void.class); + invokeExact(array, 0, 1L, Void.class); }); } } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java index 634646e78c1..16efabe0917 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeShort * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeShort */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeShort::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeShort::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeShort::testArrayWrongMethodType, false)); } @@ -329,63 +331,63 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - short x = (short) hs.get(am, methodType(short.class, Void.class)). - invoke(null); + short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class)). + invokeExact((VarHandleTestMethodTypeShort) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class short x = (short) hs.get(am, methodType(short.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class short x = (short) hs.get(am, methodType(short.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type checkWMTE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class)). - invoke(recv); + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 short x = (short) hs.get(am, methodType(short.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, short.class)). - invoke(null, (short)1); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact((VarHandleTestMethodTypeShort) null, (short)1); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, short.class)). - invoke(Void.class, (short)1); + invokeExact(Void.class, (short)1); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, short.class)). - invoke(0, (short)1); + invokeExact(0, (short)1); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeShort.class, short.class, Class.class)). - invoke(recv, (short)1, Void.class); + invokeExact(recv, (short)1, Void.class); }); } @@ -513,32 +515,32 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > short x = (short) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, short.class, Class.class)). - invoke((short)1, Void.class); + invokeExact((short)1, Void.class); }); } @@ -783,71 +785,71 @@ public class VarHandleTestMethodTypeShort extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - short x = (short) hs.get(am, methodType(short.class, Void.class, int.class)). - invoke(null, 0); + short x = (short) hs.get(am, methodType(short.class, short[].class, int.class)). + invokeExact((short[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class short x = (short) hs.get(am, methodType(short.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class short x = (short) hs.get(am, methodType(short.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, short[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 short x = (short) hs.get(am, methodType(short.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, short.class)). - invoke(null, 0, (short)1); + hs.get(am, methodType(void.class, short[].class, int.class, short.class)). + invokeExact((short[]) null, 0, (short)1); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, short.class)). - invoke(Void.class, 0, (short)1); + invokeExact(Void.class, 0, (short)1); }); checkWMTE(() -> { // value reference class hs.get(am, methodType(void.class, short[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, short.class)). - invoke(0, 0, (short)1); + invokeExact(0, 0, (short)1); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, short[].class, Class.class, short.class)). - invoke(array, Void.class, (short)1); + invokeExact(array, Void.class, (short)1); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, short[].class, int.class, Class.class)). - invoke(array, 0, (short)1, Void.class); + invokeExact(array, 0, (short)1, Void.class); }); } diff --git a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java index f3b58c9e2f9..2cc853349ce 100644 --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodTypeString * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodTypeString */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodTypeString::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodTypeString::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodTypeString::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodTypeString::testArrayWrongMethodType, false)); } @@ -586,174 +588,174 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - String x = (String) hs.get(am, methodType(String.class, Void.class)). - invoke(null); + String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class)). + invokeExact((VarHandleTestMethodTypeString) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class String x = (String) hs.get(am, methodType(String.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class String x = (String) hs.get(am, methodType(String.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type - checkCCE(() -> { // reference class - Void x = (Void) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class)). - invoke(recv); + hs.checkWMTEOrCCE(() -> { // reference class + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, String.class)). - invoke(null, "foo"); + hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, String.class)). + invokeExact((VarHandleTestMethodTypeString) null, "foo"); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, String.class)). - invoke(Void.class, "foo"); + invokeExact(Void.class, "foo"); }); - checkCCE(() -> { // value reference class + hs.checkWMTEOrCCE(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, String.class)). - invoke(0, "foo"); + invokeExact(0, "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodTypeString.class, String.class, Class.class)). - invoke(recv, "foo", Void.class); + invokeExact(recv, "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, String.class, String.class)). - invoke(null, "foo", "foo"); + boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, String.class)). + invokeExact((VarHandleTestMethodTypeString) null, "foo", "foo"); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class, String.class)). - invoke(Void.class, "foo", "foo"); + invokeExact(Void.class, "foo", "foo"); }); - checkCCE(() -> { // expected reference class + hs.checkWMTEOrCCE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, Class.class, String.class)). - invoke(recv, Void.class, "foo"); + invokeExact(recv, Void.class, "foo"); }); - checkCCE(() -> { // actual reference class + hs.checkWMTEOrCCE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, Class.class)). - invoke(recv, "foo", Void.class); + invokeExact(recv, "foo", Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , String.class, String.class)). - invoke(0, "foo", "foo"); + invokeExact(0, "foo", "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class, String.class, Class.class)). - invoke(recv, "foo", "foo", Void.class); + invokeExact(recv, "foo", "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { checkNPE(() -> { // null receiver - String x = (String) hs.get(am, methodType(String.class, Void.class, String.class, String.class)). - invoke(null, "foo", "foo"); + String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, String.class)). + invokeExact((VarHandleTestMethodTypeString) null, "foo", "foo"); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class String x = (String) hs.get(am, methodType(String.class, Class.class, String.class, String.class)). - invoke(Void.class, "foo", "foo"); + invokeExact(Void.class, "foo", "foo"); }); - checkCCE(() -> { // expected reference class + hs.checkWMTEOrCCE(() -> { // expected reference class String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class, String.class)). - invoke(recv, Void.class, "foo"); + invokeExact(recv, Void.class, "foo"); }); - checkCCE(() -> { // actual reference class + hs.checkWMTEOrCCE(() -> { // actual reference class String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, Class.class)). - invoke(recv, "foo", Void.class); + invokeExact(recv, "foo", Void.class); }); checkWMTE(() -> { // reciever primitive class String x = (String) hs.get(am, methodType(String.class, int.class , String.class, String.class)). - invoke(0, "foo", "foo"); + invokeExact(0, "foo", "foo"); }); // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class , String.class, String.class)). - invoke(recv, "foo", "foo"); + invokeExact(recv, "foo", "foo"); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class , String.class, String.class)). - invoke(recv, "foo", "foo"); + invokeExact(recv, "foo", "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class, String.class, Class.class)). - invoke(recv, "foo", "foo", Void.class); + invokeExact(recv, "foo", "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { checkNPE(() -> { // null receiver - String x = (String) hs.get(am, methodType(String.class, Void.class, String.class)). - invoke(null, "foo"); + String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class)). + invokeExact((VarHandleTestMethodTypeString) null, "foo"); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)). - invoke(Void.class, "foo"); + invokeExact(Void.class, "foo"); }); - checkCCE(() -> { // value reference class + hs.checkWMTEOrCCE(() -> { // value reference class String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class String x = (String) hs.get(am, methodType(String.class, int.class, String.class)). - invoke(0, "foo"); + invokeExact(0, "foo"); }); // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeString.class, String.class)). - invoke(recv, "foo"); + invokeExact(recv, "foo"); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeString.class, String.class)). - invoke(recv, "foo"); + invokeExact(recv, "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, VarHandleTestMethodTypeString.class, String.class)). - invoke(recv, "foo", Void.class); + invokeExact(recv, "foo", Void.class); }); } @@ -1054,110 +1056,110 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { - checkCCE(() -> { // value reference class + hs.checkWMTEOrCCE(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, String.class, Class.class)). - invoke("foo", Void.class); + invokeExact("foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types - checkCCE(() -> { // expected reference class + hs.checkWMTEOrCCE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, String.class)). - invoke(Void.class, "foo"); + invokeExact(Void.class, "foo"); }); - checkCCE(() -> { // actual reference class + hs.checkWMTEOrCCE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, String.class, Class.class)). - invoke("foo", Void.class); + invokeExact("foo", Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, String.class, String.class, Class.class)). - invoke("foo", "foo", Void.class); + invokeExact("foo", "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { // Incorrect argument types - checkCCE(() -> { // expected reference class + hs.checkWMTEOrCCE(() -> { // expected reference class String x = (String) hs.get(am, methodType(String.class, Class.class, String.class)). - invoke(Void.class, "foo"); + invokeExact(Void.class, "foo"); }); - checkCCE(() -> { // actual reference class + hs.checkWMTEOrCCE(() -> { // actual reference class String x = (String) hs.get(am, methodType(String.class, String.class, Class.class)). - invoke("foo", Void.class); + invokeExact("foo", Void.class); }); // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, String.class, String.class)). - invoke("foo", "foo"); + invokeExact("foo", "foo"); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, String.class, String.class)). - invoke("foo", "foo"); + invokeExact("foo", "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, String.class, String.class, Class.class)). - invoke("foo", "foo", Void.class); + invokeExact("foo", "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { // Incorrect argument types - checkCCE(() -> { // value reference class + hs.checkWMTEOrCCE(() -> { // value reference class String x = (String) hs.get(am, methodType(String.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, String.class)). - invoke("foo"); + invokeExact("foo"); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, String.class)). - invoke("foo"); + invokeExact("foo"); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, String.class, Class.class)). - invoke("foo", Void.class); + invokeExact("foo", Void.class); }); } @@ -1686,195 +1688,195 @@ public class VarHandleTestMethodTypeString extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - String x = (String) hs.get(am, methodType(String.class, Void.class, int.class)). - invoke(null, 0); + String x = (String) hs.get(am, methodType(String.class, String[].class, int.class)). + invokeExact((String[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class String x = (String) hs.get(am, methodType(String.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class String x = (String) hs.get(am, methodType(String.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, String[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, String.class)). - invoke(null, 0, "foo"); + hs.get(am, methodType(void.class, String[].class, int.class, String.class)). + invokeExact((String[]) null, 0, "foo"); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, String.class)). - invoke(Void.class, 0, "foo"); + invokeExact(Void.class, 0, "foo"); }); - checkCCE(() -> { // value reference class + hs.checkWMTEOrCCE(() -> { // value reference class hs.get(am, methodType(void.class, String[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, String.class)). - invoke(0, 0, "foo"); + invokeExact(0, 0, "foo"); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, String[].class, Class.class, String.class)). - invoke(array, Void.class, "foo"); + invokeExact(array, Void.class, "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, String[].class, int.class, Class.class)). - invoke(array, 0, "foo", Void.class); + invokeExact(array, 0, "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, String.class, String.class)). - invoke(null, 0, "foo", "foo"); + boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class)). + invokeExact((String[]) null, 0, "foo", "foo"); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, String.class, String.class)). - invoke(Void.class, 0, "foo", "foo"); + invokeExact(Void.class, 0, "foo", "foo"); }); - checkCCE(() -> { // expected reference class + hs.checkWMTEOrCCE(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, Class.class, String.class)). - invoke(array, 0, Void.class, "foo"); + invokeExact(array, 0, Void.class, "foo"); }); - checkCCE(() -> { // actual reference class + hs.checkWMTEOrCCE(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, Class.class)). - invoke(array, 0, "foo", Void.class); + invokeExact(array, 0, "foo", Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, String.class, String.class)). - invoke(0, 0, "foo", "foo"); + invokeExact(0, 0, "foo", "foo"); }); checkWMTE(() -> { // index reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, Class.class, String.class, String.class)). - invoke(array, Void.class, "foo", "foo"); + invokeExact(array, Void.class, "foo", "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class, Class.class)). - invoke(array, 0, "foo", "foo", Void.class); + invokeExact(array, 0, "foo", "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { // Incorrect argument types checkNPE(() -> { // null receiver - String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class, String.class)). - invoke(null, 0, "foo", "foo"); + String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, String.class)). + invokeExact((String[]) null, 0, "foo", "foo"); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class String x = (String) hs.get(am, methodType(String.class, Class.class, int.class, String.class, String.class)). - invoke(Void.class, 0, "foo", "foo"); + invokeExact(Void.class, 0, "foo", "foo"); }); - checkCCE(() -> { // expected reference class + hs.checkWMTEOrCCE(() -> { // expected reference class String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class, String.class)). - invoke(array, 0, Void.class, "foo"); + invokeExact(array, 0, Void.class, "foo"); }); - checkCCE(() -> { // actual reference class + hs.checkWMTEOrCCE(() -> { // actual reference class String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, Class.class)). - invoke(array, 0, "foo", Void.class); + invokeExact(array, 0, "foo", Void.class); }); checkWMTE(() -> { // array primitive class String x = (String) hs.get(am, methodType(String.class, int.class, int.class, String.class, String.class)). - invoke(0, 0, "foo", "foo"); + invokeExact(0, 0, "foo", "foo"); }); checkWMTE(() -> { // index reference class String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class, String.class, String.class)). - invoke(array, Void.class, "foo", "foo"); + invokeExact(array, Void.class, "foo", "foo"); }); // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, String[].class, int.class, String.class, String.class)). - invoke(array, 0, "foo", "foo"); + invokeExact(array, 0, "foo", "foo"); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class, String.class)). - invoke(array, 0, "foo", "foo"); + invokeExact(array, 0, "foo", "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, String.class, Class.class)). - invoke(array, 0, "foo", "foo", Void.class); + invokeExact(array, 0, "foo", "foo", Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null array - String x = (String) hs.get(am, methodType(String.class, Void.class, int.class, String.class)). - invoke(null, 0, "foo"); + String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class)). + invokeExact((String[]) null, 0, "foo"); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class String x = (String) hs.get(am, methodType(String.class, Class.class, int.class, String.class)). - invoke(Void.class, 0, "foo"); + invokeExact(Void.class, 0, "foo"); }); - checkCCE(() -> { // value reference class + hs.checkWMTEOrCCE(() -> { // value reference class String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class String x = (String) hs.get(am, methodType(String.class, int.class, int.class, String.class)). - invoke(0, 0, "foo"); + invokeExact(0, 0, "foo"); }); checkWMTE(() -> { // index reference class String x = (String) hs.get(am, methodType(String.class, String[].class, Class.class, String.class)). - invoke(array, Void.class, "foo"); + invokeExact(array, Void.class, "foo"); }); // Incorrect return type - checkCCE(() -> { // reference class + hs.checkWMTEOrCCE(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, String[].class, int.class, String.class)). - invoke(array, 0, "foo"); + invokeExact(array, 0, "foo"); }); checkWMTE(() -> { // primitive class boolean x = (boolean) hs.get(am, methodType(boolean.class, String[].class, int.class, String.class)). - invoke(array, 0, "foo"); + invokeExact(array, 0, "foo"); }); // Incorrect arity checkWMTE(() -> { // 0 String x = (String) hs.get(am, methodType(String.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > String x = (String) hs.get(am, methodType(String.class, String[].class, int.class, String.class, Class.class)). - invoke(array, 0, "foo", Void.class); + invokeExact(array, 0, "foo", Void.class); }); } diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template index 391dc1a5197..5dfd82f6cd7 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template @@ -309,6 +309,10 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSet(recv, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -399,6 +403,10 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { boolean r = vh.weakCompareAndSetRelease($value1$, $value2$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSet($value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -504,29 +512,41 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(recv, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(recv); assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); } { - boolean r = vh.weakCompareAndSetAcquire(recv, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(recv, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(recv); assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$"); } { - boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(recv, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(recv); assertEquals(x, $value2$, "weakCompareAndSetRelease $type$"); } { - boolean r = vh.weakCompareAndSetVolatile(recv, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(recv, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetVolatile $type$"); $type$ x = ($type$) vh.get(recv); assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); } @@ -586,6 +606,10 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { boolean r = vh.weakCompareAndSetRelease(recv, $value1$, $value2$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSet(recv, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -691,36 +715,48 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { } { - boolean r = (boolean) vh.weakCompareAndSet($value1$, $value2$); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet($value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(); assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); } { - boolean r = (boolean) vh.weakCompareAndSetAcquire($value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire($value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(); assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$"); } { - boolean r = (boolean) vh.weakCompareAndSetRelease($value1$, $value2$); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease($value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(); assertEquals(x, $value2$, "weakCompareAndSetRelease $type$"); } { - boolean r = (boolean) vh.weakCompareAndSetVolatile($value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease($value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetVolatile $type$"); $type$ x = ($type$) vh.get(); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); } // Compare set and get { - $type$ o = ($type$) vh.getAndSet( $value2$); + $type$ o = ($type$) vh.getAndSet($value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) vh.get(); assertEquals(x, $value2$, "getAndSet $type$ value"); @@ -773,6 +809,10 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { boolean r = vh.weakCompareAndSetRelease($value1$, $value2$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSet($value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -881,31 +921,43 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { } { - boolean r = vh.weakCompareAndSet(array, i, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, $value2$, "weakCompareAndSetRelease $type$"); } { - boolean r = vh.weakCompareAndSetVolatile(array, i, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetVolatile(array, i, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetVolatile $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); } // Compare set and get @@ -967,6 +1019,10 @@ public class VarHandleTestAccess$Type$ extends VarHandleBaseTest { checkUOE(() -> { boolean r = vh.weakCompareAndSetRelease(array, i, $value1$, $value2$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSet(array, i, $value1$); + }); #end[CAS] #if[!AtomicAdd] diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template index e433789f8cd..615bb528e06 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template @@ -311,10 +311,12 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { checkROBE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + +#else[CAS] checkUOE(() -> { boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); }); -#else[CAS] + checkUOE(() -> { $type$ r = ($type$) vh.compareAndExchangeVolatile(array, ci, VALUE_2, VALUE_1); }); @@ -884,22 +886,31 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire $type$"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease $type$"); } @@ -1037,22 +1048,31 @@ public class VarHandleTestByteArrayAs$Type$ extends VarHandleBaseByteArrayTest { } { - boolean r = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value"); } { - boolean r = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetAcquire(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_1, "weakCompareAndSetAcquire $type$"); } { - boolean r = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSetRelease(array, i, VALUE_1, VALUE_2); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "weakCompareAndSetRelease $type$"); } diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template index f56d9a641a7..e4bd78e8f45 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template @@ -209,31 +209,43 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(recv, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(recv, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); assertEquals(x, $value2$, "weakCompareAndSetRelease $type$"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetVolatile $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); } // Compare set and get @@ -380,36 +392,48 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact($value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact($value1$, $value2$); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact($value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, $value2$, "weakCompareAndSetRelease $type$"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact($value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact($value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetVolatile $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); } // Compare set and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact($value2$); + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact( $value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, $value2$, "getAndSet $type$ value"); @@ -554,31 +578,43 @@ public class VarHandleTestMethodHandleAccess$Type$ extends VarHandleBaseTest { } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSet $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetAcquire $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_ACQUIRE).invokeExact(array, i, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetAcquire $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, $value1$, $value2$); - assertEquals(r, true, "weakCompareAndSetRelease $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_RELEASE).invokeExact(array, i, $value1$, $value2$); + } + assertEquals(success, true, "weakCompareAndSetRelease $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, $value2$, "weakCompareAndSetRelease $type$"); } { - boolean r = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, $value2$, $value1$); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, $value2$, $value1$); + } + assertEquals(success, true, "weakCompareAndSetVolatile $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); } // Compare set and get diff --git a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template index fe504902f10..5bec8b46a10 100644 --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template @@ -23,6 +23,7 @@ /* * @test + * @bug 8156486 * @run testng/othervm VarHandleTestMethodType$Type$ * @run testng/othervm -Djava.lang.invoke.VarHandle.VAR_HANDLE_GUARDS=false VarHandleTestMethodType$Type$ */ @@ -81,27 +82,28 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { public Object[][] accessTestCaseProvider() throws Exception { List> cases = new ArrayList<>(); - cases.add(new VarHandleAccessTestCase("Instance field wrong method type", + cases.add(new VarHandleAccessTestCase("Instance field", vhField, vh -> testInstanceFieldWrongMethodType(this, vh), false)); - cases.add(new VarHandleAccessTestCase("Static field wrong method type", + cases.add(new VarHandleAccessTestCase("Static field", vhStaticField, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType, false)); - cases.add(new VarHandleAccessTestCase("Array wrong method type", + cases.add(new VarHandleAccessTestCase("Array", vhArray, VarHandleTestMethodType$Type$::testArrayWrongMethodType, false)); + for (VarHandleToMethodHandle f : VarHandleToMethodHandle.values()) { - cases.add(new MethodHandleAccessTestCase("Instance field wrong method type", + cases.add(new MethodHandleAccessTestCase("Instance field", vhField, f, hs -> testInstanceFieldWrongMethodType(this, hs), false)); - cases.add(new MethodHandleAccessTestCase("Static field wrong method type", + cases.add(new MethodHandleAccessTestCase("Static field", vhStaticField, f, VarHandleTestMethodType$Type$::testStaticFieldWrongMethodType, false)); - cases.add(new MethodHandleAccessTestCase("Array wrong method type", + cases.add(new MethodHandleAccessTestCase("Array", vhArray, f, VarHandleTestMethodType$Type$::testArrayWrongMethodType, false)); } @@ -648,63 +650,63 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null receiver - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class)). - invoke(null); + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); checkWMTE(() -> { // receiver primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class)). - invoke(0); + invokeExact(0); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class - Void x = (Void) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class)). - invoke(recv); + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class + Void x = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class)). + invokeExact(recv); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class)). - invoke(recv); + invokeExact(recv); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - hs.get(am, methodType(void.class, Void.class, $type$.class)). - invoke(null, $value1$); + hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null, $value1$); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class hs.get(am, methodType(void.class, Class.class, $type$.class)). - invoke(Void.class, $value1$); + invokeExact(Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, $type$.class)). - invoke(0, $value1$); + invokeExact(0, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)). - invoke(recv, $value1$, Void.class); + invokeExact(recv, $value1$, Void.class); }); } @@ -712,111 +714,111 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, $type$.class, $type$.class)). - invoke(null, $value1$, $value1$); + boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class, $type$.class)). - invoke(Void.class, $value1$, $value1$); + invokeExact(Void.class, $value1$, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)). - invoke(recv, Void.class, $value1$); + invokeExact(recv, Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)). - invoke(recv, $value1$, Void.class); + invokeExact(recv, $value1$, Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class , $type$.class, $type$.class)). - invoke(0, $value1$, $value1$); + invokeExact(0, $value1$, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)). - invoke(recv, $value1$, $value1$, Void.class); + invokeExact(recv, $value1$, $value1$, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { checkNPE(() -> { // null receiver - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class, $type$.class)). - invoke(null, $value1$, $value1$); + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null, $value1$, $value1$); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class, $type$.class)). - invoke(Void.class, $value1$, $value1$); + invokeExact(Void.class, $value1$, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class, $type$.class)). - invoke(recv, Void.class, $value1$); + invokeExact(recv, Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, Class.class)). - invoke(recv, $value1$, Void.class); + invokeExact(recv, $value1$, Void.class); }); checkWMTE(() -> { // reciever primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class , $type$.class, $type$.class)). - invoke(0, $value1$, $value1$); + invokeExact(0, $value1$, $value1$); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)). - invoke(recv, $value1$, $value1$); + invokeExact(recv, $value1$, $value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class , $type$.class, $type$.class)). - invoke(recv, $value1$, $value1$); + invokeExact(recv, $value1$, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class, $type$.class, Class.class)). - invoke(recv, $value1$, $value1$, Void.class); + invokeExact(recv, $value1$, $value1$, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { checkNPE(() -> { // null receiver - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)). - invoke(null, $value1$); + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null, $value1$); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). - invoke(Void.class, $value1$); + invokeExact(Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)). - invoke(0, $value1$); + invokeExact(0, $value1$); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)). - invoke(recv, $value1$); + invokeExact(recv, $value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). - invoke(recv, $value1$); + invokeExact(recv, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). - invoke(recv, $value1$, Void.class); + invokeExact(recv, $value1$, Void.class); }); } #end[CAS] @@ -824,38 +826,38 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { #if[AtomicAdd] for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { checkNPE(() -> { // null receiver - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, $type$.class)). - invoke(null, $value1$); + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null, $value1$); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). - invoke(Void.class, $value1$); + invokeExact(Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). - invoke(recv, Void.class); + invokeExact(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)). - invoke(0, $value1$); + invokeExact(0, $value1$); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)). - invoke(recv, $value1$); + invokeExact(recv, $value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). - invoke(recv, $value1$); + invokeExact(recv, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). - invoke(recv, $value1$, Void.class); + invokeExact(recv, $value1$, Void.class); }); } #end[AtomicAdd] @@ -1200,111 +1202,111 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class)). - invoke(); + invokeExact(); }); // Incorrect arity checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType(Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class hs.get(am, methodType(void.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, $type$.class, Class.class)). - invoke($value1$, Void.class); + invokeExact($value1$, Void.class); }); } #if[CAS] for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types - check{#if[String]?CCE:WMTE}(() -> { // expected reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, $type$.class)). - invoke(Void.class, $value1$); + invokeExact(Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, Class.class)). - invoke($value1$, Void.class); + invokeExact($value1$, Void.class); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$.class, $type$.class, Class.class)). - invoke($value1$, $value1$, Void.class); + invokeExact($value1$, $value1$, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { // Incorrect argument types - check{#if[String]?CCE:WMTE}(() -> { // expected reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). - invoke(Void.class, $value1$); + invokeExact(Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). - invoke($value1$, Void.class); + invokeExact($value1$, Void.class); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, $type$.class, $type$.class)). - invoke($value1$, $value1$); + invokeExact($value1$, $value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class, $type$.class)). - invoke($value1$, $value1$); + invokeExact($value1$, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, $type$.class, Class.class)). - invoke($value1$, $value1$, Void.class); + invokeExact($value1$, $value1$, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { // Incorrect argument types - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)). - invoke($value1$); + invokeExact($value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)). - invoke($value1$); + invokeExact($value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). - invoke($value1$, Void.class); + invokeExact($value1$, Void.class); }); } #end[CAS] @@ -1314,25 +1316,25 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { // Incorrect argument types check{#if[String]?CCE:WMTE}(() -> { // value reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). - invoke(Void.class); + invokeExact(Void.class); }); // Incorrect return type check{#if[String]?CCE:WMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)). - invoke($value1$); + invokeExact($value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)). - invoke($value1$); + invokeExact($value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). - invoke($value1$, Void.class); + invokeExact($value1$, Void.class); }); } #end[AtomicAdd] @@ -1929,196 +1931,196 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET)) { // Incorrect argument types checkNPE(() -> { // null array - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class)). - invoke(null, 0); + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class)). + invokeExact(($type$[]) null, 0); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class)). - invoke(Void.class, 0); + invokeExact(Void.class, 0); }); checkWMTE(() -> { // array primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class)). - invoke(0, 0); + invokeExact(0, 0); }); checkWMTE(() -> { // index reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class)). - invoke(array, Void.class); + invokeExact(array, Void.class); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void x = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class)). - invoke(array, 0); + invokeExact(array, 0); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.SET)) { // Incorrect argument types checkNPE(() -> { // null array - hs.get(am, methodType(void.class, Void.class, int.class, $type$.class)). - invoke(null, 0, $value1$); + hs.get(am, methodType(void.class, $type$[].class, int.class, $type$.class)). + invokeExact(($type$[]) null, 0, $value1$); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class hs.get(am, methodType(void.class, Class.class, int.class, $type$.class)). - invoke(Void.class, 0, $value1$); + invokeExact(Void.class, 0, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // receiver primitive class hs.get(am, methodType(void.class, int.class, int.class, $type$.class)). - invoke(0, 0, $value1$); + invokeExact(0, 0, $value1$); }); checkWMTE(() -> { // index reference class hs.get(am, methodType(void.class, $type$[].class, Class.class, $type$.class)). - invoke(array, Void.class, $value1$); + invokeExact(array, Void.class, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 hs.get(am, methodType(void.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > hs.get(am, methodType(void.class, $type$[].class, int.class, Class.class)). - invoke(array, 0, $value1$, Void.class); + invokeExact(array, 0, $value1$, Void.class); }); } #if[CAS] for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null receiver - boolean r = (boolean) hs.get(am, methodType(boolean.class, Void.class, int.class, $type$.class, $type$.class)). - invoke(null, 0, $value1$, $value1$); + boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class)). + invokeExact(($type$[]) null, 0, $value1$, $value1$); }); - checkCCE(() -> { // receiver reference class + hs.checkWMTEOrCCE(() -> { // receiver reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, $type$.class, $type$.class)). - invoke(Void.class, 0, $value1$, $value1$); + invokeExact(Void.class, 0, $value1$, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, Class.class, $type$.class)). - invoke(array, 0, Void.class, $value1$); + invokeExact(array, 0, Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, Class.class)). - invoke(array, 0, $value1$, Void.class); + invokeExact(array, 0, $value1$, Void.class); }); checkWMTE(() -> { // receiver primitive class boolean r = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, $type$.class, $type$.class)). - invoke(0, 0, $value1$, $value1$); + invokeExact(0, 0, $value1$, $value1$); }); checkWMTE(() -> { // index reference class boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, Class.class, $type$.class, $type$.class)). - invoke(array, Void.class, $value1$, $value1$); + invokeExact(array, Void.class, $value1$, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 boolean r = (boolean) hs.get(am, methodType(boolean.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > boolean r = (boolean) hs.get(am, methodType(boolean.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)). - invoke(array, 0, $value1$, $value1$, Void.class); + invokeExact(array, 0, $value1$, $value1$, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.COMPARE_AND_EXCHANGE)) { // Incorrect argument types checkNPE(() -> { // null receiver - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class, $type$.class)). - invoke(null, 0, $value1$, $value1$); + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class)). + invokeExact(($type$[]) null, 0, $value1$, $value1$); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class, $type$.class)). - invoke(Void.class, 0, $value1$, $value1$); + invokeExact(Void.class, 0, $value1$, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // expected reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class, $type$.class)). - invoke(array, 0, Void.class, $value1$); + invokeExact(array, 0, Void.class, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // actual reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). - invoke(array, 0, $value1$, Void.class); + invokeExact(array, 0, $value1$, Void.class); }); checkWMTE(() -> { // array primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class, $type$.class)). - invoke(0, 0, $value1$, $value1$); + invokeExact(0, 0, $value1$, $value1$); }); checkWMTE(() -> { // index reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class, $type$.class)). - invoke(array, Void.class, $value1$, $value1$); + invokeExact(array, Void.class, $value1$, $value1$); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class, $type$.class)). - invoke(array, 0, $value1$, $value1$); + invokeExact(array, 0, $value1$, $value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class, $type$.class)). - invoke(array, 0, $value1$, $value1$); + invokeExact(array, 0, $value1$, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, $type$.class, Class.class)). - invoke(array, 0, $value1$, $value1$, Void.class); + invokeExact(array, 0, $value1$, $value1$, Void.class); }); } for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_SET)) { // Incorrect argument types checkNPE(() -> { // null array - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)). - invoke(null, 0, $value1$); + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)). + invokeExact(($type$[]) null, 0, $value1$); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)). - invoke(Void.class, 0, $value1$); + invokeExact(Void.class, 0, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)). - invoke(0, 0, $value1$); + invokeExact(0, 0, $value1$); }); checkWMTE(() -> { // index reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)). - invoke(array, Void.class, $value1$); + invokeExact(array, Void.class, $value1$); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)). - invoke(array, 0, $value1$); + invokeExact(array, 0, $value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)). - invoke(array, 0, $value1$); + invokeExact(array, 0, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). - invoke(array, 0, $value1$, Void.class); + invokeExact(array, 0, $value1$, Void.class); }); } #end[CAS] @@ -2127,42 +2129,42 @@ public class VarHandleTestMethodType$Type$ extends VarHandleBaseTest { for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_ADD)) { // Incorrect argument types checkNPE(() -> { // null array - $type$ x = ($type$) hs.get(am, methodType($type$.class, Void.class, int.class, $type$.class)). - invoke(null, 0, $value1$); + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)). + invokeExact(($type$[]) null, 0, $value1$); }); - checkCCE(() -> { // array reference class + hs.checkWMTEOrCCE(() -> { // array reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)). - invoke(Void.class, 0, $value1$); + invokeExact(Void.class, 0, $value1$); }); - check{#if[String]?CCE:WMTE}(() -> { // value reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). - invoke(array, 0, Void.class); + invokeExact(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)). - invoke(0, 0, $value1$); + invokeExact(0, 0, $value1$); }); checkWMTE(() -> { // index reference class $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)). - invoke(array, Void.class, $value1$); + invokeExact(array, Void.class, $value1$); }); // Incorrect return type - check{#if[String]?CCE:WMTE}(() -> { // reference class + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)). - invoke(array, 0, $value1$); + invokeExact(array, 0, $value1$); }); checkWMTE(() -> { // primitive class $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)). - invoke(array, 0, $value1$); + invokeExact(array, 0, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 $type$ x = ($type$) hs.get(am, methodType($type$.class)). - invoke(); + invokeExact(); }); checkWMTE(() -> { // > $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). - invoke(array, 0, $value1$, Void.class); + invokeExact(array, 0, $value1$, Void.class); }); } #end[AtomicAdd] diff --git a/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh b/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh index 7d6afc7b206..436d2d371d9 100644 --- a/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh +++ b/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh @@ -113,36 +113,40 @@ do ;; esac + # The value of `value3` is chosen such that when added to `value1` or `value2` + # it will result in carrying of bits over to the next byte, thereby detecting + # possible errors in endianness conversion e.g. if say for atomic addition the + # augend is incorrectly processed case $type in short) value1=(short)0x0102 value2=(short)0x1112 - value3=(short)0x2122 + value3=(short)0xFFFE ;; char) value1=(char)0x0102 value2=(char)0x1112 - value3=(char)0x2122 + value3=(char)0xFFFE ;; int) value1=0x01020304 value2=0x11121314 - value3=0x21222324 + value3=0xFFFEFDFC ;; long) value1=0x0102030405060708L value2=0x1112131415161718L - value3=0x2122232425262728L + value3=0xFFFEFDFCFBFAF9F8L ;; float) value1=0x01020304 value2=0x11121314 - value3=0x21222324 + value3=0xFFFEFDFC ;; double) value1=0x0102030405060708L value2=0x1112131415161718L - value3=0x2122232425262728L + value3=0xFFFEFDFCFBFAF9F8L ;; esac diff --git a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java index 195cb3a2fd8..2d52eeb4299 100644 --- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java +++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java @@ -36,9 +36,13 @@ * @modules jdk.management * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil * @run main ResetPeakMemoryUsage + * @requires vm.opt.ExplicitGCInvokesConcurrent != "true" + * @requires vm.opt.ExplicitGCInvokesConcurrentAndUnloadsClasses != "true" + * @requires vm.opt.DisableExplicitGC != "true" */ import java.lang.management.*; +import java.lang.ref.WeakReference; import java.util.*; public class ResetPeakMemoryUsage { @@ -100,6 +104,7 @@ public class ResetPeakMemoryUsage { printMemoryUsage(usage0, peak0); obj = new Object[largeArraySize]; + WeakReference weakRef = new WeakReference<>(obj); MemoryUsage usage1 = mpool.getUsage(); MemoryUsage peak1 = mpool.getPeakUsage(); @@ -124,7 +129,11 @@ public class ResetPeakMemoryUsage { // The object is now garbage and do a GC // memory usage should drop obj = null; - mbean.gc(); + + //This will cause sure shot GC unlike Runtime.gc() invoked by mbean.gc() + while(weakRef.get() != null) { + mbean.gc(); + } MemoryUsage usage2 = mpool.getUsage(); MemoryUsage peak2 = mpool.getPeakUsage(); diff --git a/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java b/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java index ac0bc89f98c..63f5c5fbc31 100644 --- a/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java +++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/PlatformLoggingMXBeanTest.java @@ -270,8 +270,7 @@ public class PlatformLoggingMXBeanTest // Calling getMBeanInfo will throw exception if not found. platformMBS.getMBeanInfo(objName); - if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean") || - !platformMBS.isInstanceOf(objName, "java.util.logging.LoggingMXBean")) { + if (!platformMBS.isInstanceOf(objName, "java.lang.management.PlatformLoggingMXBean")) { throw new RuntimeException(objName + " is of unexpected type"); } diff --git a/jdk/test/java/lang/module/AutomaticModulesTest.java b/jdk/test/java/lang/module/AutomaticModulesTest.java index d400ffb86cf..93dd5f7685d 100644 --- a/jdk/test/java/lang/module/AutomaticModulesTest.java +++ b/jdk/test/java/lang/module/AutomaticModulesTest.java @@ -469,7 +469,7 @@ public class AutomaticModulesTest { static Configuration resolve(Configuration parent, ModuleFinder finder, String... roots) { - return parent.resolveRequires(finder, ModuleFinder.empty(), Set.of(roots)); + return parent.resolveRequires(finder, ModuleFinder.of(), Set.of(roots)); } /** diff --git a/jdk/test/java/lang/module/ConfigurationTest.java b/jdk/test/java/lang/module/ConfigurationTest.java index 9e7e9d4357c..4d885cd7e59 100644 --- a/jdk/test/java/lang/module/ConfigurationTest.java +++ b/jdk/test/java/lang/module/ConfigurationTest.java @@ -721,7 +721,7 @@ public class ConfigurationTest { // finder2 is the after ModuleFinder and so p@2.0 should not be located // as module p is in parent configuration. - cf2 = resolveRequiresAndUses(cf1, ModuleFinder.empty(), finder2, "m1"); + cf2 = resolveRequiresAndUses(cf1, ModuleFinder.of(), finder2, "m1"); assertTrue(cf2.parent().get() == cf1); assertTrue(cf2.modules().size() == 1); @@ -865,7 +865,7 @@ public class ConfigurationTest { ModuleFinder finder2 = ModuleUtils.finderOf(descriptor2); - Configuration cf2 = resolveRequires(cf1, ModuleFinder.empty(), finder2, "m2"); + Configuration cf2 = resolveRequires(cf1, ModuleFinder.of(), finder2, "m2"); assertTrue(cf2.modules().size() == 1); assertTrue(cf2.findModule("m2").isPresent()); @@ -967,7 +967,7 @@ public class ConfigurationTest { */ @Test(expectedExceptions = { ResolutionException.class }) public void testRootNotFound() { - resolveRequires(ModuleFinder.empty(), "m1"); + resolveRequires(ModuleFinder.of(), "m1"); } @@ -1440,22 +1440,22 @@ public class ConfigurationTest { @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresWithNull1() { - resolveRequires((ModuleFinder)null, ModuleFinder.empty()); + resolveRequires((ModuleFinder)null, ModuleFinder.of()); } @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresWithNull2() { - resolveRequires(ModuleFinder.empty(), (ModuleFinder)null); + resolveRequires(ModuleFinder.of(), (ModuleFinder)null); } @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresAndUsesWithNull1() { - resolveRequiresAndUses((ModuleFinder) null, ModuleFinder.empty()); + resolveRequiresAndUses((ModuleFinder) null, ModuleFinder.of()); } @Test(expectedExceptions = { NullPointerException.class }) public void testResolveRequiresAndUsesWithNull2() { - resolveRequiresAndUses(ModuleFinder.empty(), (ModuleFinder) null); + resolveRequiresAndUses(ModuleFinder.of(), (ModuleFinder) null); } @Test(expectedExceptions = { NullPointerException.class }) @@ -1493,7 +1493,7 @@ public class ConfigurationTest { private Configuration resolveRequires(Configuration parent, ModuleFinder before, String... roots) { - return resolveRequires(parent, before, ModuleFinder.empty(), roots); + return resolveRequires(parent, before, ModuleFinder.of(), roots); } private Configuration resolveRequires(ModuleFinder before, @@ -1521,7 +1521,7 @@ public class ConfigurationTest { private Configuration resolveRequiresAndUses(Configuration parent, ModuleFinder before, String... roots) { - return resolveRequiresAndUses(parent, before, ModuleFinder.empty(), roots); + return resolveRequiresAndUses(parent, before, ModuleFinder.of(), roots); } private Configuration resolveRequiresAndUses(ModuleFinder before, diff --git a/jdk/test/java/lang/module/ModuleFinderTest.java b/jdk/test/java/lang/module/ModuleFinderTest.java index 3270dfd4085..58c2ae56334 100644 --- a/jdk/test/java/lang/module/ModuleFinderTest.java +++ b/jdk/test/java/lang/module/ModuleFinderTest.java @@ -76,9 +76,9 @@ public class ModuleFinderTest { /** - * Test ModuleFinder.of with zero entries + * Test ModuleFinder.of with no entries */ - public void testOfZeroEntries() { + public void testOfNoEntries() { ModuleFinder finder = ModuleFinder.of(); assertTrue(finder.findAll().isEmpty()); assertFalse(finder.find("java.rhubarb").isPresent()); @@ -454,18 +454,46 @@ public class ModuleFinderTest { /** - * Test ModuleFinder.compose + * Test ModuleFinder.compose with no module finders */ - public void testCompose() throws Exception { + public void testComposeOfNone() throws Exception { + ModuleFinder finder = ModuleFinder.of(); + assertTrue(finder.findAll().isEmpty()); + assertFalse(finder.find("java.rhubarb").isPresent()); + } + + + /** + * Test ModuleFinder.compose with one module finder + */ + public void testComposeOfOne() throws Exception { + Path dir = Files.createTempDirectory(USER_DIR, "mods"); + createModularJar(dir.resolve("m1.jar"), "m1"); + createModularJar(dir.resolve("m2.jar"), "m2"); + + ModuleFinder finder1 = ModuleFinder.of(dir); + + ModuleFinder finder = ModuleFinder.compose(finder1); + assertTrue(finder.findAll().size() == 2); + assertTrue(finder.find("m1").isPresent()); + assertTrue(finder.find("m2").isPresent()); + assertFalse(finder.find("java.rhubarb").isPresent()); + } + + + /** + * Test ModuleFinder.compose with two module finders + */ + public void testComposeOfTwo() throws Exception { Path dir1 = Files.createTempDirectory(USER_DIR, "mods1"); - createExplodedModule(dir1.resolve("m1"), "m1@1.0"); - createExplodedModule(dir1.resolve("m2"), "m2@1.0"); + createModularJar(dir1.resolve("m1.jar"), "m1@1.0"); + createModularJar(dir1.resolve("m2.jar"), "m2@1.0"); Path dir2 = Files.createTempDirectory(USER_DIR, "mods2"); - createExplodedModule(dir2.resolve("m1"), "m1@2.0"); - createExplodedModule(dir2.resolve("m2"), "m2@2.0"); - createExplodedModule(dir2.resolve("m3"), "m3"); - createExplodedModule(dir2.resolve("m4"), "m4"); + createModularJar(dir2.resolve("m1.jar"), "m1@2.0"); + createModularJar(dir2.resolve("m2.jar"), "m2@2.0"); + createModularJar(dir2.resolve("m3.jar"), "m3"); + createModularJar(dir2.resolve("m4.jar"), "m4"); ModuleFinder finder1 = ModuleFinder.of(dir1); ModuleFinder finder2 = ModuleFinder.of(dir2); @@ -478,23 +506,65 @@ public class ModuleFinderTest { assertTrue(finder.find("m4").isPresent()); assertFalse(finder.find("java.rhubarb").isPresent()); - // check that m1@1.0 (and not m1@2.0) is found + // check that m1@1.0 is found ModuleDescriptor m1 = finder.find("m1").get().descriptor(); assertEquals(m1.version().get().toString(), "1.0"); - // check that m2@1.0 (and not m2@2.0) is found + // check that m2@1.0 is found ModuleDescriptor m2 = finder.find("m2").get().descriptor(); assertEquals(m2.version().get().toString(), "1.0"); } /** - * Test ModuleFinder.empty + * Test ModuleFinder.compose with three module finders */ - public void testEmpty() { - ModuleFinder finder = ModuleFinder.empty(); - assertTrue(finder.findAll().isEmpty()); + public void testComposeOfThree() throws Exception { + Path dir1 = Files.createTempDirectory(USER_DIR, "mods1"); + createModularJar(dir1.resolve("m1.jar"), "m1@1.0"); + createModularJar(dir1.resolve("m2.jar"), "m2@1.0"); + + Path dir2 = Files.createTempDirectory(USER_DIR, "mods2"); + createModularJar(dir2.resolve("m1.jar"), "m1@2.0"); + createModularJar(dir2.resolve("m2.jar"), "m2@2.0"); + createModularJar(dir2.resolve("m3.jar"), "m3@2.0"); + createModularJar(dir2.resolve("m4.jar"), "m4@2.0"); + + Path dir3 = Files.createTempDirectory(USER_DIR, "mods3"); + createModularJar(dir3.resolve("m3.jar"), "m3@3.0"); + createModularJar(dir3.resolve("m4.jar"), "m4@3.0"); + createModularJar(dir3.resolve("m5.jar"), "m5"); + createModularJar(dir3.resolve("m6.jar"), "m6"); + + ModuleFinder finder1 = ModuleFinder.of(dir1); + ModuleFinder finder2 = ModuleFinder.of(dir2); + ModuleFinder finder3 = ModuleFinder.of(dir3); + + ModuleFinder finder = ModuleFinder.compose(finder1, finder2, finder3); + assertTrue(finder.findAll().size() == 6); + assertTrue(finder.find("m1").isPresent()); + assertTrue(finder.find("m2").isPresent()); + assertTrue(finder.find("m3").isPresent()); + assertTrue(finder.find("m4").isPresent()); + assertTrue(finder.find("m5").isPresent()); + assertTrue(finder.find("m6").isPresent()); assertFalse(finder.find("java.rhubarb").isPresent()); + + // check that m1@1.0 is found + ModuleDescriptor m1 = finder.find("m1").get().descriptor(); + assertEquals(m1.version().get().toString(), "1.0"); + + // check that m2@1.0 is found + ModuleDescriptor m2 = finder.find("m2").get().descriptor(); + assertEquals(m2.version().get().toString(), "1.0"); + + // check that m3@2.0 is found + ModuleDescriptor m3 = finder.find("m3").get().descriptor(); + assertEquals(m3.version().get().toString(), "2.0"); + + // check that m4@2.0 is found + ModuleDescriptor m4 = finder.find("m4").get().descriptor(); + assertEquals(m4.version().get().toString(), "2.0"); } @@ -503,33 +573,45 @@ public class ModuleFinderTest { */ public void testNulls() { + // ofSystem try { ModuleFinder.ofSystem().find(null); assertTrue(false); } catch (NullPointerException expected) { } + // of + Path dir = Paths.get("d"); try { ModuleFinder.of().find(null); assertTrue(false); } catch (NullPointerException expected) { } - try { - ModuleFinder.empty().find(null); + ModuleFinder.of((Path)null); assertTrue(false); } catch (NullPointerException expected) { } - try { ModuleFinder.of((Path[])null); assertTrue(false); } catch (NullPointerException expected) { } - try { - ModuleFinder.of((Path)null); + ModuleFinder.of(dir, null); + assertTrue(false); + } catch (NullPointerException expected) { } + try { + ModuleFinder.of(null, dir); assertTrue(false); } catch (NullPointerException expected) { } // compose ModuleFinder finder = ModuleFinder.of(); + try { + ModuleFinder.compose((ModuleFinder)null); + assertTrue(false); + } catch (NullPointerException expected) { } + try { + ModuleFinder.compose((ModuleFinder[])null); + assertTrue(false); + } catch (NullPointerException expected) { } try { ModuleFinder.compose(finder, null); assertTrue(false); diff --git a/jdk/test/java/lang/module/ModuleReader/MultiReleaseJarTest.java b/jdk/test/java/lang/module/ModuleReader/MultiReleaseJarTest.java new file mode 100644 index 00000000000..4bb6ceaf34f --- /dev/null +++ b/jdk/test/java/lang/module/ModuleReader/MultiReleaseJarTest.java @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @library /lib/testlibrary + * @modules java.base/jdk.internal.module + * @build MultiReleaseJarTest JarUtils + * @run testng MultiReleaseJarTest + * @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarTest + * @summary Basic test of ModuleReader with a modular JAR that is also a + * multi-release JAR + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleFinder; +import java.lang.module.ModuleReader; +import java.lang.module.ModuleReference; +import java.net.URI; +import java.net.URLConnection; +import java.nio.ByteBuffer; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Optional; +import java.util.Set; +import java.util.jar.Attributes; +import java.util.jar.Manifest; +import java.util.stream.Collectors; + +import jdk.internal.module.ModuleInfoWriter; + +import org.testng.annotations.Test; +import static org.testng.Assert.*; + +/** + * Exercises ModuleReader with a modular JAR containing the following files: + * + *
    {@code
    + *     module-info.class
    + *     META-INF/versions//module.class
    + * }
    + * + * The module-info.class in the top-level directory is the binary form of: + *
    {@code
    + *     module jdk.test {
    + *         requires java.base;
    + *     }
    + * }
    + * + * The module-info.class in the versioned section is the binary form of: + *
    {@code
    + *     module jdk.test {
    + *         requires java.base;
    + *         requires jdk.unsupported;
    + *     }
    + * }
    + */ + +@Test +public class MultiReleaseJarTest { + + // Java SE/JDK major release + private static final int RELEASE = Runtime.version().major(); + + // the name of the test module + private static final String MODULE_NAME = "jdk.test"; + + private static final String MODULE_INFO_CLASS = "module-info.class"; + + /** + * Uses the ModuleFinder API to locate the module packaged as a modular + * and mutli-release JAR and then creates a ModuleReader to access the + * contents of the module. + */ + public void testMultiReleaseJar() throws IOException { + + // are multi-release JARs enabled? + String s = System.getProperty("jdk.util.jar.enableMultiRelease"); + boolean multiRelease = (s == null || Boolean.parseBoolean(s)); + + // create the multi-release modular JAR + Path jarfile = createJarFile(); + + // find the module + ModuleFinder finder = ModuleFinder.of(jarfile); + Optional omref = finder.find(MODULE_NAME); + assertTrue((omref.isPresent())); + ModuleReference mref = omref.get(); + + // test that correct module-info.class was read + checkDescriptor(mref.descriptor(), multiRelease); + + // test ModuleReader + try (ModuleReader reader = mref.open()) { + + // open resource + Optional oin = reader.open(MODULE_INFO_CLASS); + assertTrue(oin.isPresent()); + try (InputStream in = oin.get()) { + checkDescriptor(ModuleDescriptor.read(in), multiRelease); + } + + // read resource + Optional obb = reader.read(MODULE_INFO_CLASS); + assertTrue(obb.isPresent()); + ByteBuffer bb = obb.get(); + try { + checkDescriptor(ModuleDescriptor.read(bb), multiRelease); + } finally { + reader.release(bb); + } + + // find resource + Optional ouri = reader.find(MODULE_INFO_CLASS); + assertTrue(ouri.isPresent()); + URI uri = ouri.get(); + + String expectedTail = "!/"; + if (multiRelease) + expectedTail += "META-INF/versions/" + RELEASE + "/"; + expectedTail += MODULE_INFO_CLASS; + assertTrue(uri.toString().endsWith(expectedTail)); + + URLConnection uc = uri.toURL().openConnection(); + uc.setUseCaches(false); + try (InputStream in = uc.getInputStream()) { + checkDescriptor(ModuleDescriptor.read(in), multiRelease); + } + + } + + } + + /** + * Checks that the module descriptor is the expected module descriptor. + * When the multi release JAR feature is enabled then the module + * descriptor is expected to have been read from the versioned section + * of the JAR file. + */ + private void checkDescriptor(ModuleDescriptor descriptor, boolean multiRelease) { + Set requires = descriptor.requires().stream() + .map(ModuleDescriptor.Requires::name) + .collect(Collectors.toSet()); + assertTrue(requires.contains("java.base")); + assertTrue(requires.contains("jdk.unsupported") == multiRelease); + } + + /** + * Creates the modular JAR for the test, returning the Path to the JAR file. + */ + private Path createJarFile() throws IOException { + + // module descriptor for top-level directory + ModuleDescriptor descriptor1 + = new ModuleDescriptor.Builder(MODULE_NAME) + .requires("java.base") + .build(); + + // module descriptor for versioned section + ModuleDescriptor descriptor2 + = new ModuleDescriptor.Builder(MODULE_NAME) + .requires("java.base") + .requires("jdk.unsupported") + .build(); + + Path top = Paths.get(MODULE_NAME); + Files.createDirectories(top); + + Path mi1 = Paths.get(MODULE_INFO_CLASS); + try (OutputStream out = Files.newOutputStream(top.resolve(mi1))) { + ModuleInfoWriter.write(descriptor1, out); + } + + Path vdir = Paths.get("META-INF", "versions", Integer.toString(RELEASE)); + Files.createDirectories(top.resolve(vdir)); + + Path mi2 = vdir.resolve(MODULE_INFO_CLASS); + try (OutputStream out = Files.newOutputStream(top.resolve(mi2))) { + ModuleInfoWriter.write(descriptor2, out); + } + + Manifest man = new Manifest(); + Attributes attrs = man.getMainAttributes(); + attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0"); + attrs.put(Attributes.Name.MULTI_RELEASE, "true"); + + Path jarfile = Paths.get(MODULE_NAME + ".jar"); + JarUtils.createJarFile(jarfile, man, top, mi1, mi2); + + return jarfile; + } +} diff --git a/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java b/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java index f54a320a3f8..f6aeb6bbb23 100644 --- a/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java +++ b/jdk/test/java/lang/reflect/Layer/BasicLayerTest.java @@ -33,7 +33,6 @@ import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import static java.lang.module.ModuleFinder.empty; import java.lang.reflect.Layer; import java.lang.reflect.LayerInstantiationException; import java.lang.reflect.Module; @@ -358,7 +357,7 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor); Configuration parent = Layer.boot().configuration(); - Configuration cf = parent.resolveRequires(finder, empty(), Set.of("m1")); + Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); assertTrue(cf.modules().size() == 1); ClassLoader loader = new ClassLoader() { }; @@ -684,7 +683,7 @@ public class BasicLayerTest { Configuration parent = Layer.boot().configuration(); - Configuration cf = parent.resolveRequires(finder, empty(), Set.of("m")); + Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of("m")); ClassLoader loader = new ClassLoader() { }; @@ -724,13 +723,13 @@ public class BasicLayerTest { Configuration parent = Layer.boot().configuration(); - Configuration cf1 = parent.resolveRequires(finder, empty(), Set.of("m1")); + Configuration cf1 = parent.resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); Layer layer1 = Layer.boot().defineModules(cf1, mn -> loader); // attempt to define m2 containing package p to class loader - Configuration cf2 = parent.resolveRequires(finder, empty(), Set.of("m2")); + Configuration cf2 = parent.resolveRequires(finder, ModuleFinder.of(), Set.of("m2")); // should throw exception because p already in m1 Layer layer2 = Layer.boot().defineModules(cf2, mn -> loader); @@ -757,7 +756,7 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(md); Configuration parent = Layer.boot().configuration(); - Configuration cf = parent.resolveRequires(finder, empty(), Set.of("m")); + Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of("m")); Layer.boot().defineModules(cf, mn -> c.getClassLoader()); } @@ -777,7 +776,7 @@ public class BasicLayerTest { ModuleFinder finder = ModuleUtils.finderOf(descriptor1); Configuration parent = Layer.boot().configuration(); - Configuration cf = parent.resolveRequires(finder, empty(), Set.of("m1")); + Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); ClassLoader loader = new ClassLoader() { }; Layer.empty().defineModules(cf, mn -> loader); @@ -814,7 +813,7 @@ public class BasicLayerTest { @Test(expectedExceptions = { NullPointerException.class }) public void testCreateWithNull2() { ClassLoader loader = new ClassLoader() { }; - Configuration cf = resolveRequires(Layer.boot().configuration(), empty()); + Configuration cf = resolveRequires(Layer.boot().configuration(), ModuleFinder.of()); Layer.boot().defineModules(cf, null); } @@ -857,7 +856,7 @@ public class BasicLayerTest { private static Configuration resolveRequires(Configuration cf, ModuleFinder finder, String... roots) { - return cf.resolveRequires(finder, empty(), Set.of(roots)); + return cf.resolveRequires(finder, ModuleFinder.of(), Set.of(roots)); } private static Configuration resolveRequires(ModuleFinder finder, diff --git a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java b/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java index b37813fd290..c07ab264232 100644 --- a/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java +++ b/jdk/test/java/lang/reflect/Layer/LayerAndLoadersTest.java @@ -24,6 +24,7 @@ /** * @test * @library /lib/testlibrary + * @modules jdk.compiler * @build LayerAndLoadersTest CompilerUtils ModuleUtils * @run testng LayerAndLoadersTest * @summary Tests for java.lang.reflect.Layer@createWithXXX methods @@ -32,7 +33,6 @@ import java.lang.module.Configuration; import java.lang.module.ModuleDescriptor; import java.lang.module.ModuleFinder; -import static java.lang.module.ModuleFinder.empty; import java.lang.module.ModuleReference; import java.lang.reflect.Layer; import java.lang.reflect.LayerInstantiationException; @@ -70,7 +70,7 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer.createWithOneLoader + * Basic test of Layer.defineModulesWithOneLoader * * Test scenario: * m1 requires m2 and m3 @@ -99,7 +99,7 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer.createWithManyLoaders + * Basic test of Layer.defineModulesWithManyLoaders * * Test scenario: * m1 requires m2 and m3 @@ -131,7 +131,7 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer.createWithOneLoader where one of the modules + * Basic test of Layer.defineModulesWithOneLoader where one of the modules * is a service provider module. * * Test scenario: @@ -172,7 +172,7 @@ public class LayerAndLoadersTest { /** - * Basic test of Layer.createWithManyLoaders where one of the modules + * Basic test of Layer.defineModulesWithManyLoaders where one of the modules * is a service provider module. * * Test scenario: @@ -272,7 +272,7 @@ public class LayerAndLoadersTest { Configuration cf = Layer.boot() .configuration() - .resolveRequires(finder, empty(), Set.of("m1", "m2")); + .resolveRequires(finder, ModuleFinder.of(), Set.of("m1", "m2")); // cannot define both module m1 and m2 to the same class loader try { @@ -306,7 +306,7 @@ public class LayerAndLoadersTest { Configuration cf1 = Layer.boot() .configuration() - .resolveRequires(finder1, empty(), Set.of("m1", "m2")); + .resolveRequires(finder1, ModuleFinder.of(), Set.of("m1", "m2")); Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, null); checkLayer(layer1, "m1", "m2"); @@ -319,7 +319,7 @@ public class LayerAndLoadersTest { ModuleFinder finder2 = ModuleUtils.finderOf(descriptor3, descriptor4); - Configuration cf2 = cf1.resolveRequires(finder2, empty(), Set.of("m3", "m4")); + Configuration cf2 = cf1.resolveRequires(finder2, ModuleFinder.of(), Set.of("m3", "m4")); // package p cannot be supplied by two class loaders try { @@ -350,7 +350,7 @@ public class LayerAndLoadersTest { checkLayer(layer1, "m1", "m2", "m3"); ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Configuration cf2 = cf1.resolveRequires(finder, empty(), Set.of("m1")); + Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null); checkLayer(layer2, "m1", "m2", "m3"); @@ -398,7 +398,7 @@ public class LayerAndLoadersTest { checkLayer(layer1, "m1", "m2", "m3"); ModuleFinder finder = ModuleFinder.of(MODS_DIR); - Configuration cf2 = cf1.resolveRequires(finder, empty(), Set.of("m1")); + Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); checkLayer(layer2, "m1", "m2", "m3"); @@ -492,7 +492,7 @@ public class LayerAndLoadersTest { ModuleFinder finder = finderFor("m1", "m3"); - Configuration cf2 = cf1.resolveRequires(finder, empty(), Set.of("m1")); + Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); Layer layer2 = layer1.defineModulesWithOneLoader(cf2, null); checkLayer(layer2, "m1", "m3"); @@ -528,7 +528,7 @@ public class LayerAndLoadersTest { ModuleFinder finder = finderFor("m1", "m3"); - Configuration cf2 = cf1.resolveRequires(finder, empty(), Set.of("m1")); + Configuration cf2 = cf1.resolveRequires(finder, ModuleFinder.of(), Set.of("m1")); Layer layer2 = layer1.defineModulesWithManyLoaders(cf2, null); checkLayer(layer2, "m1", "m3"); @@ -574,7 +574,7 @@ public class LayerAndLoadersTest { ModuleFinder finder = ModuleFinder.of(MODS_DIR); return Layer.boot() .configuration() - .resolveRequires(finder, empty(), Set.of(roots)); + .resolveRequires(finder, ModuleFinder.of(), Set.of(roots)); } /** @@ -585,7 +585,7 @@ public class LayerAndLoadersTest { ModuleFinder finder = ModuleFinder.of(MODS_DIR); return Layer.boot() .configuration() - .resolveRequiresAndUses(finder, empty(), Set.of(roots)); + .resolveRequiresAndUses(finder, ModuleFinder.of(), Set.of(roots)); } diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java b/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java index 529f294401d..fcc673909fa 100644 --- a/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java +++ b/jdk/test/java/lang/reflect/Proxy/ProxyClassAccessTest.java @@ -91,7 +91,7 @@ public class ProxyClassAccessTest { Layer bootLayer = Layer.boot(); Configuration cf = bootLayer .configuration() - .resolveRequiresAndUses(ModuleFinder.empty(), finder, modules); + .resolveRequiresAndUses(ModuleFinder.of(), finder, modules); ClassLoader parentLoader = this.getClass().getClassLoader(); Layer layer = bootLayer.defineModulesWithOneLoader(cf, parentLoader); diff --git a/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java b/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java index 4ee43ea11c1..37c0bd59b23 100644 --- a/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java +++ b/jdk/test/java/lang/reflect/Proxy/ProxyLayerTest.java @@ -79,7 +79,7 @@ public class ProxyLayerTest { Layer bootLayer = Layer.boot(); Configuration cf = bootLayer .configuration() - .resolveRequiresAndUses(ModuleFinder.empty(), finder, Arrays.asList(modules)); + .resolveRequiresAndUses(ModuleFinder.of(), finder, Arrays.asList(modules)); ClassLoader scl = ClassLoader.getSystemClassLoader(); Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); @@ -113,7 +113,7 @@ public class ProxyLayerTest { Layer bootLayer = Layer.boot(); Configuration cf = bootLayer .configuration() - .resolveRequiresAndUses(ModuleFinder.empty(), finder, Arrays.asList(modules)); + .resolveRequiresAndUses(ModuleFinder.of(), finder, Arrays.asList(modules)); ClassLoader scl = ClassLoader.getSystemClassLoader(); Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); @@ -143,7 +143,7 @@ public class ProxyLayerTest { Layer bootLayer = Layer.boot(); Configuration cf = bootLayer .configuration() - .resolveRequiresAndUses(ModuleFinder.empty(), finder, Arrays.asList(modules)); + .resolveRequiresAndUses(ModuleFinder.of(), finder, Arrays.asList(modules)); ClassLoader scl = ClassLoader.getSystemClassLoader(); Layer layer = bootLayer.defineModulesWithOneLoader(cf, scl); diff --git a/jdk/test/java/math/BigDecimal/SquareRootTests.java b/jdk/test/java/math/BigDecimal/SquareRootTests.java new file mode 100644 index 00000000000..1ad72d0f8ea --- /dev/null +++ b/jdk/test/java/math/BigDecimal/SquareRootTests.java @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 4851777 + * @summary Tests of BigDecimal.sqrt(). + */ + +import java.math.*; +import java.util.*; + +public class SquareRootTests { + + public static void main(String... args) { + int failures = 0; + + failures += negativeTests(); + failures += zeroTests(); + failures += evenPowersOfTenTests(); + failures += squareRootTwoTests(); + failures += lowPrecisionPerfectSquares(); + + if (failures > 0 ) { + throw new RuntimeException("Incurred " + failures + " failures" + + " testing BigDecimal.sqrt()."); + } + } + + private static int negativeTests() { + int failures = 0; + + for (long i = -10; i < 0; i++) { + for (int j = -5; j < 5; j++) { + try { + BigDecimal input = BigDecimal.valueOf(i, j); + BigDecimal result = input.sqrt(MathContext.DECIMAL64); + System.err.println("Unexpected sqrt of negative: (" + + input + ").sqrt() = " + result ); + failures += 1; + } catch (ArithmeticException e) { + ; // Expected + } + } + } + + return failures; + } + + private static int zeroTests() { + int failures = 0; + + for (int i = -100; i < 100; i++) { + BigDecimal expected = BigDecimal.valueOf(0L, i/2); + // These results are independent of rounding mode + failures += compare(BigDecimal.valueOf(0L, i).sqrt(MathContext.UNLIMITED), + expected, true, "zeros"); + + failures += compare(BigDecimal.valueOf(0L, i).sqrt(MathContext.DECIMAL64), + expected, true, "zeros"); + } + + return failures; + } + + /** + * sqrt(10^2N) is 10^N + * Both numerical value and representation should be verified + */ + private static int evenPowersOfTenTests() { + int failures = 0; + MathContext oneDigitExactly = new MathContext(1, RoundingMode.UNNECESSARY); + + for (int scale = -100; scale <= 100; scale++) { + BigDecimal testValue = BigDecimal.valueOf(1, 2*scale); + BigDecimal expectedNumericalResult = BigDecimal.valueOf(1, scale); + + BigDecimal result; + + + failures += equalNumerically(expectedNumericalResult, + result = testValue.sqrt(MathContext.DECIMAL64), + "Even powers of 10, DECIMAL64"); + + // Can round to one digit of precision exactly + failures += equalNumerically(expectedNumericalResult, + result = testValue.sqrt(oneDigitExactly), + "even powers of 10, 1 digit"); + if (result.precision() > 1) { + failures += 1; + System.err.println("Excess precision for " + result); + } + + + // If rounding to more than one digit, do precision / scale checking... + + } + + return failures; + } + + private static int squareRootTwoTests() { + int failures = 0; + BigDecimal TWO = new BigDecimal(2); + + // Square root of 2 truncated to 65 digits + BigDecimal highPrecisionRoot2 = + new BigDecimal("1.41421356237309504880168872420969807856967187537694807317667973799"); + + + RoundingMode[] modes = { + RoundingMode.UP, RoundingMode.DOWN, + RoundingMode.CEILING, RoundingMode.FLOOR, + RoundingMode.HALF_UP, RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN + }; + + // For each iteresting rounding mode, for precisions 1 to, say + // 63 numerically compare TWO.sqrt(mc) to + // highPrecisionRoot2.round(mc) + + for (RoundingMode mode : modes) { + for (int precision = 1; precision < 63; precision++) { + MathContext mc = new MathContext(precision, mode); + BigDecimal expected = highPrecisionRoot2.round(mc); + BigDecimal computed = TWO.sqrt(mc); + + equalNumerically(expected, computed, "sqrt(2)"); + } + } + + return failures; + } + + private static int lowPrecisionPerfectSquares() { + int failures = 0; + + // For 5^2 through 9^2, if the input is rounded to one digit + // first before the root is computed, the wrong answer will + // result. Verify results and scale for different rounding + // modes and precisions. + long[][] squaresWithOneDigitRoot = {{ 4, 2}, + { 9, 3}, + {25, 5}, + {36, 6}, + {49, 7}, + {64, 8}, + {81, 9}}; + + for (long[] squareAndRoot : squaresWithOneDigitRoot) { + BigDecimal square = new BigDecimal(squareAndRoot[0]); + BigDecimal expected = new BigDecimal(squareAndRoot[1]); + + for (int scale = 0; scale <= 4; scale++) { + BigDecimal scaledSquare = square.setScale(scale, RoundingMode.UNNECESSARY); + int expectedScale = scale/2; + for (int precision = 0; precision <= 5; precision++) { + for (RoundingMode rm : RoundingMode.values()) { + MathContext mc = new MathContext(precision, rm); + BigDecimal computedRoot = scaledSquare.sqrt(mc); + failures += equalNumerically(expected, computedRoot, "simple squares"); + int computedScale = computedRoot.scale(); + if (precision >= expectedScale + 1 && + computedScale != expectedScale) { + System.err.printf("%s\tprecision=%d\trm=%s%n", + computedRoot.toString(), precision, rm); + failures++; + System.err.printf("\t%s does not have expected scale of %d%n.", + computedRoot, expectedScale); + } + } + } + } + } + + return failures; + } + + private static int compare(BigDecimal a, BigDecimal b, boolean expected, String prefix) { + boolean result = a.equals(b); + int failed = (result==expected) ? 0 : 1; + if (failed == 1) { + System.err.println("Testing " + prefix + + "(" + a + ").compareTo(" + b + ") => " + result + + "\n\tExpected " + expected); + } + return failed; + } + + private static int equalNumerically(BigDecimal a, BigDecimal b, + String prefix) { + return compareNumerically(a, b, 0, prefix); + } + + + private static int compareNumerically(BigDecimal a, BigDecimal b, + int expected, String prefix) { + int result = a.compareTo(b); + int failed = (result==expected) ? 0 : 1; + if (failed == 1) { + System.err.println("Testing " + prefix + + "(" + a + ").compareTo(" + b + ") => " + result + + "\n\tExpected " + expected); + } + return failed; + } + +} diff --git a/jdk/test/java/net/DatagramSocket/PortUnreachable.java b/jdk/test/java/net/DatagramSocket/PortUnreachable.java index 91e68472af8..143c842d45e 100644 --- a/jdk/test/java/net/DatagramSocket/PortUnreachable.java +++ b/jdk/test/java/net/DatagramSocket/PortUnreachable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -24,6 +24,7 @@ /** * @test * @bug 4361783 + * @key intermittent * @summary Test to see if ICMP Port Unreachable on non-connected * DatagramSocket causes a SocketException "socket closed" * exception on Windows 2000. diff --git a/jdk/test/java/net/InetAddress/IsReachableViaLoopbackTest.java b/jdk/test/java/net/InetAddress/IsReachableViaLoopbackTest.java index 4d7f266ec1d..5364ba7895e 100644 --- a/jdk/test/java/net/InetAddress/IsReachableViaLoopbackTest.java +++ b/jdk/test/java/net/InetAddress/IsReachableViaLoopbackTest.java @@ -5,6 +5,7 @@ import java.util.*; /** * @test * @bug 8135305 + * @key intermittent * @summary ensure we can't ping external hosts via loopback if */ diff --git a/jdk/test/java/net/MulticastSocket/TestInterfaces.java b/jdk/test/java/net/MulticastSocket/TestInterfaces.java index b9b641d40cc..2d90cb8a58e 100644 --- a/jdk/test/java/net/MulticastSocket/TestInterfaces.java +++ b/jdk/test/java/net/MulticastSocket/TestInterfaces.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -24,6 +24,7 @@ /* * @test * @bug 4422122 + * @key intermittent * @summary Test that MulticastSocket.getInterface returns the * same InetAddress set by MulticastSocket.setInterface */ diff --git a/jdk/test/java/net/SocketOption/OptionsTest.java b/jdk/test/java/net/SocketOption/OptionsTest.java index 81f33f73b9f..f1309f11b50 100644 --- a/jdk/test/java/net/SocketOption/OptionsTest.java +++ b/jdk/test/java/net/SocketOption/OptionsTest.java @@ -26,7 +26,7 @@ * @bug 8036979 8072384 8044773 * @run main/othervm -Xcheck:jni OptionsTest * @run main/othervm -Xcheck:jni -Djava.net.preferIPv4Stack=true OptionsTest - * @run main/othervm -Djdk.launcher.limitmods=java.base OptionsTest + * @run main/othervm -limitmods java.base OptionsTest */ import java.lang.reflect.Method; diff --git a/jdk/test/java/net/SocketOption/SupportedOptionsSet.java b/jdk/test/java/net/SocketOption/SupportedOptionsSet.java new file mode 100644 index 00000000000..eaa31e1246c --- /dev/null +++ b/jdk/test/java/net/SocketOption/SupportedOptionsSet.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.net.*; +import java.util.Set; +import static java.lang.System.out; + +/* + * @test + * @bug 8143923 + * @summary java.net socket supportedOptions set depends on call order + * @run main/othervm SupportedOptionsSet first + * @run main/othervm SupportedOptionsSet second + */ + +// Run with othervm as the implementation of the supported options sets, once +// calculated, stores them in a private static fields. + +public class SupportedOptionsSet { + + public static void main(String[] args) throws IOException { + if (args[0].equals("first")) + first(); + else if (args[0].equals("second")) + second(); + } + + static void first() throws IOException { + try (Socket s = new Socket(); + ServerSocket ss = new ServerSocket(); + DatagramSocket ds = new DatagramSocket(); + MulticastSocket ms = new MulticastSocket()) { + + Set first = s.supportedOptions(); + Set second = ss.supportedOptions(); + assertNotEqual(first, second, + "Socket and ServerSocket should have different options."); + + first = ds.supportedOptions(); + second = ms.supportedOptions(); + assertNotEqual(first, second, + "DatagramSocket and MulticastSocket should have different options."); + } + } + + /** Tests with the order of access to supportedOptions reversed. */ + static void second() throws IOException { + try (ServerSocket ss = new ServerSocket(); + Socket s = new Socket(); + DatagramSocket ds = new DatagramSocket(); + MulticastSocket ms = new MulticastSocket()) { + + Set first = ss.supportedOptions(); + Set second = s.supportedOptions(); + assertNotEqual(first, second, + "ServerSocket and Socket should have different options."); + + first = ms.supportedOptions(); + second = ds.supportedOptions(); + assertNotEqual(first, second, + "MulticastSocket and DatagramSocket should have different options."); + + } + } + + static void assertNotEqual(Set s1, Set s2, String message) { + if (s1.equals(s2)) { + out.println("s1: " + s1); + out.println("s2: " + s2); + throw new RuntimeException(message); + } + } +} diff --git a/jdk/test/java/net/SocketOption/UnsupportedOptionsTest.java b/jdk/test/java/net/SocketOption/UnsupportedOptionsTest.java index 0ab43f6ff27..488960c4bb3 100644 --- a/jdk/test/java/net/SocketOption/UnsupportedOptionsTest.java +++ b/jdk/test/java/net/SocketOption/UnsupportedOptionsTest.java @@ -33,7 +33,7 @@ import java.util.List; * @summary Test checks that UnsupportedOperationException for unsupported * SOCKET_OPTIONS is thrown by both getOption() and setOption() methods. * @run main UnsupportedOptionsTest - * @run main/othervm -Djdk.launcher.limitmods=java.base UnsupportedOptionsTest + * @run main/othervm -limitmods java.base UnsupportedOptionsTest */ public class UnsupportedOptionsTest { diff --git a/jdk/test/java/net/httpclient/HeadersTest1.java b/jdk/test/java/net/httpclient/HeadersTest1.java new file mode 100644 index 00000000000..79f62006722 --- /dev/null +++ b/jdk/test/java/net/httpclient/HeadersTest1.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2015, 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. 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 + */ + +/** + * @test + * @bug 8153142 + * @run main/othervm HeadersTest1 + * @summary HeadersTest1 + */ + +import com.sun.net.httpserver.HttpContext; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; +import com.sun.net.httpserver.Headers; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import java.net.PasswordAuthentication; +import java.net.URI; +import java.net.http.*; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.List; +import static java.nio.charset.StandardCharsets.US_ASCII; + +public class HeadersTest1 { + + final static String RESPONSE = "Hello world"; + + public static void main(String[] args) throws Exception { + HttpServer server = HttpServer.create(new InetSocketAddress(0), 10); + ExecutorService e = Executors.newCachedThreadPool(); + Handler h = new Handler(); + HttpContext serverContext = server.createContext("/test", h); + int port = server.getAddress().getPort(); + System.out.println("Server port = " + port); + + server.setExecutor(e); + server.start(); + HttpClient client = HttpClient.create() + .build(); + + try { + URI uri = new URI("http://127.0.0.1:" + Integer.toString(port) + "/test/foo"); + HttpRequest req = client.request(uri) + .headers("X-Bar", "foo1") + .headers("X-Bar", "foo2") + .GET(); + + HttpResponse resp = req.response(); + if (resp.statusCode() != 200) + throw new RuntimeException("Test failed: status code"); + HttpHeaders hd = resp.headers(); + List v = hd.allValues("X-Foo-Response"); + if (!v.contains("resp1")) + throw new RuntimeException("Test failed: resp1"); + if (!v.contains("resp2")) + throw new RuntimeException("Test failed: resp2"); + + } finally { + client.executorService().shutdownNow(); + server.stop(0); + e.shutdownNow(); + } + System.out.println("OK"); + } + + static class Handler implements HttpHandler { + + @Override + public void handle(HttpExchange he) throws IOException { + String method = he.getRequestMethod(); + InputStream is = he.getRequestBody(); + List l = he.getRequestHeaders().get("X-Bar"); + if (!l.contains("foo1") || !l.contains("foo2")) { + for (String s : l) + System.out.println("HH: " + s); + he.sendResponseHeaders(500, -1); + he.close(); + return; + } + Headers h = he.getResponseHeaders(); + h.add("X-Foo-Response", "resp1"); + h.add("X-Foo-Response", "resp2"); + he.sendResponseHeaders(200, RESPONSE.length()); + OutputStream os = he.getResponseBody(); + os.write(RESPONSE.getBytes(US_ASCII)); + os.close(); + } + + } +} diff --git a/jdk/test/java/net/httpclient/http2/ErrorTest.java b/jdk/test/java/net/httpclient/http2/ErrorTest.java new file mode 100644 index 00000000000..578dc4df797 --- /dev/null +++ b/jdk/test/java/net/httpclient/http2/ErrorTest.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8157105 + * @library /lib/testlibrary + * @build jdk.testlibrary.SimpleSSLContext + * @modules java.httpclient + * @compile/module=java.httpclient java/net/http/BodyOutputStream.java + * @compile/module=java.httpclient java/net/http/BodyInputStream.java + * @compile/module=java.httpclient java/net/http/EchoHandler.java + * @compile/module=java.httpclient java/net/http/Http2Handler.java + * @compile/module=java.httpclient java/net/http/Http2TestExchange.java + * @compile/module=java.httpclient java/net/http/Http2TestServerConnection.java + * @compile/module=java.httpclient java/net/http/Http2TestServer.java + * @compile/module=java.httpclient java/net/http/OutgoingPushPromise.java + * @compile/module=java.httpclient java/net/http/TestUtil.java + * @run testng/othervm -Djava.net.http.HttpClient.log=ssl,errors ErrorTest + * @summary check exception thrown when bad TLS parameters selected + */ + +import java.io.*; +import java.net.*; +import java.net.http.*; +import static java.net.http.HttpClient.Version.HTTP_2; +import javax.net.ssl.*; +import java.nio.file.*; +import java.util.concurrent.*; +import jdk.testlibrary.SimpleSSLContext; + + +import org.testng.annotations.Test; +import org.testng.annotations.Parameters; + +/** + * When selecting an unacceptable cipher suite the TLS handshake will fail. + * But, the exception that was thrown was not being returned up to application + * causing hang problems + */ +@Test +public class ErrorTest { + static int httpsPort; + static Http2TestServer httpsServer; + static HttpClient client = null; + static ExecutorService exec; + static SSLContext sslContext; + + static String httpsURIString; + + static HttpClient getClient() { + if (client == null) { + client = HttpClient.create() + .sslContext(sslContext) + .sslParameters(new SSLParameters( + new String[]{"TLS_KRB5_WITH_3DES_EDE_CBC_SHA"})) + .version(HTTP_2) + .build(); + } + return client; + } + + static URI getURI() { + return URI.create(httpsURIString); + } + + static final String SIMPLE_STRING = "Hello world Goodbye world"; + + @Test(timeOut=5000) + static void test() throws Exception { + try { + SimpleSSLContext sslct = new SimpleSSLContext(); + sslContext = sslct.get(); + client = getClient(); + exec = client.executorService(); + + httpsServer = new Http2TestServer(true, 0, new EchoHandler(), + exec, sslContext); + + httpsPort = httpsServer.getAddress().getPort(); + httpsURIString = "https://127.0.0.1:" + + Integer.toString(httpsPort) + "/bar/"; + + httpsServer.start(); + URI uri = getURI(); + System.err.println("Request to " + uri); + + HttpClient client = getClient(); + HttpRequest req = client.request(uri) + .body(HttpRequest.fromString(SIMPLE_STRING)) + .POST(); + HttpResponse response = null; + try { + response = req.response(); + throw new RuntimeException("Expected exception"); + } catch (IOException e) { + System.err.println("Expected IOException received " + e); + } + System.err.println("DONE"); + } finally { + httpsServer.stop(); + exec.shutdownNow(); + } + } +} diff --git a/jdk/test/java/net/httpclient/http2/TLSConnection.java b/jdk/test/java/net/httpclient/http2/TLSConnection.java new file mode 100644 index 00000000000..f2721eb268e --- /dev/null +++ b/jdk/test/java/net/httpclient/http2/TLSConnection.java @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.http.Http2Handler; +import java.net.http.Http2TestExchange; +import java.net.http.Http2TestServer; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import javax.net.ssl.SSLParameters; +import javax.net.ssl.SSLSession; + +/* + * @test + * @bug 8150769 8157107 + * @summary Checks that SSL parameters can be set for HTTP/2 connection + * @modules java.httpclient + * @compile/module=java.httpclient java/net/http/Http2Handler.java + * @compile/module=java.httpclient java/net/http/Http2TestExchange.java + * @compile/module=java.httpclient java/net/http/Http2TestServer.java + * @run main/othervm TLSConnection + */ +public class TLSConnection { + + private static final String KEYSTORE = System.getProperty("test.src") + + File.separator + "keystore.p12"; + private static final String PASSWORD = "password"; + + public static void main(String[] args) throws Exception { + + // enable all logging + System.setProperty("java.net.http.HttpClient.log", "all,frames:all"); + + // initialize JSSE + System.setProperty("javax.net.ssl.keyStore", KEYSTORE); + System.setProperty("javax.net.ssl.keyStorePassword", PASSWORD); + System.setProperty("javax.net.ssl.trustStore", KEYSTORE); + System.setProperty("javax.net.ssl.trustStorePassword", PASSWORD); + + Handler handler = new Handler(); + + try (Http2TestServer server = new Http2TestServer(true, 0, handler)) { + server.start(); + + int port = server.getAddress().getPort(); + String uriString = "https://127.0.0.1:" + Integer.toString(port); + + // run test cases + boolean success = true; + + SSLParameters parameters = null; + success &= expectFailure( + "Test #1: SSL parameters is null, expect NPE", + () -> connect(uriString, parameters), + NullPointerException.class); + + success &= expectSuccess( + "Test #2: default SSL parameters, " + + "expect successful connection", + () -> connect(uriString, new SSLParameters())); + success &= checkProtocol(handler.getSSLSession(), "TLSv1.2"); + + // set SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA cipher suite + // which has less priority in default cipher suite list + success &= expectSuccess( + "Test #3: SSL parameters with " + + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA cipher suite, " + + "expect successful connection", + () -> connect(uriString, new SSLParameters( + new String[] { "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA" }))); + success &= checkProtocol(handler.getSSLSession(), "TLSv1.2"); + success &= checkCipherSuite(handler.getSSLSession(), + "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA"); + + // set TLS_RSA_WITH_AES_128_CBC_SHA cipher suite + // which has less priority in default cipher suite list + // also set TLSv11 protocol + success &= expectSuccess( + "Test #4: SSL parameters with " + + "TLS_RSA_WITH_AES_128_CBC_SHA cipher suite," + + " expect successful connection", + () -> connect(uriString, new SSLParameters( + new String[] { "TLS_RSA_WITH_AES_128_CBC_SHA" }, + new String[] { "TLSv1.1" }))); + success &= checkProtocol(handler.getSSLSession(), "TLSv1.1"); + success &= checkCipherSuite(handler.getSSLSession(), + "TLS_RSA_WITH_AES_128_CBC_SHA"); + + if (success) { + System.out.println("Test passed"); + } else { + throw new RuntimeException("At least one test case failed"); + } + } + } + + private static interface Test { + + public void run() throws Exception; + } + + private static class Handler implements Http2Handler { + + private static final byte[] BODY = "Test response".getBytes(); + + private volatile SSLSession sslSession; + + @Override + public void handle(Http2TestExchange t) throws IOException { + System.out.println("Handler: received request to " + + t.getRequestURI()); + + try (InputStream is = t.getRequestBody()) { + byte[] body = is.readAllBytes(); + System.out.println("Handler: read " + body.length + + " bytes of body: "); + System.out.println(new String(body)); + } + + try (OutputStream os = t.getResponseBody()) { + t.sendResponseHeaders(200, BODY.length); + os.write(BODY); + } + + sslSession = t.getSSLSession(); + } + + SSLSession getSSLSession() { + return sslSession; + } + } + + private static void connect(String uriString, SSLParameters sslParameters) + throws URISyntaxException, IOException, InterruptedException { + + String body = HttpClient.create() + .sslParameters(sslParameters) + .version(HttpClient.Version.HTTP_2) + .build() + .request(new URI(uriString)) + .body(HttpRequest.fromString("body")) + .GET() + .response() + .body(HttpResponse.asString()); + + System.out.println("Response: " + body); + } + + private static boolean checkProtocol(SSLSession session, String protocol) { + if (session == null) { + System.out.println("Check protocol: no session provided"); + return false; + } + + System.out.println("Check protocol: negotiated protocol: " + + session.getProtocol()); + System.out.println("Check protocol: expected protocol: " + + protocol); + if (!protocol.equals(session.getProtocol())) { + System.out.println("Check protocol: unexpected negotiated protocol"); + return false; + } + + return true; + } + + private static boolean checkCipherSuite(SSLSession session, String ciphersuite) { + if (session == null) { + System.out.println("Check protocol: no session provided"); + return false; + } + + System.out.println("Check protocol: negotiated ciphersuite: " + + session.getCipherSuite()); + System.out.println("Check protocol: expected ciphersuite: " + + ciphersuite); + if (!ciphersuite.equals(session.getCipherSuite())) { + System.out.println("Check protocol: unexpected negotiated ciphersuite"); + return false; + } + + return true; + } + + private static boolean expectSuccess(String message, Test test) { + System.out.println(message); + try { + test.run(); + System.out.println("Passed"); + return true; + } catch (Exception e) { + System.out.println("Failed: unexpected exception:"); + e.printStackTrace(System.out); + return false; + } + } + + private static boolean expectFailure(String message, Test test, + Class expectedException) { + + System.out.println(message); + try { + test.run(); + System.out.println("Failed: unexpected successful connection"); + return false; + } catch (Exception e) { + System.out.println("Got an exception:"); + e.printStackTrace(System.out); + if (expectedException != null + && !expectedException.isAssignableFrom(e.getClass())) { + System.out.printf("Failed: expected %s, but got %s%n", + expectedException.getName(), + e.getClass().getName()); + return false; + } + System.out.println("Passed: expected exception"); + return true; + } + } + +} diff --git a/jdk/test/java/net/httpclient/http2/java.httpclient/java/net/http/Http2TestServer.java b/jdk/test/java/net/httpclient/http2/java.httpclient/java/net/http/Http2TestServer.java index 667a1d6ec55..3baefe142bb 100644 --- a/jdk/test/java/net/httpclient/http2/java.httpclient/java/net/http/Http2TestServer.java +++ b/jdk/test/java/net/httpclient/http2/java.httpclient/java/net/http/Http2TestServer.java @@ -42,7 +42,7 @@ import javax.net.ssl.SSLServerSocketFactory; * Http2Handler on additional threads. All threads * obtained from the supplied ExecutorService. */ -public class Http2TestServer { +public class Http2TestServer implements AutoCloseable { final ServerSocket server; boolean secure; SettingsFrame serverSettings, clientSettings; @@ -156,4 +156,9 @@ public class Http2TestServer { }); } + @Override + public void close() throws Exception { + stop(); + } + } diff --git a/jdk/test/java/nio/Buffer/Order-X.java.template b/jdk/test/java/nio/Buffer/Order-X.java.template index a8753a5f8a9..97313a841f6 100644 --- a/jdk/test/java/nio/Buffer/Order-X.java.template +++ b/jdk/test/java/nio/Buffer/Order-X.java.template @@ -52,8 +52,5 @@ public class Order$Type$ extends Order { buf = $Type$Buffer.allocate(LENGTH); ck(buf.order(), nord); ck$Type$Buffer(buf, nord); - - ck$Type$Buffer(ByteBuffer.allocate(LENGTH).as$Type$Buffer(), be); - ck$Type$Buffer(ByteBuffer.allocateDirect(LENGTH).as$Type$Buffer(), be); } } diff --git a/jdk/test/java/nio/Buffer/Order.java b/jdk/test/java/nio/Buffer/Order.java index 0232992525b..33ae418bb56 100644 --- a/jdk/test/java/nio/Buffer/Order.java +++ b/jdk/test/java/nio/Buffer/Order.java @@ -51,25 +51,31 @@ public class Order { ck(bb.asDoubleBuffer().order(), bb.order()); } + private static void ckCopyViews(ByteBuffer bb) { + ck(bb.asReadOnlyBuffer().order(), be); + ck(bb.duplicate().order(), be); + ck(bb.slice().order(), be); + } + private static void ckByteBuffer(ByteBuffer bb) { ckViews(bb); + ckCopyViews(bb); bb.order(be); ckViews(bb); + ckCopyViews(bb); bb.order(le); ckViews(bb); - - if (bb.hasArray()) { - byte[] array = bb.array(); - ck(ByteBuffer.wrap(array, LENGTH/2, LENGTH/2).order(), be); - ck(ByteBuffer.wrap(array).order(), be); - ck(bb.asReadOnlyBuffer().order(), be); - ck(bb.duplicate().order(), be); - ck(bb.slice().order(), be); - } + ckCopyViews(bb); } public static void main(String args[]) throws Exception { + ck(ByteBuffer.wrap(new byte[LENGTH], LENGTH/2, LENGTH/2).order(), be); + ck(ByteBuffer.wrap(new byte[LENGTH]).order(), be); + ck(ByteBuffer.wrap(new byte[LENGTH], LENGTH/2, LENGTH/2).order(be).order(), be); + ck(ByteBuffer.wrap(new byte[LENGTH]).order(be).order(), be); + ck(ByteBuffer.wrap(new byte[LENGTH], LENGTH/2, LENGTH/2).order(le).order(), le); + ck(ByteBuffer.wrap(new byte[LENGTH]).order(le).order(), le); ck(ByteBuffer.allocate(LENGTH).order(), be); ck(ByteBuffer.allocateDirect(LENGTH).order(), be); ck(ByteBuffer.allocate(LENGTH).order(be).order(), be); diff --git a/jdk/test/java/nio/Buffer/OrderChar.java b/jdk/test/java/nio/Buffer/OrderChar.java index ebf9faad79c..f72828bd0de 100644 --- a/jdk/test/java/nio/Buffer/OrderChar.java +++ b/jdk/test/java/nio/Buffer/OrderChar.java @@ -52,8 +52,5 @@ public class OrderChar extends Order { buf = CharBuffer.allocate(LENGTH); ck(buf.order(), nord); ckCharBuffer(buf, nord); - - ckCharBuffer(ByteBuffer.allocate(LENGTH).asCharBuffer(), be); - ckCharBuffer(ByteBuffer.allocateDirect(LENGTH).asCharBuffer(), be); } } diff --git a/jdk/test/java/nio/Buffer/OrderDouble.java b/jdk/test/java/nio/Buffer/OrderDouble.java index deaa6a3eb27..4100695cab5 100644 --- a/jdk/test/java/nio/Buffer/OrderDouble.java +++ b/jdk/test/java/nio/Buffer/OrderDouble.java @@ -52,8 +52,5 @@ public class OrderDouble extends Order { buf = DoubleBuffer.allocate(LENGTH); ck(buf.order(), nord); ckDoubleBuffer(buf, nord); - - ckDoubleBuffer(ByteBuffer.allocate(LENGTH).asDoubleBuffer(), be); - ckDoubleBuffer(ByteBuffer.allocateDirect(LENGTH).asDoubleBuffer(), be); } } diff --git a/jdk/test/java/nio/Buffer/OrderFloat.java b/jdk/test/java/nio/Buffer/OrderFloat.java index 6a65eaa8e4f..905d531d434 100644 --- a/jdk/test/java/nio/Buffer/OrderFloat.java +++ b/jdk/test/java/nio/Buffer/OrderFloat.java @@ -52,8 +52,5 @@ public class OrderFloat extends Order { buf = FloatBuffer.allocate(LENGTH); ck(buf.order(), nord); ckFloatBuffer(buf, nord); - - ckFloatBuffer(ByteBuffer.allocate(LENGTH).asFloatBuffer(), be); - ckFloatBuffer(ByteBuffer.allocateDirect(LENGTH).asFloatBuffer(), be); } } diff --git a/jdk/test/java/nio/Buffer/OrderInt.java b/jdk/test/java/nio/Buffer/OrderInt.java index 5d3843ffec7..700fc07110a 100644 --- a/jdk/test/java/nio/Buffer/OrderInt.java +++ b/jdk/test/java/nio/Buffer/OrderInt.java @@ -52,8 +52,5 @@ public class OrderInt extends Order { buf = IntBuffer.allocate(LENGTH); ck(buf.order(), nord); ckIntBuffer(buf, nord); - - ckIntBuffer(ByteBuffer.allocate(LENGTH).asIntBuffer(), be); - ckIntBuffer(ByteBuffer.allocateDirect(LENGTH).asIntBuffer(), be); } } diff --git a/jdk/test/java/nio/Buffer/OrderLong.java b/jdk/test/java/nio/Buffer/OrderLong.java index abda8b22932..9e507ffc18e 100644 --- a/jdk/test/java/nio/Buffer/OrderLong.java +++ b/jdk/test/java/nio/Buffer/OrderLong.java @@ -52,8 +52,5 @@ public class OrderLong extends Order { buf = LongBuffer.allocate(LENGTH); ck(buf.order(), nord); ckLongBuffer(buf, nord); - - ckLongBuffer(ByteBuffer.allocate(LENGTH).asLongBuffer(), be); - ckLongBuffer(ByteBuffer.allocateDirect(LENGTH).asLongBuffer(), be); } } diff --git a/jdk/test/java/nio/Buffer/OrderShort.java b/jdk/test/java/nio/Buffer/OrderShort.java index d19b43a1b60..f385b62d6dd 100644 --- a/jdk/test/java/nio/Buffer/OrderShort.java +++ b/jdk/test/java/nio/Buffer/OrderShort.java @@ -52,8 +52,5 @@ public class OrderShort extends Order { buf = ShortBuffer.allocate(LENGTH); ck(buf.order(), nord); ckShortBuffer(buf, nord); - - ckShortBuffer(ByteBuffer.allocate(LENGTH).asShortBuffer(), be); - ckShortBuffer(ByteBuffer.allocateDirect(LENGTH).asShortBuffer(), be); } } diff --git a/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java b/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java index 00281647f17..270efce9126 100644 --- a/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java +++ b/jdk/test/java/nio/channels/DatagramChannel/SocketOptionTests.java @@ -25,7 +25,7 @@ * @bug 4640544 8044773 * @summary Unit test for setOption/getOption/options methods * @run main SocketOptionTests - * @run main/othervm -Djdk.launcher.limitmods=java.base SocketOptionTests + * @run main/othervm -limitmods java.base SocketOptionTests */ import java.nio.*; diff --git a/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java b/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java index a0b2b6a8e82..b8c7c327bcb 100644 --- a/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java +++ b/jdk/test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java @@ -26,7 +26,7 @@ * @summary Unit test for ServerSocketChannel setOption/getOption/options * methods. * @run main SocketOptionTests - * @run main/othervm -Djdk.launcher.limitmods=java.base SocketOptionTests + * @run main/othervm -limitmods java.base SocketOptionTests */ import java.nio.*; diff --git a/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java b/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java index 74f87c71623..38a4e9c170e 100644 --- a/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java +++ b/jdk/test/java/nio/channels/SocketChannel/SocketOptionTests.java @@ -26,7 +26,7 @@ * @summary Unit test to check SocketChannel setOption/getOption/options * methods. * @run main SocketOptionTests - * @run main/othervm -Djdk.launcher.limitmods=java.base SocketOptionTests + * @run main/othervm -limitmods java.base SocketOptionTests */ import java.nio.*; diff --git a/jdk/test/java/security/Provider/DefaultProviderList.java b/jdk/test/java/security/Provider/DefaultProviderList.java index c2836642f42..ba63c76caf6 100644 --- a/jdk/test/java/security/Provider/DefaultProviderList.java +++ b/jdk/test/java/security/Provider/DefaultProviderList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,13 +23,16 @@ /** * @test - * @bug 7191662 + * @bug 7191662 8157469 * @summary Ensure non-java.base providers can be found by ServiceLoader * @author Valerie Peng */ -import java.util.*; -import java.security.*; +import java.security.Provider; +import java.security.Security; +import java.util.Arrays; +import java.util.Iterator; +import java.util.ServiceLoader; public class DefaultProviderList { @@ -44,7 +47,8 @@ public class DefaultProviderList { String pName = p.getName(); // only providers outside java.base are loaded by ServiceLoader if (pName.equals("SUN") || pName.equals("SunRsaSign") || - pName.equals("SunJCE") || pName.equals("SunJSSE")) { + pName.equals("SunJCE") || pName.equals("SunJSSE") || + pName.equals("Apple")) { System.out.println("Skip test for provider " + pName); continue; } diff --git a/jdk/test/java/security/SecureRandom/ApiTest.java b/jdk/test/java/security/SecureRandom/ApiTest.java new file mode 100644 index 00000000000..e48ee4a90de --- /dev/null +++ b/jdk/test/java/security/SecureRandom/ApiTest.java @@ -0,0 +1,366 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8141039 + * @library /lib/testlibrary + * @summary This test do API coverage for SecureRandom. It covers most of + * supported operations along with possible positive and negative + * parameters for DRBG mechanism. + * @run main/othervm ApiTest Hash_DRBG + * @run main/othervm ApiTest HMAC_DRBG + * @run main/othervm ApiTest CTR_DRBG + * @run main/othervm ApiTest SHA1PRNG + * @run main/othervm ApiTest NATIVE + */ +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.Security; +import java.security.SecureRandomParameters; +import java.security.DrbgParameters; +import java.security.DrbgParameters.Instantiation; +import java.security.DrbgParameters.Capability; +import javax.crypto.Cipher; + +public class ApiTest { + + private static final boolean SHOULD_PASS = true; + private static final long SEED = 1l; + private static final String INVALID_ALGO = "INVALID"; + private static final String DRBG_CONFIG = "securerandom.drbg.config"; + private static final String DRBG_CONFIG_VALUE + = Security.getProperty(DRBG_CONFIG); + + public static void main(String[] args) throws Exception { + System.setProperty("java.security.egd", "file:/dev/urandom"); + + if (args == null || args.length < 1) { + throw new RuntimeException("No mechanism available to run test."); + } + String mech + = "NATIVE".equals(args[0]) ? supportedNativeAlgo() : args[0]; + String[] algs = null; + boolean success = true; + + try { + if (!isDRBG(mech)) { + SecureRandom random = SecureRandom.getInstance(mech); + verifyAPI(random, mech); + return; + } else if (mech.equals("CTR_DRBG")) { + algs = new String[]{"AES-128", "AES-192", "AES-256", + INVALID_ALGO}; + } else if (mech.equals("Hash_DRBG") || mech.equals("HMAC_DRBG")) { + algs = new String[]{"SHA-224", "SHA-256", "SHA-512/224", + "SHA-512/256", "SHA-384", "SHA-512", INVALID_ALGO}; + } else { + throw new RuntimeException( + String.format("Not a valid mechanism '%s'", mech)); + } + runForEachMech(mech, algs); + } catch (Exception e) { + e.printStackTrace(System.out); + success = false; + } + + if (!success) { + throw new RuntimeException("At least one test failed."); + } + } + + /** + * Run the test for a DRBG mechanism with a possible set of parameter + * combination. + * @param mech DRBG mechanism name + * @param algs Algorithm supported by each mechanism + * @throws Exception + */ + private static void runForEachMech(String mech, String[] algs) + throws Exception { + for (String alg : algs) { + runForEachAlg(mech, alg); + } + } + + private static void runForEachAlg(String mech, String alg) + throws Exception { + for (int strength : new int[]{Integer.MIN_VALUE, -1, 0, 1, 223, 224, + 192, 255, 256}) { + for (Capability cp : Capability.values()) { + for (byte[] pr : new byte[][]{null, new byte[]{}, + "personal".getBytes()}) { + SecureRandomParameters param + = DrbgParameters.instantiation(strength, cp, pr); + runForEachParam(mech, alg, param); + } + } + } + } + + private static void runForEachParam(String mech, String alg, + SecureRandomParameters param) throws Exception { + + for (boolean df : new Boolean[]{true, false}) { + try { + Security.setProperty(DRBG_CONFIG, mech + "," + alg + "," + + (df ? "use_df" : "no_df")); + System.out.printf("%nParameter for SecureRandom " + + "mechanism: %s is (param:%s, algo:%s, df:%s)", + mech, param, alg, df); + SecureRandom sr = SecureRandom.getInstance("DRBG", param); + verifyAPI(sr, mech); + } catch (NoSuchAlgorithmException e) { + // Verify exception status for current test. + checkException(getDefaultAlg(mech, alg), param, e); + } finally { + Security.setProperty(DRBG_CONFIG, DRBG_CONFIG_VALUE); + } + } + } + + /** + * Returns the algorithm supported for input mechanism. + * @param mech Mechanism name + * @param alg Algorithm name + * @return Algorithm name + */ + private static String getDefaultAlg(String mech, String alg) + throws NoSuchAlgorithmException { + if (alg == null) { + switch (mech) { + case "Hash_DRBG": + case "HMAC_DRBG": + return "SHA-256"; + case "CTR_DRBG": + return (Cipher.getMaxAllowedKeyLength("AES") < 256) + ? "AES-128" : "AES-256"; + default: + throw new RuntimeException("Mechanism not supported"); + } + } + return alg; + } + + /** + * Verify the exception type either it is expected to occur or not. + * @param alg Algorithm name + * @param param DRBG parameter + * @param e Exception to verify + * @throws NoSuchAlgorithmException + */ + private static void checkException(String alg, SecureRandomParameters param, + NoSuchAlgorithmException e) throws NoSuchAlgorithmException { + + int strength = ((Instantiation) param).getStrength(); + boolean error = true; + switch (alg) { + case INVALID_ALGO: + error = false; + break; + case "SHA-224": + case "SHA-512/224": + if (strength > 192) { + error = false; + } + break; + case "SHA-256": + case "SHA-512/256": + case "SHA-384": + case "SHA-512": + if (strength > 256) { + error = false; + } + break; + case "AES-128": + case "AES-192": + case "AES-256": + int algoStrength = Integer.parseInt(alg.replaceAll("AES-", "")); + int maxStrengthSupported = Cipher.getMaxAllowedKeyLength("AES"); + if (strength > maxStrengthSupported + || algoStrength > maxStrengthSupported) { + error = false; + } + break; + } + if (error) { + throw new RuntimeException("Unknown :", e); + } + } + + /** + * Find if the mechanism is a DRBG mechanism. + * @param mech Mechanism name + * @return True for DRBG mechanism else False + */ + private static boolean isDRBG(String mech) { + return mech.contains("_DRBG"); + } + + /** + * Find the name of supported native mechanism name for current platform. + */ + private static String supportedNativeAlgo() { + String nativeSr = "Windows-PRNG"; + try { + SecureRandom.getInstance(nativeSr); + } catch (NoSuchAlgorithmException e) { + nativeSr = "NativePRNG"; + } + return nativeSr; + } + + /** + * Test a possible set of SecureRandom API for a SecureRandom instance. + * @param random SecureRandom instance + * @param mech Mechanism used to create SecureRandom instance + */ + private static void verifyAPI(SecureRandom random, String mech) + throws Exception { + + System.out.printf("%nTest SecureRandom mechanism: %s for provider: %s", + mech, random.getProvider().getName()); + byte[] output = new byte[2]; + + // Generate random number. + random.nextBytes(output); + + // Seed the SecureRandom with a generated seed value of lesser size. + byte[] seed = random.generateSeed(1); + random.setSeed(seed); + random.nextBytes(output); + + // Seed the SecureRandom with a fixed seed value. + random.setSeed(SEED); + random.nextBytes(output); + + // Seed the SecureRandom with a larger seed value. + seed = random.generateSeed(128); + random.setSeed(seed); + random.nextBytes(output); + + // Additional operation only supported for DRBG based SecureRandom. + // Execute the code block and expect to pass for DRBG. If it will fail + // then it should fail with specified exception type. Else the case + // will be considered as a test case failure. + matchExc(() -> { + random.reseed(); + random.nextBytes(output); + }, + isDRBG(mech), + UnsupportedOperationException.class, + String.format("PASS - Unsupported reseed() method for " + + "SecureRandom Algorithm %s ", mech)); + + matchExc(() -> { + random.reseed(DrbgParameters.reseed(false, new byte[]{})); + random.nextBytes(output); + }, + isDRBG(mech), + UnsupportedOperationException.class, + String.format("PASS - Unsupported reseed(param) method for " + + "SecureRandom Algorithm %s ", mech)); + + matchExc(() -> { + random.reseed(DrbgParameters.reseed(true, new byte[]{})); + random.nextBytes(output); + }, + isDRBG(mech), + !isSupportPR(mech, random) ? IllegalArgumentException.class + : UnsupportedOperationException.class, + String.format("PASS - Unsupported or illegal reseed(param) " + + "method for SecureRandom Algorithm %s ", mech)); + + matchExc(() -> random.nextBytes(output, + DrbgParameters.nextBytes(-1, false, new byte[]{})), + isDRBG(mech), + UnsupportedOperationException.class, + String.format("PASS - Unsupported nextBytes(out, nextByteParam)" + + " method for SecureRandom Algorithm %s ", mech)); + + matchExc(() -> random.nextBytes(output, + DrbgParameters.nextBytes(-1, true, new byte[]{})), + isDRBG(mech), + !isSupportPR(mech, random) ? IllegalArgumentException.class + : UnsupportedOperationException.class, + String.format("PASS - Unsupported or illegal " + + "nextBytes(out, nextByteParam) method for " + + "SecureRandom Algorithm %s ", mech)); + + matchExc(() -> { + random.reseed(null); + random.nextBytes(output); + }, + !SHOULD_PASS, + IllegalArgumentException.class, + "PASS - Test is expected to fail when parameter for reseed() " + + "is null"); + + matchExc(() -> random.nextBytes(output, null), + !SHOULD_PASS, + IllegalArgumentException.class, + "PASS - Test is expected to fail when parameter for nextBytes()" + + " is null"); + + } + + private static boolean isSupportPR(String mech, SecureRandom random) { + return (isDRBG(mech) && ((Instantiation) random.getParameters()) + .getCapability() + .supportsPredictionResistance()); + } + + private interface RunnableCode { + + void run() throws Exception; + } + + /** + * Execute a given code block and verify, if the exception type is expected. + * @param r Code block to run + * @param ex Expected exception type + * @param shouldPass If the code execution expected to pass without failure + * @param msg Message to log in case of expected failure + */ + private static void matchExc(RunnableCode r, boolean shouldPass, Class ex, + String msg) { + try { + r.run(); + if (!shouldPass) { + throw new RuntimeException("Excecution should fail here."); + } + } catch (Exception e) { + System.out.printf("%nOccured exception: %s - Expected exception: " + + "%s : ", e.getClass(), ex.getCanonicalName()); + if (ex.isAssignableFrom(e.getClass())) { + System.out.printf("%n%s : Expected Exception occured: %s : ", + e.getClass(), msg); + } else if (shouldPass) { + throw new RuntimeException(e); + } else { + System.out.printf("Ignore the following exception: %s%n", + e.getMessage()); + } + } + } +} diff --git a/jdk/test/java/security/SecureRandom/EnoughSeedTest.java b/jdk/test/java/security/SecureRandom/EnoughSeedTest.java new file mode 100644 index 00000000000..a42807d0530 --- /dev/null +++ b/jdk/test/java/security/SecureRandom/EnoughSeedTest.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8141039 + * @library /lib/testlibrary + * @summary Check SecureRandom generate expected seed counts what the caller + * asked for. + * @run main/othervm EnoughSeedTest + */ +import java.security.SecureRandom; +import java.security.Security; +import static java.lang.Math.*; + +public class EnoughSeedTest { + + private static final String DRBG_CONFIG = "securerandom.drbg.config"; + private static final String DRBG_CONFIG_VALUE + = Security.getProperty(DRBG_CONFIG); + + public static void main(String[] args) { + System.setProperty("java.security.egd", "file:/dev/urandom"); + + boolean success = true; + for (String mech : new String[]{ + "SHA1PRNG", "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + System.out.printf("%nTest for SecureRandom algorithm: '%s'", mech); + try { + SecureRandom sr = null; + if (!mech.contains("_DRBG")) { + sr = SecureRandom.getInstance(mech); + } else { + Security.setProperty(DRBG_CONFIG, mech); + sr = SecureRandom.getInstance("DRBG"); + } + + success &= forEachSeedBytes(sr); + System.out.printf("%nCompleted test for SecureRandom " + + "mechanism: '%s'", mech); + } catch (Exception e) { + success &= false; + e.printStackTrace(System.out); + } finally { + Security.setProperty(DRBG_CONFIG, DRBG_CONFIG_VALUE); + } + } + if (!success) { + throw new RuntimeException("At least one test failed."); + } + } + + /** + * Generates fixed number of seed bytes through a SecureRandom instance + * to verify it's seed generation status. + * @param sr SecureRandom instance + * @return The test success indicator + */ + private static boolean forEachSeedBytes(SecureRandom sr) { + boolean success = true; + sr.setSeed(1l); + for (int seedByte : new int[]{Integer.MIN_VALUE, -1, 0, 1, 256, 1024, + Short.MAX_VALUE, (int) pow(2, 20)}) { + try { + byte[] seed = sr.generateSeed(seedByte); + if (seed.length != seedByte) { + throw new RuntimeException("Not able to produce expected " + + "seed size."); + } + } catch (IllegalArgumentException e) { + if (seedByte >= 0) { + throw new RuntimeException("Unknown Exception occured.", e); + } + System.out.printf("%nPASS - Exception expected when required " + + "seed size requested is negative: %s", seedByte); + } + } + return success; + } + +} diff --git a/jdk/test/java/security/SecureRandom/GetAlgorithm.java b/jdk/test/java/security/SecureRandom/GetAlgorithm.java index b1947ef1db8..1ec3fd25ce2 100644 --- a/jdk/test/java/security/SecureRandom/GetAlgorithm.java +++ b/jdk/test/java/security/SecureRandom/GetAlgorithm.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -23,49 +23,54 @@ /** * @test - * @bug 4915392 + * @bug 4915392 8141039 * @summary test that the getAlgorithm() method works correctly * @author Andreas Sterbenz + * @run main GetAlgorithm */ - import java.io.*; - import java.security.*; +import java.util.Arrays; +import java.util.List; public class GetAlgorithm { - private final static String BASE = System.getProperty("test.src", "."); + private static final String BASE = System.getProperty("test.src", "."); + private static final String DRBG_CONFIG = "securerandom.drbg.config"; + private static final String DRBG_CONFIG_VALUE + = Security.getProperty(DRBG_CONFIG); public static void main(String[] args) throws Exception { - SecureRandom sr; - - sr = new SecureRandom(); + SecureRandom sr = new SecureRandom(); if (sr.getAlgorithm().equals("unknown")) { throw new Exception("Unknown: " + sr.getAlgorithm()); } - sr = SecureRandom.getInstance("SHA1PRNG"); - check("SHA1PRNG", sr); + for (String mech : new String[]{supportedNativeAlgo(), "SHA1PRNG", + "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + if (!mech.contains("_DRBG")) { + check(mech, SecureRandom.getInstance(mech)); + } else { + try { + Security.setProperty(DRBG_CONFIG, mech); + check("DRBG", SecureRandom.getInstance("DRBG")); + } finally { + Security.setProperty(DRBG_CONFIG, DRBG_CONFIG_VALUE); + } + } + } + check("unknown", new MySecureRandom()); -// OutputStream out = new FileOutputStream("sha1prng.bin"); -// ObjectOutputStream oout = new ObjectOutputStream(out); -// sr.nextInt(); -// oout.writeObject(sr); -// oout.flush(); -// oout.close(); - - sr = new MySecureRandom(); - check("unknown", sr); - - InputStream in = new FileInputStream(new File(BASE, "sha1prng-old.bin")); + InputStream in = new FileInputStream( + new File(BASE, "sha1prng-old.bin")); ObjectInputStream oin = new ObjectInputStream(in); - sr = (SecureRandom)oin.readObject(); + sr = (SecureRandom) oin.readObject(); oin.close(); check("unknown", sr); in = new FileInputStream(new File(BASE, "sha1prng-new.bin")); oin = new ObjectInputStream(in); - sr = (SecureRandom)oin.readObject(); + sr = (SecureRandom) oin.readObject(); oin.close(); check("SHA1PRNG", sr); @@ -83,4 +88,17 @@ public class GetAlgorithm { } + /** + * Find the name of supported native mechanism name for current platform. + */ + private static String supportedNativeAlgo() { + String nativeSr = "Windows-PRNG"; + try { + SecureRandom.getInstance(nativeSr); + } catch (NoSuchAlgorithmException e) { + nativeSr = "NativePRNG"; + } + return nativeSr; + } + } diff --git a/jdk/test/java/security/SecureRandom/GetInstanceTest.java b/jdk/test/java/security/SecureRandom/GetInstanceTest.java new file mode 100644 index 00000000000..08477da847e --- /dev/null +++ b/jdk/test/java/security/SecureRandom/GetInstanceTest.java @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8141039 + * @library /lib/testlibrary + * @summary SecureRandom supports multiple getInstance method including + * getInstanceStrong() method. This test verifies a set of possible + * cases for getInstance with different SecureRandom mechanism + * supported in Java. + * @run main GetInstanceTest + */ +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.SecureRandom; +import java.security.SecureRandomParameters; +import java.security.DrbgParameters; +import static java.security.DrbgParameters.Capability.*; +import java.security.Security; +import java.util.Arrays; +import jdk.testlibrary.Asserts; + +public class GetInstanceTest { + + private static final boolean PASS = true; + private static final String INVALID_ALGO = "INVALID"; + private static final String SUN_PROVIDER = "SUN"; + private static final String INVALID_PROVIDER = "INVALID"; + private static final String STRONG_ALG_SEC_PROP + = "securerandom.strongAlgorithms"; + private static final String DRBG_CONFIG = "securerandom.drbg.config"; + private static final String DRBG_CONFIG_VALUE + = Security.getProperty(DRBG_CONFIG); + + public static void main(String[] args) throws Exception { + + boolean success = true; + // Only accepted failure is NoSuchAlgorithmException. + // For any other failure the test case will fail here. + SecureRandom sr = matchExc(() -> SecureRandom.getInstanceStrong(), + PASS, NoSuchAlgorithmException.class, + "PASS - Undefined security Property " + + "'securerandom.strongAlgorithms'"); + System.out.format("Current platform supports mechanism: '%s' through " + + "provider: '%s' for the method getInstanceStrong().", + sr.getAlgorithm(), sr.getProvider().getName()); + + // DRBG name should appear with "securerandom.strongAlgorithms" + // security property. + String origDRBGConfig = Security.getProperty(STRONG_ALG_SEC_PROP); + if (!origDRBGConfig.contains("DRBG")) { + throw new RuntimeException("DRBG is not associated with default " + + "strong algorithm through security Property: " + + "'securerandom.strongAlgorithms'."); + } + try { + Security.setProperty(STRONG_ALG_SEC_PROP, "DRBG:SUN"); + sr = matchExc(() -> SecureRandom.getInstanceStrong(), + PASS, NoSuchAlgorithmException.class, + "PASS - Undefined security Property " + + "'securerandom.strongAlgorithms'"); + checkAttributes(sr, "DRBG"); + } finally { + Security.setProperty(STRONG_ALG_SEC_PROP, origDRBGConfig); + } + + for (String mech : new String[]{ + "SHA1PRNG", "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG", INVALID_ALGO,}) { + System.out.printf("%nTest SecureRandom mechanism: '%s'", mech); + try { + if (isDRBG(mech)) { + Security.setProperty(DRBG_CONFIG, mech); + } + verifyInstance(mech); + } catch (Exception e) { + e.printStackTrace(System.out); + success = false; + } finally { + Security.setProperty(DRBG_CONFIG, DRBG_CONFIG_VALUE); + } + } + if (!success) { + throw new RuntimeException("At least one test failed."); + } + } + + private static void verifyInstance(String mech) throws Exception { + + String srAlgo = isDRBG(mech) ? "DRBG" : mech; + + // Test for getInstance(algorithm) method. + // It should pass for all case other than invalid algorithm name. + // If it fails then the expected exception type should be + // NoSuchAlgorithmException. Any other Exception type occured will be + // treated as failure. + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo), !(nsa(mech)), + NoSuchAlgorithmException.class, + String.format("PASS - It is expected to fail for" + + " getInstance(algorithm) when algorithm: '%s'" + + " is null or invalid.", mech)), mech); + // Test for getInstance(algorithm, provider) method. + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo, + Security.getProvider(SUN_PROVIDER)), + !(nsa(mech)), + NoSuchAlgorithmException.class, + String.format("PASS - It is expected to fail for" + + " getInstance(algorithm, provider) when" + + " algorithm:'%s' is null or invalid.", mech)), + mech); + // Test for getInstance(algorithm, providerName) method. + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo, SUN_PROVIDER), + !(nsa(mech)), NoSuchAlgorithmException.class, + String.format("PASS - It is expected to fail for " + + "getInstance(algorithm, providerName) when " + + "algorithm: '%s' is null or invalid.", mech)), + mech); + // Test for getInstance(algorithm, providerName) method. + checkAttributes( + matchExc(() -> SecureRandom.getInstance( + srAlgo, INVALID_PROVIDER), + !PASS, NoSuchProviderException.class, + String.format("PASS - It is expected to fail for " + + "getInstance(algorithm, providerName) when " + + "provider name: '%s' is invalid and " + + "algorithm: '%s'", INVALID_PROVIDER, mech)), + mech); + + // Run the test for a set of SecureRandomParameters + for (SecureRandomParameters param : Arrays.asList(null, + DrbgParameters.instantiation(-1, NONE, null))) { + + System.out.printf("%nRunning DRBG param getInstance() methods " + + "for algorithm: %s and DRBG param type: %s", mech, + (param != null) ? param.getClass().getName() : param); + + // Following Test are applicable for new DRBG methods only. + // Test for getInstance(algorithm, params) method. + // Tests are expected to pass for DRBG type with valid parameter + // If it fails the expected exception type is derived from + // getExcType(mech, param) method. If exception type is not + // expected then the test will be considered as failure. + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo, param), + (isDRBG(mech)) && (isValidDRBGParam(param)), + getExcType(mech, param), + String.format("PASS - It is expected to fail " + + "for getInstance(algorithm, params) " + + "for algorithm: %s and parameter: %s", + mech, param)), + mech); + // Test for getInstance(algorithm, params, provider) method. + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo, param, + Security.getProvider(SUN_PROVIDER)), + (isDRBG(mech)) && (isValidDRBGParam(param)), + getExcType(mech, param), + String.format("PASS - It is expected to fail " + + "for getInstance(algorithm, params, " + + "provider) for algorithm: %s and " + + "parameter: %s", mech, param)), + mech); + // Test for getInstance(algorithm, params, providerName) method. + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo, param, + SUN_PROVIDER), + (isDRBG(mech)) && (isValidDRBGParam(param)), + getExcType(mech, param), + String.format("PASS - It is expected to fail " + + "for getInstance(algorithm, params, " + + "providerName) for algorithm: %s and " + + "parameter: %s", mech, param)), mech); + // getInstance(algorithm, params, providerName) when + // providerName is invalid + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo, param, + INVALID_PROVIDER), + !PASS, ((param == null) + ? IllegalArgumentException.class + : NoSuchProviderException.class), + String.format("PASS - It is expected to fail " + + "for getInstance(algorithm, params, " + + "providerName) when param is null or" + + " provider: %s is invalid for " + + "algorithm: '%s'", INVALID_PROVIDER, + mech)), mech); + // getInstance(algorithm, params, provider) when provider=null + checkAttributes( + matchExc(() -> SecureRandom.getInstance(srAlgo, param, + (String) null), + !PASS, IllegalArgumentException.class, + String.format("PASS - It is expected to fail " + + "for getInstance(algorithm, params, " + + "providerName) when provider name " + + "is null")), mech); + // getInstance(algorithm, params, providerName) when + // providerName is empty. + checkAttributes( + matchExc(() -> SecureRandom.getInstance( + srAlgo, param, ""), + !PASS, IllegalArgumentException.class, + String.format("PASS - It is expected to fail " + + "for getInstance(algorithm, params, " + + "providerName) when provider name " + + "is empty")), mech); + } + } + + private static boolean isValidDRBGParam(SecureRandomParameters param) { + return (param instanceof DrbgParameters.Instantiation); + } + + /** + * If the mechanism should occur NoSuchAlgorithmException. + */ + private static boolean nsa(String mech) { + return mech.equals(INVALID_ALGO); + } + + /** + * Verify if the mechanism is DRBG type. + * @param mech Mechanism name + * @return True if the mechanism name is DRBG type else False. + */ + private static boolean isDRBG(String mech) { + return mech.contains("_DRBG"); + } + + /** + * Type of exception expected for a SecureRandom instance when exception + * occurred while calling getInstance method with a fixed set of parameter. + * @param mech Mechanism used to create a SecureRandom instance + * @param param Parameter to getInstance() method + * @return Exception type expected + */ + private static Class getExcType(String mech, SecureRandomParameters param) { + return ((isDRBG(mech) && !isValidDRBGParam(param)) || param == null) + ? IllegalArgumentException.class + : NoSuchAlgorithmException.class; + } + + private interface RunnableCode { + + SecureRandom run() throws Exception; + } + + /** + * Execute a given code block and verify, if the exception type is expected. + * @param r Code block to run + * @param ex Expected exception type + * @param shouldPass If the code execution expected to pass without failure + * @param msg Message to log in case of expected failure + */ + private static SecureRandom matchExc(RunnableCode r, boolean shouldPass, + Class ex, String msg) { + SecureRandom sr = null; + try { + sr = r.run(); + if (!shouldPass) { + throw new RuntimeException("Excecution should fail here."); + } + } catch (Exception e) { + System.out.printf("%nOccured exception: %s - Expected exception: %s" + + " : ", e.getClass(), ex.getCanonicalName()); + if (ex.isAssignableFrom(e.getClass())) { + System.out.printf("%n%s : Expected Exception: %s : ", + e.getClass(), msg); + } else if (shouldPass) { + throw new RuntimeException(e); + } else { + System.out.printf("%nIgnore the following exception: %s%n", + e.getMessage()); + } + } + return sr; + } + + /** + * Check specific attributes of a SecureRandom instance. + */ + private static void checkAttributes(SecureRandom sr, String mech) { + if (sr == null) { + return; + } + Asserts.assertEquals(sr.getAlgorithm(), (isDRBG(mech) ? "DRBG" : mech)); + Asserts.assertEquals(sr.getProvider().getName(), SUN_PROVIDER); + } + +} diff --git a/jdk/test/java/security/SecureRandom/MultiThreadTest.java b/jdk/test/java/security/SecureRandom/MultiThreadTest.java new file mode 100644 index 00000000000..82c6d68dd94 --- /dev/null +++ b/jdk/test/java/security/SecureRandom/MultiThreadTest.java @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.math.BigInteger; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.Security; +import java.util.concurrent.Callable; +import java.util.concurrent.CompletionService; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorCompletionService; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import static java.lang.Math.*; + +/* + * @test + * @bug 8141039 + * @library /lib/testlibrary + * @summary Test behavior of a shared SecureRandom object when it is operated + * by multiple threads concurrently. + * @run main/othervm -Djava.security.egd=file:/dev/urandom MultiThreadTest + */ +public class MultiThreadTest { + + private static final byte[] GEN_RND_BYTES = {1}; + private static final String DRBG_CONFIG = "securerandom.drbg.config"; + private static final String DRBG_CONFIG_VALUE + = Security.getProperty(DRBG_CONFIG); + + private enum SEED { + + NONE, RESEED, SETSEED + } + + public static void main(String[] args) { + + boolean success = true; + for (int byteLen : GEN_RND_BYTES) { + for (SEED reSeed : SEED.values()) { + for (String mech : new String[]{ + "SHA1PRNG", "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + try { + forEachMech(mech, byteLen, reSeed); + } catch (Exception e) { + success = false; + e.printStackTrace(System.out); + } finally { + Security.setProperty(DRBG_CONFIG, DRBG_CONFIG_VALUE); + } + } + } + } + + if (!success) { + throw new RuntimeException("At least one test failed."); + } + } + + /** + * Generate a number of threads to fetch random numbers of certain bits + * generated through a shared SecureRandom instance. + * @param mech Mechanism name + * @param byteLen Number of bytes of random number to produce + * @param reSeed Call reseed() before generating random numbers + * @throws NoSuchAlgorithmException + * @throws InterruptedException + * @throws ExecutionException + */ + private static void forEachMech(String mech, int byteLen, SEED reSeed) + throws NoSuchAlgorithmException, InterruptedException, + ExecutionException { + + if ("SHA1PRNG".equals(mech) && SEED.RESEED.equals(reSeed)) { + System.out.printf( + "%nreseed() api is not supported for '%s'", mech); + return; + } + System.out.printf("%nTest SecureRandom mechanism: '%s' with support of" + + " reseed: '%s'", mech, reSeed); + int threadCount = (int) pow(2, 8 * byteLen); + System.out.printf("%nCreating %s number of threads to generate secure " + + "random numbers concurrently.", threadCount); + + ExecutorService executor + = Executors.newCachedThreadPool(new ThreadFactory() { + @Override + public Thread newThread(Runnable r) { + Thread t = Executors.defaultThreadFactory() + .newThread(r); + t.setDaemon(true); + return t; + } + }); + CompletionService completionService + = new ExecutorCompletionService(executor); + + CountDownLatch latch = new CountDownLatch(1); + SecureRandom rnd = null; + if (!mech.contains("_DRBG")) { + rnd = SecureRandom.getInstance(mech); + } else { + Security.setProperty(DRBG_CONFIG, mech); + rnd = SecureRandom.getInstance("DRBG"); + } + try { + for (int i = 0; i < threadCount; i++) { + completionService.submit(new Task(rnd, latch, byteLen, reSeed)); + } + latch.countDown(); + + for (int i = 0; i < threadCount; i++) { + completionService.take(); + } + } finally { + executor.shutdown(); + } + System.out.printf("%nCompleted Test for algorithm '%s' with thread " + + "counts to '%s' using reseeding '%s'", + mech, threadCount, reSeed); + + } + + /** + * Define a Task to be executed by multiple thread to produce random numbers + * from a shared SecureRandom instance. + */ + private static class Task implements Callable { + + private final SecureRandom random; + private final CountDownLatch latch; + private final SEED reSeed; + private final int byteSize; + + public Task(SecureRandom random, CountDownLatch latch, int byteSize, + SEED reSeed) { + this.random = random; + this.latch = latch; + this.byteSize = byteSize; + this.reSeed = reSeed; + } + + @Override + public Integer call() throws Exception { + latch.await(); + switch (this.reSeed) { + case RESEED: + this.random.reseed(); + break; + case SETSEED: + this.random.setSeed(1l); + break; + } + byte[] bytes = new byte[byteSize]; + random.nextBytes(bytes); + return new BigInteger(bytes).intValue(); + } + } + +} diff --git a/jdk/test/java/security/SecureRandom/Serialize.java b/jdk/test/java/security/SecureRandom/Serialize.java index 799f1bfa428..2e364878c80 100644 --- a/jdk/test/java/security/SecureRandom/Serialize.java +++ b/jdk/test/java/security/SecureRandom/Serialize.java @@ -24,6 +24,7 @@ /* @test * @bug 4102896 * @summary Make sure that a SecureRandom object can be serialized + * @run main/othervm Serialize */ import java.security.*; @@ -32,6 +33,8 @@ import java.io.*; public class Serialize { public static void main(String args[]) throws Exception { + System.setProperty("java.security.egd", "file:/dev/urandom"); + for (String alg: new String[]{ "SHA1PRNG", "DRBG", "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG", "Hash_DRBG,SHA-512,192,pr_and_reseed"}) { diff --git a/jdk/test/java/security/SecureRandom/SerializedSeedTest.java b/jdk/test/java/security/SecureRandom/SerializedSeedTest.java new file mode 100644 index 00000000000..9af7296c4ab --- /dev/null +++ b/jdk/test/java/security/SecureRandom/SerializedSeedTest.java @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8141039 + * @library /lib/testlibrary + * @summary When random number is generated through the a SecureRandom instance + * as well from it's serialized instance in the same time then the + * generated random numbers should be different when one or both are + * reseeded. + * @run main/othervm -Djava.security.egd=file:/dev/urandom SerializedSeedTest + */ +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.ByteArrayInputStream; +import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; +import java.security.Security; +import jdk.testlibrary.Asserts; + +public class SerializedSeedTest { + + private static final byte[] SEED = "seed".getBytes(); + private static final String DRBG_CONFIG = "securerandom.drbg.config"; + private static final String DRBG_CONFIG_VALUE + = Security.getProperty(DRBG_CONFIG); + + public static void main(String[] args) { + boolean success = true; + + for (String mech : new String[]{ + "SHA1PRNG", "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + System.out.printf( + "%nRunning test for SecureRandom mechanism: '%s'", mech); + try { + // Serialize without seed and compare generated random numbers + // produced through original and serialized instances. + SecureRandom orig = getSRInstance(mech); + SecureRandom copy = deserializedCopy(orig); + System.out.printf("%nSerialize without seed. Generated random" + + " numbers should be different."); + check(orig, copy, false, mech); + + // Serialize after default seed and compare generated random + // numbers produced through original and serialized instances. + orig = getSRInstance(mech); + orig.nextInt(); // Default seeded + copy = deserializedCopy(orig); + System.out.printf("%nSerialize after default seed. Generated" + + " random numbers should be same till 20-bytes."); + check(orig, copy, !isDRBG(mech), mech); + + // Serialize after explicit seed and compare generated random + // numbers produced through original and serialized instances. + orig = getSRInstance(mech); + orig.setSeed(SEED); // Explicitly seeded + copy = deserializedCopy(orig); + System.out.printf("%nSerialize after explicit seed. Generated " + + "random numbers should be same till 20-bytes."); + check(orig, copy, !isDRBG(mech), mech); + + // Serialize without seed but original is explicitly seeded + // before generating any random number. Then compare generated + // random numbers produced through original and serialized + // instances. + orig = getSRInstance(mech); + copy = deserializedCopy(orig); + orig.setSeed(SEED); // Explicitly seeded + System.out.printf("%nSerialize without seed. When original is " + + "explicitly seeded before generating random numbers," + + " Generated random numbers should be different."); + check(orig, copy, false, mech); + + // Serialize after default seed but original is explicitly + // seeded before generating any random number. Then compare + // generated random numbers produced through original and + // serialized instances. + orig = getSRInstance(mech); + orig.nextInt(); // Default seeded + copy = deserializedCopy(orig); + orig.setSeed(SEED); // Explicitly seeded + System.out.printf("%nSerialize after default seed but original " + + "is explicitly seeded before generating random number" + + ". Generated random numbers should be different."); + check(orig, copy, false, mech); + + // Serialize after explicit seed but original is explicitly + // seeded again before generating random number. Then compare + // generated random numbers produced through original and + // serialized instances. + orig = getSRInstance(mech); + orig.setSeed(SEED); // Explicitly seeded + copy = deserializedCopy(orig); + orig.setSeed(SEED); // Explicitly seeded + System.out.printf("%nSerialize after explicit seed but " + + "original is explicitly seeded again before " + + "generating random number. Generated random " + + "numbers should be different."); + check(orig, copy, false, mech); + + } catch (Exception e) { + e.printStackTrace(System.out); + success = false; + } finally { + Security.setProperty(DRBG_CONFIG, DRBG_CONFIG_VALUE); + } + System.out.printf("%n------Completed Test for %s------", mech); + } + + if (!success) { + throw new RuntimeException("At least one test failed."); + } + } + + /** + * Find if the mechanism is a DRBG mechanism. + * @param mech Mechanism name + * @return True for DRBG mechanism else False + */ + private static boolean isDRBG(String mech) { + return mech.contains("_DRBG"); + } + + /** + * Verify the similarity of random numbers generated though both original + * as well as deserialized instance. + */ + private static void check(SecureRandom orig, SecureRandom copy, + boolean equal, String mech) { + int o = orig.nextInt(); + int c = copy.nextInt(); + System.out.printf("%nRandom number generated for mechanism: '%s' " + + "from original instance as: '%s' and from serialized " + + "instance as: '%s'", mech, o, c); + if (equal) { + Asserts.assertEquals(o, c, mech); + } else { + Asserts.assertNotEquals(o, c, mech); + } + } + + /** + * Get a copy of SecureRandom instance through deserialization. + * @param orig Original SecureRandom instance + * @return Deserialized SecureRandom instance + * @throws IOException + * @throws ClassNotFoundException + */ + private static SecureRandom deserializedCopy(SecureRandom orig) + throws IOException, ClassNotFoundException { + return deserialize(serialize(orig)); + } + + /** + * Deserialize the SecureRandom object. + */ + private static SecureRandom deserialize(byte[] serialized) + throws IOException, ClassNotFoundException { + SecureRandom sr = null; + try (ByteArrayInputStream bis = new ByteArrayInputStream(serialized); + ObjectInputStream ois = new ObjectInputStream(bis)) { + sr = (SecureRandom) ois.readObject(); + } + return sr; + } + + /** + * Serialize the given SecureRandom object. + */ + private static byte[] serialize(SecureRandom sr) throws IOException { + try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos)) { + oos.writeObject(sr); + return bos.toByteArray(); + } + } + + /** + * Create a SecureRandom instance for a given mechanism. + */ + private static SecureRandom getSRInstance(String mech) + throws NoSuchAlgorithmException { + if (!isDRBG(mech)) { + return SecureRandom.getInstance(mech); + } else { + Security.setProperty(DRBG_CONFIG, mech); + return SecureRandom.getInstance("DRBG"); + } + } + +} diff --git a/jdk/test/java/sql/TEST.properties b/jdk/test/java/sql/TEST.properties new file mode 100644 index 00000000000..878b05fc591 --- /dev/null +++ b/jdk/test/java/sql/TEST.properties @@ -0,0 +1,2 @@ +modules = java.sql + diff --git a/jdk/test/java/util/Currency/PropertiesTest.java b/jdk/test/java/util/Currency/PropertiesTest.java index 96127bf19fe..fe35f2e6161 100644 --- a/jdk/test/java/util/Currency/PropertiesTest.java +++ b/jdk/test/java/util/Currency/PropertiesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ import java.io.*; import java.text.*; import java.util.*; import java.util.regex.*; +import java.util.stream.Collectors; public class PropertiesTest { public static void main(String[] args) throws Exception { @@ -32,9 +33,14 @@ public class PropertiesTest { dump(args[1]); } else if (args.length == 4 && args[0].equals("-c")) { compare(args[1], args[2], args[3]); + } else if (args.length == 1 && args[0].equals("bug7102969")) { + bug7102969(); + } else if (args.length == 1 && args[0].equals("bug8157138")) { + bug8157138(); } else { System.err.println("Usage: java PropertiesTest -d "); System.err.println(" java PropertiesTest -c "); + System.err.println(" java PropertiesTest bug[JBS bug id number] e.g. bug7102969"); System.exit(-1); } } @@ -174,6 +180,74 @@ public class PropertiesTest { } } + private static void bug7102969() { + + // check the correct overriding of special case entries + Currency cur = Currency.getInstance(new Locale("", "JP")); + if (!cur.getCurrencyCode().equals("ABC")) { + throw new RuntimeException("[Expected: ABC as currency code of JP, found: " + + cur.getCurrencyCode() + "]"); + } + + /* check if the currency instance is returned by + * getAvailableCurrencies() method + */ + if (!Currency.getAvailableCurrencies().contains(cur)) { + throw new RuntimeException("[The Currency instance [" + + cur.getCurrencyCode() + ", " + + cur.getNumericCode() + ", " + + cur.getDefaultFractionDigits() + + "] is not available in the currencies list]"); + } + + } + + private static void bug8157138() { + + /* check the currencies which exist only as a special case are + * accessible i.e. it should not throw IllegalArgumentException + */ + try { + Currency.getInstance("MAD"); + } catch (IllegalArgumentException ex) { + throw new RuntimeException("Test Failed: " + + "special case currency instance MAD not found" + + " via Currency.getInstance(\"MAD\")"); + } + + try { + Currency.getInstance("ABC"); + } catch (IllegalArgumentException ex) { + throw new RuntimeException("Test Failed: " + + "special case currency instance ABC not found" + + " via Currency.getInstance(\"ABC\")"); + } + + /* check the currency value is returned by getAvailableCurrencies() + * method + */ + List list = Currency.getAvailableCurrencies().stream() + .filter(cur -> cur.getCurrencyCode().equals("MAD")) + .collect(Collectors.toList()); + + if (list.isEmpty()) { + throw new RuntimeException("Test Failed: " + + "special case currency instance MAD not found" + + " in Currency.getAvailableCurrencies() list"); + } + + list = Currency.getAvailableCurrencies().stream() + .filter(cur -> cur.getCurrencyCode().equals("ABC")) + .collect(Collectors.toList()); + + if (list.isEmpty()) { + throw new RuntimeException("Test Failed: " + + "special case currency instance ABC not found" + + " in Currency.getAvailableCurrencies() list"); + } + + } + private static boolean isPastCutoverDate(String s) throws IndexOutOfBoundsException, NullPointerException, ParseException { String dateString = s.substring(s.lastIndexOf(',')+1, s.length()).trim(); diff --git a/jdk/test/java/util/Currency/PropertiesTest.sh b/jdk/test/java/util/Currency/PropertiesTest.sh index a6f8a76d189..215be9229ae 100644 --- a/jdk/test/java/util/Currency/PropertiesTest.sh +++ b/jdk/test/java/util/Currency/PropertiesTest.sh @@ -23,7 +23,8 @@ # # @test -# @bug 6332666 6863624 7180362 8003846 8074350 8074351 8130246 8149735 +# @bug 6332666 6863624 7180362 8003846 8074350 8074351 8130246 8149735 7102969 +# 8157138 # @summary tests the capability of replacing the currency data with user # specified currency properties file # @build PropertiesTest @@ -113,6 +114,16 @@ ${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest if [ $? != 0 ]; then failures=`expr $failures + 1`; fi if [ ! -f dump3 ]; then echo "file dump3 not created. Test cannot execute. Failed."; exit 1; fi +# run bug7102969 test +echo '' +${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug7102969 +if [ $? != 0 ]; then failures=`expr $failures + 1`; fi + +# run bug8157138 test +echo '' +${WRITABLEJDK}${FS}bin${FS}java ${TESTVMOPTS} -cp ${TESTCLASSES} PropertiesTest bug8157138 +if [ $? != 0 ]; then failures=`expr $failures + 1`; fi + # Cleanup rm -rf $WRITABLEJDK diff --git a/jdk/test/java/util/Currency/currency.properties b/jdk/test/java/util/Currency/currency.properties index d8e874d819a..57b293542b8 100644 --- a/jdk/test/java/util/Currency/currency.properties +++ b/jdk/test/java/util/Currency/currency.properties @@ -6,7 +6,7 @@ CL=CLF,990,4 CM=IED,111,2, 2004-01-01T00:70:00 ES=ESD,877,2 -JP=JPZ,123,2 +JP=ABC,999,0 MA=MAA,555,5 MC=MCC,555,6 MD=MDD,555,7 diff --git a/jdk/test/java/util/Currency/tablea1.txt b/jdk/test/java/util/Currency/tablea1.txt index 92e43adf2be..dacc0fb5210 100644 --- a/jdk/test/java/util/Currency/tablea1.txt +++ b/jdk/test/java/util/Currency/tablea1.txt @@ -5,7 +5,7 @@ # # Version -FILEVERSION=2 +FILEVERSION=3 DATAVERSION=160 # ISO 4217 currency data diff --git a/jdk/test/java/util/Objects/CheckIndex.java b/jdk/test/java/util/Objects/CheckIndex.java index c4efdb1c253..bcfa1d5b23d 100644 --- a/jdk/test/java/util/Objects/CheckIndex.java +++ b/jdk/test/java/util/Objects/CheckIndex.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,11 +23,13 @@ /** * @test - * @summary IndexOutOfBoundsException check index tests + * @summary Objects.checkIndex/jdk.internal.util.Preconditions.checkIndex tests * @run testng CheckIndex - * @bug 8135248 8142493 + * @bug 8135248 8142493 8155794 + * @modules java.base/jdk.internal.util */ +import jdk.internal.util.Preconditions; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -95,7 +97,7 @@ public class CheckIndex { public void testCheckIndex(int index, int length, boolean withinBounds) { String expectedMessage = withinBounds ? null - : Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new). + : Preconditions.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new). apply("checkIndex", List.of(index, length)).getMessage(); BiConsumer, IntSupplier> checker = (ec, s) -> { @@ -117,21 +119,21 @@ public class CheckIndex { }; checker.accept(AssertingOutOfBoundsException.class, - () -> Objects.checkIndex(index, length, - assertingOutOfBounds(expectedMessage, "checkIndex", index, length))); + () -> Preconditions.checkIndex(index, length, + assertingOutOfBounds(expectedMessage, "checkIndex", index, length))); checker.accept(IndexOutOfBoundsException.class, - () -> Objects.checkIndex(index, length, - assertingOutOfBoundsReturnNull("checkIndex", index, length))); + () -> Preconditions.checkIndex(index, length, + assertingOutOfBoundsReturnNull("checkIndex", index, length))); checker.accept(IndexOutOfBoundsException.class, - () -> Objects.checkIndex(index, length, null)); + () -> Preconditions.checkIndex(index, length, null)); checker.accept(IndexOutOfBoundsException.class, () -> Objects.checkIndex(index, length)); checker.accept(ArrayIndexOutOfBoundsException.class, - () -> Objects.checkIndex(index, length, - Objects.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new))); + () -> Preconditions.checkIndex(index, length, + Preconditions.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new))); checker.accept(StringIndexOutOfBoundsException.class, - () -> Objects.checkIndex(index, length, - Objects.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new))); + () -> Preconditions.checkIndex(index, length, + Preconditions.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new))); } @@ -157,7 +159,7 @@ public class CheckIndex { public void testCheckFromToIndex(int fromIndex, int toIndex, int length, boolean withinBounds) { String expectedMessage = withinBounds ? null - : Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new). + : Preconditions.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new). apply("checkFromToIndex", List.of(fromIndex, toIndex, length)).getMessage(); BiConsumer, IntSupplier> check = (ec, s) -> { @@ -179,21 +181,21 @@ public class CheckIndex { }; check.accept(AssertingOutOfBoundsException.class, - () -> Objects.checkFromToIndex(fromIndex, toIndex, length, - assertingOutOfBounds(expectedMessage, "checkFromToIndex", fromIndex, toIndex, length))); + () -> Preconditions.checkFromToIndex(fromIndex, toIndex, length, + assertingOutOfBounds(expectedMessage, "checkFromToIndex", fromIndex, toIndex, length))); check.accept(IndexOutOfBoundsException.class, - () -> Objects.checkFromToIndex(fromIndex, toIndex, length, - assertingOutOfBoundsReturnNull("checkFromToIndex", fromIndex, toIndex, length))); + () -> Preconditions.checkFromToIndex(fromIndex, toIndex, length, + assertingOutOfBoundsReturnNull("checkFromToIndex", fromIndex, toIndex, length))); check.accept(IndexOutOfBoundsException.class, - () -> Objects.checkFromToIndex(fromIndex, toIndex, length, null)); + () -> Preconditions.checkFromToIndex(fromIndex, toIndex, length, null)); check.accept(IndexOutOfBoundsException.class, () -> Objects.checkFromToIndex(fromIndex, toIndex, length)); check.accept(ArrayIndexOutOfBoundsException.class, - () -> Objects.checkFromToIndex(fromIndex, toIndex, length, - Objects.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new))); + () -> Preconditions.checkFromToIndex(fromIndex, toIndex, length, + Preconditions.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new))); check.accept(StringIndexOutOfBoundsException.class, - () -> Objects.checkFromToIndex(fromIndex, toIndex, length, - Objects.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new))); + () -> Preconditions.checkFromToIndex(fromIndex, toIndex, length, + Preconditions.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new))); } @@ -226,7 +228,7 @@ public class CheckIndex { public void testCheckFromIndexSize(int fromIndex, int size, int length, boolean withinBounds) { String expectedMessage = withinBounds ? null - : Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new). + : Preconditions.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new). apply("checkFromIndexSize", List.of(fromIndex, size, length)).getMessage(); BiConsumer, IntSupplier> check = (ec, s) -> { @@ -248,27 +250,27 @@ public class CheckIndex { }; check.accept(AssertingOutOfBoundsException.class, - () -> Objects.checkFromIndexSize(fromIndex, size, length, - assertingOutOfBounds(expectedMessage, "checkFromIndexSize", fromIndex, size, length))); + () -> Preconditions.checkFromIndexSize(fromIndex, size, length, + assertingOutOfBounds(expectedMessage, "checkFromIndexSize", fromIndex, size, length))); check.accept(IndexOutOfBoundsException.class, - () -> Objects.checkFromIndexSize(fromIndex, size, length, - assertingOutOfBoundsReturnNull("checkFromIndexSize", fromIndex, size, length))); + () -> Preconditions.checkFromIndexSize(fromIndex, size, length, + assertingOutOfBoundsReturnNull("checkFromIndexSize", fromIndex, size, length))); check.accept(IndexOutOfBoundsException.class, - () -> Objects.checkFromIndexSize(fromIndex, size, length, null)); + () -> Preconditions.checkFromIndexSize(fromIndex, size, length, null)); check.accept(IndexOutOfBoundsException.class, () -> Objects.checkFromIndexSize(fromIndex, size, length)); check.accept(ArrayIndexOutOfBoundsException.class, - () -> Objects.checkFromIndexSize(fromIndex, size, length, - Objects.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new))); + () -> Preconditions.checkFromIndexSize(fromIndex, size, length, + Preconditions.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new))); check.accept(StringIndexOutOfBoundsException.class, - () -> Objects.checkFromIndexSize(fromIndex, size, length, - Objects.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new))); + () -> Preconditions.checkFromIndexSize(fromIndex, size, length, + Preconditions.outOfBoundsExceptionFormatter(StringIndexOutOfBoundsException::new))); } @Test public void uniqueMessagesForCheckKinds() { BiFunction, IndexOutOfBoundsException> f = - Objects.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new); + Preconditions.outOfBoundsExceptionFormatter(IndexOutOfBoundsException::new); List messages = new ArrayList<>(); // Exact arguments diff --git a/jdk/test/java/util/Properties/CheckOverrides.java b/jdk/test/java/util/Properties/CheckOverrides.java new file mode 100644 index 00000000000..327143a66cb --- /dev/null +++ b/jdk/test/java/util/Properties/CheckOverrides.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/* + * @test + * @bug 8029891 + * @summary Test that the Properties class overrides all public+protected + * methods of all ancestor classes and interfaces + * @run main CheckOverrides + */ +public class CheckOverrides { + + public static void main(String[] args) { + Set pMethodSignatures = + Stream.of(Properties.class.getDeclaredMethods()) + .filter(CheckOverrides::isMethodOfInterest) + .map(MethodSignature::new) + .collect(Collectors.toSet()); + + Map unoverriddenMethods = new HashMap<>(); + for (Class superclass = Properties.class.getSuperclass(); + superclass != Object.class; + superclass = superclass.getSuperclass()) { + Stream.of(superclass.getDeclaredMethods()) + .filter(CheckOverrides::isMethodOfInterest) + .forEach(m -> unoverriddenMethods.putIfAbsent(new MethodSignature(m), m)); + } + unoverriddenMethods.keySet().removeAll(pMethodSignatures); + + if (!unoverriddenMethods.isEmpty()) { + throw new RuntimeException( + "The following methods should be overridden by Properties class:\n" + + unoverriddenMethods.values().stream() + .map(Method::toString) + .collect(Collectors.joining("\n ", " ", "\n")) + ); + } + } + + static boolean isMethodOfInterest(Method method) { + int mods = method.getModifiers(); + return !Modifier.isStatic(mods) && + (Modifier.isPublic(mods) || Modifier.isProtected(mods)); + } + + static class MethodSignature { + final Class returnType; + final String name; + final Class[] parameterTypes; + + MethodSignature(Method method) { + this(method.getReturnType(), method.getName(), method.getParameterTypes()); + } + + private MethodSignature(Class returnType, String name, Class[] parameterTypes) { + this.returnType = returnType; + this.name = name; + this.parameterTypes = parameterTypes; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MethodSignature that = (MethodSignature) o; + if (!returnType.equals(that.returnType)) return false; + if (!name.equals(that.name)) return false; + return Arrays.equals(parameterTypes, that.parameterTypes); + } + + @Override + public int hashCode() { + int result = returnType.hashCode(); + result = 31 * result + name.hashCode(); + result = 31 * result + Arrays.hashCode(parameterTypes); + return result; + } + } +} + diff --git a/jdk/test/java/util/Properties/CheckUnsynchronized.java b/jdk/test/java/util/Properties/CheckUnsynchronized.java new file mode 100644 index 00000000000..1b32cca0827 --- /dev/null +++ b/jdk/test/java/util/Properties/CheckUnsynchronized.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.Enumeration; +import java.util.Properties; +import java.util.concurrent.CompletableFuture; + +/* + * @test + * @bug 8029891 + * @summary Test Properties methods that do not synchronize any more + * @run main CheckUnsynchronized + */ +public class CheckUnsynchronized { + public static void main(String[] args) { + Properties props = new Properties(); + synchronized (props) { + props.setProperty("key", "value"); + System.out.println("contains(value)? " + + CompletableFuture.supplyAsync(() -> props.contains("value")).join()); + System.out.println("containsKey(key)? " + + CompletableFuture.supplyAsync(() -> props.containsKey("key")).join()); + System.out.println("containsValue(value)? " + + CompletableFuture.supplyAsync(() -> props.containsValue("value")).join()); + Enumeration elems = + CompletableFuture.supplyAsync(() -> props.elements()).join(); + System.out.println("first value from elements(): " + elems.nextElement()); + System.out.println("value from get(): " + + CompletableFuture.supplyAsync(() -> props.getProperty("key")).join()); + System.out.println("getOrDefault(\"missing\"): " + + CompletableFuture.supplyAsync(() -> props.getOrDefault("missing", "default")).join()); + System.out.println("isEmpty()? " + + CompletableFuture.supplyAsync(() -> props.isEmpty()).join()); + Enumeration keys = + CompletableFuture.supplyAsync(() -> props.keys()).join(); + System.out.println("first key from keys(): " + keys.nextElement()); + System.out.println("size(): " + + CompletableFuture.supplyAsync(() -> props.size()).join()); + } + } +} diff --git a/jdk/test/java/util/Properties/PropertiesSerialization.java b/jdk/test/java/util/Properties/PropertiesSerialization.java new file mode 100644 index 00000000000..2fcf1dc810a --- /dev/null +++ b/jdk/test/java/util/Properties/PropertiesSerialization.java @@ -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. + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.util.Base64; +import java.util.Properties; + +/** + * @test + * @bug 8029891 + * @summary tests the compatibility of Properties serial form + * @run main PropertiesSerialization read + * + * To update this test in case the serial form of Properties changes, run this + * test with the 'write' flag, and copy the resulting output back into this + * file, replacing the existing String declaration(s). + */ +public class PropertiesSerialization { + private static final Properties TEST_PROPS; + static { + TEST_PROPS = new Properties(); + TEST_PROPS.setProperty("one", "two"); + TEST_PROPS.setProperty("buckle", "shoe"); + TEST_PROPS.setProperty("three", "four"); + TEST_PROPS.setProperty("shut", "door"); + } + + /** + * Base64 encoded string for Properties object + * Java version: 1.8.0 + **/ + private static final String TEST_SER_BASE64 = + "rO0ABXNyABRqYXZhLnV0aWwuUHJvcGVydGllczkS0HpwNj6YAgABTAAIZGVmYXVs" + + "dHN0ABZMamF2YS91dGlsL1Byb3BlcnRpZXM7eHIAE2phdmEudXRpbC5IYXNodGFi" + + "bGUTuw8lIUrkuAMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAI" + + "dwgAAAALAAAABHQAA29uZXQAA3R3b3QABHNodXR0AARkb29ydAAGYnVja2xldAAE" + + "c2hvZXQABXRocmVldAAEZm91cnhw"; + + public static void main(String[] args) throws IOException, + ClassNotFoundException { + if (args.length == 0) { + System.err.println("Run with 'read' or 'write'"); + System.err.println(" read mode: normal test mode."); + System.err.println(" Confirms that serial stream can"); + System.err.println(" be deserialized as expected."); + System.err.println(" write mode: meant for updating the test,"); + System.err.println(" should the serial form change."); + System.err.println(" Test output should be pasted"); + System.err.println(" back into the test source."); + return; + } + + Properties deserializedObject; + if ("read".equals(args[0])) { + ByteArrayInputStream bais = new + ByteArrayInputStream(Base64.getDecoder().decode(TEST_SER_BASE64)); + try (ObjectInputStream ois = new ObjectInputStream(bais)) { + deserializedObject = (Properties) ois.readObject(); + } + if (!TEST_PROPS.equals(deserializedObject)) { + throw new RuntimeException("deserializedObject not equals()"); + } + System.out.println("Test passed"); + } else if ("write".equals(args[0])) { + System.out.println("\nTo update the test, paste the following back " + + "into the test code:\n"); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + oos.writeObject(TEST_PROPS); + oos.flush(); + oos.close(); + + byte[] byteArray = baos.toByteArray(); + // Check that the Properties deserializes correctly + ByteArrayInputStream bais = new ByteArrayInputStream(byteArray); + ObjectInputStream ois = new ObjectInputStream(bais); + Properties deser = (Properties)ois.readObject(); + if (!TEST_PROPS.equals(deser)) { + throw new RuntimeException("write: Deserialized != original"); + } + + // Now get a Base64 string representation of the serialized bytes. + final String base64 = Base64.getEncoder().encodeToString(byteArray); + // Check that we can deserialize the Base64 string we just computed. + ByteArrayInputStream bais2 = + new ByteArrayInputStream(Base64.getDecoder().decode(base64)); + ObjectInputStream ois2 = new ObjectInputStream(bais2); + Properties deser2 = (Properties)ois2.readObject(); + if (!TEST_PROPS.equals(deser2)) { + throw new RuntimeException("write: Deserialized base64 != " + + "original"); + } + System.out.println(dumpBase64SerialStream(base64)); + } + } + + private static final String INDENT = " "; + /* Based on: + * java/util/logging/HigherResolutionTimeStamps/SerializeLogRecored.java + */ + private static String dumpBase64SerialStream(String base64) { + // Generates the Java Pseudo code that can be cut & pasted into + // this test (see Jdk8SerializedLog and Jdk9SerializedLog below) + final StringBuilder sb = new StringBuilder(); + sb.append(INDENT).append(" /**").append('\n'); + sb.append(INDENT).append(" * Base64 encoded string for Properties object\n"); + sb.append(INDENT).append(" * Java version: ") + .append(System.getProperty("java.version")).append('\n'); + sb.append(INDENT).append(" **/").append('\n'); + sb.append(INDENT).append(" private static final String TEST_SER_BASE64 = ") + .append("\n").append(INDENT).append(" "); + final int last = base64.length() - 1; + for (int i=0; i listNotFound = new ArrayList<>(); + String[][] zoneStrings = DateFormatSymbols.getInstance() + .getZoneStrings(); + for (String tzID : TimeZone.getAvailableIDs()) { + if (!Arrays.stream(zoneStrings) + .anyMatch(zone -> tzID.equalsIgnoreCase(zone[0]))) { + // to ignore names for Etc/GMT[+-][0-9]+ which are not supported + if (!tzID.startsWith("Etc/GMT") && !tzID.startsWith("GMT")) { + listNotFound.add(tzID); + } + } + } + + if (!listNotFound.isEmpty()) { + throw new RuntimeException("Test Failed: Time Zone Strings for " + + listNotFound + " not found"); + } + + } + +} diff --git a/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java b/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java index 7d6da0b255e..630f3796b8c 100644 --- a/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java +++ b/jdk/test/java/util/concurrent/locks/Lock/TimedAcquireLeak.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -167,7 +167,7 @@ public class TimedAcquireLeak { final String childPid, final String className) { final String regex = - "(?m)^ *[0-9]+: +([0-9]+) +[0-9]+ +\\Q"+className+"\\E$"; + "(?m)^ *[0-9]+: +([0-9]+) +[0-9]+ +\\Q"+className+"\\E(?:$| )"; final Callable objectsInUse = new Callable() { public Integer call() { Integer i = Integer.parseInt( diff --git a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java index e6dd04c23af..54b889f9427 100644 --- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java +++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8132734 + * @bug 8132734 8144062 * @summary Test the extended API and the aliasing additions in JarFile that * support multi-release jar files * @library /lib/testlibrary/java/util/jar @@ -39,7 +39,6 @@ import java.util.Arrays; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import jdk.Version; import static java.util.jar.JarFile.Release; @@ -51,7 +50,7 @@ import org.testng.annotations.Test; public class MultiReleaseJarAPI { - static final int MAJOR_VERSION = Version.current().major(); + static final int MAJOR_VERSION = Runtime.version().major(); String userdir = System.getProperty("user.dir","."); CreateMultiReleaseTestJars creator = new CreateMultiReleaseTestJars(); diff --git a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarIterators.java b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarIterators.java index 59900cf3f7a..60d5063ba71 100644 --- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarIterators.java +++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarIterators.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8132734 + * @bug 8132734 8144062 * @summary Test the extended API and the aliasing additions in JarFile that * support multi-release jar files * @library /lib/testlibrary/java/util/jar @@ -42,7 +42,6 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.stream.Collectors; import java.util.zip.ZipFile; -import jdk.Version; import static java.util.jar.JarFile.Release; @@ -54,7 +53,7 @@ import org.testng.annotations.Test; public class MultiReleaseJarIterators { - static final int MAJOR_VERSION = Version.current().major(); + static final int MAJOR_VERSION = Runtime.version().major(); String userdir = System.getProperty("user.dir", "."); File unversioned = new File(userdir, "unversioned.jar"); diff --git a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarProperties.java b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarProperties.java index 6bf059fb8ea..d729c438a66 100644 --- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarProperties.java +++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarProperties.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8132734 + * @bug 8132734 8144062 * @summary Test the System properties for JarFile that support multi-release jar files * @library /lib/testlibrary/java/util/jar * @build Compiler JarBuilder CreateMultiReleaseTestJars @@ -54,7 +54,6 @@ import java.net.URLClassLoader; import java.nio.file.Files; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import jdk.Version; import org.testng.Assert; import org.testng.annotations.AfterClass; @@ -63,7 +62,7 @@ import org.testng.annotations.Test; public class MultiReleaseJarProperties { - static final int MAJOR_VERSION = Version.current().major(); + static final int MAJOR_VERSION = Runtime.version().major(); final static int ROOTVERSION = 8; // magic number from knowledge of internals final static String userdir = System.getProperty("user.dir", "."); diff --git a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarSecurity.java b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarSecurity.java index 348194a3be3..538742ce192 100644 --- a/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarSecurity.java +++ b/jdk/test/java/util/jar/JarFile/mrjar/MultiReleaseJarSecurity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8132734 + * @bug 8132734 8144062 * @summary Test potential security related issues * @library /lib/testlibrary/java/util/jar * @build Compiler JarBuilder CreateMultiReleaseTestJars @@ -40,7 +40,6 @@ import java.util.Arrays; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipFile; -import jdk.Version; import org.testng.Assert; import org.testng.annotations.AfterClass; @@ -49,7 +48,7 @@ import org.testng.annotations.Test; public class MultiReleaseJarSecurity { - static final int MAJOR_VERSION = Version.current().major(); + static final int MAJOR_VERSION = Runtime.version().major(); String userdir = System.getProperty("user.dir","."); File multirelease = new File(userdir, "multi-release.jar"); diff --git a/jdk/test/java/util/regex/RegExTest.java b/jdk/test/java/util/regex/RegExTest.java index 815cb99104e..34f9cdbfc60 100644 --- a/jdk/test/java/util/regex/RegExTest.java +++ b/jdk/test/java/util/regex/RegExTest.java @@ -34,7 +34,7 @@ * 7067045 7014640 7189363 8007395 8013252 8013254 8012646 8023647 6559590 * 8027645 8035076 8039124 8035975 8074678 6854417 8143854 8147531 7071819 * 8151481 4867170 7080302 6728861 6995635 6736245 4916384 - * 6328855 6192895 6345469 6988218 6693451 7006761 8140212 + * 6328855 6192895 6345469 6988218 6693451 7006761 8140212 8143282 * * @library /lib/testlibrary * @build jdk.testlibrary.* @@ -4345,12 +4345,13 @@ public class RegExTest { Matcher definedP = Pattern.compile("\\p{IsAssigned}").matcher(""); Matcher nonCCPP = Pattern.compile("\\p{IsNoncharacterCodePoint}").matcher(""); Matcher joinCrtl = Pattern.compile("\\p{IsJoinControl}").matcher(""); - // javaMethod Matcher lowerJ = Pattern.compile("\\p{javaLowerCase}").matcher(""); Matcher upperJ = Pattern.compile("\\p{javaUpperCase}").matcher(""); Matcher alphaJ = Pattern.compile("\\p{javaAlphabetic}").matcher(""); Matcher ideogJ = Pattern.compile("\\p{javaIdeographic}").matcher(""); + // GC/C + Matcher gcC = Pattern.compile("\\p{C}").matcher(""); for (int cp = 1; cp < 0x30000; cp++) { String str = new String(Character.toChars(cp)); @@ -4416,8 +4417,14 @@ public class RegExTest { Character.isIdeographic(cp) != ideogJ.reset(str).matches() || (Character.UNASSIGNED == type) == definedP.reset(str).matches() || POSIX_Unicode.isNoncharacterCodePoint(cp) != nonCCPP.reset(str).matches() || - POSIX_Unicode.isJoinControl(cp) != joinCrtl.reset(str).matches()) + POSIX_Unicode.isJoinControl(cp) != joinCrtl.reset(str).matches() || + // gc_C + (Character.CONTROL == type || Character.FORMAT == type || + Character.PRIVATE_USE == type || Character.SURROGATE == type || + Character.UNASSIGNED == type) + != gcC.reset(str).matches()) { failCount++; + } } // bounds/word align diff --git a/jdk/test/javax/accessibility/8017112/AccessibleIndexInParentTest.java b/jdk/test/javax/accessibility/8017112/AccessibleIndexInParentTest.java new file mode 100644 index 00000000000..87f35b40da9 --- /dev/null +++ b/jdk/test/javax/accessibility/8017112/AccessibleIndexInParentTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Component; +import javax.swing.JLabel; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; +import javax.accessibility.Accessible; +import javax.accessibility.AccessibleContext; +/* + * @test + * @bug 8017112 + * @summary JTabbedPane components have inconsistent accessibility tree + * @run main AccessibleIndexInParentTest + */ + +public class AccessibleIndexInParentTest { + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(AccessibleIndexInParentTest::test); + } + + private static void test() { + + int N = 5; + JTabbedPane tabbedPane = new JTabbedPane(); + + for (int i = 0; i < N; i++) { + tabbedPane.addTab("Title: " + i, new JLabel("Component: " + i)); + } + + for (int i = 0; i < tabbedPane.getTabCount(); i++) { + Component child = tabbedPane.getComponentAt(i); + + AccessibleContext ac = child.getAccessibleContext(); + if (ac == null) { + throw new RuntimeException("Accessible Context is null!"); + } + + int index = ac.getAccessibleIndexInParent(); + Accessible parent = ac.getAccessibleParent(); + + if (parent.getAccessibleContext().getAccessibleChild(index) != child) { + throw new RuntimeException("Wrong getAccessibleIndexInParent!"); + } + } + } +} \ No newline at end of file diff --git a/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java b/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java index 6592555706d..35f35a5c410 100644 --- a/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java +++ b/jdk/test/javax/net/ssl/DTLS/DTLSOverDatagram.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -47,8 +47,16 @@ import sun.security.util.HexDumpEncoder; * An example to show the way to use SSLEngine in datagram connections. */ public class DTLSOverDatagram { + + static { + System.setProperty("javax.net.debug", "ssl"); + } + private static int MAX_HANDSHAKE_LOOPS = 200; private static int MAX_APP_READ_LOOPS = 60; + private static int SOCKET_TIMEOUT = 10 * 1000; // in millis + private static int BUFFER_SIZE = 1024; + private static int MAXIMUM_PACKET_SIZE = 1024; /* * The following is to set up the keystores. @@ -84,37 +92,33 @@ public class DTLSOverDatagram { /* * Define the server side of the test. */ - void doServerSide() throws Exception { - DatagramSocket socket = serverDatagramSocket; - socket.setSoTimeout(10000); // 10 second + void doServerSide(DatagramSocket socket, InetSocketAddress clientSocketAddr) + throws Exception { // create SSLEngine SSLEngine engine = createSSLEngine(false); // handshaking - handshake(engine, socket, clientSocketAddr); + handshake(engine, socket, clientSocketAddr, "Server"); // read client application data receiveAppData(engine, socket, clientApp); // write server application data deliverAppData(engine, socket, serverApp, clientSocketAddr); - - socket.close(); } /* * Define the client side of the test. */ - void doClientSide() throws Exception { - DatagramSocket socket = clientDatagramSocket; - socket.setSoTimeout(1000); // 1 second read timeout + void doClientSide(DatagramSocket socket, InetSocketAddress serverSocketAddr) + throws Exception { // create SSLEngine SSLEngine engine = createSSLEngine(true); // handshaking - handshake(engine, socket, serverSocketAddr); + handshake(engine, socket, serverSocketAddr, "Client"); // write client application data deliverAppData(engine, socket, clientApp, serverSocketAddr); @@ -132,7 +136,7 @@ public class DTLSOverDatagram { SSLEngine engine = context.createSSLEngine(); SSLParameters paras = engine.getSSLParameters(); - paras.setMaximumPacketSize(1024); + paras.setMaximumPacketSize(MAXIMUM_PACKET_SIZE); engine.setUseClientMode(isClient); engine.setSSLParameters(paras); @@ -142,7 +146,7 @@ public class DTLSOverDatagram { // handshake void handshake(SSLEngine engine, DatagramSocket socket, - SocketAddress peerAddr) throws Exception { + SocketAddress peerAddr, String side) throws Exception { boolean endLoops = false; int loops = MAX_HANDSHAKE_LOOPS; @@ -159,39 +163,60 @@ public class DTLSOverDatagram { if (hs == SSLEngineResult.HandshakeStatus.NEED_UNWRAP || hs == SSLEngineResult.HandshakeStatus.NEED_UNWRAP_AGAIN) { + log(side, "Receive DTLS records, handshake status is " + hs); + ByteBuffer iNet; ByteBuffer iApp; if (hs == SSLEngineResult.HandshakeStatus.NEED_UNWRAP) { - // receive ClientHello request and other SSL/TLS records - byte[] buf = new byte[1024]; + byte[] buf = new byte[BUFFER_SIZE]; DatagramPacket packet = new DatagramPacket(buf, buf.length); try { socket.receive(packet); } catch (SocketTimeoutException ste) { - List packets = - onReceiveTimeout(engine, peerAddr); + log(side, "Warning: " + ste); + + List packets = new ArrayList<>(); + boolean finished = onReceiveTimeout( + engine, peerAddr, side, packets); + for (DatagramPacket p : packets) { socket.send(p); } + if (finished) { + log(side, "Handshake status is FINISHED " + + "after calling onReceiveTimeout(), " + + "finish the loop"); + endLoops = true; + } + + log(side, "New handshake status is " + + engine.getHandshakeStatus()); + continue; } iNet = ByteBuffer.wrap(buf, 0, packet.getLength()); - iApp = ByteBuffer.allocate(1024); + iApp = ByteBuffer.allocate(BUFFER_SIZE); } else { iNet = ByteBuffer.allocate(0); - iApp = ByteBuffer.allocate(1024); + iApp = ByteBuffer.allocate(BUFFER_SIZE); } SSLEngineResult r = engine.unwrap(iNet, iApp); SSLEngineResult.Status rs = r.getStatus(); hs = r.getHandshakeStatus(); - if (rs == SSLEngineResult.Status.BUFFER_OVERFLOW) { + if (rs == SSLEngineResult.Status.OK) { + // OK + } else if (rs == SSLEngineResult.Status.BUFFER_OVERFLOW) { + log(side, "BUFFER_OVERFLOW, handshake status is " + hs); + // the client maximum fragment size config does not work? throw new Exception("Buffer overflow: " + "incorrect client maximum fragment size"); } else if (rs == SSLEngineResult.Status.BUFFER_UNDERFLOW) { + log(side, "BUFFER_UNDERFLOW, handshake status is " + hs); + // bad packet, or the client maximum fragment size // config does not work? if (hs != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) { @@ -199,31 +224,64 @@ public class DTLSOverDatagram { "incorrect client maximum fragment size"); } // otherwise, ignore this packet } else if (rs == SSLEngineResult.Status.CLOSED) { - endLoops = true; - } // otherwise, SSLEngineResult.Status.OK: + throw new Exception( + "SSL engine closed, handshake status is " + hs); + } else { + throw new Exception("Can't reach here, result is " + rs); + } - if (rs != SSLEngineResult.Status.OK) { - continue; + if (hs == SSLEngineResult.HandshakeStatus.FINISHED) { + log(side, "Handshake status is FINISHED, finish the loop"); + endLoops = true; } } else if (hs == SSLEngineResult.HandshakeStatus.NEED_WRAP) { - List packets = - produceHandshakePackets(engine, peerAddr); + List packets = new ArrayList<>(); + boolean finished = produceHandshakePackets( + engine, peerAddr, side, packets); + for (DatagramPacket p : packets) { socket.send(p); } + + if (finished) { + log(side, "Handshake status is FINISHED " + + "after producing handshake packets, " + + "finish the loop"); + endLoops = true; + } } else if (hs == SSLEngineResult.HandshakeStatus.NEED_TASK) { runDelegatedTasks(engine); } else if (hs == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) { - // OK, time to do application data exchange. + log(side, "Handshake status is NOT_HANDSHAKING, finish the loop"); endLoops = true; } else if (hs == SSLEngineResult.HandshakeStatus.FINISHED) { - endLoops = true; + throw new Exception( + "Unexpected status, SSLEngine.getHandshakeStatus() " + + "shouldn't return FINISHED"); + } else { + throw new Exception("Can't reach here, handshake status is " + hs); } } SSLEngineResult.HandshakeStatus hs = engine.getHandshakeStatus(); + log(side, "Handshake finished, status is " + hs); + + if (engine.getHandshakeSession() != null) { + throw new Exception( + "Handshake finished, but handshake session is not null"); + } + + SSLSession session = engine.getSession(); + if (session == null) { + throw new Exception("Handshake finished, but session is null"); + } + log(side, "Negotiated protocol is " + session.getProtocol()); + log(side, "Negotiated cipher suite is " + session.getCipherSuite()); + + // handshake status should be NOT_HANDSHAKING + // according to the spec, SSLEngine.getHandshakeStatus() can't return FINISHED if (hs != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) { - throw new Exception("Not ready for application data yet"); + throw new Exception("Unexpected handshake status " + hs); } } @@ -251,11 +309,11 @@ public class DTLSOverDatagram { "Too much loops to receive application data"); } - byte[] buf = new byte[1024]; + byte[] buf = new byte[BUFFER_SIZE]; DatagramPacket packet = new DatagramPacket(buf, buf.length); socket.receive(packet); ByteBuffer netBuffer = ByteBuffer.wrap(buf, 0, packet.getLength()); - ByteBuffer recBuffer = ByteBuffer.allocate(1024); + ByteBuffer recBuffer = ByteBuffer.allocate(BUFFER_SIZE); SSLEngineResult rs = engine.unwrap(netBuffer, recBuffer); recBuffer.flip(); if (recBuffer.remaining() != 0) { @@ -270,10 +328,9 @@ public class DTLSOverDatagram { } // produce handshake packets - List produceHandshakePackets( - SSLEngine engine, SocketAddress socketAddr) throws Exception { + boolean produceHandshakePackets(SSLEngine engine, SocketAddress socketAddr, + String side, List packets) throws Exception { - List packets = new ArrayList<>(); boolean endLoops = false; int loops = MAX_HANDSHAKE_LOOPS; while (!endLoops && @@ -296,6 +353,8 @@ public class DTLSOverDatagram { throw new Exception("Buffer overflow: " + "incorrect server maximum fragment size"); } else if (rs == SSLEngineResult.Status.BUFFER_UNDERFLOW) { + log(side, "Produce handshake packets: BUFFER_UNDERFLOW occured"); + log(side, "Produce handshake packets: Handshake status: " + hs); // bad packet, or the client maximum fragment size // config does not work? if (hs != SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) { @@ -304,7 +363,11 @@ public class DTLSOverDatagram { } // otherwise, ignore this packet } else if (rs == SSLEngineResult.Status.CLOSED) { throw new Exception("SSLEngine has closed"); - } // otherwise, SSLEngineResult.Status.OK + } else if (rs == SSLEngineResult.Status.OK) { + // OK + } else { + throw new Exception("Can't reach here, result is " + rs); + } // SSLEngineResult.Status.OK: if (oNet.hasRemaining()) { @@ -313,25 +376,39 @@ public class DTLSOverDatagram { DatagramPacket packet = createHandshakePacket(ba, socketAddr); packets.add(packet); } + + if (hs == SSLEngineResult.HandshakeStatus.FINISHED) { + log(side, "Produce handshake packets: " + + "Handshake status is FINISHED, finish the loop"); + return true; + } + boolean endInnerLoop = false; SSLEngineResult.HandshakeStatus nhs = hs; while (!endInnerLoop) { if (nhs == SSLEngineResult.HandshakeStatus.NEED_TASK) { runDelegatedTasks(engine); - nhs = engine.getHandshakeStatus(); - } else if ((nhs == SSLEngineResult.HandshakeStatus.FINISHED) || - (nhs == SSLEngineResult.HandshakeStatus.NEED_UNWRAP) || - (nhs == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING)) { + } else if (nhs == SSLEngineResult.HandshakeStatus.NEED_UNWRAP || + nhs == SSLEngineResult.HandshakeStatus.NEED_UNWRAP_AGAIN || + nhs == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) { endInnerLoop = true; endLoops = true; } else if (nhs == SSLEngineResult.HandshakeStatus.NEED_WRAP) { endInnerLoop = true; + } else if (nhs == SSLEngineResult.HandshakeStatus.FINISHED) { + throw new Exception( + "Unexpected status, SSLEngine.getHandshakeStatus() " + + "shouldn't return FINISHED"); + } else { + throw new Exception("Can't reach here, handshake status is " + + nhs); } + nhs = engine.getHandshakeStatus(); } } - return packets; + return false; } DatagramPacket createHandshakePacket(byte[] ba, SocketAddress socketAddr) { @@ -358,7 +435,11 @@ public class DTLSOverDatagram { throw new Exception("Buffer underflow during wraping"); } else if (rs == SSLEngineResult.Status.CLOSED) { throw new Exception("SSLEngine has closed"); - } // otherwise, SSLEngineResult.Status.OK + } else if (rs == SSLEngineResult.Status.OK) { + // OK + } else { + throw new Exception("Can't reach here, result is " + rs); + } // SSLEngineResult.Status.OK: if (appNet.hasRemaining()) { @@ -386,15 +467,15 @@ public class DTLSOverDatagram { } // retransmission if timeout - List onReceiveTimeout( - SSLEngine engine, SocketAddress socketAddr) throws Exception { + boolean onReceiveTimeout(SSLEngine engine, SocketAddress socketAddr, + String side, List packets) throws Exception { SSLEngineResult.HandshakeStatus hs = engine.getHandshakeStatus(); if (hs == SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING) { - return new ArrayList(); + return false; } else { // retransmission of handshake messages - return produceHandshakePackets(engine, socketAddr); + return produceHandshakePackets(engine, socketAddr, side, packets); } } @@ -405,8 +486,13 @@ public class DTLSOverDatagram { char[] passphrase = "passphrase".toCharArray(); - ks.load(new FileInputStream(keyFilename), passphrase); - ts.load(new FileInputStream(trustFilename), passphrase); + try (FileInputStream fis = new FileInputStream(keyFilename)) { + ks.load(fis, passphrase); + } + + try (FileInputStream fis = new FileInputStream(trustFilename)) { + ts.load(fis, passphrase); + } KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, passphrase); @@ -427,94 +513,84 @@ public class DTLSOverDatagram { * The remainder is support stuff to kickstart the testing. */ - // the server side SocketAddress - volatile static SocketAddress serverSocketAddr = null; - - // the client side SocketAddress - volatile static SocketAddress clientSocketAddr = null; - - // the server side DatagramSocket instance - volatile static DatagramSocket serverDatagramSocket = null; - - // the server side DatagramSocket instance - volatile static DatagramSocket clientDatagramSocket = null; - - // get server side SocketAddress object - public SocketAddress getServerSocketAddress() { - return serverSocketAddr; - } - - // get client side SocketAddress object - public SocketAddress getClientSocketAddress() { - return clientSocketAddr; - } - - // get server side DatagramSocket object - public DatagramSocket getServerDatagramSocket() { - return serverDatagramSocket; - } - - // get client side DatagramSocket object - public DatagramSocket getClientDatagramSocket() { - return clientDatagramSocket; - } - // Will the handshaking and application data exchange succeed? public boolean isGoodJob() { return true; } public final void runTest(DTLSOverDatagram testCase) throws Exception { - serverDatagramSocket = new DatagramSocket(); - serverSocketAddr = new InetSocketAddress( - InetAddress.getLocalHost(), serverDatagramSocket.getLocalPort()); + try (DatagramSocket serverSocket = new DatagramSocket(); + DatagramSocket clientSocket = new DatagramSocket()) { - clientDatagramSocket = new DatagramSocket(); - clientSocketAddr = new InetSocketAddress( - InetAddress.getLocalHost(), clientDatagramSocket.getLocalPort()); + serverSocket.setSoTimeout(SOCKET_TIMEOUT); + clientSocket.setSoTimeout(SOCKET_TIMEOUT); - ExecutorService pool = Executors.newFixedThreadPool(2); - List> list = new ArrayList>(); + InetSocketAddress serverSocketAddr = new InetSocketAddress( + InetAddress.getLocalHost(), serverSocket.getLocalPort()); - try { - list.add(pool.submit(new ServerCallable(testCase))); // server task - list.add(pool.submit(new ClientCallable(testCase))); // client task - } finally { - pool.shutdown(); - } + InetSocketAddress clientSocketAddr = new InetSocketAddress( + InetAddress.getLocalHost(), clientSocket.getLocalPort()); + + ExecutorService pool = Executors.newFixedThreadPool(2); + Future server, client; - Exception reserved = null; - for (Future fut : list) { try { - System.out.println(fut.get()); - } catch (CancellationException | - InterruptedException | ExecutionException cie) { - if (reserved != null) { - cie.addSuppressed(reserved); - reserved = cie; - } else { - reserved = cie; - } + server = pool.submit(new ServerCallable( + testCase, serverSocket, clientSocketAddr)); + client = pool.submit(new ClientCallable( + testCase, clientSocket, serverSocketAddr)); + } finally { + pool.shutdown(); } - } - if (reserved != null) { - throw reserved; + boolean failed = false; + + // wait for client to finish + try { + System.out.println("Client finished: " + client.get()); + } catch (CancellationException | InterruptedException + | ExecutionException e) { + System.out.println("Exception on client side: "); + e.printStackTrace(System.out); + failed = true; + } + + // wait for server to finish + try { + System.out.println("Client finished: " + server.get()); + } catch (CancellationException | InterruptedException + | ExecutionException e) { + System.out.println("Exception on server side: "); + e.printStackTrace(System.out); + failed = true; + } + + if (failed) { + throw new RuntimeException("Test failed"); + } } } final static class ServerCallable implements Callable { - DTLSOverDatagram testCase; - ServerCallable(DTLSOverDatagram testCase) { + private final DTLSOverDatagram testCase; + private final DatagramSocket socket; + private final InetSocketAddress clientSocketAddr; + + ServerCallable(DTLSOverDatagram testCase, DatagramSocket socket, + InetSocketAddress clientSocketAddr) { + this.testCase = testCase; + this.socket = socket; + this.clientSocketAddr = clientSocketAddr; } @Override public String call() throws Exception { try { - testCase.doServerSide(); + testCase.doServerSide(socket, clientSocketAddr); } catch (Exception e) { + System.out.println("Exception in ServerCallable.call():"); e.printStackTrace(System.out); serverException = e; @@ -523,10 +599,6 @@ public class DTLSOverDatagram { } else { return "Well done, server!"; } - } finally { - if (serverDatagramSocket != null) { - serverDatagramSocket.close(); - } } if (testCase.isGoodJob()) { @@ -538,28 +610,33 @@ public class DTLSOverDatagram { } final static class ClientCallable implements Callable { - DTLSOverDatagram testCase; - ClientCallable(DTLSOverDatagram testCase) { + private final DTLSOverDatagram testCase; + private final DatagramSocket socket; + private final InetSocketAddress serverSocketAddr; + + ClientCallable(DTLSOverDatagram testCase, DatagramSocket socket, + InetSocketAddress serverSocketAddr) { + this.testCase = testCase; + this.socket = socket; + this.serverSocketAddr = serverSocketAddr; } @Override public String call() throws Exception { try { - testCase.doClientSide(); + testCase.doClientSide(socket, serverSocketAddr); } catch (Exception e) { + System.out.println("Exception in ClientCallable.call():"); e.printStackTrace(System.out); clientException = e; + if (testCase.isGoodJob()) { throw e; } else { return "Well done, client!"; } - } finally { - if (clientDatagramSocket != null) { - clientDatagramSocket.close(); - } } if (testCase.isGoodJob()) { @@ -600,4 +677,8 @@ public class DTLSOverDatagram { System.out.flush(); } } + + static void log(String side, String message) { + System.out.println(side + ": " + message); + } } diff --git a/jdk/test/javax/net/ssl/DTLS/Reordered.java b/jdk/test/javax/net/ssl/DTLS/Reordered.java index 9e91979a909..25053d221bb 100644 --- a/jdk/test/javax/net/ssl/DTLS/Reordered.java +++ b/jdk/test/javax/net/ssl/DTLS/Reordered.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -51,16 +51,17 @@ public class Reordered extends DTLSOverDatagram { } @Override - List produceHandshakePackets( - SSLEngine engine, SocketAddress socketAddr) throws Exception { - List packets = - super.produceHandshakePackets(engine, socketAddr); + boolean produceHandshakePackets(SSLEngine engine, SocketAddress socketAddr, + String side, List packets) throws Exception { + + boolean finished = super.produceHandshakePackets( + engine, socketAddr, side, packets); if (needPacketReorder && (!engine.getUseClientMode())) { needPacketReorder = false; Collections.reverse(packets); } - return packets; + return finished; } } diff --git a/jdk/test/javax/net/ssl/DTLS/Retransmission.java b/jdk/test/javax/net/ssl/DTLS/Retransmission.java index 75aecab22fb..840b08a7d7d 100644 --- a/jdk/test/javax/net/ssl/DTLS/Retransmission.java +++ b/jdk/test/javax/net/ssl/DTLS/Retransmission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -52,13 +52,14 @@ public class Retransmission extends DTLSOverDatagram { } @Override - List produceHandshakePackets( - SSLEngine engine, SocketAddress socketAddr) throws Exception { - List packets = - super.produceHandshakePackets(engine, socketAddr); + boolean produceHandshakePackets(SSLEngine engine, SocketAddress socketAddr, + String side, List packets) throws Exception { + + boolean finished = super.produceHandshakePackets( + engine, socketAddr, side, packets); if (!needPacketLoss || (!engine.getUseClientMode())) { - return packets; + return finished; } List parts = new ArrayList<>(); @@ -75,6 +76,9 @@ public class Retransmission extends DTLSOverDatagram { parts.add(packet); } - return parts; + packets.clear(); + packets.addAll(parts); + + return finished; } } diff --git a/jdk/test/javax/net/ssl/HttpsURLConnection/Equals.java b/jdk/test/javax/net/ssl/HttpsURLConnection/Equals.java index 0a482f31b90..0e40e52ce9b 100644 --- a/jdk/test/javax/net/ssl/HttpsURLConnection/Equals.java +++ b/jdk/test/javax/net/ssl/HttpsURLConnection/Equals.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -24,6 +24,7 @@ /** * @test * @library /lib/testlibrary + * @modules jdk.httpserver * @build jdk.testlibrary.SimpleSSLContext * @run main Equals * @bug 8055299 diff --git a/jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java b/jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java index ba3e5f10e50..bda0710f61e 100644 --- a/jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java +++ b/jdk/test/javax/net/ssl/ServerName/BestEffortOnLazyConnected.java @@ -34,9 +34,6 @@ */ import java.io.*; -import java.nio.*; -import java.nio.channels.*; -import java.util.*; import java.net.*; import javax.net.ssl.*; @@ -197,6 +194,7 @@ public class BestEffortOnLazyConnected { hostname); // Ignore the test if the hostname does not sound like a domain name. if ((hostname == null) || hostname.isEmpty() || + !hostname.contains(".") || hostname.endsWith(".") || hostname.startsWith("localhost") || Character.isDigit(hostname.charAt(hostname.length() - 1))) { diff --git a/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java b/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java index a86b10abd26..04020bc6f03 100644 --- a/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java +++ b/jdk/test/javax/net/ssl/TLS/CipherTestUtils.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -202,6 +202,8 @@ public class CipherTestUtils { @Override public abstract void run(); + abstract int getPort(); + void handleRequest(InputStream in, OutputStream out) throws IOException { boolean newline = false; @@ -528,9 +530,9 @@ public class CipherTestUtils { return ks; } - public static void main(PeerFactory peerFactory, String mode, - String expectedException) - throws Exception { + public static int mainServer(PeerFactory peerFactory, + String expectedException) throws Exception { + long time = System.currentTimeMillis(); setTestedArguments(peerFactory.getTestedProtocol(), peerFactory.getTestedCipher()); @@ -540,33 +542,49 @@ public class CipherTestUtils { secureRandom.nextInt(); CipherTestUtils cipherTest = CipherTestUtils.getInstance(); - if (mode.equalsIgnoreCase("Server")) { // server mode - Thread serverThread = new Thread(peerFactory.newServer(cipherTest), - "Server"); - serverThread.start(); - } else if (mode.equalsIgnoreCase("Client")) { - peerFactory.newClient(cipherTest).run(); - cipherTest.checkResult(expectedException); - JSSEServer.closeServer = true; - } else { - throw new RuntimeException("unsupported mode"); - } + Server server = peerFactory.newServer(cipherTest, PeerFactory.FREE_PORT); + Thread serverThread = new Thread(server, "Server"); + serverThread.start(); + time = System.currentTimeMillis() - time; System.out.println("Elapsed time " + time); + return server.getPort(); + } + + public static void mainClient(PeerFactory peerFactory, int port, + String expectedException) throws Exception { + + long time = System.currentTimeMillis(); + setTestedArguments(peerFactory.getTestedProtocol(), + peerFactory.getTestedCipher()); + + System.out.print( + " Initializing test '" + peerFactory.getName() + "'..."); + secureRandom.nextInt(); + + CipherTestUtils cipherTest = CipherTestUtils.getInstance(); + peerFactory.newClient(cipherTest, port).run(); + cipherTest.checkResult(expectedException); + JSSEServer.closeServer = true; + + time = System.currentTimeMillis() - time; + System.out.println("Elapsed time " + time); } public static abstract class PeerFactory { + public static final int FREE_PORT = 0; + abstract String getName(); abstract String getTestedProtocol(); abstract String getTestedCipher(); - abstract Client newClient(CipherTestUtils cipherTest) throws Exception; + abstract Client newClient(CipherTestUtils cipherTest, int testPort) throws Exception; - abstract Server newServer(CipherTestUtils cipherTest) throws Exception; + abstract Server newServer(CipherTestUtils cipherTest, int testPort) throws Exception; boolean isSupported(String cipherSuite) { return true; diff --git a/jdk/test/javax/net/ssl/TLS/JSSEServer.java b/jdk/test/javax/net/ssl/TLS/JSSEServer.java index f6e55a31706..1ece6f0f8b8 100644 --- a/jdk/test/javax/net/ssl/TLS/JSSEServer.java +++ b/jdk/test/javax/net/ssl/TLS/JSSEServer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -77,4 +77,8 @@ public class JSSEServer extends CipherTestUtils.Server { } } } + + int getPort() { + return serverSocket.getLocalPort(); + } } diff --git a/jdk/test/javax/net/ssl/TLS/TestJSSE.java b/jdk/test/javax/net/ssl/TLS/TestJSSE.java index d4c41480c0b..d477e4facdf 100644 --- a/jdk/test/javax/net/ssl/TLS/TestJSSE.java +++ b/jdk/test/javax/net/ssl/TLS/TestJSSE.java @@ -27,10 +27,8 @@ import java.security.Security; /** * @test * @bug 8049429 - * @library ../../../../lib/testlibrary/ * @modules java.management * jdk.crypto.ec/sun.security.ec - * @build jdk.testlibrary.Utils * @compile CipherTestUtils.java JSSEClient.java JSSEServer.java * @summary Test that all cipher suites work in all versions and all client * authentication types. The way this is setup the server is stateless and @@ -86,7 +84,6 @@ public class TestJSSE { String serverProtocol = System.getProperty("SERVER_PROTOCOL"); String clientProtocol = System.getProperty("CLIENT_PROTOCOL"); - int port = jdk.testlibrary.Utils.getFreePort(); String cipher = System.getProperty("CIPHER"); if (serverProtocol == null || clientProtocol == null @@ -97,7 +94,7 @@ public class TestJSSE { out.println("ServerProtocol =" + serverProtocol); out.println("ClientProtocol =" + clientProtocol); out.println("Cipher =" + cipher); - server(serverProtocol, cipher, port, args); + int port = server(serverProtocol, cipher, args); client(port, clientProtocol, cipher, args); } @@ -112,28 +109,30 @@ public class TestJSSE { out.println(" Testing - Protocol : " + testProtocols); out.println(" Testing - Cipher : " + testCipher); try { - CipherTestUtils.main(new JSSEFactory(LOCAL_IP, - testPort, testProtocols, - testCipher, "client JSSE"), - "client", expectedException); + CipherTestUtils.mainClient(new JSSEFactory(LOCAL_IP, testProtocols, + testCipher, "Client JSSE"), + testPort, expectedException); } catch (Exception e) { throw new RuntimeException(e); } } - public static void server(String testProtocol, String testCipher, - int testPort, + public static int server(String testProtocol, String testCipher, String... exception) throws Exception { + String expectedException = exception.length >= 1 ? exception[0] : null; out.println(" This is Server"); out.println(" Testing Protocol: " + testProtocol); out.println(" Testing Cipher: " + testCipher); - out.println(" Testing Port: " + testPort); + try { - CipherTestUtils.main(new JSSEFactory(null, testPort, - testProtocol, testCipher, "Server JSSE"), - "Server", expectedException); + int port = CipherTestUtils.mainServer(new JSSEFactory( + null, testProtocol, testCipher, "Server JSSE"), + expectedException); + + out.println(" Testing Port: " + port); + return port; } catch (Exception e) { throw new RuntimeException(e); } @@ -142,15 +141,13 @@ public class TestJSSE { private static class JSSEFactory extends CipherTestUtils.PeerFactory { final String testedCipherSuite, testedProtocol, testHost; - final int testPort; final String name; - JSSEFactory(String testHost, int testPort, String testedProtocol, + JSSEFactory(String testHost, String testedProtocol, String testedCipherSuite, String name) { this.testedCipherSuite = testedCipherSuite; this.testedProtocol = testedProtocol; this.testHost = testHost; - this.testPort = testPort; this.name = name; } @@ -170,14 +167,14 @@ public class TestJSSE { } @Override - CipherTestUtils.Client newClient(CipherTestUtils cipherTest) + CipherTestUtils.Client newClient(CipherTestUtils cipherTest, int testPort) throws Exception { return new JSSEClient(cipherTest, testHost, testPort, testedProtocol, testedCipherSuite); } @Override - CipherTestUtils.Server newServer(CipherTestUtils cipherTest) + CipherTestUtils.Server newServer(CipherTestUtils cipherTest, int testPort) throws Exception { return new JSSEServer(cipherTest, testPort, testedProtocol, testedCipherSuite); diff --git a/jdk/test/javax/net/ssl/etc/README b/jdk/test/javax/net/ssl/etc/README new file mode 100644 index 00000000000..0ac6a844a86 --- /dev/null +++ b/jdk/test/javax/net/ssl/etc/README @@ -0,0 +1,94 @@ +Keystores used for the JSSE regression test suite. + +keystore +truststore +========== + +These are the primary two keystores and contain entries for testing most +of the JSSE regression test files. There are three entries, one RSA-based, +one DSA-based and one EC-based. If they expire, simply recreate them +using keytool and most of the test cases should work. + +The password on both files is: + + passphrase + +There are no individual key entry passwords at this time. + + +keystore entries +================ + +Alias name: dummy +----------------- +Creation date: May 16, 2016 +Entry type: PrivateKeyEntry +Certificate chain length: 1 +Certificate[1]: +Owner: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US +Issuer: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US +Serial number: 57399b87 +Valid from: Mon May 16 10:06:38 UTC 2016 until: Sat May 16 10:06:38 UTC 2026 +Signature algorithm name: SHA256withRSA +Version: 1 + +This can be generated using hacked (update the keytool source code so that +it can be used for version 1 X.509 certificate) keytool command: +% keytool -genkeypair -alias dummy -keyalg RSA -keysize 2048 \ + -sigalg SHA256withRSA \ + -dname "CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US" \ + -validity 3652 -keypass passphrase -keystore keystore -storepass passphrase + + +Alias name: dummyecdsa +---------------------- +Creation date: May 16, 2016 +Entry type: PrivateKeyEntry +Certificate chain length: 1 +Certificate[1]: +Owner: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US +Issuer: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US +Serial number: 57399c1d +Valid from: Mon May 16 10:09:01 UTC 2016 until: Sat May 16 10:09:01 UTC 2026 +Signature algorithm name: SHA256withECDSA +Version: 1 + +This can be generated using hacked (update the keytool source code so that +it can be used for version 1 X.509 certificate) keytool command: +% keytool -genkeypair -alias dummy -keyalg EC -keysize 256 \ + -sigalg SHA256withECDSA \ + -dname "CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US" \ + -validity 3652 -keypass passphrase -keystore keystore -storepass passphrase + +Alias name: dummydsa +-------------------- +Creation date: Mar 11, 2007 +Entry type: PrivateKeyEntry +Certificate chain length: 1 +Certificate[1]: +Owner: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US +Issuer: CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US +Serial number: 45f3a314 +Valid from: Sun Mar 11 06:35:00 UTC 2007 until: Wed Mar 08 06:35:00 UTC 2017 +Certificate fingerprints: +Signature algorithm name: SHA1withDSA +Version: 1 + +This can be generated using hacked (update the keytool source code so that +it can be used for version 1 X.509 certificate) keytool command: +% keytool -genkeypair -alias dummy -keyalg DSA -keysize 1024 \ + -sigalg SHA1withDSA \ + -dname "CN=dummy.example.com, OU=Dummy, O=Dummy, L=Cupertino, ST=CA, C=US" \ + -validity 3652 -keypass passphrase -keystore keystore -storepass passphrase + + +truststore entries +================== +This key store contains only trusted certificate entries. The same +certificates are used in both keystore and truststore. + + +unknown_keystore +================ +A keystore you can use when you don't want things to be verified. +Use this with keystore/truststore, and you'll never get a match. diff --git a/jdk/test/javax/net/ssl/etc/keystore b/jdk/test/javax/net/ssl/etc/keystore index 2eb1993f3af..4062e1798c5 100644 Binary files a/jdk/test/javax/net/ssl/etc/keystore and b/jdk/test/javax/net/ssl/etc/keystore differ diff --git a/jdk/test/javax/net/ssl/etc/truststore b/jdk/test/javax/net/ssl/etc/truststore index 65a140d7732..12da39e66a5 100644 Binary files a/jdk/test/javax/net/ssl/etc/truststore and b/jdk/test/javax/net/ssl/etc/truststore differ diff --git a/jdk/test/javax/rmi/TEST.properties b/jdk/test/javax/rmi/TEST.properties new file mode 100644 index 00000000000..d4bbfc905b9 --- /dev/null +++ b/jdk/test/javax/rmi/TEST.properties @@ -0,0 +1 @@ +modules = java.rmi diff --git a/jdk/test/javax/script/ProviderTest.sh b/jdk/test/javax/script/ProviderTest.sh index 1db161dfcf6..24b4120912c 100644 --- a/jdk/test/javax/script/ProviderTest.sh +++ b/jdk/test/javax/script/ProviderTest.sh @@ -43,8 +43,18 @@ $JAR ${TESTTOOLVMOPTS} -cf ${TESTCLASSES}/dummy.jar \ -C ${TESTCLASSES} DummyScriptEngineFactory.class \ -C "${TESTSRC}" META-INF/services/javax.script.ScriptEngineFactory -echo "Running test ..." +echo "Running test with security manager ..." +$JAVA ${TESTVMOPTS} -Djava.security.manager -classpath \ + "${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar" \ + ProviderTest +ret=$? +if [ $ret -ne 0 ] +then + exit $ret +fi + +echo "Running test without security manager ..." $JAVA ${TESTVMOPTS} -classpath \ "${TESTCLASSES}${PS}${TESTCLASSES}/dummy.jar" \ ProviderTest diff --git a/jdk/test/javax/script/TEST.properties b/jdk/test/javax/script/TEST.properties new file mode 100644 index 00000000000..3bb100c3fad --- /dev/null +++ b/jdk/test/javax/script/TEST.properties @@ -0,0 +1 @@ +modules = java.scripting diff --git a/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeAiffFiles.java b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeAiffFiles.java new file mode 100644 index 00000000000..c0899484328 --- /dev/null +++ b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeAiffFiles.java @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.ByteArrayInputStream; + +import javax.sound.sampled.AudioFileFormat; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; + +/** + * @test + * @bug 6729836 + */ +public final class RecognizeHugeAiffFiles { + + /** + * The maximum number of sample frames per AIFF specification. + */ + private static final /* unsigned int */ long MAX_UNSIGNED_INT = 0xffffffffL; + + /** + * The supported aiff sample size in bits. + */ + private static final byte[] aiffBits = { + 1, 2, 4, 8, 11, 16, 20, 24, 27, 32 + }; + + /** + * The list of supported sample rates. + */ + private static final int[] sampleRates = { + 8000, 11025, 16000, 22050, 32000, 37800, 44056, 44100, 47250, 48000, + 50000, 50400, 88200, 96000, 176400, 192000, 352800, 2822400, + 5644800, Integer.MAX_VALUE + }; + + /** + * The list of supported channels. + */ + private static final int[] channels = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 + }; + + /** + * The list of supported number of frames. + *

    + * The {@code MAX_UNSIGNED_INT} is a maximum. + */ + private static final long[] numberOfFrames = { + 0, 1, 2, 3, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, + (long) Integer.MAX_VALUE + 1, MAX_UNSIGNED_INT - 1, MAX_UNSIGNED_INT + }; + + public static void main(final String[] args) throws Exception { + for (final byte bits : aiffBits) { + for (final int sampleRate : sampleRates) { + for (final int channel : channels) { + for (final long dataSize : numberOfFrames) { + testAFF(bits, sampleRate, channel, dataSize); + testAIS(bits, sampleRate, channel, dataSize); + } + } + } + } + } + + /** + * Tests the {@code AudioFileFormat} fetched from the fake header. + *

    + * Note that the frameLength and byteLength are stored as int which means + * that {@code AudioFileFormat} will store the data above {@code MAX_INT} as + * NOT_SPECIFIED. + */ + private static void testAFF(final byte bits, final int rate, + final int channel, final long frameLength) + throws Exception { + final byte[] header = createHeader(bits, rate, channel, frameLength); + final ByteArrayInputStream fake = new ByteArrayInputStream(header); + final AudioFileFormat aff = AudioSystem.getAudioFileFormat(fake); + + if (aff.getType() != AudioFileFormat.Type.AIFF) { + throw new RuntimeException("Error"); + } + + if (frameLength <= Integer.MAX_VALUE) { + if (aff.getFrameLength() != frameLength) { + System.err.println("Expected: " + frameLength); + System.err.println("Actual: " + aff.getFrameLength()); + throw new RuntimeException(); + } + } else { + if (aff.getFrameLength() != AudioSystem.NOT_SPECIFIED) { + System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED); + System.err.println("Actual: " + aff.getFrameLength()); + throw new RuntimeException(); + } + } + validateFormat(bits, rate, channel, aff.getFormat()); + } + + /** + * Tests the {@code AudioInputStream} fetched from the fake header. + *

    + * Note that the frameLength is stored as long which means that {@code + * AudioInputStream} must store all possible data from aiff file. + */ + private static void testAIS(final byte bits, final int rate, + final int channel, final long frameLength) + throws Exception { + final byte[] header = createHeader(bits, rate, channel, frameLength); + final ByteArrayInputStream fake = new ByteArrayInputStream(header); + final AudioInputStream ais = AudioSystem.getAudioInputStream(fake); + final AudioFormat format = ais.getFormat(); + + if (frameLength != ais.getFrameLength()) { + System.err.println("Expected: " + frameLength); + System.err.println("Actual: " + ais.getFrameLength()); + throw new RuntimeException(); + } + if (ais.available() < 0) { + System.err.println("available should be >=0: " + ais.available()); + throw new RuntimeException(); + } + + validateFormat(bits, rate, channel, format); + } + + /** + * Tests that format contains the same data as were provided to the fake + * stream. + */ + private static void validateFormat(final byte bits, final int rate, + final int channel, + final AudioFormat format) { + + if (Float.compare(format.getSampleRate(), rate) != 0) { + System.err.println("Expected: " + rate); + System.err.println("Actual: " + format.getSampleRate()); + throw new RuntimeException(); + } + if (format.getChannels() != channel) { + System.err.println("Expected: " + channel); + System.err.println("Actual: " + format.getChannels()); + throw new RuntimeException(); + } + int frameSize = ((bits + 7) / 8) * channel; + if (format.getFrameSize() != frameSize) { + System.out.println("Expected: " + frameSize); + System.err.println("Actual: " + format.getFrameSize()); + throw new RuntimeException(); + } + } + + private static final int DOUBLE_MANTISSA_LENGTH = 52; + private static final int DOUBLE_EXPONENT_LENGTH = 11; + private static final long DOUBLE_SIGN_MASK = 0x8000000000000000L; + private static final long DOUBLE_EXPONENT_MASK = 0x7FF0000000000000L; + private static final long DOUBLE_MANTISSA_MASK = 0x000FFFFFFFFFFFFFL; + private static final int DOUBLE_EXPONENT_OFFSET = 1023; + + private static final int EXTENDED_EXPONENT_OFFSET = 16383; + private static final int EXTENDED_MANTISSA_LENGTH = 63; + private static final int EXTENDED_EXPONENT_LENGTH = 15; + private static final long EXTENDED_INTEGER_MASK = 0x8000000000000000L; + + /** + * Creates the custom header of the AIFF file. It is expected that all + * passed data are supported. + */ + private static byte[] createHeader(final byte bits, final int rate, + final int channel, final long frameLength) { + long doubleBits = Double.doubleToLongBits(rate); + + long sign = (doubleBits & DOUBLE_SIGN_MASK) + >> (DOUBLE_EXPONENT_LENGTH + DOUBLE_MANTISSA_LENGTH); + long doubleExponent = (doubleBits & DOUBLE_EXPONENT_MASK) + >> DOUBLE_MANTISSA_LENGTH; + long doubleMantissa = doubleBits & DOUBLE_MANTISSA_MASK; + + long extendedExponent = doubleExponent - DOUBLE_EXPONENT_OFFSET + + EXTENDED_EXPONENT_OFFSET; + long extendedMantissa = doubleMantissa + << (EXTENDED_MANTISSA_LENGTH - DOUBLE_MANTISSA_LENGTH); + long extendedSign = sign << EXTENDED_EXPONENT_LENGTH; + short extendedBits79To64 = (short) (extendedSign | extendedExponent); + long extendedBits63To0 = EXTENDED_INTEGER_MASK | extendedMantissa; + + return new byte[]{ + // AIFF_MAGIC + 0x46, 0x4f, 0x52, 0x4d, + // fileLength (will use the number of frames for testing) + (byte) (frameLength >> 24), (byte) (frameLength >> 16), + (byte) (frameLength >> 8), (byte) frameLength, + // form aiff + 0x41, 0x49, 0x46, 0x46, + // COMM_MAGIC + 0x43, 0x4f, 0x4d, 0x4d, + // comm chunk size + 0, 0, 0, 18, + // channels + (byte) (channel >> 8),(byte) channel, + // numSampleFrames + (byte) (frameLength >> 24), (byte) (frameLength >> 16), + (byte) (frameLength >> 8), (byte) (frameLength), + // samplesize + (byte) (bits >> 8),(byte) (bits), + // samplerate + (byte) (extendedBits79To64 >> 8), + (byte) extendedBits79To64, + (byte) (extendedBits63To0 >> 56), + (byte) (extendedBits63To0 >> 48), + (byte) (extendedBits63To0 >> 40), + (byte) (extendedBits63To0 >> 32), (byte) (extendedBits63To0 >> 24), + (byte) (extendedBits63To0 >> 16), (byte) (extendedBits63To0 >> 8), + (byte) extendedBits63To0, + // SND_MAGIC + 0x53, 0x53, 0x4e, 0x44, + // data chunk size + 0, 0, 0, 0, + // dataOffset + 0, 0, 0, 0, + // blocksize + 0, 0, 0, 0, + }; + } +} diff --git a/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeAuFiles.java b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeAuFiles.java new file mode 100644 index 00000000000..ba908667299 --- /dev/null +++ b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeAuFiles.java @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.ByteArrayInputStream; + +import javax.sound.sampled.AudioFileFormat; +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; + +/** + * @test + * @bug 6729836 + */ +public final class RecognizeHugeAuFiles { + + /** + * The size of the header's data. + */ + private static final byte AU_HEADER = 44; + + /** + * This value should be used if the size in bytes is unknown. + */ + private static final /* unsigned int */ long MAX_UNSIGNED_INT = 0xffffffffL; + + /** + * The list of supported au formats and sample size in bits per format. + */ + private static final byte[][] auTypeBits = { + {1, 8}, {2, 8}, {3, 16}, {4, 24}, {5, 32}, {6, 32}, {27, 8} + }; + + /** + * The list of supported sample rates(stored as unsigned int). + */ + private static final int[] sampleRates = { + 8000, 11025, 16000, 22050, 32000, 37800, 44056, 44100, 47250, 48000, + 50000, 50400, 88200, 96000, 176400, 192000, 352800, 2822400, + 5644800, Integer.MAX_VALUE + }; + + /** + * The list of supported channels (stored as unsigned int). + */ + private static final int[] channels = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 + }; + + /** + * The list of supported size of data (stored as unsigned int). + *

    + * The {@code MAX_UNSIGNED_INT} used if the size in bytes is unknown. + */ + private static final long[] dataSizes = { + 0, 1, 2, 3, Integer.MAX_VALUE - AU_HEADER, Integer.MAX_VALUE - 1, + Integer.MAX_VALUE, (long) Integer.MAX_VALUE + 1, + (long) Integer.MAX_VALUE + AU_HEADER, MAX_UNSIGNED_INT - AU_HEADER, + MAX_UNSIGNED_INT - 1, MAX_UNSIGNED_INT + }; + + public static void main(final String[] args) throws Exception { + for (final byte[] type : auTypeBits) { + for (final int sampleRate : sampleRates) { + for (final int channel : channels) { + for (final long dataSize : dataSizes) { + testAFF(type, sampleRate, channel, dataSize); + testAIS(type, sampleRate, channel, dataSize); + } + } + } + } + } + + /** + * Tests the {@code AudioFileFormat} fetched from the fake header. + *

    + * Note that the frameLength and byteLength are stored as int which means + * that {@code AudioFileFormat} will store the data above {@code MAX_INT} + * as NOT_SPECIFIED. + */ + private static void testAFF(final byte[] type, final int rate, + final int channel, final long size) + throws Exception { + final byte[] header = createHeader(type, rate, channel, size); + final ByteArrayInputStream fake = new ByteArrayInputStream(header); + final AudioFileFormat aff = AudioSystem.getAudioFileFormat(fake); + final AudioFormat format = aff.getFormat(); + + if (aff.getType() != AudioFileFormat.Type.AU) { + throw new RuntimeException("Error"); + } + + final long frameLength = size / format.getFrameSize(); + if (size != MAX_UNSIGNED_INT && frameLength <= Integer.MAX_VALUE) { + if (aff.getFrameLength() != frameLength) { + System.err.println("Expected: " + frameLength); + System.err.println("Actual: " + aff.getFrameLength()); + throw new RuntimeException(); + } + } else { + if (aff.getFrameLength() != AudioSystem.NOT_SPECIFIED) { + System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED); + System.err.println("Actual: " + aff.getFrameLength()); + throw new RuntimeException(); + } + } + + final long byteLength = size + AU_HEADER; + if (byteLength <= Integer.MAX_VALUE) { + if (aff.getByteLength() != byteLength) { + System.err.println("Expected: " + byteLength); + System.err.println("Actual: " + aff.getByteLength()); + throw new RuntimeException(); + } + } else { + if (aff.getByteLength() != AudioSystem.NOT_SPECIFIED) { + System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED); + System.err.println("Actual: " + aff.getByteLength()); + throw new RuntimeException(); + } + } + validateFormat(type[1], rate, channel, aff.getFormat()); + } + + /** + * Tests the {@code AudioInputStream} fetched from the fake header. + *

    + * Note that the frameLength is stored as long which means + * that {@code AudioInputStream} must store all possible data from au file. + */ + private static void testAIS(final byte[] type, final int rate, + final int channel, final long size) + throws Exception { + final byte[] header = createHeader(type, rate, channel, size); + final ByteArrayInputStream fake = new ByteArrayInputStream(header); + final AudioInputStream ais = AudioSystem.getAudioInputStream(fake); + final AudioFormat format = ais.getFormat(); + final long frameLength = size / format.getFrameSize(); + if (size != MAX_UNSIGNED_INT) { + if (frameLength != ais.getFrameLength()) { + System.err.println("Expected: " + frameLength); + System.err.println("Actual: " + ais.getFrameLength()); + throw new RuntimeException(); + } + } else { + if (ais.getFrameLength() != AudioSystem.NOT_SPECIFIED) { + System.err.println("Expected: " + AudioSystem.NOT_SPECIFIED); + System.err.println("Actual: " + ais.getFrameLength()); + throw new RuntimeException(); + } + } + if (ais.available() < 0) { + System.err.println("available should be >=0: " + ais.available()); + throw new RuntimeException(); + } + validateFormat(type[1], rate, channel, format); + } + + /** + * Tests that format contains the same data as were provided to the fake + * stream. + */ + private static void validateFormat(final byte bits, final int rate, + final int channel, + final AudioFormat format) { + + if (Float.compare(format.getSampleRate(), rate) != 0) { + System.out.println("Expected: " + rate); + System.out.println("Actual: " + format.getSampleRate()); + throw new RuntimeException(); + } + if (format.getChannels() != channel) { + System.out.println("Expected: " + channel); + System.out.println("Actual: " + format.getChannels()); + throw new RuntimeException(); + } + int frameSize = ((bits + 7) / 8) * channel; + if (format.getFrameSize() != frameSize) { + System.out.println("Expected: " + frameSize); + System.out.println("Actual: " + format.getFrameSize()); + throw new RuntimeException(); + } + } + + /** + * Creates the custom header of the AU file. It is expected that all passed + * data are supported. + */ + private static byte[] createHeader(final byte[] type, final int rate, + final int channel, final long size) { + return new byte[]{ + // AU_SUN_MAGIC + 0x2e, 0x73, 0x6e, 0x64, + // headerSize + 0, 0, 0, AU_HEADER, + // dataSize + (byte) (size >> 24), (byte) (size >> 16), (byte) (size >> 8), + (byte) size, + // encoding + 0, 0, 0, type[0], + // sampleRate + (byte) (rate >> 24), (byte) (rate >> 16), (byte) (rate >> 8), + (byte) (rate), + // channels + (byte) (channel >> 24), (byte) (channel >> 16), + (byte) (channel >> 8), (byte) (channel), + // data + 0, 0, 0, 0, 0, 0 + }; + } +} diff --git a/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveExtFiles.java b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveExtFiles.java index 88b231d62d7..ca8d17e3e78 100644 --- a/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveExtFiles.java +++ b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveExtFiles.java @@ -125,7 +125,7 @@ public final class RecognizeHugeWaveExtFiles { * Tests the {@code AudioInputStream} fetched from the fake header. *

    * Note that the frameLength is stored as long which means that {@code - * AudioInputStream} must store all possible data from au file. + * AudioInputStream} must store all possible data from wave file. */ private static void testAIS(final int[] type, final int rate, final int channel, final long size) @@ -166,8 +166,9 @@ public final class RecognizeHugeWaveExtFiles { System.err.println("Actual: " + format.getChannels()); throw new RuntimeException(); } - if (format.getFrameSize() != ((bits + 7) / 8) * channel) { - System.err.println("Expected: " + (bits * channel + 1) / 8); + int frameSize = ((bits + 7) / 8) * channel; + if (format.getFrameSize() != frameSize) { + System.err.println("Expected: " + frameSize); System.err.println("Actual: " + format.getFrameSize()); throw new RuntimeException(); } diff --git a/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveFloatFiles.java b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveFiles.java similarity index 91% rename from jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveFloatFiles.java rename to jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveFiles.java index e36a7e2b180..191290a128e 100644 --- a/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveFloatFiles.java +++ b/jdk/test/javax/sound/sampled/spi/AudioFileReader/RecognizeHugeWaveFiles.java @@ -30,9 +30,9 @@ import javax.sound.sampled.AudioSystem; /** * @test - * @bug 8132782 + * @bug 8132782 6729836 */ -public final class RecognizeHugeWaveFloatFiles { +public final class RecognizeHugeWaveFiles { /** * The maximum size in bytes per WAVE specification. @@ -43,7 +43,17 @@ public final class RecognizeHugeWaveFloatFiles { * The supported wave pcm_float format and sample size in bits. */ private static final byte[][] waveTypeBits = { - {0x0003/*WAVE_FORMAT_IEEE_FLOAT*/, 32} + {0x0001/*WAVE_FORMAT_PCM*/,1}, + {0x0001/*WAVE_FORMAT_PCM*/,2}, + {0x0001/*WAVE_FORMAT_PCM*/,4}, + {0x0001/*WAVE_FORMAT_PCM*/,8}, + {0x0001/*WAVE_FORMAT_PCM*/,16}, + {0x0001/*WAVE_FORMAT_PCM*/,20}, + {0x0001/*WAVE_FORMAT_PCM*/,24}, + {0x0001/*WAVE_FORMAT_PCM*/,32}, + {0x0003/*WAVE_FORMAT_IEEE_FLOAT*/, 32}, + {0x0006/*WAVE_FORMAT_ALAW*/, 8}, + {0x0007/*WAVE_FORMAT_MULAW*/, 8} }; /** @@ -125,7 +135,7 @@ public final class RecognizeHugeWaveFloatFiles { * Tests the {@code AudioInputStream} fetched from the fake header. *

    * Note that the frameLength is stored as long which means that {@code - * AudioInputStream} must store all possible data from au file. + * AudioInputStream} must store all possible data from wave file. */ private static void testAIS(final byte[] type, final int rate, final int channel, final long size) @@ -166,8 +176,9 @@ public final class RecognizeHugeWaveFloatFiles { System.err.println("Actual: " + format.getChannels()); throw new RuntimeException(); } - if (format.getFrameSize() != ((bits + 7) / 8) * channel) { - System.err.println("Expected: " + (bits * channel + 1) / 8); + int frameSize = ((bits + 7) / 8) * channel; + if (format.getFrameSize() != frameSize) { + System.err.println("Expected: " + frameSize); System.err.println("Actual: " + format.getFrameSize()); throw new RuntimeException(); } diff --git a/jdk/test/javax/swing/JFileChooser/8152677/SelectAllFilesFilterTest.java b/jdk/test/javax/swing/JFileChooser/8152677/SelectAllFilesFilterTest.java new file mode 100644 index 00000000000..bc17b04a306 --- /dev/null +++ b/jdk/test/javax/swing/JFileChooser/8152677/SelectAllFilesFilterTest.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Component; +import java.awt.Container; +import java.awt.Robot; +import javax.swing.JComboBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.SwingUtilities; +import javax.swing.filechooser.FileFilter; +import javax.swing.filechooser.FileNameExtensionFilter; + +/* + * @test + * @bug 8152677 + * @requires (os.family == "mac") + * @summary [macosx] All files filter can't be selected in JFileChooser + * @run main SelectAllFilesFilterTest + */ + +public class SelectAllFilesFilterTest { + + private static final String LABEL_TEXT = "File Format:"; + private static volatile JFileChooser fileChooser; + private static JComboBox comboBox; + + public static void main(String[] args) throws Exception { + + SwingUtilities.invokeLater(SelectAllFilesFilterTest::createAndShowGUI); + + while (fileChooser == null) { + Thread.sleep(100); + } + + Robot robot = new Robot(); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + comboBox = findComboBox(fileChooser); + comboBox.setSelectedIndex(0); + }); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + int selectedIndex = comboBox.getSelectedIndex(); + fileChooser.setVisible(false); + + if (selectedIndex != 0) { + throw new RuntimeException("Select All file filter is not selected!"); + } + }); + } + + private static void createAndShowGUI() { + fileChooser = new JFileChooser(); + fileChooser.setAcceptAllFileFilterUsed(true); + fileChooser.setDialogType(JFileChooser.OPEN_DIALOG); + + FileFilter txtFilter = new FileNameExtensionFilter("Text files", "txt"); + fileChooser.addChoosableFileFilter(txtFilter); + fileChooser.setFileFilter(txtFilter); + fileChooser.showOpenDialog(null); + } + + private static JComboBox findComboBox(Component comp) { + + if (comp instanceof JLabel) { + JLabel label = (JLabel) comp; + if (LABEL_TEXT.equals(label.getText())) { + return (JComboBox) label.getLabelFor(); + } + } + + if (comp instanceof Container) { + Container cont = (Container) comp; + for (int i = 0; i < cont.getComponentCount(); i++) { + + JComboBox result = findComboBox(cont.getComponent(i)); + if (result != null) { + return result; + } + } + } + + return null; + } +} diff --git a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java index 1a9f42120e2..589bb9b5744 100644 --- a/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java +++ b/jdk/test/javax/swing/JMenuItem/ActionListenerCalledTwice/ActionListenerCalledTwiceTest.java @@ -21,23 +21,23 @@ * questions. */ -/* + /* * @test - * @bug 7160951 + * @bug 7160951 8152492 * @summary [macosx] ActionListener called twice for JMenuItem using ScreenMenuBar * @author vera.akulova@oracle.com * @library ../../../../lib/testlibrary * @build jdk.testlibrary.OSInfo * @run main ActionListenerCalledTwiceTest */ - import jdk.testlibrary.OSInfo; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ActionListenerCalledTwiceTest { - static String menuItems[] = { "Item1", "Item2", "Item3", "Item4", "Item5", "Item6" }; + + static String menuItems[] = {"Item1", "Item2", "Item3", "Item4", "Item5", "Item6"}; static KeyStroke keyStrokes[] = { KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.META_MASK), KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), @@ -46,8 +46,10 @@ public class ActionListenerCalledTwiceTest { KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK), KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.META_MASK) }; - + static JMenu menu; + static JFrame frame; static volatile int listenerCallCounter = 0; + public static void main(String[] args) throws Exception { if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) { System.out.println("This test is for MacOS only. Automatically passed on other platforms."); @@ -82,33 +84,38 @@ public class ActionListenerCalledTwiceTest { robot.waitForIdle(); if (listenerCallCounter != 1) { - throw new Exception("Test failed: ActionListener for " + menuItems[i] + - " called " + listenerCallCounter + " times instead of 1!"); + throw new Exception("Test failed: ActionListener for " + menuItems[i] + + " called " + listenerCallCounter + " times instead of 1!"); } listenerCallCounter = 0; } + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.dispose(); + } + }); } private static void createAndShowGUI() { - JMenu menu = new JMenu("Menu"); + menu = new JMenu("Menu"); for (int i = 0; i < menuItems.length; ++i) { JMenuItem newItem = new JMenuItem(menuItems[i]); newItem.setAccelerator(keyStrokes[i]); newItem.addActionListener( - new ActionListener(){ - public void actionPerformed(ActionEvent e) { - listenerCallCounter++; - } + new ActionListener() { + public void actionPerformed(ActionEvent e) { + listenerCallCounter++; } + } ); menu.add(newItem); } JMenuBar bar = new JMenuBar(); bar.add(menu); - JFrame frame = new JFrame("Test"); + frame = new JFrame("Test"); frame.setJMenuBar(bar); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); diff --git a/jdk/test/javax/swing/JSpinner/6421058/bug6421058.java b/jdk/test/javax/swing/JSpinner/6421058/bug6421058.java new file mode 100644 index 00000000000..d67762b21d7 --- /dev/null +++ b/jdk/test/javax/swing/JSpinner/6421058/bug6421058.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + /* + * @test + * @bug 6421058 + * @summary Verify font of the text field is changed to the font of + * JSpinner if the font of text field was NOT set by the user + * @run main bug6421058 + */ + +import java.awt.Font; +import javax.swing.JFrame; +import javax.swing.JSpinner; +import javax.swing.JSpinner.DefaultEditor; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.plaf.UIResource; +import static javax.swing.UIManager.getInstalledLookAndFeels; + +public class bug6421058 implements Runnable { + + public static void main(final String[] args) throws Exception { + for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) { + SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf)); + SwingUtilities.invokeAndWait(new bug6421058()); + } + } + + @Override + public void run() { + final JFrame mainFrame = new JFrame(); + try { + testDefaultFont(mainFrame); + } finally { + mainFrame.dispose(); + } + } + + private static void testDefaultFont(final JFrame frame) { + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JSpinner spinner = new JSpinner(); + frame.add(spinner); + frame.setSize(300, 100); + frame.setVisible(true); + + final DefaultEditor editor = (DefaultEditor) spinner.getEditor(); + final Font editorFont = editor.getTextField().getFont(); + + /* + * Validate that the font of the text field is changed to the + * font of JSpinner if the font of text field was not set by the + * user. + */ + + if (!(editorFont instanceof UIResource)) { + throw new RuntimeException("Font must be UIResource"); + } + if (!editorFont.equals(spinner.getFont())) { + throw new RuntimeException("Wrong FONT"); + } + } + + private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) { + try { + UIManager.setLookAndFeel(laf.getClassName()); + } catch (ClassNotFoundException | InstantiationException | + UnsupportedLookAndFeelException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } +} diff --git a/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK.java b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK.java new file mode 100644 index 00000000000..c1b7214e406 --- /dev/null +++ b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + @test + @summary Tests that GTK LaF is supported on solaris + regardless of jdk.gtk.version flag values. + @bug 8156121 + @requires (os.name == "linux" | os.name == "solaris") + @run main/othervm -Djdk.gtk.version=2 DemandGTK + @run main/othervm -Djdk.gtk.version=3 DemandGTK +*/ + +import javax.swing.JFrame; +import javax.swing.UIManager; +import javax.swing.SwingUtilities; +import java.awt.Robot; + +public class DemandGTK { + + static JFrame frame; + public static void createAndShow() { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); + } catch(Exception cnf) { + cnf.printStackTrace(); + throw new RuntimeException("GTK LaF must be supported"); + } + frame = new JFrame("JFrame"); + frame.setSize(200, 200); + + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(DemandGTK::createAndShow); + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait( () -> { + frame.setVisible(false); + frame.dispose(); + }); + + } +} + diff --git a/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.sh b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.sh new file mode 100644 index 00000000000..93de97904fd --- /dev/null +++ b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.sh @@ -0,0 +1,89 @@ +#!/bin/ksh -p + +# +# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# @test +# @summary Try to force GTK2. We must bail out to GTK3 (if any) if no 2 available. +# +# @compile ProvokeGTK.java +# @requires os.family == "linux" +# @run shell/timeout=400 DemandGTK2.sh + +# +# Note that we depend on +# strace in the PATH +# /sbin/ldconfig (which may be not in PATH) +# It is true for OEL 7 and Ubuntu 14, 16 +# but may fail in future. Save tomorrow for tomorrow. +# +# Read DemandGTK2.txt how to prepare GTK2-less machine. +# + +which strace +if [ $? -ne 0 ] +then + echo "Please provide strace: \"which strace\" failed." + exit 1 +fi + +HAVE_2=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-x11-2 | wc -l` +HAVE_3=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-3.so | wc -l` + + +if [ "${HAVE_2}" = "0" ] +then + + if [ "${HAVE_3}" = "0" ] + then + echo "Neither GTK2 nor GTK3 found: system misconfiguration. Exit." + exit 1 + fi + echo "No GTK 2 library found: we should bail out to 3" + strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=2 ProvokeGTK + EXECRES=$? + grep 'libgtk-3.*=\ *[0-9]*$' strace.log > logg +else + echo "There is GTK 2 library: we should use it" + strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=2 ProvokeGTK + EXECRES=$? + grep 'libgtk-x11.*=\ *[0-9]*$' strace.log > logg +fi + +if [ ${EXECRES} -ne 0 ] +then + echo "java execution failed for unknown reason, see logs" + exit 2 +fi + +cat logg +if [ -s logg ] +then + echo "Success." + exit 0 +else + echo "Failed. Examine logs." + exit 3 +fi + + diff --git a/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.txt b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.txt new file mode 100644 index 00000000000..7313e3ee4a7 --- /dev/null +++ b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK2.txt @@ -0,0 +1,36 @@ +How to prepare an Ubuntu machine for GTK-2-less test run. + +The test DemandGTK2.sh should work well without GTK-2 switching to version 3 +if there's no GTK-2 library available. +At the moment, it's not easy to find a system with GTK-3 and without GTK-2: +many programs still depend on version 2. +We can, however, rename GTK-2 library for a single test run and then restore +it back. + +(1) Find GTK2 library: run + /sbin/ldconfig -v 2>/dev/null | grep libgtk-x11-2 + +It will output one or two lines like +libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.2400.23 +Search for the target of that symlink for instance with locate: +locate libgtk-x11-2.0.so.0.2400.23 +Finally, you'll find the libraries. On my current machine they are +/usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0.2400.23 +/usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 + +I'm running 64-bit JDK and need to tamper with x86_64 copy only. + +(2) Find running programs depending on this library. They probably would crash +if you rename it. Stop them for this test run. +That said, I'm afraid it would be impossible to do on a system older than Ubuntu 16.04. +On my Ubuntu 16.04 I have only hud-service using this library, and that's OK, it will restart +after a crash, if any. +To find these programs, run +lsof /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 + +(3) Now, +sudo mv /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 /usr/lib/x86_64-linux-gnu/bak.libgtk-x11-2.0.so.0.2400.23 +jtreg DemandGTK2.sh +sudo mv /usr/lib/x86_64-linux-gnu/bak.libgtk-x11-2.0.so.0.2400.23 /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.23 + +Needless to say, you should substitute your own library path and however you run jtreg. diff --git a/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK3.sh b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK3.sh new file mode 100644 index 00000000000..1a9038a4bef --- /dev/null +++ b/jdk/test/javax/swing/LookAndFeel/8145547/DemandGTK3.sh @@ -0,0 +1,81 @@ +#!/bin/ksh -p + +# +# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + + +# @test +# @summary Try to force GTK3. We must bail out to GTK2 if no 3 available. +# +# @compile ProvokeGTK.java +# @requires os.family == "linux" +# @run shell/timeout=400 DemandGTK3.sh + +# +# Note that we depend on +# strace in the PATH +# /sbin/ldconfig (which may be is not in PATH) +# It is true for OEL 7 and Ubuntu 14, 16 +# but may fail in future. Save tomorrow for tomorrow. +# + +which strace +if [ $? -ne 0 ] +then + echo "Please provide strace: \"which strace\" failed." + exit 1 +fi + +HAVE_3=`/sbin/ldconfig -v 2>/dev/null | grep libgtk-3.so | wc -l` + + +if [ "${HAVE_3}" = "0" ] +then + + echo "No GTK 3 library found: we should bail out to 2" + strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=3 ProvokeGTK + EXECRES=$? + grep 'libgtk-x11.*=\ *[0-9]*$' strace.log > logg +else + echo "There is GTK 3 library: we should use it" + strace -o strace.log -fe open ${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} -Djdk.gtk.version=3 ProvokeGTK + EXECRES=$? + grep 'libgtk-3.*=\ *[0-9]*$' strace.log > logg +fi + +if [ ${EXECRES} -ne 0 ] +then + echo "java execution failed for unknown reason, see logs" + exit 2 +fi + +cat logg +if [ -s logg ] +then + echo "Success." + exit 0 +else + echo "Failed. Examine logs." + exit 3 +fi + diff --git a/jdk/test/javax/swing/LookAndFeel/8145547/ProvokeGTK.java b/jdk/test/javax/swing/LookAndFeel/8145547/ProvokeGTK.java new file mode 100644 index 00000000000..485ea05beaa --- /dev/null +++ b/jdk/test/javax/swing/LookAndFeel/8145547/ProvokeGTK.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JFrame; +import javax.swing.UIManager; +import javax.swing.SwingUtilities; + +public class ProvokeGTK { + + static JFrame frame; + public static void createAndShow() { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); + } catch(Exception cnf) { + cnf.printStackTrace(); + } + frame = new JFrame("JFrame"); + frame.setSize(200, 200); + + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(ProvokeGTK::createAndShow); + Thread.sleep(1000); + SwingUtilities.invokeAndWait( () -> { + frame.setVisible(false); + frame.dispose(); + }); + + } +} + diff --git a/jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java b/jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java index 4a556efce13..9cc57cfcdae 100644 --- a/jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java +++ b/jdk/test/javax/xml/bind/xjc/8032884/XjcOptionalPropertyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -23,47 +23,107 @@ /* * @test - * @bug 8032884 + * @bug 8032884 8072579 * @summary Globalbindings optionalProperty="primitive" does not work when minOccurs=0 - * @run shell compile-schema.sh - * @compile -addmods java.xml.bind XjcOptionalPropertyTest.java - * @run main/othervm XjcOptionalPropertyTest + * @library /lib/testlibrary + * @modules java.xml.bind + * @run testng/othervm XjcOptionalPropertyTest */ import java.io.IOException; import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import java.util.Arrays; +import jdk.testlibrary.JDKToolLauncher; +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; public class XjcOptionalPropertyTest { - public static void main(String[] args) throws IOException { - - generated.Foo foo = new generated.Foo(); - log("foo = " + foo); + @Test + public void optionalPropertyTest() throws Exception { + runXjc(); + compileXjcGeneratedClasses(); + URLClassLoader testClassLoader; + testClassLoader = URLClassLoader.newInstance(new URL[]{testWorkDirUrl}); + Class fooClass = testClassLoader.loadClass(CLASS_TO_TEST); + Object foo = fooClass.newInstance(); Method[] methods = foo.getClass().getMethods(); - log("Found [" + methods.length + "] methods"); + System.out.println("Found [" + methods.length + "] methods"); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equals("setFoo")) { - log("Checking method [" + method.getName() + "]"); + System.out.println("Checking method [" + method.getName() + "]"); Class[] parameterTypes = method.getParameterTypes(); - if (parameterTypes.length != 1) - fail("more than 1 parameter"); - if (!parameterTypes[0].isPrimitive()) { - fail("Found [" + parameterTypes[0].getName() + "], but expected primitive!"); - } + Assert.assertEquals(parameterTypes.length, 1); + Assert.assertTrue(parameterTypes[0].isPrimitive()); break; } } - log("TEST PASSED."); - } - private static void fail(String message) { - throw new RuntimeException(message); + @BeforeTest + public void setUp() throws IOException { + // Create test directory inside scratch + testWorkDir = Paths.get(System.getProperty("user.dir", ".")); + // Save its URL + testWorkDirUrl = testWorkDir.toUri().toURL(); + // Get test source directory path + testSrcDir = Paths.get(System.getProperty("test.src", ".")); + // Get path of xjc result folder + xjcResultDir = testWorkDir.resolve(TEST_PACKAGE); + // Copy schema document file to scratch directory + Files.copy(testSrcDir.resolve(XSD_FILENAME), testWorkDir.resolve(XSD_FILENAME), REPLACE_EXISTING); } - private static void log(String msg) { - System.out.println(msg); + // Compile schema file into java classes definitions + void runXjc() throws Exception { + // Prepare process builder to run schemagen tool and save its output + JDKToolLauncher xjcLauncher = JDKToolLauncher.createUsingTestJDK("xjc"); + xjcLauncher.addToolArg(XSD_FILENAME); + System.out.println("Executing xjc command: " + Arrays.asList(xjcLauncher.getCommand())); + ProcessBuilder pb = new ProcessBuilder(xjcLauncher.getCommand()); + // Set xjc work directory with the input java file + pb.directory(testWorkDir.toFile()); + pb.inheritIO(); + Process p = pb.start(); + p.waitFor(); + p.destroy(); } + // Compile java classes with javac tool + void compileXjcGeneratedClasses() throws Exception { + JDKToolLauncher javacLauncher = JDKToolLauncher.createUsingTestJDK("javac"); + javacLauncher.addToolArg("-addmods"); + javacLauncher.addToolArg("java.xml.bind"); + javacLauncher.addToolArg(xjcResultDir.resolve("Foo.java").toString()); + System.out.println("Compiling xjc generated class: " + Arrays.asList(javacLauncher.getCommand())); + ProcessBuilder pb = new ProcessBuilder(javacLauncher.getCommand()); + pb.inheritIO(); + pb.directory(testWorkDir.toFile()); + Process p = pb.start(); + p.waitFor(); + p.destroy(); + } + + // Test schema filename + static final String XSD_FILENAME = "optional-property-schema.xsd"; + // Test package with generated class + static final String TEST_PACKAGE = "anamespace"; + // Name of generated java class + static final String CLASS_TO_TEST = TEST_PACKAGE+".Foo"; + // Test working directory + Path testWorkDir; + // Test working directory URL + URL testWorkDirUrl; + // Directory with test src + Path testSrcDir; + // Directory with java files generated by xjc + Path xjcResultDir; } diff --git a/jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh b/jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh deleted file mode 100644 index 8051abf438a..00000000000 --- a/jdk/test/javax/xml/bind/xjc/8032884/compile-schema.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/sh - -# -# Copyright (c) 2014, 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. -# - -# - -if [ "x$TESTJAVA" = x ]; then - TESTJAVA=$1; shift - TESTCLASSES=. -fi - -echo "cleaning generated files ..." -rm -rfv ${TESTSRC}/generated - -echo "compiling [optional-property-schema.xsd] schema ..." -$TESTJAVA/bin/xjc -p generated -d ${TESTSRC} ${TESTSRC}/optional-property-schema.xsd - -echo "Schema compiled. Verification of generated files can be done now." diff --git a/jdk/test/javax/xml/bind/xjc/8145039/JaxbMarshallTest.java b/jdk/test/javax/xml/bind/xjc/8145039/JaxbMarshallTest.java index 37b817d0b4d..cc1be256343 100644 --- a/jdk/test/javax/xml/bind/xjc/8145039/JaxbMarshallTest.java +++ b/jdk/test/javax/xml/bind/xjc/8145039/JaxbMarshallTest.java @@ -23,10 +23,10 @@ /* * @test - * @bug 8145039 + * @bug 8145039 8157096 * @summary Check that marshalling of xjc generated class doesn't throw * ClassCast exception. - * @modules javax.xml.bind + * @modules java.xml.bind * @library /lib/testlibrary * @run testng/othervm JaxbMarshallTest */ @@ -127,6 +127,8 @@ public class JaxbMarshallTest { // Compile java classes with javac tool void compileXjcGeneratedClasses() throws Exception { JDKToolLauncher javacLauncher = JDKToolLauncher.createUsingTestJDK("javac"); + javacLauncher.addToolArg("-addmods"); + javacLauncher.addToolArg("java.xml.bind"); javacLauncher.addToolArg(xjcResultDir.resolve("ObjectFactory.java").toString()); javacLauncher.addToolArg(xjcResultDir.resolve("TypesLongList.java").toString()); javacLauncher.addToolArg(xjcResultDir.resolve("package-info.java").toString()); diff --git a/jdk/test/javax/xml/jaxp/TEST.properties b/jdk/test/javax/xml/jaxp/TEST.properties new file mode 100644 index 00000000000..fbf9f77ec10 --- /dev/null +++ b/jdk/test/javax/xml/jaxp/TEST.properties @@ -0,0 +1 @@ +modules = java.xml diff --git a/jdk/test/jdk/internal/jimage/JImageOpenTest.java b/jdk/test/jdk/internal/jimage/JImageOpenTest.java new file mode 100644 index 00000000000..06c19937a41 --- /dev/null +++ b/jdk/test/jdk/internal/jimage/JImageOpenTest.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.reflect.Layer; +import java.net.URI; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/* + * jimage shared open testing. + * @test + * @summary Test to see if thread interrupt handling interferes with other threads. + * @build JImageOpenTest.java + * @run main/othervm -Djdk.image.map.all=false JImageOpenTest + */ +public class JImageOpenTest { + private static final int NTHREADS = 10; + + public static void main(String[] args) throws Exception { + + final FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); + final Path root = fs.getPath("/modules"); + + final List names = Files.walk(root) + .filter(p -> p.getNameCount() > 2) + .filter(p -> Layer.boot().findModule(p.getName(1).toString()).isPresent()) + .map(p -> p.subpath(2, p.getNameCount())) + .map(p -> p.toString()) + .filter(s -> s.endsWith(".class") && !s.endsWith("module-info.class")) + .collect(Collectors.toList()); + + Runnable r = new Runnable() { + @Override + public void run() { + names.forEach(name -> { + String cn = name.substring(0, name.length() - 6).replace('/', '.'); + try { + Class.forName(cn, false, ClassLoader.getSystemClassLoader()); + } catch (Exception ex) { + System.err.println(Thread.currentThread() + " " + ex.getClass()); + } + }); + } + }; + + Thread[] threads = new Thread[NTHREADS]; + + for (int i = 0; i < NTHREADS; i++) { + Thread thread = new Thread(r); + threads[i] = thread; + thread.start(); + } + + Thread.sleep(1); + + for (int i = 0; i < NTHREADS; i++) { + Thread thread = threads[i]; + + if (thread.isAlive()) { + thread.interrupt(); + break; + } + } + + for (int i = 0; i < NTHREADS; i++) { + Thread thread = threads[i]; + thread.join(); + } + } +} diff --git a/jdk/test/jdk/internal/jline/extra/HistoryTest.java b/jdk/test/jdk/internal/jline/extra/HistoryTest.java new file mode 100644 index 00000000000..f8d3084b767 --- /dev/null +++ b/jdk/test/jdk/internal/jline/extra/HistoryTest.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary Test Completion + * @modules jdk.internal.le/jdk.internal.jline + * jdk.internal.le/jdk.internal.jline.console + * jdk.internal.le/jdk.internal.jline.console.history + * jdk.internal.le/jdk.internal.jline.extra + * @build HistoryTest + * @run testng HistoryTest + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.concurrent.atomic.AtomicBoolean; + +import jdk.internal.jline.UnsupportedTerminal; +import jdk.internal.jline.console.ConsoleReader; +import jdk.internal.jline.console.history.MemoryHistory; +import jdk.internal.jline.extra.EditingHistory; + +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +@Test +public class HistoryTest { + + public void testHistory() throws IOException { + ConsoleReader in = new ConsoleReader(new ByteArrayInputStream(new byte[0]), new ByteArrayOutputStream(), new UnsupportedTerminal()); + AtomicBoolean complete = new AtomicBoolean(); + EditingHistory history = new EditingHistory(in, Collections.emptyList()) { + @Override + protected boolean isComplete(CharSequence input) { + return complete.get(); + } + }; + complete.set(false); history.add("void test() {"); + complete.set(false); history.add(" System.err.println(1);"); + complete.set(true); history.add("}"); + complete.set(true); history.add("/exit"); + + previousAndAssert(history, "/exit"); + + history.previous(); history.previous(); history.previous(); + + complete.set(false); history.add("void test() { /*changed*/"); + + complete.set(true); + previousAndAssert(history, "}"); + previousAndAssert(history, " System.err.println(1);"); + previousAndAssert(history, "void test() {"); + + assertFalse(history.previous()); + + nextAndAssert(history, " System.err.println(1);"); + nextAndAssert(history, "}"); + nextAndAssert(history, ""); + + complete.set(false); history.add(" System.err.println(2);"); + complete.set(true); history.add("} /*changed*/"); + + assertEquals(history.size(), 7); + + Collection persistentHistory = history.save(); + + history = new EditingHistory(in, persistentHistory) { + @Override + protected boolean isComplete(CharSequence input) { + return complete.get(); + } + }; + + previousSnippetAndAssert(history, "void test() { /*changed*/"); + previousSnippetAndAssert(history, "/exit"); + previousSnippetAndAssert(history, "void test() {"); + + assertFalse(history.previousSnippet()); + + nextSnippetAndAssert(history, "/exit"); + nextSnippetAndAssert(history, "void test() { /*changed*/"); + nextSnippetAndAssert(history, ""); + + assertFalse(history.nextSnippet()); + + complete.set(false); history.add("{"); + complete.set(true); history.add("}"); + + persistentHistory = history.save(); + + history = new EditingHistory(in, persistentHistory) { + @Override + protected boolean isComplete(CharSequence input) { + return complete.get(); + } + }; + + previousSnippetAndAssert(history, "{"); + previousSnippetAndAssert(history, "void test() { /*changed*/"); + previousSnippetAndAssert(history, "/exit"); + previousSnippetAndAssert(history, "void test() {"); + + while (history.next()); + + complete.set(true); history.add("/*current1*/"); + complete.set(true); history.add("/*current2*/"); + complete.set(true); history.add("/*current3*/"); + + assertEquals(history.currentSessionEntries(), Arrays.asList("/*current1*/", "/*current2*/", "/*current3*/")); + + history.remove(0); + + assertEquals(history.currentSessionEntries(), Arrays.asList("/*current1*/", "/*current2*/", "/*current3*/")); + + while (history.size() > 2) + history.remove(0); + + assertEquals(history.currentSessionEntries(), Arrays.asList("/*current2*/", "/*current3*/")); + + for (int i = 0; i < MemoryHistory.DEFAULT_MAX_SIZE * 2; i++) { + complete.set(true); history.add("/exit"); + } + + complete.set(false); history.add("void test() { /*after full*/"); + complete.set(false); history.add(" System.err.println(1);"); + complete.set(true); history.add("}"); + + previousSnippetAndAssert(history, "void test() { /*after full*/"); + } + + private void previousAndAssert(EditingHistory history, String expected) { + assertTrue(history.previous()); + assertEquals(history.current().toString(), expected); + } + + private void nextAndAssert(EditingHistory history, String expected) { + assertTrue(history.next()); + assertEquals(history.current().toString(), expected); + } + + private void previousSnippetAndAssert(EditingHistory history, String expected) { + assertTrue(history.previousSnippet()); + assertEquals(history.current().toString(), expected); + } + + private void nextSnippetAndAssert(EditingHistory history, String expected) { + assertTrue(history.nextSnippet()); + assertEquals(history.current().toString(), expected); + } + +} diff --git a/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java b/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java index 4c86c6e549c..67f2416187f 100644 --- a/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java +++ b/jdk/test/jdk/modules/scenarios/container/src/container/container/Main.java @@ -72,7 +72,7 @@ public class Main { Configuration cf = Layer.boot().configuration() .resolveRequiresAndUses(finder, - ModuleFinder.empty(), + ModuleFinder.of(), Set.of(appModuleName)); System.out.println("Resolved"); diff --git a/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java b/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java index 826e282326a..529996e8e7d 100644 --- a/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java +++ b/jdk/test/jdk/modules/scenarios/overlappingpackages/OverlappingPackagesTest.java @@ -66,13 +66,7 @@ public class OverlappingPackagesTest { } Path srcMisc = SRC_DIR.resolve("misc"); Path modsMisc = MODS_DIR.resolve("misc"); - assertTrue(CompilerUtils.compile(srcMisc.resolve("sun") - .resolve("misc") - .resolve("Unsafe.java"), - modsMisc, - "-Xmodule:java.base")); - assertTrue(CompilerUtils.compile(srcMisc.resolve("module-info.java"), - modsMisc)); + assertTrue(CompilerUtils.compile(srcMisc, modsMisc)); } /** @@ -92,7 +86,7 @@ public class OverlappingPackagesTest { /** * Run the test with "-addmods misc", the misc module has package - * sun.misc and so should overlap with the base module. + * jdk.internal.misc and so should overlap with the base module. */ public void testOverlapWithBaseModule() throws Exception { int exitValue diff --git a/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/sun/misc/Unsafe.java b/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/jdk/internal/misc/Unsafe.java similarity index 97% rename from jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/sun/misc/Unsafe.java rename to jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/jdk/internal/misc/Unsafe.java index 135652ea9b7..0b4aa917ccd 100644 --- a/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/sun/misc/Unsafe.java +++ b/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/jdk/internal/misc/Unsafe.java @@ -21,7 +21,7 @@ * questions. */ -package sun.misc; +package jdk.internal.misc; public class Unsafe { private Unsafe() { } diff --git a/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/module-info.java b/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/module-info.java index 65cc15d749b..d4f3bd98b69 100644 --- a/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/module-info.java +++ b/jdk/test/jdk/modules/scenarios/overlappingpackages/src/misc/module-info.java @@ -22,6 +22,6 @@ */ module misc { - exports sun.misc; + exports jdk.internal.misc; } diff --git a/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java b/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java index 6f87dc68813..7f5f37b44fa 100644 --- a/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java +++ b/jdk/test/jdk/nio/zipfs/MultiReleaseJarTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8144355 + * @bug 8144355 8144062 * @summary Test aliasing additions to ZipFileSystem for multi-release jar files * @library /lib/testlibrary/java/util/jar * @build Compiler JarBuilder CreateMultiReleaseTestJars @@ -34,17 +34,17 @@ import java.io.IOException; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; +import java.lang.Runtime.Version; import java.net.URI; import java.nio.file.*; import java.util.HashMap; import java.util.Map; -import jdk.Version; import org.testng.Assert; import org.testng.annotations.*; public class MultiReleaseJarTest { - final private int MAJOR_VERSION = Version.current().major(); + final private int MAJOR_VERSION = Runtime.version().major(); final private String userdir = System.getProperty("user.dir","."); final private Map stringEnv = new HashMap<>(); diff --git a/jdk/test/lib/testlibrary/CompilerUtils.java b/jdk/test/lib/testlibrary/CompilerUtils.java index 91ca9181340..261c2c8f930 100644 --- a/jdk/test/lib/testlibrary/CompilerUtils.java +++ b/jdk/test/lib/testlibrary/CompilerUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -50,13 +50,21 @@ public final class CompilerUtils { * * @return true if the compilation is successful * - * @throws IOException if there is an I/O error scanning the source tree or - * creating the destination directory + * @throws IOException + * if there is an I/O error scanning the source tree or + * creating the destination directory + * @throws UnsupportedOperationException + * if there is no system java compiler */ public static boolean compile(Path source, Path destination, String ... options) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + if (compiler == null) { + // no compiler available + throw new UnsupportedOperationException("Unable to get system java compiler. " + + "Perhaps, jdk.compiler module is not available."); + } StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null); List sources diff --git a/jdk/test/lib/testlibrary/JarUtils.java b/jdk/test/lib/testlibrary/JarUtils.java index 94905ccffed..8f0e97321f4 100644 --- a/jdk/test/lib/testlibrary/JarUtils.java +++ b/jdk/test/lib/testlibrary/JarUtils.java @@ -35,6 +35,7 @@ import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -49,12 +50,12 @@ public final class JarUtils { /** * Creates a JAR file. * - * Equivalent to {@code jar cf -C

    file...} + * Equivalent to {@code jar cfm -C file...} * * The input files are resolved against the given directory. Any input * files that are directories are processed recursively. */ - public static void createJarFile(Path jarfile, Path dir, Path... file) + public static void createJarFile(Path jarfile, Manifest man, Path dir, Path... file) throws IOException { // create the target directory @@ -73,14 +74,36 @@ public final class JarUtils { try (OutputStream out = Files.newOutputStream(jarfile); JarOutputStream jos = new JarOutputStream(out)) { + if (man != null) { + JarEntry je = new JarEntry(JarFile.MANIFEST_NAME); + jos.putNextEntry(je); + man.write(jos); + jos.closeEntry(); + } + for (Path entry : entries) { String name = toJarEntryName(entry); jos.putNextEntry(new JarEntry(name)); Files.copy(dir.resolve(entry), jos); + jos.closeEntry(); } } } + /** + * Creates a JAR file. + * + * Equivalent to {@code jar cf -C file...} + * + * The input files are resolved against the given directory. Any input + * files that are directories are processed recursively. + */ + public static void createJarFile(Path jarfile, Path dir, Path... file) + throws IOException + { + createJarFile(jarfile, null, dir, file); + } + /** * Creates a JAR file. * diff --git a/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java b/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java index f3b43f83eee..27cf0330389 100644 --- a/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java +++ b/jdk/test/sun/applet/DeprecatedAppletViewer/DeprecatedAppletViewer.java @@ -32,17 +32,18 @@ import java.io.PrintStream; */ public final class DeprecatedAppletViewer { - private static final String TEXT = "AppletViewer is deprecated."; + private static final String TEXT + = "Warning: Applet API and AppletViewer are deprecated."; public static void main(final String[] args) { - final PrintStream old = System.out; + final PrintStream old = System.err; final ByteArrayOutputStream baos = new ByteArrayOutputStream(1000); final PrintStream ps = new PrintStream(baos); try { - System.setOut(ps); + System.setErr(ps); sun.applet.Main.main(new String[]{}); } finally { - System.setOut(old); + System.setErr(old); } final String text = new String(baos.toByteArray()); diff --git a/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java b/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java index 4575f91e93b..50435ea43c1 100644 --- a/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java +++ b/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -24,6 +24,7 @@ /** * @test * @bug 5054016 + * @key intermittent * @run main/othervm/timeout=300 checkError * @summary get the failure immediately when writing individual chunks over socket fail */ diff --git a/jdk/test/sun/net/www/protocol/http/ZoneId.java b/jdk/test/sun/net/www/protocol/http/ZoneId.java index 125c97d486d..fb611a4ea52 100644 --- a/jdk/test/sun/net/www/protocol/http/ZoneId.java +++ b/jdk/test/sun/net/www/protocol/http/ZoneId.java @@ -24,6 +24,7 @@ /* * @test * @bug 8027308 + * @key intermittent * @modules java.base/sun.net.www.protocol.http * @summary verifies that HttpURLConnection does not send the zone id in the * 'Host' field of the header: diff --git a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java index 4e0f0bdac59..d90d9478e2a 100644 --- a/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java +++ b/jdk/test/sun/net/www/protocol/https/HttpsURLConnection/ImpactOnSNI.java @@ -235,6 +235,7 @@ public class ImpactOnSNI { hostname); // Ignore the test if the hostname does not sound like a domain name. if ((hostname == null) || hostname.isEmpty() || + !hostname.contains(".") || hostname.endsWith(".") || hostname.startsWith("localhost") || Character.isDigit(hostname.charAt(hostname.length() - 1))) { diff --git a/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java b/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java index 0f5545707a4..f6b01a08d40 100644 --- a/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java +++ b/jdk/test/sun/net/www/protocol/jar/MultiReleaseJarURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 8132734 + * @bug 8132734 8144062 * @summary Test that URL connections to multi-release jars can be runtime versioned * @library /lib/testlibrary/java/util/jar * @build Compiler JarBuilder CreateMultiReleaseTestJars SimpleHttpServer @@ -43,8 +43,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.jar.JarFile; -import jdk.Version; - import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -94,7 +92,7 @@ public class MultiReleaseJarURLConnection { public void testRuntimeVersioning(String style, String file) throws Exception { String urlFile = "jar:file:" + file + "!/"; String baseUrlEntry = urlFile + "version/Version.java"; - String rtreturn = "return " + Version.current().major(); + String rtreturn = "return " + Runtime.version().major(); Assert.assertTrue(readAndCompare(new URL(baseUrlEntry), "return 8")); // #runtime is "magic" for a multi-release jar, but not for unversioned jar @@ -109,7 +107,7 @@ public class MultiReleaseJarURLConnection { if (style.equals("unversioned")) return; // direct access to versioned entry - String versUrlEntry = urlFile + "META-INF/versions/" + Version.current().major() + String versUrlEntry = urlFile + "META-INF/versions/" + Runtime.version().major() + "/version/Version.java"; Assert.assertTrue(readAndCompare(new URL(versUrlEntry), rtreturn)); // adding any fragment does not change things @@ -187,7 +185,7 @@ public class MultiReleaseJarURLConnection { MethodType mt = MethodType.methodType(int.class); MethodHandle mh = MethodHandles.lookup().findVirtual(vcls, "getVersion", mt); Assert.assertEquals((int)mh.invoke(vcls.newInstance()), - style.equals("unversioned") ? 8 : Version.current().major()); + style.equals("unversioned") ? 8 : Runtime.version().major()); // now get a resource and verify that we don't have a fragment attached URL vclsUrl = vcls.getResource("/version/Version.class"); @@ -206,7 +204,7 @@ public class MultiReleaseJarURLConnection { if (style.equals("unversioned")) { suffix = ".jar!/version/Version.class"; } else { - suffix = ".jar!/META-INF/versions/" + Version.current().major() + suffix = ".jar!/META-INF/versions/" + Runtime.version().major() + "/version/Version.class"; } Assert.assertTrue(rep.endsWith(suffix)); diff --git a/jdk/test/sun/security/jca/PreferredProviderTest.java b/jdk/test/sun/security/jca/PreferredProviderTest.java index 56aa4a0210e..72026222fee 100644 --- a/jdk/test/sun/security/jca/PreferredProviderTest.java +++ b/jdk/test/sun/security/jca/PreferredProviderTest.java @@ -25,15 +25,17 @@ import java.security.MessageDigest; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.Security; +import java.security.Signature; import java.security.Provider; import java.util.Arrays; import java.util.List; import javax.crypto.Cipher; +import javax.crypto.Mac; import javax.crypto.NoSuchPaddingException; /** * @test - * @bug 8076359 8133151 8145344 8150512 + * @bug 8076359 8133151 8145344 8150512 8155847 * @summary Test the value for new jdk.security.provider.preferred * security property */ @@ -61,8 +63,8 @@ public class PreferredProviderTest { //java.security file which will be verified. switch (type) { case "sparcv9": - preferredProp = "AES:SunJCE, SHA1:SUN, SHA-224:SUN," - + " SHA-256:SUN, SHA-384:SUN, SHA-512:SUN"; + preferredProp = "AES:SunJCE, SHA1:SUN, Group.SHA2:SUN, " + + "HmacSHA1:SunJCE, Group.HmacSHA2:SunJCE"; verifyPreferredProviderProperty(os, type, preferredProp); verifyDigestProvider(os, type, Arrays.asList( @@ -71,14 +73,51 @@ public class PreferredProviderTest { new DataTuple("SHA-224", "SUN"), new DataTuple("SHA-256", "SUN"), new DataTuple("SHA-384", "SUN"), - new DataTuple("SHA-512", "SUN"))); + new DataTuple("SHA-512", "SUN"), + new DataTuple("SHA-512/224", "SUN"), + new DataTuple("SHA-512/256", "SUN"))); + + verifyMacProvider(os, type, Arrays.asList( + new DataTuple("HmacSHA1", "SunJCE"), + new DataTuple("HmacSHA224", "SunJCE"), + new DataTuple("HmacSHA256", "SunJCE"), + new DataTuple("HmacSHA384", "SunJCE"), + new DataTuple("HmacSHA512", "SunJCE"))); break; case "amd64": - preferredProp = "AES:SunJCE, RSA:SunRsaSign"; + preferredProp = "AES:SunJCE, SHA1:SUN, Group.SHA2:SUN, " + + "HmacSHA1:SunJCE, Group.HmacSHA2:SunJCE, " + + "RSA:SunRsaSign, SHA1withRSA:SunRsaSign, " + + "Group.SHA2RSA:SunRsaSign"; + verifyPreferredProviderProperty(os, type, preferredProp); verifyKeyFactoryProvider(os, type, Arrays.asList( new DataTuple("RSA", "SunRsaSign"))); + + verifyDigestProvider(os, type, Arrays.asList( + new DataTuple("SHA1", "SUN"), + new DataTuple("SHA-1", "SUN"), + new DataTuple("SHA-224", "SUN"), + new DataTuple("SHA-256", "SUN"), + new DataTuple("SHA-384", "SUN"), + new DataTuple("SHA-512", "SUN"), + new DataTuple("SHA-512/224", "SUN"), + new DataTuple("SHA-512/256", "SUN"))); + + verifyMacProvider(os, type, Arrays.asList( + new DataTuple("HmacSHA1", "SunJCE"), + new DataTuple("HmacSHA224", "SunJCE"), + new DataTuple("HmacSHA256", "SunJCE"), + new DataTuple("HmacSHA384", "SunJCE"), + new DataTuple("HmacSHA512", "SunJCE"))); + + verifySignatureProvider(os, type, Arrays.asList( + new DataTuple("SHA1withRSA", "SunRsaSign"), + new DataTuple("SHA224withRSA", "SunRsaSign"), + new DataTuple("SHA256withRSA", "SunRsaSign"), + new DataTuple("SHA384withRSA", "SunRsaSign"), + new DataTuple("SHA512withRSA", "SunRsaSign"))); break; } verifyDigestProvider(os, type, Arrays.asList( @@ -99,6 +138,8 @@ public class PreferredProviderTest { String preferredProvider = Security.getProperty("jdk.security.provider.preferred"); if (!preferredProvider.equals(preferred)) { + System.out.println("Expected: " + preferred + "\nResult: " + + preferredProvider); throw new RuntimeException(String.format( "Test Failed: wrong jdk.security.provider.preferred value " + "on %s-%s", os, arch)); @@ -120,6 +161,19 @@ public class PreferredProviderTest { "Preferred MessageDigest algorithm verification successful."); } + private static void verifyMacProvider(String os, String arch, + List algoProviders) throws NoSuchAlgorithmException { + for (DataTuple dataTuple : algoProviders) { + System.out.printf( + "Verifying Mac for '%s'%n", dataTuple.algorithm); + Mac mac = Mac.getInstance(dataTuple.algorithm); + matchProvider(mac.getProvider(), dataTuple.provider, + dataTuple.algorithm, os, arch); + } + System.out.println( + "Preferred Mac algorithm verification successful."); + } + private static void verifyKeyFactoryProvider(String os, String arch, List algoProviders) throws NoSuchAlgorithmException { for (DataTuple dataTuple : algoProviders) { @@ -133,6 +187,19 @@ public class PreferredProviderTest { "Preferred KeyFactory algorithm verification successful."); } + private static void verifySignatureProvider(String os, String arch, + List algoProviders) throws NoSuchAlgorithmException { + for (DataTuple dataTuple : algoProviders) { + System.out.printf( + "Verifying Signature for '%s'%n", dataTuple.algorithm); + Signature si = Signature.getInstance(dataTuple.algorithm); + matchProvider(si.getProvider(), dataTuple.provider, + dataTuple.algorithm, os, arch); + } + System.out.println( + "Preferred Signature algorithm verification successful."); + } + private static void matchProvider(Provider provider, String expected, String algo, String os, String arch) { if (!provider.getName().equals(expected)) { diff --git a/jdk/test/sun/security/krb5/canonicalize/Test.java b/jdk/test/sun/security/krb5/canonicalize/Test.java index 8d21a50727f..62c44de9984 100644 --- a/jdk/test/sun/security/krb5/canonicalize/Test.java +++ b/jdk/test/sun/security/krb5/canonicalize/Test.java @@ -22,7 +22,7 @@ */ /* * @test - * @bug 6682516 + * @bug 6682516 8149521 * @summary SPNEGO_HTTP_AUTH/WWW_KRB and SPNEGO_HTTP_AUTH/WWW_SPNEGO failed on all non-windows platforms * @modules java.security.jgss/sun.security.krb5 * @run main/othervm -Djava.security.krb5.conf=krb5.conf Test @@ -44,9 +44,11 @@ public class Test { check("c1", "c1.this.domain"); check("c1.this", "c1.this.domain"); check("c1.this.domain", "c1.this.domain"); + check("c1.this.domain.", "c1.this.domain"); // canonicalized name goes IP, reject check("c2", "c2"); + check("c2.", "c2"); // canonicalized name goes strange, reject check("c3", "c3"); @@ -63,4 +65,4 @@ public class Test { throw new Exception("Output is " + pn); } } - } +} diff --git a/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.java b/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.java new file mode 100644 index 00000000000..17a4c5d8d71 --- /dev/null +++ b/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8150468 + * @summary check that a badly formatted policy file is handled correctly + * @run main/othervm BadPolicyFile + */ + +import java.io.File; +import java.net.URI; +import java.security.AccessControlException; +import java.security.Policy; +import java.security.URIParameter; + +public class BadPolicyFile { + + public static void main(String[] args) throws Exception { + URI uri = new File(System.getProperty("test.src", "."), + "BadPolicyFile.policy").toURI(); + Policy.setPolicy(Policy.getInstance("JavaPolicy", new URIParameter(uri))); + System.setSecurityManager(new SecurityManager()); + try { + String javahome = System.getProperty("java.home"); + throw new Exception("Expected AccessControlException"); + } catch (AccessControlException ace) { + System.out.println("Test PASSED"); + } + } +} diff --git a/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.policy b/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.policy new file mode 100644 index 00000000000..b5abfaf8f42 --- /dev/null +++ b/jdk/test/sun/security/provider/PolicyFile/BadPolicyFile.policy @@ -0,0 +1,4 @@ +grant { + // permission statement is missing trailing semi-colon + permission "java.util.PropertyPermission" "java.home", "read" +}; diff --git a/jdk/test/sun/security/provider/SecureRandom/StrongSecureRandom.java b/jdk/test/sun/security/provider/SecureRandom/StrongSecureRandom.java index 2a45522cad8..fd0b20cfdb2 100644 --- a/jdk/test/sun/security/provider/SecureRandom/StrongSecureRandom.java +++ b/jdk/test/sun/security/provider/SecureRandom/StrongSecureRandom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -21,11 +21,11 @@ * questions. */ -/** +/* * @test - * @bug 6425477 + * @bug 6425477 8141039 * @summary Better support for generation of high entropy random numbers - * @run main/othervm StrongSecureRandom + * @run main StrongSecureRandom */ import java.security.*; import java.util.*; @@ -35,7 +35,10 @@ import java.util.*; */ public class StrongSecureRandom { - private static String os = System.getProperty("os.name", "unknown"); + private static final String os = System.getProperty("os.name", "unknown"); + private static final String DRBG_CONFIG = "securerandom.drbg.config"; + private static final String DRBG_CONFIG_VALUE + = Security.getProperty(DRBG_CONFIG); private static void testDefaultEgd() throws Exception { // No SecurityManager installed. @@ -47,31 +50,53 @@ public class StrongSecureRandom { } } - private static void testSHA1PRNGImpl() throws Exception { - SecureRandom sr; + /** + * Verify if the mechanism is DRBG type. + * @param mech Mechanism name + * @return True if the mechanism name is DRBG type else False. + */ + private static boolean isDRBG(String mech) { + return mech.contains("_DRBG"); + } + + private static void testSecureRandomImpl(String algo, boolean drbg) + throws Exception { + byte[] ba; + final String secureRandomSource + = Security.getProperty("securerandom.source"); + try { + String urandom = "file:/dev/urandom"; - String urandom = "file:/dev/urandom"; + System.out.println("Testing new SeedGenerator and EGD"); - System.out.println("Testing new SeedGenerator and EGD"); + Security.setProperty("securerandom.source", urandom); + if (!Security.getProperty("securerandom.source").equals(urandom)) { + throw new Exception("Couldn't set securerandom.source"); + } - Security.setProperty("securerandom.source", urandom); - if (!Security.getProperty("securerandom.source").equals(urandom)) { - throw new Exception("Couldn't set securerandom.source"); + /* + * Take out a large number of bytes in hopes of blocking. + * Don't expect this to happen, unless something is broken on Linux + */ + SecureRandom sr = null; + if (drbg) { + Security.setProperty(DRBG_CONFIG, algo); + sr = SecureRandom.getInstance("DRBG"); + } else { + sr = SecureRandom.getInstance(algo); + } + if (!sr.getAlgorithm().equals(isDRBG(algo) ? "DRBG" : algo)) { + throw new Exception("sr.getAlgorithm(): " + sr.getAlgorithm()); + } + + ba = sr.generateSeed(4096); + sr.nextBytes(ba); + sr.setSeed(ba); + } finally { + Security.setProperty("securerandom.source", secureRandomSource); + Security.setProperty(DRBG_CONFIG, DRBG_CONFIG_VALUE); } - - /* - * Take out a large number of bytes in hopes of blocking. - * Don't expect this to happen, unless something is broken on Linux - */ - sr = SecureRandom.getInstance("SHA1PRNG"); - if (!sr.getAlgorithm().equals("SHA1PRNG")) { - throw new Exception("sr.getAlgorithm(): " + sr.getAlgorithm()); - } - - ba = sr.generateSeed(4096); - sr.nextBytes(ba); - sr.setSeed(ba); } private static void testNativePRNGImpls() throws Exception { @@ -85,7 +110,7 @@ public class StrongSecureRandom { return; } - System.out.println(" Testing regular"); + System.out.println("Testing regular"); sr = SecureRandom.getInstance("NativePRNG"); if (!sr.getAlgorithm().equals("NativePRNG")) { throw new Exception("sr.getAlgorithm(): " + sr.getAlgorithm()); @@ -94,7 +119,7 @@ public class StrongSecureRandom { sr.nextBytes(ba); sr.setSeed(ba); - System.out.println(" Testing NonBlocking"); + System.out.println("Testing NonBlocking"); sr = SecureRandom.getInstance("NativePRNGNonBlocking"); if (!sr.getAlgorithm().equals("NativePRNGNonBlocking")) { throw new Exception("sr.getAlgorithm(): " + sr.getAlgorithm()); @@ -108,7 +133,7 @@ public class StrongSecureRandom { return; } - System.out.println(" Testing Blocking"); + System.out.println("Testing Blocking"); sr = SecureRandom.getInstance("NativePRNGBlocking"); if (!sr.getAlgorithm().equals("NativePRNGBlocking")) { throw new Exception("sr.getAlgorithm(): " + sr.getAlgorithm()); @@ -141,9 +166,15 @@ public class StrongSecureRandom { throws Exception { System.out.println("Testing: '" + property + "' " + expected); - - Security.setProperty("securerandom.strongAlgorithms", property); - testStrongInstance(expected); + final String origStrongAlgoProp + = Security.getProperty("securerandom.strongAlgorithms"); + try { + Security.setProperty("securerandom.strongAlgorithms", property); + testStrongInstance(expected); + } finally { + Security.setProperty( + "securerandom.strongAlgorithms", origStrongAlgoProp); + } } private static void testProperties() throws Exception { @@ -228,7 +259,10 @@ public class StrongSecureRandom { public static void main(String args[]) throws Exception { testDefaultEgd(); - testSHA1PRNGImpl(); + for (String algo : new String[]{ + "SHA1PRNG", "Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + testSecureRandomImpl(algo, isDRBG(algo)); + } testNativePRNGImpls(); testAllImpls(); diff --git a/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java b/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java index d91ce78db4b..93889729058 100644 --- a/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java +++ b/jdk/test/sun/security/provider/SeedGenerator/SeedGeneratorChoice.java @@ -1,5 +1,6 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2011, 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 @@ -23,10 +24,9 @@ /* * @test - * @bug 6998583 + * @bug 6998583 8141039 * @summary NativeSeedGenerator is making 8192 byte read requests from * entropy pool on each init. - * @run main SeedGeneratorChoice * @run main/othervm -Djava.security.egd=file:/dev/random SeedGeneratorChoice * @run main/othervm -Djava.security.egd=file:filename SeedGeneratorChoice */ @@ -39,14 +39,24 @@ * We should always fall back to the ThreadedSeedGenerator if exceptions * are encountered with user defined source of entropy. */ - import java.security.SecureRandom; +import java.security.Security; public class SeedGeneratorChoice { public static void main(String... arguments) throws Exception { - byte[] bytes; - SecureRandom prng = SecureRandom.getInstance("SHA1PRNG"); - bytes = prng.generateSeed(1); + for (String mech : new String[]{"SHA1PRNG", "Hash_DRBG", "HMAC_DRBG", + "CTR_DRBG"}) { + + SecureRandom prng = null; + if (!mech.contains("_DRBG")) { + prng = SecureRandom.getInstance(mech); + } else { + Security.setProperty("securerandom.drbg.config", mech); + prng = SecureRandom.getInstance("DRBG"); + } + prng.generateSeed(1); + } } + } diff --git a/jdk/test/sun/security/rsa/SpecTest.java b/jdk/test/sun/security/rsa/SpecTest.java index 24cddfe3591..7b3c52e5d1f 100644 --- a/jdk/test/sun/security/rsa/SpecTest.java +++ b/jdk/test/sun/security/rsa/SpecTest.java @@ -24,7 +24,6 @@ /** * @test * @bug 8044199 8137231 - * @key intermittent * @summary Check same KeyPair's private key and public key have same modulus. * also check public key's public exponent equals to given spec's public * exponent. Only key size 1024 is tested with RSAKeyGenParameterSpec.F0 (3). diff --git a/jdk/test/sun/security/tools/keytool/DefaultSignatureAlgorithm.java b/jdk/test/sun/security/tools/keytool/DefaultSignatureAlgorithm.java new file mode 100644 index 00000000000..ad6297f2b21 --- /dev/null +++ b/jdk/test/sun/security/tools/keytool/DefaultSignatureAlgorithm.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8138766 + * @summary New default -sigalg for keytool + * @modules java.base/sun.security.tools.keytool + */ + +import sun.security.tools.keytool.Main; + +import java.io.File; +import java.security.KeyStore; +import java.security.cert.X509Certificate; + +public class DefaultSignatureAlgorithm { + + private static int counter = 0; + + public static void main(String[] args) throws Exception { + + // Calculating large RSA keys are too slow. + run("RSA", 1024, null, "SHA256withRSA"); + run("RSA", 3072, null, "SHA256withRSA"); + run("RSA", 3073, null, "SHA384withRSA"); + + run("DSA", 1024, null, "SHA256withDSA"); + run("DSA", 3072, null, "SHA256withDSA"); + + run("EC", 192, null, "SHA256withECDSA"); + run("EC", 384, null, "SHA384withECDSA"); + run("EC", 571, null, "SHA512withECDSA"); + + // If you specify one, it will be used. + run("EC", 571, "SHA256withECDSA", "SHA256withECDSA"); + } + + private static void run(String keyAlg, int keySize, + String sigAlg, String expectedSigAlg) throws Exception { + String alias = keyAlg + keySize + (counter++); + String cmd = "-keystore ks -storepass changeit" + + " -keypass changeit -alias " + alias + + " -keyalg " + keyAlg + " -keysize " + keySize + + " -genkeypair -dname CN=" + alias + " -debug"; + if (sigAlg != null) { + cmd += " -sigalg " + sigAlg; + } + Main.main(cmd.split(" ")); + + KeyStore ks = KeyStore.getInstance( + new File("ks"), "changeit".toCharArray()); + X509Certificate cert = (X509Certificate)ks.getCertificate(alias); + String actualSigAlg = cert.getSigAlgName(); + if (!actualSigAlg.equals(expectedSigAlg)) { + throw new Exception("Failure at " + alias + ": expected " + + expectedSigAlg + ", actually " + actualSigAlg); + } + } +} diff --git a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java index afba30c6055..b0f3b8d4f73 100644 --- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java +++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java @@ -31,9 +31,12 @@ * @run main BasicLauncherTest */ +import static jdk.testlibrary.Asserts.assertTrue; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Arrays; @@ -99,7 +102,7 @@ public class BasicLauncherTest { System.out.println("Starting LingeredApp"); try { - theApp = LingeredApp.startApp(); + theApp = LingeredApp.startApp(Arrays.asList("-Xmx256m")); System.out.println("Starting " + toolName + " " + toolArgs.get(0) + " against " + theApp.getPid()); JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName); @@ -129,6 +132,21 @@ public class BasicLauncherTest { launch(expectedMessage, Arrays.asList(toolArgs)); } + public static void testHeapDump() throws IOException { + File dump = new File("jhsdb.jmap.dump." + + System.currentTimeMillis() + ".hprof"); + if (dump.exists()) { + dump.delete(); + } + dump.deleteOnExit(); + + launch("heap written to", "jmap", + "--binaryheap", "--dumpfile=" + dump.getAbsolutePath()); + + assertTrue(dump.exists() && dump.isFile(), + "Could not create dump file " + dump.getAbsolutePath()); + } + public static void main(String[] args) throws IOException { @@ -145,6 +163,8 @@ public class BasicLauncherTest { launch("Java System Properties", "jinfo"); launch("java.threads", "jsnap"); + testHeapDump(); + // The test throws RuntimeException on error. // IOException is thrown if LingeredApp can't start because of some bad // environment condition diff --git a/jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java similarity index 98% rename from jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java rename to jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java index 5a84b6261d6..c768dd6eb01 100644 --- a/jdk/test/sun/tools/jmap/heapconfig/JMapHeapConfigTest.java +++ b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java @@ -36,9 +36,9 @@ import jdk.testlibrary.Platform; * @test * @bug 8042397 * @summary Unit test for jmap utility test heap configuration reader + * @modules jdk.hotspot.agent/sun.jvm.hotspot * @library /test/lib/share/classes * @library /lib/testlibrary - * @modules java.management * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* * @build JMapHeapConfigTest TmtoolTestScenario @@ -149,7 +149,7 @@ public class JMapHeapConfigTest { } cmd.add("-XX:+PrintFlagsFinal"); - TmtoolTestScenario tmt = TmtoolTestScenario.create("jmap", "-heap"); + TmtoolTestScenario tmt = TmtoolTestScenario.create("jmap", "--heap"); int exitcode = tmt.launch(cmd); if (exitcode != 0) { throw new RuntimeException("Test FAILED jmap exits with non zero exit code " + exitcode); diff --git a/jdk/test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java b/jdk/test/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java similarity index 97% rename from jdk/test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java rename to jdk/test/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java index 4558f3e346b..25beea66f72 100644 --- a/jdk/test/sun/tools/jmap/heapconfig/TmtoolTestScenario.java +++ b/jdk/test/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java @@ -100,11 +100,13 @@ public class TmtoolTestScenario { theApp = LingeredApp.startApp(vmArgsExtended); System.out.println("Starting " + toolName + " against " + theApp.getPid()); - JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(toolName); + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb"); + launcher.addToolArg(toolName); for (String cmd : toolArgs) { launcher.addToolArg(cmd); } + launcher.addToolArg("--pid"); launcher.addToolArg(Long.toString(theApp.getPid())); ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand()); diff --git a/jdk/test/sun/tools/jinfo/JInfoHelper.java b/jdk/test/sun/tools/jinfo/BasicJInfoTest.java similarity index 51% rename from jdk/test/sun/tools/jinfo/JInfoHelper.java rename to jdk/test/sun/tools/jinfo/BasicJInfoTest.java index 7f945136b4f..c612652f46b 100644 --- a/jdk/test/sun/tools/jinfo/JInfoHelper.java +++ b/jdk/test/sun/tools/jinfo/BasicJInfoTest.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * 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. + * 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 @@ -29,41 +27,58 @@ import jdk.testlibrary.JDKToolLauncher; import jdk.testlibrary.OutputAnalyzer; import jdk.testlibrary.ProcessTools; -/** - * The helper class for running jinfo utility. +/* + * @test + * @summary Unit test for jinfo utility + * @library /lib/testlibrary + * @build jdk.testlibrary.* + * @run main BasicJInfoTest */ -public final class JInfoHelper { +public class BasicJInfoTest { - /** - * Print configuration information for the current process - * - * @param toolArgs List of jinfo options - */ - public static OutputAnalyzer jinfo(String... toolArgs) throws Exception { - return jinfo(true, toolArgs); + private static ProcessBuilder processBuilder = new ProcessBuilder(); + + public static void main(String[] args) throws Exception { + testJinfoNoArgs(); + testJinfoFlags(); + testJinfoProps(); + testJinfoFlagInvalid(); } - /** - * Print usage information - * - * @param toolArgs List of jinfo options - */ - public static OutputAnalyzer jinfoNoPid(String... toolArgs) throws Exception { - return jinfo(false, toolArgs); + private static void testJinfoNoArgs() throws Exception { + OutputAnalyzer output = jinfo(); + output.shouldContain("-XX"); + output.shouldContain("test.jdk="); + output.shouldHaveExitValue(0); } - private static OutputAnalyzer jinfo(boolean toPid, String... toolArgs) throws Exception { + private static void testJinfoFlagInvalid() throws Exception { + OutputAnalyzer output = jinfo("-flag"); + output.shouldHaveExitValue(1); + } + + private static void testJinfoFlags() throws Exception { + OutputAnalyzer output = jinfo("-flags"); + output.shouldContain("-XX"); + output.shouldHaveExitValue(0); + } + + private static void testJinfoProps() throws Exception { + OutputAnalyzer output = jinfo("-props"); + output.shouldContain("test.jdk="); + output.shouldHaveExitValue(0); + } + + private static OutputAnalyzer jinfo(String... toolArgs) throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jinfo"); if (toolArgs != null) { for (String toolArg : toolArgs) { launcher.addToolArg(toolArg); } } - if (toPid) { - launcher.addToolArg(Long.toString(ProcessTools.getProcessId())); - } + launcher.addToolArg(Long.toString(ProcessTools.getProcessId())); - ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand()); + processBuilder.command(launcher.getCommand()); System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", "")); OutputAnalyzer output = ProcessTools.executeProcess(processBuilder); System.out.println(output.getOutput()); diff --git a/jdk/test/sun/tools/jinfo/JInfoLauncherTest.java b/jdk/test/sun/tools/jinfo/JInfoLauncherTest.java deleted file mode 100644 index 09b4750d778..00000000000 --- a/jdk/test/sun/tools/jinfo/JInfoLauncherTest.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ - -import org.testng.annotations.Test; -import org.testng.annotations.BeforeClass; -import sun.tools.jinfo.JInfo; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.util.Arrays; - -import static org.testng.Assert.*; - -/** - * @test - * @bug 8039080 - * @modules jdk.jcmd/sun.tools.jinfo - * @run testng JInfoLauncherTest - * @summary Test JInfo launcher argument parsing - */ -@Test -public class JInfoLauncherTest { - public static final String VALIDATION_EXCEPTION_CLSNAME = - IllegalArgumentException.class.getName(); - - private Constructor jInfoConstructor; - private Field fldUseSA; - - @BeforeClass - public void setup() throws Exception { - jInfoConstructor = JInfo.class.getDeclaredConstructor(String[].class); - jInfoConstructor.setAccessible(true); - fldUseSA = JInfo.class.getDeclaredField("useSA"); - fldUseSA.setAccessible(true); - } - - private JInfo newJInfo(String[] args) throws Exception { - try { - return jInfoConstructor.newInstance((Object) args); - } catch (Exception e) { - if (isValidationException(e.getCause())) { - throw (Exception)e.getCause(); - } - throw e; - } - } - - private boolean getUseSA(JInfo jinfo) throws Exception { - return fldUseSA.getBoolean(jinfo); - } - - private void cmdPID(String cmd, String ... params) throws Exception { - int offset = (cmd != null ? 1 : 0); - String[] args = new String[offset + params.length]; - args[0] = cmd; - System.arraycopy(params, 0, args, offset, params.length); - JInfo j = newJInfo(args); - assertFalse(getUseSA(j), "Local jinfo must not forward to SA"); - } - - private void cmdCore(String cmd, String ... params) throws Exception { - int offset = (cmd != null ? 1 : 0); - String[] args = new String[offset + params.length]; - args[0] = cmd; - System.arraycopy(params, 0, args, offset, params.length); - JInfo j = newJInfo(args); - assertTrue(getUseSA(j), "Core jinfo must forward to SA"); - } - - private void cmdRemote(String cmd, String ... params) throws Exception { - int offset = (cmd != null ? 1 : 0); - String[] args = new String[offset + params.length]; - args[0] = cmd; - System.arraycopy(params, 0, args, offset, params.length); - JInfo j = newJInfo(args); - assertTrue(getUseSA(j), "Remote jinfo must forward to SA"); - } - - private void cmdExtraArgs(String cmd, int argsLen) throws Exception { - String[] args = new String[argsLen + 1 + (cmd != null ? 1 : 0)]; - Arrays.fill(args, "a"); - if (cmd != null) { - args[0] = cmd; - } else { - cmd = "default"; - } - try { - JInfo j = newJInfo(args); - fail("\"" + cmd + "\" does not support more than " + argsLen + - " arguments"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - private void cmdMissingArgs(String cmd, int reqArgs) throws Exception { - String[] args = new String[reqArgs - 1 + (cmd != null ? 1 : 0)]; - Arrays.fill(args, "a"); - if (cmd != null) { - args[0] = cmd; - } else { - cmd = "default"; - } - try { - JInfo j = newJInfo(args); - fail("\"" + cmd + "\" requires at least " + reqArgs + " argument"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testDefaultPID() throws Exception { - cmdPID(null, "1234"); - } - - public void testFlagsPID() throws Exception { - cmdPID("-flags", "1234"); - } - - public void testSyspropsPID() throws Exception { - cmdPID("-sysprops", "1234"); - } - - public void testReadFlagPID() throws Exception { - cmdPID("-flag", "SomeManagementFlag", "1234"); - } - - public void testSetFlag1PID() throws Exception { - cmdPID("-flag", "+SomeManagementFlag", "1234"); - } - - public void testSetFlag2PID() throws Exception { - cmdPID("-flag", "-SomeManagementFlag", "1234"); - } - - public void testSetFlag3PID() throws Exception { - cmdPID("-flag", "SomeManagementFlag=314", "1234"); - } - - public void testDefaultCore() throws Exception { - cmdCore(null, "myapp.exe", "my.core"); - } - - public void testFlagsCore() throws Exception { - cmdCore("-flags", "myapp.exe", "my.core"); - } - - public void testSyspropsCore() throws Exception { - cmdCore("-sysprops", "myapp.exe", "my.core"); - } - - public void testReadFlagCore() throws Exception { - try { - cmdCore("-flag", "SomeManagementFlag", "myapp.exe", "my.core"); - fail("Flags can not be read from core files"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testSetFlag1Core() throws Exception { - try { - cmdCore("-flag", "+SomeManagementFlag", "myapp.exe", "my.core"); - fail("Flags can not be set in core files"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testSetFlag2Core() throws Exception { - try { - cmdCore("-flag", "-SomeManagementFlag", "myapp.exe", "my.core"); - fail("Flags can not be set in core files"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testSetFlag3Core() throws Exception { - try { - cmdCore("-flag", "SomeManagementFlag=314", "myapp.exe", "my.core"); - fail("Flags can not be set in core files"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testDefaultRemote() throws Exception { - cmdRemote(null, "serverid@host"); - } - - public void testFlagsRemote() throws Exception { - cmdRemote("-flags", "serverid@host"); - } - - public void testSyspropsRemote() throws Exception { - cmdRemote("-sysprops", "serverid@host"); - } - - public void testReadFlagRemote() throws Exception { - try { - cmdCore("-flag", "SomeManagementFlag", "serverid@host"); - fail("Flags can not be read from SA server"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testSetFlag1Remote() throws Exception { - try { - cmdCore("-flag", "+SomeManagementFlag","serverid@host"); - fail("Flags can not be set on SA server"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testSetFlag2Remote() throws Exception { - try { - cmdCore("-flag", "-SomeManagementFlag", "serverid@host"); - fail("Flags can not be read set on SA server"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testSetFlag3Remote() throws Exception { - try { - cmdCore("-flag", "SomeManagementFlag=314", "serverid@host"); - fail("Flags can not be read set on SA server"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - public void testDefaultExtraArgs() throws Exception { - cmdExtraArgs(null, 2); - } - - public void testFlagsExtraArgs() throws Exception { - cmdExtraArgs("-flags", 2); - } - - public void testSyspropsExtraArgs() throws Exception { - cmdExtraArgs("-sysprops", 2); - } - - public void testFlagExtraArgs() throws Exception { - cmdExtraArgs("-flag", 2); - } - - public void testHelp1ExtraArgs() throws Exception { - cmdExtraArgs("-h", 0); - } - - public void testHelp2ExtraArgs() throws Exception { - cmdExtraArgs("-help", 0); - } - - public void testDefaultMissingArgs() throws Exception { - cmdMissingArgs(null, 1); - } - - public void testFlagsMissingArgs() throws Exception { - cmdMissingArgs("-flags", 1); - } - - public void testSyspropsMissingArgs() throws Exception { - cmdMissingArgs("-sysprops", 1); - } - - public void testFlagMissingArgs() throws Exception { - cmdMissingArgs("-flag", 2); - } - - public void testUnknownCommand() throws Exception { - try { - JInfo j = newJInfo(new String[]{"-unknown_command"}); - fail("JInfo accepts unknown commands"); - } catch (Exception e) { - if (!isValidationException(e)) { - throw e; - } - // ignore - } - } - - private static boolean isValidationException(Throwable e) { - return e.getClass().getName().equals(VALIDATION_EXCEPTION_CLSNAME); - } -} diff --git a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java deleted file mode 100644 index cb28cc7a49f..00000000000 --- a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -import java.lang.management.ManagementFactory; -import com.sun.management.HotSpotDiagnosticMXBean; -import jdk.testlibrary.OutputAnalyzer; -import static jdk.testlibrary.Platform.isSolaris; -import static jdk.testlibrary.Asserts.assertEquals; -import static jdk.testlibrary.Asserts.assertNotEquals; -import static jdk.testlibrary.Asserts.assertTrue; - -/** - * @test - * @summary The test sanity checks 'jinfo -flag' option. - * @library /lib/testlibrary - * @modules java.management - * @build jdk.testlibrary.* JInfoHelper - * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessFlagTest - */ -public class JInfoRunningProcessFlagTest { - - public static void main(String[] args) throws Exception { - testFlag(); - testFlagPlus(); - testFlagMinus(); - testFlagEqual(); - - testInvalidFlag(); - - testSolarisSpecificFlag(); - } - - private static void testFlag() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError"); - output.shouldHaveExitValue(0); - assertTrue(output.getStderr().isEmpty(), "'jinfo -flag HeapDumpOnOutOfMemoryError' stderr should be empty"); - output.shouldContain("+HeapDumpOnOutOfMemoryError"); - } - - private static void testFlagPlus() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+HeapDumpOnOutOfMemoryError"); - output.shouldHaveExitValue(0); - output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError"); - output.shouldHaveExitValue(0); - output.shouldContain("+HeapDumpOnOutOfMemoryError"); - verifyIsEnabled("HeapDumpOnOutOfMemoryError"); - } - - private static void testFlagMinus() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-HeapDumpOnOutOfMemoryError"); - output.shouldHaveExitValue(0); - output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError"); - output.shouldHaveExitValue(0); - output.shouldContain("-HeapDumpOnOutOfMemoryError"); - verifyIsDisabled("HeapDumpOnOutOfMemoryError"); - } - - private static void testFlagEqual() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError=1"); - output.shouldHaveExitValue(0); - output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError"); - output.shouldHaveExitValue(0); - output.shouldContain("+HeapDumpOnOutOfMemoryError"); - verifyIsEnabled("HeapDumpOnOutOfMemoryError"); - } - - private static void testInvalidFlag() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo("-flag", "monkey"); - assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid flag"); - } - - private static void testSolarisSpecificFlag() throws Exception { - if (!isSolaris()) - return; - - OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+ExtendedDTraceProbes"); - output.shouldHaveExitValue(0); - output = JInfoHelper.jinfo(); - output.shouldContain("+ExtendedDTraceProbes"); - verifyIsEnabled("ExtendedDTraceProbes"); - - output = JInfoHelper.jinfo("-flag", "-ExtendedDTraceProbes"); - output.shouldHaveExitValue(0); - output = JInfoHelper.jinfo(); - output.shouldContain("-ExtendedDTraceProbes"); - verifyIsDisabled("ExtendedDTraceProbes"); - - output = JInfoHelper.jinfo("-flag", "ExtendedDTraceProbes"); - output.shouldContain("-ExtendedDTraceProbes"); - output.shouldHaveExitValue(0); - } - - private static void verifyIsEnabled(String flag) { - HotSpotDiagnosticMXBean hotspotDiagnostic = - ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); - String flagValue = hotspotDiagnostic.getVMOption(flag).getValue(); - assertEquals(flagValue, "true", "Expected '" + flag + "' flag be enabled"); - } - - private static void verifyIsDisabled(String flag) { - HotSpotDiagnosticMXBean hotspotDiagnostic = - ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); - String flagValue = hotspotDiagnostic.getVMOption(flag).getValue(); - assertEquals(flagValue, "false", "Expected '" + flag + "' flag be disabled"); - } - -} diff --git a/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java b/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java deleted file mode 100644 index 633a2c99b51..00000000000 --- a/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -import jdk.testlibrary.OutputAnalyzer; -import static jdk.testlibrary.Asserts.assertTrue; - -/** - * @test - * @summary The test sanity checks functionality of 'jinfo', 'jinfo -sysprops' and 'jinfo -flags' - * @library /lib/testlibrary - * @modules java.management - * @build jdk.testlibrary.* JInfoHelper - * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessTest - */ -public class JInfoRunningProcessTest { - - public static void main(String[] args) throws Exception { - testNoOptions(); - testSysprops(); - testFlags(); - } - - private static void testNoOptions() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo(); - output.shouldHaveExitValue(0); - assertTrue(output.getStderr().isEmpty(), "'jinfo' stderr should be empty"); - output.shouldContain("+HeapDumpOnOutOfMemoryError"); - } - - private static void testSysprops() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo("-sysprops"); - output.shouldHaveExitValue(0); - assertTrue(output.getStderr().isEmpty(), "'jinfo -sysprops' stderr should be empty"); - } - - private static void testFlags() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfo("-flags"); - output.shouldHaveExitValue(0); - assertTrue(output.getStderr().isEmpty(), "'jinfo -flags' stderr should be empty"); - output.shouldContain("+HeapDumpOnOutOfMemoryError"); - } - -} diff --git a/jdk/test/sun/tools/jinfo/JInfoSanityTest.java b/jdk/test/sun/tools/jinfo/JInfoSanityTest.java deleted file mode 100644 index 9b0bcf1b141..00000000000 --- a/jdk/test/sun/tools/jinfo/JInfoSanityTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * 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. - */ - -import static jdk.testlibrary.Asserts.assertNotEquals; -import static jdk.testlibrary.Asserts.assertTrue; -import static jdk.testlibrary.Asserts.assertFalse; -import jdk.testlibrary.OutputAnalyzer; - -/** - * @test - * @summary The test sanity checks functionality of 'jinfo -h', 'jinfo -help', - * and verifies jinfo exits abnormally if started with invalid options. - * @library /lib/testlibrary - * @modules java.management - * @build jdk.testlibrary.* JInfoHelper - * @run main JInfoSanityTest - */ -public class JInfoSanityTest { - - public static void main(String[] args) throws Exception { - test_h(); - test_help(); - testVersion(); - testUnknownHost(); - } - - private static void test_h() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfoNoPid("-h"); - output.shouldHaveExitValue(0); - assertFalse(output.getStderr().isEmpty(), "'jinfo -h' stderr should not be empty"); - assertTrue(output.getStdout().isEmpty(), "'jinfo -h' stdout should be empty"); - } - - private static void test_help() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfoNoPid("-help"); - output.shouldHaveExitValue(0); - assertFalse(output.getStderr().isEmpty(), "'jinfo -help' stderr should not be empty"); - assertTrue(output.getStdout().isEmpty(), "'jinfo -help' stdout should be empty"); - } - - private static void testVersion() throws Exception { - OutputAnalyzer output = JInfoHelper.jinfoNoPid("-version"); - output.shouldHaveExitValue(1); - assertFalse(output.getStderr().isEmpty(), "'jinfo -version' stderr should not be empty"); - assertTrue(output.getStdout().isEmpty(), "'jinfo -version' stdout should be empty"); - } - - private static void testUnknownHost() throws Exception { - String unknownHost = "Oja781nh2ev7vcvbajdg-Sda1-C"; - OutputAnalyzer output = JInfoHelper.jinfoNoPid("med@" + unknownHost); - assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid operation"); - output.shouldMatch(".*(Connection refused to host\\:|UnknownHostException\\:) " + unknownHost + ".*"); - } - -} diff --git a/jdk/test/sun/tools/jmap/BasicJMapTest.java b/jdk/test/sun/tools/jmap/BasicJMapTest.java index 75c80a2eec3..fa333cddea7 100644 --- a/jdk/test/sun/tools/jmap/BasicJMapTest.java +++ b/jdk/test/sun/tools/jmap/BasicJMapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,12 +34,10 @@ import jdk.testlibrary.ProcessTools; /* * @test - * @bug 6321286 * @summary Unit test for jmap utility * @key intermittent * @library /lib/testlibrary * @library /test/lib/share/classes - * @modules java.management * @build jdk.testlibrary.* * @build jdk.test.lib.hprof.* * @build jdk.test.lib.hprof.model.* @@ -54,6 +52,8 @@ public class BasicJMapTest { public static void main(String[] args) throws Exception { testHisto(); testHistoLive(); + testFinalizerInfo(); + testClstats(); testDump(); testDumpLive(); } @@ -68,6 +68,16 @@ public class BasicJMapTest { output.shouldHaveExitValue(0); } + private static void testFinalizerInfo() throws Exception { + OutputAnalyzer output = jmap("-finalizerinfo"); + output.shouldHaveExitValue(0); + } + + private static void testClstats() throws Exception { + OutputAnalyzer output = jmap("-clstats"); + output.shouldHaveExitValue(0); + } + private static void testDump() throws Exception { dump(false); } @@ -105,7 +115,6 @@ public class BasicJMapTest { private static OutputAnalyzer jmap(String... toolArgs) throws Exception { JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jmap"); - launcher.addVMArg("-XX:+UsePerfData"); if (toolArgs != null) { for (String toolArg : toolArgs) { launcher.addToolArg(toolArg); diff --git a/jdk/test/sun/tools/jstack/BasicJStackTest.java b/jdk/test/sun/tools/jstack/BasicJStackTest.java index 9fd0b66b578..997876a54c5 100644 --- a/jdk/test/sun/tools/jstack/BasicJStackTest.java +++ b/jdk/test/sun/tools/jstack/BasicJStackTest.java @@ -29,10 +29,8 @@ import jdk.testlibrary.ProcessTools; /* * @test - * @bug 6260070 * @summary Unit test for jstack utility * @library /lib/testlibrary - * @modules java.management * @build jdk.testlibrary.* * @run main BasicJStackTest */ diff --git a/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java b/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java index 4ff2508673b..771fd128ff7 100644 --- a/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java +++ b/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java @@ -39,7 +39,6 @@ import jdk.testlibrary.ProcessTools; * @summary Test deadlock detection * @library /test/lib/share/classes * @library /lib/testlibrary - * @modules java.management * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* * @build DeadlockDetectionTest diff --git a/jdk/test/sun/util/logging/PlatformLoggerTest.java b/jdk/test/sun/util/logging/PlatformLoggerTest.java index 530a2acea8a..4fbf0c95c2d 100644 --- a/jdk/test/sun/util/logging/PlatformLoggerTest.java +++ b/jdk/test/sun/util/logging/PlatformLoggerTest.java @@ -31,7 +31,6 @@ * * @modules java.base/sun.util.logging * java.logging/sun.util.logging.internal - * @compile -XDignore.symbol.file PlatformLoggerTest.java * @run main/othervm PlatformLoggerTest */ @@ -42,25 +41,31 @@ import sun.util.logging.PlatformLogger; import static sun.util.logging.PlatformLogger.Level.*; public class PlatformLoggerTest { + + static Logger logger; + static PlatformLogger bar; + static PlatformLogger goo; + static PlatformLogger foo; + public static void main(String[] args) throws Exception { final String FOO_PLATFORM_LOGGER = "test.platformlogger.foo"; final String BAR_PLATFORM_LOGGER = "test.platformlogger.bar"; final String GOO_PLATFORM_LOGGER = "test.platformlogger.goo"; final String BAR_LOGGER = "test.logger.bar"; - PlatformLogger goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER); + goo = PlatformLogger.getLogger(GOO_PLATFORM_LOGGER); // test the PlatformLogger methods testLogMethods(goo); // Create a platform logger using the default - PlatformLogger foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER); + foo = PlatformLogger.getLogger(FOO_PLATFORM_LOGGER); checkPlatformLogger(foo, FOO_PLATFORM_LOGGER); // create a java.util.logging.Logger // now java.util.logging.Logger should be created for each platform logger - Logger logger = Logger.getLogger(BAR_LOGGER); + logger = Logger.getLogger(BAR_LOGGER); logger.setLevel(Level.WARNING); - PlatformLogger bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER); + bar = PlatformLogger.getLogger(BAR_PLATFORM_LOGGER); checkPlatformLogger(bar, BAR_PLATFORM_LOGGER); // test the PlatformLogger methods diff --git a/jdk/test/tools/jar/modularJar/Basic.java b/jdk/test/tools/jar/modularJar/Basic.java index 417f71a2f5e..4ce94a24b56 100644 --- a/jdk/test/tools/jar/modularJar/Basic.java +++ b/jdk/test/tools/jar/modularJar/Basic.java @@ -33,6 +33,7 @@ import java.util.*; import java.util.function.Consumer; import java.util.jar.JarEntry; import java.util.jar.JarInputStream; +import java.util.jar.Manifest; import java.util.regex.Pattern; import java.util.stream.Stream; import javax.tools.JavaCompiler; @@ -52,45 +53,64 @@ import static java.lang.System.out; /* * @test * @library /lib/testlibrary + * @modules jdk.compiler + * jdk.jartool * @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder * @compile Basic.java * @run testng Basic - * @summary Basic test for Modular jars + * @summary Tests for plain Modular jars & Multi-Release Modular jars */ public class Basic { static final Path TEST_SRC = Paths.get(System.getProperty("test.src", ".")); static final Path TEST_CLASSES = Paths.get(System.getProperty("test.classes", ".")); static final Path MODULE_CLASSES = TEST_CLASSES.resolve("build"); + static final Path MRJAR_DIR = MODULE_CLASSES.resolve("mrjar"); // Details based on the checked in module source static TestModuleData FOO = new TestModuleData("foo", "1.123", "jdk.test.foo.Foo", - "Hello World!!!", null, - "jdk.test.foo.internal"); + "Hello World!!!", + null, // no hashes + Set.of("java.base"), + Set.of("jdk.test.foo"), + null, // no uses + null, // no provides + Set.of("jdk.test.foo.internal")); static TestModuleData BAR = new TestModuleData("bar", "4.5.6.7", "jdk.test.bar.Bar", - "Hello from Bar!", null, - "jdk.test.bar", - "jdk.test.bar.internal"); + "Hello from Bar!", + null, // no hashes + Set.of("java.base", "foo"), + null, // no exports + null, // no uses + null, // no provides + Set.of("jdk.test.bar", + "jdk.test.bar.internal")); static class TestModuleData { final String moduleName; + final Set requires; + final Set exports; + final Set uses; + final Set provides; final String mainClass; final String version; final String message; final String hashes; final Set conceals; - TestModuleData(String mn, String v, String mc, String m, String h, String... pkgs) { + + TestModuleData(String mn, String v, String mc, String m, String h, + Set requires, Set exports, Set uses, + Set provides, Set conceals) { moduleName = mn; mainClass = mc; version = v; message = m; hashes = h; - conceals = new HashSet<>(); - Stream.of(pkgs).forEach(conceals::add); - } - TestModuleData(String mn, String v, String mc, String m, String h, Set pkgs) { - moduleName = mn; mainClass = mc; version = v; message = m; hashes = h; - conceals = pkgs; + this.requires = requires; + this.exports = exports; + this.uses = uses; + this.provides = provides; + this.conceals = conceals; } static TestModuleData from(String s) { try { @@ -99,7 +119,8 @@ public class Basic { String message = null; String name = null, version = null, mainClass = null; String hashes = null; - Set conceals = null; + Set requires, exports, uses, provides, conceals; + requires = exports = uses = provides = conceals = null; while ((line = reader.readLine()) != null) { if (line.startsWith("message:")) { message = line.substring("message:".length()); @@ -114,28 +135,46 @@ public class Basic { } } else if (line.startsWith("mainClass:")) { mainClass = line.substring("mainClass:".length()); + } else if (line.startsWith("requires:")) { + line = line.substring("requires:".length()); + requires = stringToSet(line); + } else if (line.startsWith("exports:")) { + line = line.substring("exports:".length()); + exports = stringToSet(line); + } else if (line.startsWith("uses:")) { + line = line.substring("uses:".length()); + uses = stringToSet(line); + } else if (line.startsWith("provides:")) { + line = line.substring("provides:".length()); + provides = stringToSet(line); } else if (line.startsWith("hashes:")) { hashes = line.substring("hashes:".length()); - } else if (line.startsWith("conceals:")) { + } else if (line.startsWith("conceals:")) { line = line.substring("conceals:".length()); - conceals = new HashSet<>(); - int i = line.indexOf(','); - if (i != -1) { - String[] p = line.split(","); - Stream.of(p).forEach(conceals::add); - } else { - conceals.add(line); - } + conceals = stringToSet(line); } else { throw new AssertionError("Unknown value " + line); } } - return new TestModuleData(name, version, mainClass, message, hashes, conceals); + return new TestModuleData(name, version, mainClass, message, + hashes, requires, exports, uses, + provides, conceals); } catch (IOException x) { throw new UncheckedIOException(x); } } + static Set stringToSet(String commaList) { + Set s = new HashSet<>(); + int i = commaList.indexOf(','); + if (i != -1) { + String[] p = commaList.split(","); + Stream.of(p).forEach(s::add); + } else { + s.add(commaList); + } + return s; + } } static void assertModuleData(Result r, TestModuleData expected) { @@ -150,10 +189,19 @@ public class Basic { "Expected version: ", expected.version, ", got:", received.version); assertTrue(expected.mainClass.equals(received.mainClass), "Expected mainClass: ", expected.mainClass, ", got:", received.mainClass); - expected.conceals.forEach(p -> assertTrue(received.conceals.contains(p), - "Expected ", p, ", in ", received.conceals)); - received.conceals.forEach(p -> assertTrue(expected.conceals.contains(p), - "Expected ", p, ", in ", expected.conceals)); + assertSetsEqual(expected.requires, received.requires); + assertSetsEqual(expected.exports, received.exports); + assertSetsEqual(expected.uses, received.uses); + assertSetsEqual(expected.provides, received.provides); + assertSetsEqual(expected.conceals, received.conceals); + } + + static void assertSetsEqual(Set s1, Set s2) { + if (s1 == null && s2 == null) // none expected, or received + return; + assertTrue(s1.size() == s2.size(), + "Unexpected set size difference: ", s1.size(), ", ", s2.size()); + s1.forEach(p -> assertTrue(s2.contains(p), "Expected ", p, ", in ", s2)); } @BeforeTest @@ -161,6 +209,10 @@ public class Basic { compileModule(FOO.moduleName); compileModule(BAR.moduleName, MODULE_CLASSES); compileModule("baz"); // for service provider consistency checking + + setupMRJARModuleInfo(FOO.moduleName); + setupMRJARModuleInfo(BAR.moduleName); + setupMRJARModuleInfo("baz"); } @Test @@ -180,7 +232,6 @@ public class Basic { java(mp, FOO.moduleName + "/" + FOO.mainClass) .assertSuccess() .resultChecker(r -> assertModuleData(r, FOO)); - try (InputStream fis = Files.newInputStream(modularJar); JarInputStream jis = new JarInputStream(fis)) { assertTrue(!jarContains(jis, "./"), @@ -188,6 +239,30 @@ public class Basic { } } + /** Similar to createFoo, but with a Multi-Release Modular jar. */ + @Test + public void createMRMJarFoo() throws IOException { + Path mp = Paths.get("createMRMJarFoo"); + createTestDir(mp); + Path modClasses = MODULE_CLASSES.resolve(FOO.moduleName); + Path mrjarDir = MRJAR_DIR.resolve(FOO.moduleName); + Path modularJar = mp.resolve(FOO.moduleName + ".jar"); + + // Positive test, create + jar("--create", + "--file=" + modularJar.toString(), + "--main-class=" + FOO.mainClass, + "--module-version=" + FOO.version, + "-m", mrjarDir.resolve("META-INF/MANIFEST.MF").toRealPath().toString(), + "-C", mrjarDir.toString(), "META-INF/versions/9/module-info.class", + "-C", modClasses.toString(), ".") + .assertSuccess(); + java(mp, FOO.moduleName + "/" + FOO.mainClass) + .assertSuccess() + .resultChecker(r -> assertModuleData(r, FOO)); + } + + @Test public void updateFoo() throws IOException { Path mp = Paths.get("updateFoo"); @@ -212,6 +287,32 @@ public class Basic { .resultChecker(r -> assertModuleData(r, FOO)); } + @Test + public void updateMRMJarFoo() throws IOException { + Path mp = Paths.get("updateMRMJarFoo"); + createTestDir(mp); + Path modClasses = MODULE_CLASSES.resolve(FOO.moduleName); + Path mrjarDir = MRJAR_DIR.resolve(FOO.moduleName); + Path modularJar = mp.resolve(FOO.moduleName + ".jar"); + + jar("--create", + "--file=" + modularJar.toString(), + "--no-manifest", + "-C", modClasses.toString(), "jdk") + .assertSuccess(); + jar("--update", + "--file=" + modularJar.toString(), + "--main-class=" + FOO.mainClass, + "--module-version=" + FOO.version, + "-m", mrjarDir.resolve("META-INF/MANIFEST.MF").toRealPath().toString(), + "-C", mrjarDir.toString(), "META-INF/versions/9/module-info.class", + "-C", modClasses.toString(), "module-info.class") + .assertSuccess(); + java(mp, FOO.moduleName + "/" + FOO.mainClass) + .assertSuccess() + .resultChecker(r -> assertModuleData(r, FOO)); + } + @Test public void partialUpdateFooMainClass() throws IOException { Path mp = Paths.get("partialUpdateFooMainClass"); @@ -289,6 +390,30 @@ public class Basic { .resultChecker(r -> assertModuleData(r, FOO)); } + @Test + public void partialUpdateMRMJarFooNotAllFiles() throws IOException { + Path mp = Paths.get("partialUpdateMRMJarFooNotAllFiles"); + createTestDir(mp); + Path modClasses = MODULE_CLASSES.resolve(FOO.moduleName); + Path mrjarDir = MRJAR_DIR.resolve(FOO.moduleName); + Path modularJar = mp.resolve(FOO.moduleName + ".jar"); + + jar("--create", + "--file=" + modularJar.toString(), + "--module-version=" + FOO.version, + "-C", modClasses.toString(), ".") + .assertSuccess(); + jar("--update", + "--file=" + modularJar.toString(), + "--main-class=" + FOO.mainClass, + "-m", mrjarDir.resolve("META-INF/MANIFEST.MF").toRealPath().toString(), + "-C", mrjarDir.toString(), "META-INF/versions/9/module-info.class") + .assertSuccess(); + java(mp, FOO.moduleName + "/" + FOO.mainClass) + .assertSuccess() + .resultChecker(r -> assertModuleData(r, FOO)); + } + @Test public void partialUpdateFooAllFilesAndAttributes() throws IOException { Path mp = Paths.get("partialUpdateFooAllFilesAndAttributes"); @@ -527,6 +652,24 @@ public class Basic { .assertFailure(); } + @Test + public void servicesCreateWithoutFailureMRMJAR() throws IOException { + Path mp = Paths.get("servicesCreateWithoutFailureMRMJAR"); + createTestDir(mp); + Path modClasses = MODULE_CLASSES.resolve("baz"); + Path mrjarDir = MRJAR_DIR.resolve("baz"); + Path modularJar = mp.resolve("baz" + ".jar"); + + jar("--create", + "--file=" + modularJar.toString(), + "-m", mrjarDir.resolve("META-INF/MANIFEST.MF").toRealPath().toString(), + "-C", modClasses.toString(), "module-info.class", + "-C", mrjarDir.toString(), "META-INF/versions/9/module-info.class", + "-C", modClasses.toString(), "jdk/test/baz/BazService.class", + "-C", modClasses.toString(), "jdk/test/baz/internal/BazServiceImpl.class") + .assertSuccess(); + } + @Test public void printModuleDescriptorFoo() throws IOException { Path mp = Paths.get("printModuleDescriptorFoo"); @@ -611,6 +754,24 @@ public class Basic { return build; } + static void setupMRJARModuleInfo(String moduleName) throws IOException { + Path modClasses = MODULE_CLASSES.resolve(moduleName); + Path metaInfDir = MRJAR_DIR.resolve(moduleName).resolve("META-INF"); + Path versionSection = metaInfDir.resolve("versions").resolve("9"); + createTestDir(versionSection); + + Path versionModuleInfo = versionSection.resolve("module-info.class"); + System.out.println("copying " + modClasses.resolve("module-info.class") + " to " + versionModuleInfo); + Files.copy(modClasses.resolve("module-info.class"), versionModuleInfo); + + Manifest manifest = new Manifest(); + manifest.getMainAttributes().putValue("Manifest-Version", "1.0"); + manifest.getMainAttributes().putValue("Multi-Release", "true"); + try (OutputStream os = Files.newOutputStream(metaInfDir.resolve("MANIFEST.MF"))) { + manifest.write(os); + } + } + // Re-enable when there is support in javax.tools for module path // static void javac(Path dest, Path... sourceFiles) throws IOException { // out.printf("Compiling %d source files %s%n", sourceFiles.length, @@ -690,7 +851,7 @@ public class Basic { static void createTestDir(Path p) throws IOException{ if (Files.exists(p)) FileUtils.deleteFileTreeWithRetry(p); - Files.createDirectory(p); + Files.createDirectories(p); } static boolean jarContains(JarInputStream jis, String entryName) diff --git a/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java b/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java index 181491ab601..5267814d711 100644 --- a/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java +++ b/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/Bar.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -26,6 +24,8 @@ package jdk.test.bar; import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleDescriptor.Exports; +import java.lang.module.ModuleDescriptor.Requires; import java.lang.reflect.Method; import java.util.Optional; import java.util.StringJoiner; @@ -39,18 +39,36 @@ public class Bar { ModuleDescriptor md = Bar.class.getModule().getDescriptor(); System.out.println("nameAndVersion:" + md.toNameAndVersion()); - System.out.println("mainClass:" + md.mainClass().get()); + md.mainClass().ifPresent(mc -> System.out.println("mainClass:" + mc)); + + StringJoiner sj = new StringJoiner(","); + md.requires().stream().map(ModuleDescriptor.Requires::name).sorted().forEach(sj::add); + System.out.println("requires:" + sj.toString()); + + sj = new StringJoiner(","); + md.exports().stream().map(ModuleDescriptor.Exports::source).sorted().forEach(sj::add); + if (!sj.toString().equals("")) + System.out.println("exports:" + sj.toString()); + + sj = new StringJoiner(","); + md.uses().stream().sorted().forEach(sj::add); + if (!sj.toString().equals("")) + System.out.println("uses:" + sj.toString()); + + sj = new StringJoiner(","); + md.provides().keySet().stream().sorted().forEach(sj::add); + if (!sj.toString().equals("")) + System.out.println("provides:" + sj.toString()); + + sj = new StringJoiner(","); + md.conceals().forEach(sj::add); + if (!sj.toString().equals("")) + System.out.println("conceals:" + sj.toString()); Method m = ModuleDescriptor.class.getDeclaredMethod("hashes"); m.setAccessible(true); ModuleDescriptor foo = jdk.test.foo.Foo.class.getModule().getDescriptor(); - Optional oHashes = - (Optional) m.invoke(foo); - + Optional oHashes = (Optional) m.invoke(foo); System.out.println("hashes:" + oHashes.get().hashFor("bar")); - - StringJoiner sj = new StringJoiner(","); - md.conceals().forEach(sj::add); - System.out.println("conceals:" + sj.toString()); } } diff --git a/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/internal/Message.java b/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/internal/Message.java index 17cbe3a1a03..fe8698d2e06 100644 --- a/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/internal/Message.java +++ b/jdk/test/tools/jar/modularJar/src/bar/jdk/test/bar/internal/Message.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/jdk/test/tools/jar/modularJar/src/bar/module-info.java b/jdk/test/tools/jar/modularJar/src/bar/module-info.java index 72965186eb4..84480e25920 100644 --- a/jdk/test/tools/jar/modularJar/src/bar/module-info.java +++ b/jdk/test/tools/jar/modularJar/src/bar/module-info.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/BazService.java b/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/BazService.java index 85c585fb898..c4432047267 100644 --- a/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/BazService.java +++ b/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/BazService.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/internal/BazServiceImpl.java b/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/internal/BazServiceImpl.java index 5f41732642d..fba16b7e89f 100644 --- a/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/internal/BazServiceImpl.java +++ b/jdk/test/tools/jar/modularJar/src/baz/jdk/test/baz/internal/BazServiceImpl.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/jdk/test/tools/jar/modularJar/src/baz/module-info.java b/jdk/test/tools/jar/modularJar/src/baz/module-info.java index 8a35edb0bcc..5672f74866f 100644 --- a/jdk/test/tools/jar/modularJar/src/baz/module-info.java +++ b/jdk/test/tools/jar/modularJar/src/baz/module-info.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/Foo.java b/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/Foo.java index 1cb35351b86..3e0ce9fa601 100644 --- a/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/Foo.java +++ b/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/Foo.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 @@ -26,6 +24,8 @@ package jdk.test.foo; import java.lang.module.ModuleDescriptor; +import java.lang.module.ModuleDescriptor.Exports; +import java.lang.module.ModuleDescriptor.Requires; import java.util.StringJoiner; import jdk.test.foo.internal.Message; @@ -36,10 +36,30 @@ public class Foo { ModuleDescriptor md = Foo.class.getModule().getDescriptor(); System.out.println("nameAndVersion:" + md.toNameAndVersion()); - System.out.println("mainClass:" + md.mainClass().get()); + md.mainClass().ifPresent(mc -> System.out.println("mainClass:" + mc)); StringJoiner sj = new StringJoiner(","); + md.requires().stream().map(Requires::name).sorted().forEach(sj::add); + System.out.println("requires:" + sj.toString()); + + sj = new StringJoiner(","); + md.exports().stream().map(Exports::source).sorted().forEach(sj::add); + if (!sj.toString().equals("")) + System.out.println("exports:" + sj.toString()); + + sj = new StringJoiner(","); + md.uses().stream().sorted().forEach(sj::add); + if (!sj.toString().equals("")) + System.out.println("uses:" + sj.toString()); + + sj = new StringJoiner(","); + md.provides().keySet().stream().sorted().forEach(sj::add); + if (!sj.toString().equals("")) + System.out.println("provides:" + sj.toString()); + + sj = new StringJoiner(","); md.conceals().forEach(sj::add); - System.out.println("conceals:" + sj.toString()); + if (!sj.toString().equals("")) + System.out.println("conceals:" + sj.toString()); } } diff --git a/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/internal/Message.java b/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/internal/Message.java index 298a4fce0cb..a5959e8755a 100644 --- a/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/internal/Message.java +++ b/jdk/test/tools/jar/modularJar/src/foo/jdk/test/foo/internal/Message.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/jdk/test/tools/jar/modularJar/src/foo/module-info.java b/jdk/test/tools/jar/modularJar/src/foo/module-info.java index b46afa0b822..7f3e0f7cc0a 100644 --- a/jdk/test/tools/jar/modularJar/src/foo/module-info.java +++ b/jdk/test/tools/jar/modularJar/src/foo/module-info.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. + * 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 diff --git a/jdk/test/tools/jimage/VerifyJimage.java b/jdk/test/tools/jimage/VerifyJimage.java index 9c33cc3fa74..5056e6322a5 100644 --- a/jdk/test/tools/jimage/VerifyJimage.java +++ b/jdk/test/tools/jimage/VerifyJimage.java @@ -188,7 +188,11 @@ public class VerifyJimage { String cn = removeModule(n).replaceAll("\\.class$", "").replace('/', '.'); count.incrementAndGet(); try { + System.out.println("Loading " + cn); Class.forName(cn, false, loader); + } catch (VerifyError ve) { + System.err.println("VerifyError for " + cn); + failed.add(reader.imageName() + ": " + cn + " not verified: " + ve.getMessage()); } catch (ClassNotFoundException e) { failed.add(reader.imageName() + ": " + cn + " not found"); } diff --git a/jdk/test/tools/jlink/DefaultProviderTest.java b/jdk/test/tools/jlink/DefaultProviderTest.java index 22c68287d5c..c10e9d37060 100644 --- a/jdk/test/tools/jlink/DefaultProviderTest.java +++ b/jdk/test/tools/jlink/DefaultProviderTest.java @@ -33,7 +33,7 @@ import java.util.Set; import jdk.tools.jlink.internal.PluginRepository; import jdk.tools.jlink.plugin.Plugin; import jdk.tools.jlink.plugin.PluginException; -import jdk.tools.jlink.plugin.Pool; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; import tests.Helper; @@ -65,26 +65,26 @@ public class DefaultProviderTest { private boolean enabled = true; @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.TRANSFORMER); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.TRANSFORMER); return Collections.unmodifiableSet(set); } @Override - public Set getState() { - return enabled ? EnumSet.of(STATE.AUTO_ENABLED, STATE.FUNCTIONAL) - : EnumSet.of(STATE.DISABLED); + public Set getState() { + return enabled ? EnumSet.of(State.AUTO_ENABLED, State.FUNCTIONAL) + : EnumSet.of(State.DISABLED); } @Override - public void visit(Pool in, Pool out) { + public void visit(ModulePool in, ModulePool out) { if (!enabled) { throw new PluginException(NAME + " was set"); } DefaultProviderTest.isNewPluginsCalled = true; - in.visit((Pool.ModuleData content) -> { + in.transformAndCopy(content -> { return content; }, out); } diff --git a/jdk/test/tools/jlink/ImageFileCreatorTest.java b/jdk/test/tools/jlink/ImageFileCreatorTest.java index 449d950d04d..8e093c69459 100644 --- a/jdk/test/tools/jlink/ImageFileCreatorTest.java +++ b/jdk/test/tools/jlink/ImageFileCreatorTest.java @@ -39,7 +39,7 @@ import jdk.tools.jlink.internal.ImageFileCreator; import jdk.tools.jlink.internal.ImagePluginStack; import jdk.tools.jlink.plugin.ExecutableImage; import jdk.tools.jlink.builder.ImageBuilder; -import jdk.tools.jlink.plugin.Pool; +import jdk.tools.jlink.plugin.ModulePool; /* @@ -47,6 +47,7 @@ import jdk.tools.jlink.plugin.Pool; * @summary ImageFileCreator class test * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.builder * java.base/jdk.internal.jimage * @run main/othervm -verbose:gc -Xmx1g ImageFileCreatorTest */ @@ -214,7 +215,7 @@ public class ImageFileCreatorTest { } @Override - public void storeFiles(Pool content) { + public void storeFiles(ModulePool content) { } }; diff --git a/jdk/test/tools/jlink/ImageFilePoolTest.java b/jdk/test/tools/jlink/ImageFilePoolTest.java index 7d35f9da8d6..1ea0fada3d7 100644 --- a/jdk/test/tools/jlink/ImageFilePoolTest.java +++ b/jdk/test/tools/jlink/ImageFilePoolTest.java @@ -31,11 +31,12 @@ */ import java.io.ByteArrayInputStream; -import jdk.tools.jlink.internal.PoolImpl; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; -import jdk.tools.jlink.plugin.Pool.ModuleDataType; -import jdk.tools.jlink.plugin.Pool.Visitor; +import java.util.Optional; +import java.util.function.Function; +import jdk.tools.jlink.internal.ModuleEntryImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class ImageFilePoolTest { public static void main(String[] args) throws Exception { @@ -50,45 +51,45 @@ public class ImageFilePoolTest { private static final String SUFFIX = "END"; private void checkVisitor() throws Exception { - Pool input = new PoolImpl(); + ModulePool input = new ModulePoolImpl(); for (int i = 0; i < 1000; ++i) { String module = "module" + (i / 100); input.add(new InMemoryImageFile(module, "/" + module + "/java/class" + i, - ModuleDataType.CONFIG, "class" + i)); + ModuleEntry.Type.CONFIG, "class" + i)); } - if (input.getContent().size() != 1000) { + if (input.getEntryCount() != 1000) { throw new AssertionError(); } - Pool output = new PoolImpl(); + ModulePool output = new ModulePoolImpl(); ResourceVisitor visitor = new ResourceVisitor(); - input.visit(visitor, output); + input.transformAndCopy(visitor, output); if (visitor.getAmountBefore() == 0) { throw new AssertionError("Resources not found"); } - if (visitor.getAmountBefore() != input.getContent().size()) { + if (visitor.getAmountBefore() != input.getEntryCount()) { throw new AssertionError("Number of visited resources. Expected: " + - visitor.getAmountBefore() + ", got: " + input.getContent().size()); + visitor.getAmountBefore() + ", got: " + input.getEntryCount()); } - if (visitor.getAmountAfter() != output.getContent().size()) { + if (visitor.getAmountAfter() != output.getEntryCount()) { throw new AssertionError("Number of added resources. Expected: " + - visitor.getAmountAfter() + ", got: " + output.getContent().size()); + visitor.getAmountAfter() + ", got: " + output.getEntryCount()); } - for (ModuleData outFile : output.getContent()) { + output.entries().forEach(outFile -> { String path = outFile.getPath().replaceAll(SUFFIX + "$", ""); - ModuleData inFile = input.get(path); - if (inFile == null) { + Optional inFile = input.findEntry(path); + if (!inFile.isPresent()) { throw new AssertionError("Unknown resource: " + path); } - } + }); } - private static class ResourceVisitor implements Visitor { + private static class ResourceVisitor implements Function { private int amountBefore; private int amountAfter; @Override - public ModuleData visit(ModuleData file) { + public ModuleEntry apply(ModuleEntry file) { int index = ++amountBefore % 3; switch (index) { case 0: @@ -113,7 +114,7 @@ public class ImageFilePoolTest { } private void checkNegative() throws Exception { - PoolImpl input = new PoolImpl(); + ModulePoolImpl input = new ModulePoolImpl(); try { input.add(null); throw new AssertionError("NullPointerException is not thrown"); @@ -126,30 +127,30 @@ public class ImageFilePoolTest { } catch (NullPointerException e) { // expected } - if (input.get("unknown") != null) { - throw new AssertionError("ImageFilePool does not return null for unknown file"); + if (input.findEntry("unknown").isPresent()) { + throw new AssertionError("ImageFileModulePool does not return null for unknown file"); } - if (input.contains(new InMemoryImageFile("", "unknown", ModuleDataType.CONFIG, "unknown"))) { + if (input.contains(new InMemoryImageFile("", "unknown", ModuleEntry.Type.CONFIG, "unknown"))) { throw new AssertionError("'contain' returns true for unknown file"); } - input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleDataType.CONFIG, "")); + input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleEntry.Type.CONFIG, "")); try { - input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleDataType.CONFIG, "")); + input.add(new InMemoryImageFile("", "/aaa/bbb", ModuleEntry.Type.CONFIG, "")); throw new AssertionError("Exception expected"); } catch (Exception e) { // expected } input.setReadOnly(); try { - input.add(new InMemoryImageFile("", "/aaa/ccc", ModuleDataType.CONFIG, "")); + input.add(new InMemoryImageFile("", "/aaa/ccc", ModuleEntry.Type.CONFIG, "")); throw new AssertionError("Exception expected"); } catch (Exception e) { // expected } } - private static class InMemoryImageFile extends ModuleData { - public InMemoryImageFile(String module, String path, ModuleDataType type, String content) { + private static class InMemoryImageFile extends ModuleEntryImpl { + public InMemoryImageFile(String module, String path, ModuleEntry.Type type, String content) { super(module, path, type, new ByteArrayInputStream(content.getBytes()), content.getBytes().length); } } diff --git a/jdk/test/tools/jlink/IntegrationTest.java b/jdk/test/tools/jlink/IntegrationTest.java index 951c16cff74..e5637b421a8 100644 --- a/jdk/test/tools/jlink/IntegrationTest.java +++ b/jdk/test/tools/jlink/IntegrationTest.java @@ -39,7 +39,7 @@ import jdk.tools.jlink.Jlink.JlinkConfiguration; import jdk.tools.jlink.Jlink.PluginsConfiguration; import jdk.tools.jlink.builder.DefaultImageBuilder; import jdk.tools.jlink.plugin.ExecutableImage; -import jdk.tools.jlink.plugin.Pool; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.PostProcessorPlugin; import jdk.tools.jlink.plugin.TransformerPlugin; import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin; @@ -56,6 +56,8 @@ import tests.JImageGenerator; * @library ../lib * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile + * jdk.jlink/jdk.tools.jlink + * jdk.jlink/jdk.tools.jlink.builder * jdk.jlink/jdk.tools.jlink.internal * jdk.jlink/jdk.tools.jlink.internal.plugins * jdk.jlink/jdk.tools.jmod @@ -88,9 +90,9 @@ public class IntegrationTest { } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.PROCESSOR); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.PROCESSOR); return Collections.unmodifiableSet(set); } @@ -128,18 +130,18 @@ public class IntegrationTest { } @Override - public void visit(Pool in, Pool out) { + public void visit(ModulePool in, ModulePool out) { System.err.println(NAME + index); ordered.add(index); - in.visit((file) -> { + in.transformAndCopy((file) -> { return file; }, out); } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.TRANSFORMER); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.TRANSFORMER); return Collections.unmodifiableSet(set); } diff --git a/jdk/test/tools/jlink/JLinkOptimTest.java b/jdk/test/tools/jlink/JLinkOptimTest.java index 82c5431f034..acc089c89c0 100644 --- a/jdk/test/tools/jlink/JLinkOptimTest.java +++ b/jdk/test/tools/jlink/JLinkOptimTest.java @@ -23,15 +23,15 @@ import jdk.internal.org.objectweb.asm.tree.MethodInsnNode; import jdk.internal.org.objectweb.asm.tree.MethodNode; import jdk.internal.org.objectweb.asm.tree.TryCatchBlockNode; import jdk.tools.jlink.internal.PluginRepository; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.plugins.OptimizationPlugin; import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; import jdk.tools.jlink.internal.plugins.asm.AsmPlugin; import jdk.tools.jlink.internal.plugins.asm.AsmPools; import jdk.tools.jlink.internal.plugins.optim.ControlFlow; import jdk.tools.jlink.internal.plugins.optim.ControlFlow.Block; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import tests.Helper; import tests.JImageGenerator; @@ -134,9 +134,9 @@ public class JLinkOptimTest { } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.TRANSFORMER); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.TRANSFORMER); return Collections.unmodifiableSet(set); } } @@ -150,13 +150,13 @@ public class JLinkOptimTest { FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); Path root = fs.getPath("/modules/java.base"); // Access module-info.class to be reused as fake module-info.class - List javabaseResources = new ArrayList<>(); + List javabaseResources = new ArrayList<>(); try (Stream stream = Files.walk(root)) { for (Iterator iterator = stream.iterator(); iterator.hasNext();) { Path p = iterator.next(); if (Files.isRegularFile(p)) { try { - javabaseResources.add(Pool.newResource(p.toString(). + javabaseResources.add(ModuleEntry.create(p.toString(). substring("/modules".length()), Files.readAllBytes(p))); } catch (Exception ex) { throw new RuntimeException(ex); @@ -166,18 +166,18 @@ public class JLinkOptimTest { } //forName folding - PoolImpl pool = new PoolImpl(); + ModulePoolImpl pool = new ModulePoolImpl(); byte[] content = Files.readAllBytes(classes. resolve("optim").resolve("ForNameTestCase.class")); byte[] content2 = Files.readAllBytes(classes. resolve("optim").resolve("AType.class")); byte[] mcontent = Files.readAllBytes(classes.resolve("module-info.class")); - pool.add(Pool.newResource("/optimplugin/optim/ForNameTestCase.class", content)); - pool.add(Pool.newResource("/optimplugin/optim/AType.class", content2)); - pool.add(Pool.newResource("/optimplugin/module-info.class", mcontent)); + pool.add(ModuleEntry.create("/optimplugin/optim/ForNameTestCase.class", content)); + pool.add(ModuleEntry.create("/optimplugin/optim/AType.class", content2)); + pool.add(ModuleEntry.create("/optimplugin/module-info.class", mcontent)); - for (ModuleData r : javabaseResources) { + for (ModuleEntry r : javabaseResources) { pool.add(r); } @@ -186,10 +186,10 @@ public class JLinkOptimTest { optional.put(OptimizationPlugin.NAME, OptimizationPlugin.FORNAME_REMOVAL); optional.put(OptimizationPlugin.LOG, "forName.log"); plugin.configure(optional); - Pool out = new PoolImpl(); + ModulePool out = new ModulePoolImpl(); plugin.visit(pool, out); - ModuleData result = out.getContent().iterator().next(); + ModuleEntry result = out.entries().iterator().next(); ClassReader optimReader = new ClassReader(result.getBytes()); ClassNode optimClass = new ClassNode(); diff --git a/jdk/test/tools/jlink/JLinkOptionsTest.java b/jdk/test/tools/jlink/JLinkOptionsTest.java index 8c8d241f5b7..565c58bffa9 100644 --- a/jdk/test/tools/jlink/JLinkOptionsTest.java +++ b/jdk/test/tools/jlink/JLinkOptionsTest.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; -import jdk.tools.jlink.plugin.Pool; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.internal.PluginRepository; import jdk.tools.jlink.plugin.TransformerPlugin; @@ -62,7 +62,7 @@ public class JLinkOptionsTest { } @Override - public void visit(Pool in, Pool out) { + public void visit(ModulePool in, ModulePool out) { } diff --git a/jdk/test/tools/jlink/JLinkPostProcessingTest.java b/jdk/test/tools/jlink/JLinkPostProcessingTest.java index b32bf207ff2..abc2b58142e 100644 --- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java +++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java @@ -75,9 +75,9 @@ public class JLinkPostProcessingTest { } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.PROCESSOR); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.PROCESSOR); return Collections.unmodifiableSet(set); } diff --git a/jdk/test/tools/jlink/ResourcePoolTest.java b/jdk/test/tools/jlink/ResourcePoolTest.java index 77a82e5c1b2..523503c996a 100644 --- a/jdk/test/tools/jlink/ResourcePoolTest.java +++ b/jdk/test/tools/jlink/ResourcePoolTest.java @@ -37,14 +37,14 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.Optional; import java.util.Set; - -import jdk.tools.jlink.internal.PoolImpl; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.Module; -import jdk.tools.jlink.plugin.Pool.ModuleData; -import jdk.tools.jlink.plugin.Pool.ModuleDataType; -import jdk.tools.jlink.plugin.Pool.Visitor; +import java.util.function.Function; +import jdk.tools.jlink.internal.ModulePoolImpl; +import jdk.tools.jlink.plugin.ModulePool; +import jdk.tools.jlink.plugin.LinkModule; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class ResourcePoolTest { @@ -61,54 +61,53 @@ public class ResourcePoolTest { private static final String SUFFIX = "END"; private void checkResourceVisitor() throws Exception { - Pool input = new PoolImpl(); + ModulePool input = new ModulePoolImpl(); for (int i = 0; i < 1000; ++i) { String module = "/module" + (i / 10); String resourcePath = module + "/java/package" + i; byte[] bytes = resourcePath.getBytes(); - input.add(new ModuleData(module, resourcePath, - ModuleDataType.CLASS_OR_RESOURCE, + input.add(ModuleEntry.create(module, resourcePath, + ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(bytes), bytes.length)); } - Pool output = new PoolImpl(); + ModulePool output = new ModulePoolImpl(); ResourceVisitor visitor = new ResourceVisitor(); - input.visit(visitor, output); + input.transformAndCopy(visitor, output); if (visitor.getAmountBefore() == 0) { throw new AssertionError("Resources not found"); } - if (visitor.getAmountBefore() != input.getContent().size()) { + if (visitor.getAmountBefore() != input.getEntryCount()) { throw new AssertionError("Number of visited resources. Expected: " + - visitor.getAmountBefore() + ", got: " + input.getContent().size()); + visitor.getAmountBefore() + ", got: " + input.getEntryCount()); } - if (visitor.getAmountAfter() != output.getContent().size()) { + if (visitor.getAmountAfter() != output.getEntryCount()) { throw new AssertionError("Number of added resources. Expected: " + - visitor.getAmountAfter() + ", got: " + output.getContent().size()); + visitor.getAmountAfter() + ", got: " + output.getEntryCount()); } - for (ModuleData outResource : output.getContent()) { + output.entries().forEach(outResource -> { String path = outResource.getPath().replaceAll(SUFFIX + "$", ""); - ModuleData inResource = input.get(path); - if (inResource == null) { + if (!input.findEntry(path).isPresent()) { throw new AssertionError("Unknown resource: " + path); } - } + }); } - private static class ResourceVisitor implements Visitor { + private static class ResourceVisitor implements Function { private int amountBefore; private int amountAfter; @Override - public ModuleData visit(ModuleData resource) { + public ModuleEntry apply(ModuleEntry resource) { int index = ++amountBefore % 3; switch (index) { case 0: ++amountAfter; - return new ModuleData(resource.getModule(), resource.getPath() + SUFFIX, + return ModuleEntry.create(resource.getModule(), resource.getPath() + SUFFIX, resource.getType(), resource.stream(), resource.getLength()); case 1: ++amountAfter; - return new ModuleData(resource.getModule(), resource.getPath(), + return ModuleEntry.create(resource.getModule(), resource.getPath(), resource.getType(), resource.stream(), resource.getLength()); } return null; @@ -133,8 +132,8 @@ public class ResourcePoolTest { samples.add("javax/management/ObjectName"); test(samples, (resources, module, path) -> { try { - resources.add(new ModuleData(module, path, - ModuleDataType.CLASS_OR_RESOURCE, + resources.add(ModuleEntry.create(module, path, + ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0)); } catch (Exception ex) { throw new RuntimeException(ex); @@ -142,12 +141,12 @@ public class ResourcePoolTest { }); test(samples, (resources, module, path) -> { try { - resources.add(PoolImpl. - newCompressedResource(new ModuleData(module, path, - ModuleDataType.CLASS_OR_RESOURCE, + resources.add(ModulePoolImpl. + newCompressedResource(ModuleEntry.create(module, path, + ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0), ByteBuffer.allocate(99), "bitcruncher", null, - ((PoolImpl)resources).getStringTable(), ByteOrder.nativeOrder())); + ((ModulePoolImpl)resources).getStringTable(), ByteOrder.nativeOrder())); } catch (Exception ex) { throw new RuntimeException(ex); } @@ -158,7 +157,7 @@ public class ResourcePoolTest { if (samples.isEmpty()) { throw new AssertionError("No sample to test"); } - Pool resources = new PoolImpl(); + ModulePool resources = new ModulePoolImpl(); Set modules = new HashSet<>(); for (int i = 0; i < samples.size(); i++) { String module = samples.get(i); @@ -173,70 +172,69 @@ public class ResourcePoolTest { i++; String clazz = samples.get(i); String path = "/" + module + "/" + clazz + ".class"; - ModuleData res = resources.get(path); - checkModule(resources, res); - if (res == null) { + Optional res = resources.findEntry(path); + if (!res.isPresent()) { throw new AssertionError("Resource not found " + path); } - ModuleData res2 = resources.get(clazz); - if (res2 != null) { + checkModule(resources, res.get()); + if (resources.findEntry(clazz).isPresent()) { throw new AssertionError("Resource found " + clazz); } } - if (resources.getContent().size() != samples.size() / 2) { + if (resources.getEntryCount() != samples.size() / 2) { throw new AssertionError("Invalid number of resources"); } } - private void checkModule(Pool resources, ModuleData res) { - Module m = resources.getModule(res.getModule()); - if (m == null) { + private void checkModule(ModulePool resources, ModuleEntry res) { + Optional optMod = resources.findModule(res.getModule()); + if (!optMod.isPresent()) { throw new AssertionError("No module " + res.getModule()); } + LinkModule m = optMod.get(); if (!m.getName().equals(res.getModule())) { throw new AssertionError("Not right module name " + res.getModule()); } - if (m.get(res.getPath()) == null) { + if (!m.findEntry(res.getPath()).isPresent()) { throw new AssertionError("resource " + res.getPath() + " not in module " + m.getName()); } } private void checkResourcesAfterCompression() throws Exception { - PoolImpl resources1 = new PoolImpl(); - ModuleData res1 = new ModuleData("module1", "/module1/toto1", - ModuleDataType.CLASS_OR_RESOURCE, + ModulePoolImpl resources1 = new ModulePoolImpl(); + ModuleEntry res1 = ModuleEntry.create("module1", "/module1/toto1", + ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0); - ModuleData res2 = new ModuleData("module2", "/module2/toto1", - ModuleDataType.CLASS_OR_RESOURCE, + ModuleEntry res2 = ModuleEntry.create("module2", "/module2/toto1", + ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0); resources1.add(res1); resources1.add(res2); checkResources(resources1, res1, res2); - Pool resources2 = new PoolImpl(); - ModuleData res3 = new ModuleData("module2", "/module2/toto1", - ModuleDataType.CLASS_OR_RESOURCE, + ModulePool resources2 = new ModulePoolImpl(); + ModuleEntry res3 = ModuleEntry.create("module2", "/module2/toto1", + ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[7]), 7); resources2.add(res3); - resources2.add(PoolImpl.newCompressedResource(res1, + resources2.add(ModulePoolImpl.newCompressedResource(res1, ByteBuffer.allocate(7), "zip", null, resources1.getStringTable(), ByteOrder.nativeOrder())); checkResources(resources2, res1, res2); } - private void checkResources(Pool resources, ModuleData... expected) { - Collection ms = resources.getModules(); + private void checkResources(ModulePool resources, ModuleEntry... expected) { List modules = new ArrayList(); - for(Module m : ms) { + resources.modules().forEach(m -> { modules.add(m.getName()); - } - for (ModuleData res : expected) { + }); + for (ModuleEntry res : expected) { if (!resources.contains(res)) { throw new AssertionError("Resource not found: " + res); } - if (resources.get(res.getPath()) == null) { + if (!resources.findEntry(res.getPath()).isPresent()) { throw new AssertionError("Resource not found: " + res); } @@ -244,7 +242,7 @@ public class ResourcePoolTest { throw new AssertionError("Module not found: " + res.getModule()); } - if (!resources.getContent().contains(res)) { + if (!resources.contains(res)) { throw new AssertionError("Resources not found: " + res); } @@ -260,17 +258,17 @@ public class ResourcePoolTest { throw new AssertionError("ReadOnly resources"); } - ((PoolImpl) resources).setReadOnly(); + ((ModulePoolImpl) resources).setReadOnly(); try { - resources.add(new ModuleData("module2", "/module2/toto1", - ModuleDataType.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0)); - throw new AssertionError("Pool is read-only, but an exception is not thrown"); + resources.add(ModuleEntry.create("module2", "/module2/toto1", + ModuleEntry.Type.CLASS_OR_RESOURCE, new ByteArrayInputStream(new byte[0]), 0)); + throw new AssertionError("ModulePool is read-only, but an exception is not thrown"); } catch (Exception ex) { // Expected } } interface ResourceAdder { - void add(Pool resources, String module, String path); + void add(ModulePool resources, String module, String path); } } diff --git a/jdk/test/tools/jlink/SecurityTest.java b/jdk/test/tools/jlink/SecurityTest.java index 9497d6f3f34..dbf593bccc0 100644 --- a/jdk/test/tools/jlink/SecurityTest.java +++ b/jdk/test/tools/jlink/SecurityTest.java @@ -25,6 +25,7 @@ * @test * @summary Test JlinkPermission * @author Jean-Francois Denise + * @modules jdk.jlink/jdk.tools.jlink * @run main/othervm SecurityTest */ diff --git a/jdk/test/tools/jlink/asmplugin/AddForgetResourcesTest.java b/jdk/test/tools/jlink/asmplugin/AddForgetResourcesTest.java index 6a414b57d63..4385534e07f 100644 --- a/jdk/test/tools/jlink/asmplugin/AddForgetResourcesTest.java +++ b/jdk/test/tools/jlink/asmplugin/AddForgetResourcesTest.java @@ -55,8 +55,8 @@ import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile; import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableClassPool; import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableResourcePool; import jdk.tools.jlink.internal.plugins.asm.AsmPools; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class AddForgetResourcesTest extends AsmPluginTestBase { @@ -82,7 +82,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { new ComboPlugin() }; for (TestPlugin p : plugins) { - Pool out = p.visit(getPool()); + ModulePool out = p.visit(getPool()); p.test(getPool(), out); } } @@ -124,7 +124,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { AsmGlobalPool globalPool = pools.getGlobalPool(); WritableClassPool transformedClasses = globalPool.getTransformedClasses(); expected = globalPool.getClasses().size(); - for (ModuleData res : globalPool.getClasses()) { + for (ModuleEntry res : globalPool.getClasses()) { ClassReader reader = globalPool.getClassReader(res); String className = reader.getClassName(); if (!className.endsWith("module-info")) { @@ -137,14 +137,14 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) { - Collection inClasses = extractClasses(inResources); - Collection outClasses = extractClasses(outResources); + public void test(ModulePool inResources, ModulePool outResources) { + Collection inClasses = extractClasses(inResources); + Collection outClasses = extractClasses(outResources); if (expected != outClasses.size()) { throw new AssertionError("Classes were not added. Expected: " + expected + ", got: " + outClasses.size()); } - for (ModuleData in : inClasses) { + for (ModuleEntry in : inClasses) { String path = in.getPath(); if (!outClasses.contains(in)) { throw new AssertionError("Class not found: " + path); @@ -153,7 +153,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { continue; } String modifiedPath = path.replace(".class", SUFFIX + ".class"); - if (!outClasses.contains(Pool.newResource(modifiedPath, new byte[0]))) { + if (!outClasses.contains(ModuleEntry.create(modifiedPath, new byte[0]))) { throw new AssertionError("Class not found: " + modifiedPath); } } @@ -166,7 +166,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { public void visit() { AsmPools pools = getPools(); AsmGlobalPool globalPool = pools.getGlobalPool(); - for (ModuleData res : globalPool.getResourceFiles()) { + for (ModuleEntry res : globalPool.getResourceFiles()) { String path = res.getPath(); String moduleName = getModule(path); AsmModulePool modulePool = pools.getModulePool(moduleName); @@ -177,20 +177,20 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool in, Pool out) throws Exception { - Collection inResources = extractResources(in); - Collection outResources = extractResources(out); + public void test(ModulePool in, ModulePool out) throws Exception { + Collection inResources = extractResources(in); + Collection outResources = extractResources(out); if (2 * inResources.size() != outResources.size()) { throw new AssertionError("Classes were not added. Expected: " + (2 * inResources.size()) + ", got: " + outResources.size()); } - for (ModuleData r : inResources) { + for (ModuleEntry r : inResources) { String path = r.getPath(); if (!outResources.contains(r)) { throw new AssertionError("Class not found: " + path); } String modifiedPath = path + SUFFIX; - if (!outResources.contains(Pool.newResource(modifiedPath, new byte[0]))) { + if (!outResources.contains(ModuleEntry.create(modifiedPath, new byte[0]))) { throw new AssertionError("Class not found: " + modifiedPath); } } @@ -204,7 +204,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { AsmPools pools = getPools(); AsmGlobalPool globalPool = pools.getGlobalPool(); WritableClassPool transformedClasses = globalPool.getTransformedClasses(); - for (ModuleData res : globalPool.getClasses()) { + for (ModuleEntry res : globalPool.getClasses()) { ClassReader reader = globalPool.getClassReader(res); ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES); reader.accept(new AddMethodClassVisitor(writer), ClassReader.EXPAND_FRAMES); @@ -213,14 +213,14 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) throws Exception { - Collection inClasses = extractClasses(inResources); - Collection outClasses = extractClasses(outResources); + public void test(ModulePool inResources, ModulePool outResources) throws Exception { + Collection inClasses = extractClasses(inResources); + Collection outClasses = extractClasses(outResources); if (inClasses.size() != outClasses.size()) { throw new AssertionError("Number of classes. Expected: " + (inClasses.size()) + ", got: " + outClasses.size()); } - for (ModuleData out : outClasses) { + for (ModuleEntry out : outClasses) { String path = out.getPath(); if (!inClasses.contains(out)) { throw new AssertionError("Class not found: " + path); @@ -248,7 +248,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { public void visit() { AsmPools pools = getPools(); AsmGlobalPool globalPool = pools.getGlobalPool(); - for (ModuleData res : globalPool.getResourceFiles()) { + for (ModuleEntry res : globalPool.getResourceFiles()) { String path = res.getPath(); AsmModulePool modulePool = pools.getModulePool(getModule(path)); modulePool.getTransformedResourceFiles().addResourceFile(new ResourceFile(removeModule(path), @@ -257,14 +257,14 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool in, Pool out) throws Exception { - Collection inResources = extractResources(in); - Collection outResources = extractResources(out); + public void test(ModulePool in, ModulePool out) throws Exception { + Collection inResources = extractResources(in); + Collection outResources = extractResources(out); if (inResources.size() != outResources.size()) { throw new AssertionError("Number of resources. Expected: " + inResources.size() + ", got: " + outResources.size()); } - for (ModuleData r : outResources) { + for (ModuleEntry r : outResources) { String path = r.getPath(); if (!inResources.contains(r)) { throw new AssertionError("Resource not found: " + path); @@ -287,7 +287,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { AsmGlobalPool globalPool = pools.getGlobalPool(); WritableClassPool transformedClasses = globalPool.getTransformedClasses(); int i = 0; - for (ModuleData res : globalPool.getClasses()) { + for (ModuleEntry res : globalPool.getClasses()) { String path = removeModule(res.getPath()); String className = path.replace(".class", ""); if ((i & 1) == 0 && !className.endsWith("module-info")) { @@ -300,8 +300,8 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) throws Exception { - Collection outClasses = extractClasses(outResources); + public void test(ModulePool inResources, ModulePool outResources) throws Exception { + Collection outClasses = extractClasses(outResources); if (expected != outClasses.size()) { throw new AssertionError("Number of classes. Expected: " + expected + ", got: " + outClasses.size()); @@ -318,7 +318,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { AsmPools pools = getPools(); AsmGlobalPool globalPool = pools.getGlobalPool(); int i = 0; - for (ModuleData res : globalPool.getResourceFiles()) { + for (ModuleEntry res : globalPool.getResourceFiles()) { String path = res.getPath(); if (!path.contains("META-INF/services")) { if ((i & 1) == 0) { @@ -335,8 +335,8 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool in, Pool out) throws Exception { - Collection outResources = extractResources(out); + public void test(ModulePool in, ModulePool out) throws Exception { + Collection outResources = extractResources(out); if (expectedAmount != outResources.size()) { throw new AssertionError("Number of classes. Expected: " + expectedAmount + ", got: " + outResources.size()); @@ -354,7 +354,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { AsmGlobalPool globalPool = pools.getGlobalPool(); WritableClassPool transformedClasses = globalPool.getTransformedClasses(); int i = 0; - for (ModuleData res : globalPool.getClasses()) { + for (ModuleEntry res : globalPool.getClasses()) { ClassReader reader = globalPool.getClassReader(res); String className = reader.getClassName(); ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES); @@ -374,8 +374,8 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) throws Exception { - Collection outClasses = extractClasses(outResources); + public void test(ModulePool inResources, ModulePool outResources) throws Exception { + Collection outClasses = extractClasses(outResources); if (expected != outClasses.size()) { throw new AssertionError("Number of classes. Expected: " + expected + ", got: " + outClasses.size()); @@ -392,7 +392,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { AsmPools pools = getPools(); AsmGlobalPool globalPool = pools.getGlobalPool(); int i = 0; - for (ModuleData res : globalPool.getResourceFiles()) { + for (ModuleEntry res : globalPool.getResourceFiles()) { String path = res.getPath(); String moduleName = getModule(path); if (!path.contains("META-INF")) { @@ -412,8 +412,8 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool out) throws Exception { - Collection outResources = extractResources(out); + public void test(ModulePool inResources, ModulePool out) throws Exception { + Collection outResources = extractResources(out); if (expectedAmount != outResources.size()) { throw new AssertionError("Number of classes. Expected: " + expectedAmount + ", got: " + outResources.size()); @@ -446,7 +446,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) throws Exception { + public void test(ModulePool inResources, ModulePool outResources) throws Exception { if (!isVisitCalled()) { throw new AssertionError("Resources not visited"); } @@ -455,7 +455,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { throw new AssertionError("Number of transformed classes not equal to expected"); } // Check that only renamed classes and resource files are in the result. - for (ModuleData r : outResources.getContent()) { + outResources.entries().forEach(r -> { String resourceName = r.getPath(); if (resourceName.endsWith(".class") && !resourceName.endsWith("module-info.class")) { if (!resourceName.endsWith(SUFFIX + ".class")) { @@ -467,7 +467,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { throw new AssertionError("Resource file not renamed " + resourceName); } } - } + }); } private void renameResources() throws IOException { @@ -476,7 +476,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { for (Map.Entry> mod : MODULES.entrySet()) { String moduleName = mod.getKey(); AsmModulePool modulePool = pools.getModulePool(moduleName); - for (ModuleData res : modulePool.getResourceFiles()) { + for (ModuleEntry res : modulePool.getResourceFiles()) { ResourceFile resFile = modulePool.getResourceFile(res); if (resFile.getPath().startsWith("META-INF/services/")) { String newContent = new String(resFile.getContent()) + SUFFIX; @@ -492,7 +492,7 @@ public class AddForgetResourcesTest extends AsmPluginTestBase { AsmPools pools = getPools(); AsmGlobalPool globalPool = pools.getGlobalPool(); WritableClassPool transformedClasses = globalPool.getTransformedClasses(); - for (ModuleData res : globalPool.getClasses()) { + for (ModuleEntry res : globalPool.getClasses()) { if (res.getPath().endsWith("module-info.class")) { continue; } diff --git a/jdk/test/tools/jlink/asmplugin/AsmPluginTestBase.java b/jdk/test/tools/jlink/asmplugin/AsmPluginTestBase.java index d5c035562fa..c51419e682c 100644 --- a/jdk/test/tools/jlink/asmplugin/AsmPluginTestBase.java +++ b/jdk/test/tools/jlink/asmplugin/AsmPluginTestBase.java @@ -38,23 +38,23 @@ import java.util.Set; import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.StringTable; import jdk.tools.jlink.internal.plugins.asm.AsmPlugin; import jdk.tools.jlink.internal.plugins.asm.AsmPools; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public abstract class AsmPluginTestBase { protected static final String TEST_MODULE = "jlink.test"; protected static final Map> MODULES; - private static final Predicate isClass = r -> r.getPath().endsWith(".class"); + private static final Predicate isClass = r -> r.getPath().endsWith(".class"); private final List classes; private final List resources; - private final Pool pool; + private final ModulePool pool; static { Map> map = new HashMap<>(); @@ -75,7 +75,7 @@ public abstract class AsmPluginTestBase { List classes = new ArrayList<>(); List resources = new ArrayList<>(); - pool = new PoolImpl(); + pool = new ModulePoolImpl(); FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/")); Path root = fs.getPath("/modules"); @@ -100,7 +100,7 @@ public abstract class AsmPluginTestBase { MODULES.get(module).add(toResourceFile(p)); } resources.add(toPath(p.toString())); - ModuleData res = Pool.newResource(toPath(p.toString()), content); + ModuleEntry res = ModuleEntry.create(toPath(p.toString()), content); pool.add(res); } catch (Exception ex) { throw new RuntimeException(ex); @@ -110,17 +110,17 @@ public abstract class AsmPluginTestBase { } } // There is more than 10 classes in java.base... - if (classes.size() < 10 || pool.getContent().size() < 10) { + if (classes.size() < 10 || pool.getEntryCount() < 10) { throw new AssertionError("Not expected resource or class number"); } //Add a fake resource file String content = "java.lang.Object"; String path = "META-INF/services/com.foo.BarProvider"; - ModuleData resFile = Pool.newResource("/" + TEST_MODULE + "/" + + ModuleEntry resFile = ModuleEntry.create("/" + TEST_MODULE + "/" + path, content.getBytes()); pool.add(resFile); - ModuleData fakeInfoFile = Pool.newResource("/" + TEST_MODULE + ModuleEntry fakeInfoFile = ModuleEntry.create("/" + TEST_MODULE + "/module-info.class", moduleInfos.get(0)); pool.add(fakeInfoFile); MODULES.get(TEST_MODULE).add(path); @@ -144,20 +144,20 @@ public abstract class AsmPluginTestBase { return resources; } - public Pool getPool() { + public ModulePool getPool() { return pool; } public abstract void test() throws Exception; - public Collection extractClasses(Pool pool) { - return pool.getContent().stream() + public Collection extractClasses(ModulePool pool) { + return pool.entries() .filter(isClass) .collect(Collectors.toSet()); } - public Collection extractResources(Pool pool) { - return pool.getContent().stream() + public Collection extractResources(ModulePool pool) { + return pool.entries() .filter(isClass.negate()) .collect(Collectors.toSet()); } @@ -209,9 +209,9 @@ public abstract class AsmPluginTestBase { return pools != null; } - public Pool visit(Pool inResources) throws IOException { + public ModulePool visit(ModulePool inResources) throws IOException { try { - Pool outResources = new PoolImpl(inResources.getByteOrder(), new StringTable() { + ModulePool outResources = new ModulePoolImpl(inResources.getByteOrder(), new StringTable() { @Override public int addString(String str) { return -1; @@ -239,7 +239,7 @@ public abstract class AsmPluginTestBase { } public abstract void visit(); - public abstract void test(Pool inResources, Pool outResources) throws Exception; + public abstract void test(ModulePool inResources, ModulePool outResources) throws Exception; @Override public String getName() { diff --git a/jdk/test/tools/jlink/asmplugin/BasicTest.java b/jdk/test/tools/jlink/asmplugin/BasicTest.java index 0c42d4cfb99..afc5fd5f634 100644 --- a/jdk/test/tools/jlink/asmplugin/BasicTest.java +++ b/jdk/test/tools/jlink/asmplugin/BasicTest.java @@ -45,8 +45,8 @@ import java.util.logging.Logger; import jdk.internal.org.objectweb.asm.ClassReader; import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; import jdk.tools.jlink.internal.plugins.asm.AsmPool; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class BasicTest extends AsmPluginTestBase { @@ -61,7 +61,7 @@ public class BasicTest extends AsmPluginTestBase { @Override public void test() throws Exception { BasicPlugin basicPlugin = new BasicPlugin(getClasses()); - Pool res = basicPlugin.visit(getPool()); + ModulePool res = basicPlugin.visit(getPool()); basicPlugin.test(getPool(), res); } @@ -107,13 +107,13 @@ public class BasicTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) throws Exception { + public void test(ModulePool inResources, ModulePool outResources) throws Exception { if (!isVisitCalled()) { throw new AssertionError("Resources not visited"); } - if (inResources.getContent().size() != outResources.getContent().size()) { - throw new AssertionError("Input size " + inResources.getContent().size() + - " != to " + outResources.getContent().size()); + if (inResources.getEntryCount() != outResources.getEntryCount()) { + throw new AssertionError("Input size " + inResources.getEntryCount() + + " != to " + outResources.getEntryCount()); } } @@ -142,7 +142,7 @@ public class BasicTest extends AsmPluginTestBase { private void testPools() throws IOException { Set remain = new HashSet<>(classes); - for (ModuleData res : getPools().getGlobalPool().getClasses()) { + for (ModuleEntry res : getPools().getGlobalPool().getClasses()) { ClassReader reader = getPools().getGlobalPool().getClassReader(res); String className = reader.getClassName(); // Wrong naming of module-info.class in ASM diff --git a/jdk/test/tools/jlink/asmplugin/IdentityPluginTest.java b/jdk/test/tools/jlink/asmplugin/IdentityPluginTest.java index ceb2e50f9b9..416d3581552 100644 --- a/jdk/test/tools/jlink/asmplugin/IdentityPluginTest.java +++ b/jdk/test/tools/jlink/asmplugin/IdentityPluginTest.java @@ -35,14 +35,15 @@ import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.UncheckedIOException; import jdk.internal.org.objectweb.asm.ClassReader; import jdk.internal.org.objectweb.asm.ClassVisitor; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.Opcodes; import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableClassPool; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class IdentityPluginTest extends AsmPluginTestBase { @@ -56,7 +57,7 @@ public class IdentityPluginTest extends AsmPluginTestBase { public void test() throws Exception { IdentityPlugin asm = new IdentityPlugin(); - Pool resourcePool = asm.visit(getPool()); + ModulePool resourcePool = asm.visit(getPool()); asm.test(getPool(), resourcePool); } @@ -64,7 +65,7 @@ public class IdentityPluginTest extends AsmPluginTestBase { @Override public void visit() { - for (ModuleData res : getPools().getGlobalPool().getClasses()) { + for (ModuleEntry res : getPools().getGlobalPool().getClasses()) { if (res.getPath().endsWith("module-info.class")) { continue; } @@ -77,7 +78,7 @@ public class IdentityPluginTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) throws IOException { + public void test(ModulePool inResources, ModulePool outResources) throws IOException { if (outResources.isEmpty()) { throw new AssertionError("Empty result"); } @@ -93,13 +94,17 @@ public class IdentityPluginTest extends AsmPluginTestBase { throw new AssertionError("Class not transformed " + className); } } - for (ModuleData r : outResources.getContent()) { + outResources.entries().forEach(r -> { if (r.getPath().endsWith(".class") && !r.getPath().endsWith("module-info.class")) { - ClassReader reader = new ClassReader(new ByteArrayInputStream(r.getBytes())); - ClassWriter w = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES); - reader.accept(w, ClassReader.EXPAND_FRAMES); + try { + ClassReader reader = new ClassReader(new ByteArrayInputStream(r.getBytes())); + ClassWriter w = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES); + reader.accept(w, ClassReader.EXPAND_FRAMES); + } catch (IOException exp) { + throw new UncheckedIOException(exp); + } } - } + }); } @Override diff --git a/jdk/test/tools/jlink/asmplugin/NegativeTest.java b/jdk/test/tools/jlink/asmplugin/NegativeTest.java index f95b7c62399..6263fcaaa4a 100644 --- a/jdk/test/tools/jlink/asmplugin/NegativeTest.java +++ b/jdk/test/tools/jlink/asmplugin/NegativeTest.java @@ -43,7 +43,7 @@ import jdk.internal.org.objectweb.asm.ClassVisitor; import jdk.internal.org.objectweb.asm.ClassWriter; import jdk.internal.org.objectweb.asm.Opcodes; import jdk.tools.jlink.plugin.Plugin; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.StringTable; import jdk.tools.jlink.internal.plugins.asm.AsmGlobalPool; import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; @@ -51,7 +51,7 @@ import jdk.tools.jlink.internal.plugins.asm.AsmPlugin; import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile; import jdk.tools.jlink.internal.plugins.asm.AsmPools; import jdk.tools.jlink.plugin.PluginException; -import jdk.tools.jlink.plugin.Pool; +import jdk.tools.jlink.plugin.ModulePool; public class NegativeTest extends AsmPluginTestBase { public static void main(String[] args) throws Exception { @@ -102,7 +102,7 @@ public class NegativeTest extends AsmPluginTestBase { } } }; - Pool resources = new PoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() { + ModulePool resources = new ModulePoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() { @Override public int addString(String str) { return -1; @@ -136,7 +136,7 @@ public class NegativeTest extends AsmPluginTestBase { action(() -> pools.fillOutputResources(null), "Output resource is null", NullPointerException.class); } }; - Pool resources = new PoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() { + ModulePool resources = new ModulePoolImpl(ByteOrder.BIG_ENDIAN, new StringTable() { @Override public int addString(String str) { return -1; diff --git a/jdk/test/tools/jlink/asmplugin/PackageMappingTest.java b/jdk/test/tools/jlink/asmplugin/PackageMappingTest.java index 9453ac5f917..bd0a8fdbf4d 100644 --- a/jdk/test/tools/jlink/asmplugin/PackageMappingTest.java +++ b/jdk/test/tools/jlink/asmplugin/PackageMappingTest.java @@ -48,8 +48,8 @@ import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile; import jdk.tools.jlink.internal.plugins.asm.AsmPool.WritableResourcePool; import jdk.tools.jlink.plugin.PluginException; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class PackageMappingTest extends AsmPluginTestBase { @@ -72,7 +72,7 @@ public class PackageMappingTest extends AsmPluginTestBase { new PackageMappingPlugin(newFiles, true) }; for (TestPlugin p : plugins) { - Pool pool = p.visit(getPool()); + ModulePool pool = p.visit(getPool()); p.test(getPool(), pool); } } @@ -105,12 +105,12 @@ public class PackageMappingTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) { + public void test(ModulePool inResources, ModulePool outResources) { Set in = getPools().getGlobalPool().getResourceFiles().stream() - .map(ModuleData::getPath) + .map(ModuleEntry::getPath) .collect(Collectors.toSet()); Set out = extractResources(outResources).stream() - .map(ModuleData::getPath) + .map(ModuleEntry::getPath) .collect(Collectors.toSet()); in.addAll(PackageMappingTest.this.newFiles); if (!Objects.equals(in, out)) { diff --git a/jdk/test/tools/jlink/asmplugin/SortingTest.java b/jdk/test/tools/jlink/asmplugin/SortingTest.java index 0fc4c7a6854..26974b3b065 100644 --- a/jdk/test/tools/jlink/asmplugin/SortingTest.java +++ b/jdk/test/tools/jlink/asmplugin/SortingTest.java @@ -35,12 +35,13 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import jdk.tools.jlink.internal.plugins.asm.AsmModulePool; import jdk.tools.jlink.plugin.PluginException; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class SortingTest extends AsmPluginTestBase { @@ -66,7 +67,7 @@ public class SortingTest extends AsmPluginTestBase { List sorted = new ArrayList<>(getResources()); sorted.sort(null); ClassSorterPlugin sorterPlugin = new ClassSorterPlugin(sorted); - Pool resourcePool = sorterPlugin.visit(getPool()); + ModulePool resourcePool = sorterPlugin.visit(getPool()); sorterPlugin.test(getPool(), resourcePool); } @@ -78,7 +79,7 @@ public class SortingTest extends AsmPluginTestBase { List sorted = new ArrayList<>(getResources()); sorted.sort((s1, s2) -> -getModuleName(s1).compareTo(getModuleName(s2))); ModuleSorterPlugin sorterPlugin = new ModuleSorterPlugin(); - Pool resourcePool = sorterPlugin.visit(getPool()); + ModulePool resourcePool = sorterPlugin.visit(getPool()); sorterPlugin.test(getPool(), resourcePool); } @@ -88,8 +89,8 @@ public class SortingTest extends AsmPluginTestBase { public void visit() { for (AsmModulePool modulePool : getPools().getModulePools()) { modulePool.setSorter(resources -> { - List sort = resources.getContent().stream() - .map(ModuleData::getPath) + List sort = resources.entries() + .map(ModuleEntry::getPath) .collect(Collectors.toList()); sort.sort(null); return sort; @@ -102,21 +103,21 @@ public class SortingTest extends AsmPluginTestBase { } @Override - public void test(Pool inResources, Pool outResources) throws Exception { + public void test(ModulePool inResources, ModulePool outResources) throws Exception { if (!isVisitCalled()) { throw new AssertionError("Resources not visited"); } - List sortedResourcePaths = outResources.getContent().stream() - .map(ModuleData::getPath) + List sortedResourcePaths = outResources.entries() + .map(ModuleEntry::getPath) .collect(Collectors.toList()); List defaultResourceOrder = new ArrayList<>(); - for (ModuleData r : inResources.getContent()) { - if (!inResources.getContent().contains(r)) { + inResources.entries().forEach(r -> { + if (!inResources.contains(r)) { throw new AssertionError("Resource " + r.getPath() + " not in result pool"); } defaultResourceOrder.add(r.getPath()); - } + }); // Check that default sorting is not equal to sorted one if (defaultResourceOrder.equals(sortedResourcePaths)) { throw new AssertionError("Sorting not applied, default ordering"); @@ -147,27 +148,28 @@ public class SortingTest extends AsmPluginTestBase { public void visit() { getPools().getGlobalPool().setSorter( (resources) -> expectedClassesOrder.stream() - .map(resources::get) - .map(ModuleData::getPath) + .map(resources::findEntry) + .map(Optional::get) + .map(ModuleEntry::getPath) .collect(Collectors.toList())); } @Override - public void test(Pool inResources, Pool outResources) throws Exception { + public void test(ModulePool inResources, ModulePool outResources) throws Exception { if (!isVisitCalled()) { throw new AssertionError("Resources not visited"); } - List sortedResourcePaths = outResources.getContent().stream() - .map(ModuleData::getPath) + List sortedResourcePaths = outResources.entries() + .map(ModuleEntry::getPath) .collect(Collectors.toList()); List defaultResourceOrder = new ArrayList<>(); - for (ModuleData r : getPool().getContent()) { - if (!getPool().getContent().contains(r)) { + getPool().entries().forEach(r -> { + if (!getPool().contains(r)) { throw new AssertionError("Resource " + r.getPath() + " not in result pool"); } defaultResourceOrder.add(r.getPath()); - } + }); // Check that default sorting is not equal to sorted one if (defaultResourceOrder.equals(sortedResourcePaths)) { throw new AssertionError("Sorting not applied, default ordering"); diff --git a/jdk/test/tools/jlink/asmplugin/VisitorTest.java b/jdk/test/tools/jlink/asmplugin/VisitorTest.java index 1b278a8bd48..500d415bc50 100644 --- a/jdk/test/tools/jlink/asmplugin/VisitorTest.java +++ b/jdk/test/tools/jlink/asmplugin/VisitorTest.java @@ -46,8 +46,8 @@ import jdk.tools.jlink.internal.plugins.asm.AsmPool.ClassReaderVisitor; import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFile; import jdk.tools.jlink.internal.plugins.asm.AsmPool.ResourceFileVisitor; import jdk.tools.jlink.internal.plugins.asm.AsmPools; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class VisitorTest extends AsmPluginTestBase { @@ -69,7 +69,7 @@ public class VisitorTest extends AsmPluginTestBase { }; for (TestPlugin p : plugins) { System.err.println("Testing: " + p.getName()); - Pool out = p.visit(getPool()); + ModulePool out = p.visit(getPool()); p.test(getPool(), out); } } @@ -149,15 +149,15 @@ public class VisitorTest extends AsmPluginTestBase { } @Override - public void test(Pool in, Pool out) throws Exception { - Collection inClasses = getPool.apply(getPools()).getClasses(); + public void test(ModulePool in, ModulePool out) throws Exception { + Collection inClasses = getPool.apply(getPools()).getClasses(); if (inClasses.size() != classReaderVisitor.getAmount()) { throw new AssertionError("Testing " + name + ". Number of visited classes. Expected: " + inClasses.size() + ", got: " + classReaderVisitor.getAmount()); } - Collection outClasses = extractClasses(out); + Collection outClasses = extractClasses(out); int changedClasses = 0; - for (ModuleData r : outClasses) { + for (ModuleEntry r : outClasses) { if (r.getPath().endsWith("Changed.class")) { ++changedClasses; } @@ -192,15 +192,15 @@ public class VisitorTest extends AsmPluginTestBase { } @Override - public void test(Pool in, Pool out) throws Exception { - Collection inResources = getPool.apply(getPools()).getResourceFiles(); + public void test(ModulePool in, ModulePool out) throws Exception { + Collection inResources = getPool.apply(getPools()).getResourceFiles(); if (inResources.size() != resourceFileVisitor.getAmount()) { throw new AssertionError("Testing " + name + ". Number of visited resources. Expected: " + inResources.size() + ", got: " + resourceFileVisitor.getAmount()); } - Collection outResources = extractResources(out); + Collection outResources = extractResources(out); int changedClasses = 0; - for (ModuleData r : outResources) { + for (ModuleEntry r : outResources) { if (r.getPath().endsWith("Changed")) { ++changedClasses; } diff --git a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java index 38054ec2015..781039a517a 100644 --- a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java +++ b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java @@ -26,7 +26,9 @@ import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; -import jdk.tools.jlink.plugin.Pool; +import java.util.function.Function; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class CustomPlugin implements TransformerPlugin { @@ -37,13 +39,8 @@ public class CustomPlugin implements TransformerPlugin { } @Override - public void visit(Pool in, Pool out) { - in.visit(new Pool.Visitor() { - @Override - public Pool.ModuleData visit(Pool.ModuleData content) { - return content; - } - }, out); + public void visit(ModulePool in, ModulePool out) { + in.transformAndCopy(Function.identity(), out); } @Override @@ -61,9 +58,9 @@ public class CustomPlugin implements TransformerPlugin { } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.PROCESSOR); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.PROCESSOR); return Collections.unmodifiableSet(set); } } diff --git a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java index d06f99050b1..aa150350d7f 100644 --- a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java +++ b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java @@ -29,8 +29,8 @@ import java.util.Collections; import java.util.HashSet; import java.util.Map; import java.util.Set; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; /** @@ -49,23 +49,23 @@ public final class HelloPlugin implements TransformerPlugin { } @Override - public void visit(Pool inResources, Pool outResources) { + public void visit(ModulePool inResources, ModulePool outResources) { try { System.out.println("Hello!!!!!!!!!!"); File f = new File(OUTPUT_FILE); f.createNewFile(); - for (ModuleData res : inResources.getContent()) { + inResources.entries().forEach(res -> { outResources.add(res); - } + }); } catch (IOException ex) { throw new UncheckedIOException(ex); } } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.TRANSFORMER); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.TRANSFORMER); return Collections.unmodifiableSet(set); } diff --git a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java index cd01b93836b..d37bf1b73d2 100644 --- a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java +++ b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java @@ -53,14 +53,14 @@ import jdk.internal.jimage.decompressor.ResourceDecompressor; import jdk.internal.jimage.decompressor.ResourceDecompressorFactory; import jdk.internal.jimage.decompressor.StringSharingDecompressorFactory; import jdk.internal.jimage.decompressor.ZipDecompressorFactory; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.StringTable; import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin; import jdk.tools.jlink.internal.plugins.StringSharingPlugin; import jdk.tools.jlink.internal.plugins.ZipPlugin; import jdk.tools.jlink.plugin.Plugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class CompressorPluginTest { @@ -86,7 +86,7 @@ public class CompressorPluginTest { new ZipDecompressorFactory() }); - Pool classes = gatherClasses(javabase); + ModulePool classes = gatherClasses(javabase); // compress = String sharing checkCompress(classes, new StringSharingPlugin(), null, new ResourceDecompressorFactory[]{ @@ -173,8 +173,8 @@ public class CompressorPluginTest { Collections.singletonList(".*IOException.class")); } - private Pool gatherResources(Path module) throws Exception { - Pool pool = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() { + private ModulePool gatherResources(Path module) throws Exception { + ModulePool pool = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() { @Override public int addString(String str) { @@ -191,15 +191,15 @@ public class CompressorPluginTest { Path p = iterator.next(); if (Files.isRegularFile(p)) { byte[] content = Files.readAllBytes(p); - pool.add(Pool.newResource(p.toString(), content)); + pool.add(ModuleEntry.create(p.toString(), content)); } } } return pool; } - private Pool gatherClasses(Path module) throws Exception { - Pool pool = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() { + private ModulePool gatherClasses(Path module) throws Exception { + ModulePool pool = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() { @Override public int addString(String str) { @@ -216,27 +216,27 @@ public class CompressorPluginTest { Path p = iterator.next(); if (Files.isRegularFile(p) && p.toString().endsWith(".class")) { byte[] content = Files.readAllBytes(p); - pool.add(Pool.newResource(p.toString(), content)); + pool.add(ModuleEntry.create(p.toString(), content)); } } } return pool; } - private void checkCompress(Pool resources, Plugin prov, + private void checkCompress(ModulePool resources, Plugin prov, Properties config, ResourceDecompressorFactory[] factories) throws Exception { checkCompress(resources, prov, config, factories, Collections.emptyList(), Collections.emptyList()); } - private void checkCompress(Pool resources, Plugin prov, + private void checkCompress(ModulePool resources, Plugin prov, Properties config, ResourceDecompressorFactory[] factories, List includes, List excludes) throws Exception { - long original = 0; - long compressed = 0; - for (ModuleData resource : resources.getContent()) { + long[] original = new long[1]; + long[] compressed = new long[1]; + resources.entries().forEach(resource -> { List includesPatterns = includes.stream() .map(Pattern::compile) .collect(Collectors.toList()); @@ -252,7 +252,7 @@ public class CompressorPluginTest { } prov.configure(props); final Map strings = new HashMap<>(); - PoolImpl inputResources = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() { + ModulePoolImpl inputResources = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() { @Override public int addString(String str) { int id = strID; @@ -267,32 +267,32 @@ public class CompressorPluginTest { } }); inputResources.add(resource); - Pool compressedResources = applyCompressor(prov, inputResources, resource, includesPatterns, excludesPatterns); - original += resource.getLength(); - compressed += compressedResources.get(resource.getPath()).getLength(); + ModulePool compressedResources = applyCompressor(prov, inputResources, resource, includesPatterns, excludesPatterns); + original[0] += resource.getLength(); + compressed[0] += compressedResources.findEntry(resource.getPath()).get().getLength(); applyDecompressors(factories, inputResources, compressedResources, strings, includesPatterns, excludesPatterns); - } + }); String compressors = Stream.of(factories) .map(Object::getClass) .map(Class::getSimpleName) .collect(Collectors.joining(", ")); - String size = "Compressed size: " + compressed + ", original size: " + original; + String size = "Compressed size: " + compressed[0] + ", original size: " + original[0]; System.out.println("Used " + compressors + ". " + size); - if (original <= compressed) { + if (original[0] <= compressed[0]) { throw new AssertionError("java.base not compressed."); } } - private Pool applyCompressor(Plugin plugin, - PoolImpl inputResources, - ModuleData res, + private ModulePool applyCompressor(Plugin plugin, + ModulePoolImpl inputResources, + ModuleEntry res, List includesPatterns, - List excludesPatterns) throws Exception { + List excludesPatterns) { TransformerPlugin compressor = (TransformerPlugin) plugin; - Pool compressedPool = new PoolImpl(ByteOrder.nativeOrder(), inputResources.getStringTable()); - compressor.visit(inputResources, compressedPool); + ModulePool compressedModulePool = new ModulePoolImpl(ByteOrder.nativeOrder(), inputResources.getStringTable()); + compressor.visit(inputResources, compressedModulePool); String path = res.getPath(); - ModuleData compressed = compressedPool.get(path); + ModuleEntry compressed = compressedModulePool.findEntry(path).get(); CompressedResourceHeader header = CompressedResourceHeader.readFromResource(ByteOrder.nativeOrder(), compressed.getBytes()); if (isIncluded(includesPatterns, excludesPatterns, path)) { @@ -310,29 +310,33 @@ public class CompressorPluginTest { } else if (header != null) { throw new AssertionError("Path should not be compressed: " + path); } - return compressedPool; + return compressedModulePool; } private void applyDecompressors(ResourceDecompressorFactory[] decompressors, - Pool inputResources, - Pool compressedResources, + ModulePool inputResources, + ModulePool compressedResources, Map strings, List includesPatterns, - List excludesPatterns) throws Exception { - for (ModuleData compressed : compressedResources.getContent()) { + List excludesPatterns) { + compressedResources.entries().forEach(compressed -> { CompressedResourceHeader header = CompressedResourceHeader.readFromResource( ByteOrder.nativeOrder(), compressed.getBytes()); String path = compressed.getPath(); - ModuleData orig = inputResources.get(path); + ModuleEntry orig = inputResources.findEntry(path).get(); if (!isIncluded(includesPatterns, excludesPatterns, path)) { - continue; + return; } byte[] decompressed = compressed.getBytes(); for (ResourceDecompressorFactory factory : decompressors) { - ResourceDecompressor decompressor = factory.newDecompressor(new Properties()); - decompressed = decompressor.decompress( + try { + ResourceDecompressor decompressor = factory.newDecompressor(new Properties()); + decompressed = decompressor.decompress( strings::get, decompressed, CompressedResourceHeader.getSize(), header.getUncompressedSize()); + } catch (Exception exp) { + throw new RuntimeException(exp); + } } if (decompressed.length != orig.getLength()) { @@ -345,7 +349,7 @@ public class CompressorPluginTest { throw new AssertionError("Decompressed and original differ at index " + i); } } - } + }); } private boolean isIncluded(List includesPatterns, List excludesPatterns, String path) { diff --git a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java index cde83aa2761..744d7a2ba25 100644 --- a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java +++ b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java @@ -35,12 +35,11 @@ import java.io.File; import java.nio.file.Files; import java.util.HashMap; import java.util.Map; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; -import jdk.tools.jlink.plugin.Pool.ModuleDataType; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class ExcludeFilesPluginTest { @@ -73,20 +72,20 @@ public class ExcludeFilesPluginTest { prop.put(ExcludeFilesPlugin.NAME, s); ExcludeFilesPlugin fplug = new ExcludeFilesPlugin(); fplug.configure(prop); - PoolImpl files = new PoolImpl(); - PoolImpl fresult = new PoolImpl(); - ModuleData f = Pool.newImageFile(module, "/" + module + "/" + sample, - ModuleDataType.CONFIG, new ByteArrayInputStream(new byte[0]), 0); + ModulePoolImpl files = new ModulePoolImpl(); + ModulePoolImpl fresult = new ModulePoolImpl(); + ModuleEntry f = ModuleEntry.create(module, "/" + module + "/" + sample, + ModuleEntry.Type.CONFIG, new ByteArrayInputStream(new byte[0]), 0); files.add(f); fplug.visit(files, fresult); if (exclude) { - if (fresult.getContent().contains(f)) { + if (fresult.contains(f)) { throw new Exception(sample + " should be excluded by " + s); } } else { - if (!fresult.getContent().contains(f)) { + if (!fresult.contains(f)) { throw new Exception(sample + " shouldn't be excluded by " + s); } } diff --git a/jdk/test/tools/jlink/plugins/ExcludePluginTest.java b/jdk/test/tools/jlink/plugins/ExcludePluginTest.java index 0f508073288..c39e738e079 100644 --- a/jdk/test/tools/jlink/plugins/ExcludePluginTest.java +++ b/jdk/test/tools/jlink/plugins/ExcludePluginTest.java @@ -34,11 +34,11 @@ import java.io.File; import java.nio.file.Files; import java.util.HashMap; import java.util.Map; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.plugins.ExcludePlugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class ExcludePluginTest { @@ -75,17 +75,17 @@ public class ExcludePluginTest { prop.put(ExcludePlugin.NAME, s); ExcludePlugin excludePlugin = new ExcludePlugin(); excludePlugin.configure(prop); - Pool resources = new PoolImpl(); - ModuleData resource = Pool.newResource(sample, new byte[0]); + ModulePool resources = new ModulePoolImpl(); + ModuleEntry resource = ModuleEntry.create(sample, new byte[0]); resources.add(resource); - Pool result = new PoolImpl(); + ModulePool result = new ModulePoolImpl(); excludePlugin.visit(resources, result); if (exclude) { - if (result.getContent().contains(resource)) { + if (result.contains(resource)) { throw new AssertionError(sample + " should be excluded by " + s); } } else { - if (!result.getContent().contains(resource)) { + if (!result.contains(resource)) { throw new AssertionError(sample + " shouldn't be excluded by " + s); } } diff --git a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java index 701368c3dd0..edc10702eb3 100644 --- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java +++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java @@ -32,13 +32,12 @@ import java.io.ByteArrayInputStream; import java.util.HashMap; import java.util.Map; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.plugins.ExcludeVMPlugin; import jdk.tools.jlink.plugin.Plugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; -import jdk.tools.jlink.plugin.Pool.ModuleDataType; +import jdk.tools.jlink.plugin.ModulePool; +import jdk.tools.jlink.plugin.ModuleEntry; import jdk.tools.jlink.plugin.TransformerPlugin; public class ExcludeVMPluginTest { @@ -165,14 +164,14 @@ public class ExcludeVMPluginTest { private void doCheckVM(String vm, String[] input, String jvmcfg, String[] expectedOutput, String expectdJvmCfg) throws Exception { // Create a pool with jvm.cfg and the input paths. byte[] jvmcfgContent = jvmcfg.getBytes(); - Pool pool = new PoolImpl(); - pool.add(Pool.newImageFile("java.base", "/java.base/native/jvm.cfg", - ModuleDataType.NATIVE_LIB, new ByteArrayInputStream(jvmcfgContent), jvmcfgContent.length)); + ModulePool pool = new ModulePoolImpl(); + pool.add(ModuleEntry.create("java.base", "/java.base/native/jvm.cfg", + ModuleEntry.Type.NATIVE_LIB, new ByteArrayInputStream(jvmcfgContent), jvmcfgContent.length)); for (String in : input) { - pool.add(Pool.newImageFile("java.base", in, - ModuleDataType.NATIVE_LIB, new ByteArrayInputStream(new byte[0]), 0)); + pool.add(ModuleEntry.create("java.base", in, + ModuleEntry.Type.NATIVE_LIB, new ByteArrayInputStream(new byte[0]), 0)); } - Pool out = new PoolImpl(); + ModulePool out = new ModulePoolImpl(); TransformerPlugin p = new ExcludeVMPlugin(); Map config = new HashMap<>(); @@ -182,22 +181,22 @@ public class ExcludeVMPluginTest { p.configure(config); p.visit(pool, out); - String newContent = new String(out.get("/java.base/native/jvm.cfg").stream().readAllBytes()); + String newContent = new String(out.findEntry("/java.base/native/jvm.cfg").get().stream().readAllBytes()); if (!expectdJvmCfg.equals(newContent)) { throw new Exception("Got content " + newContent + " expected " + expectdJvmCfg); } - if (out.getContent().size() != (expectedOutput.length + 1)) { - for (ModuleData m : out.getContent()) { + if (out.getEntryCount() != (expectedOutput.length + 1)) { + out.entries().forEach(m -> { System.err.println(m.getPath()); - } - throw new Exception("Invalid output size " + out.getContent().size() + " expected " + (expectedOutput.length + 1)); + }); + throw new Exception("Invalid output size " + out.getEntryCount() + " expected " + (expectedOutput.length + 1)); } - for (ModuleData md : out.getContent()) { + out.entries().forEach(md -> { if (md.getPath().equals("/java.base/native/jvm.cfg")) { - continue; + return; } boolean contained = false; for (String o : expectedOutput) { @@ -207,9 +206,9 @@ public class ExcludeVMPluginTest { } } if (!contained) { - throw new Exception(md.getPath() + " not expected"); + throw new RuntimeException(md.getPath() + " not expected"); } - } + }); } diff --git a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java index 5fecfec388b..a6fb749ba7f 100644 --- a/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java +++ b/jdk/test/tools/jlink/plugins/FileCopierPluginTest.java @@ -26,6 +26,7 @@ * @summary Test files copy plugin * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink.builder * jdk.jlink/jdk.tools.jlink.internal.plugins * @run main FileCopierPluginTest */ @@ -36,13 +37,12 @@ import java.nio.file.Path; import java.util.Collections; import java.util.HashMap; import java.util.Map; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.builder.DefaultImageBuilder; import jdk.tools.jlink.internal.plugins.FileCopierPlugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; -import jdk.tools.jlink.plugin.Pool.ModuleDataType; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; public class FileCopierPluginTest { @@ -85,21 +85,20 @@ public class FileCopierPluginTest { Map conf = new HashMap<>(); conf.put(FileCopierPlugin.NAME, builder.toString()); plug.configure(conf); - Pool pool = new PoolImpl(); - plug.visit(new PoolImpl(), pool); - if (pool.getContent().size() != expected) { + ModulePool pool = new ModulePoolImpl(); + plug.visit(new ModulePoolImpl(), pool); + if (pool.getEntryCount() != expected) { throw new AssertionError("Wrong number of added files"); } - for (ModuleData f : pool.getContent()) { - if (!f.getType().equals(ModuleDataType.OTHER)) { + pool.entries().forEach(f -> { + if (!f.getType().equals(ModuleEntry.Type.OTHER)) { throw new AssertionError("Invalid type " + f.getType() + " for file " + f.getPath()); } if (f.stream() == null) { throw new AssertionError("Null stream for file " + f.getPath()); } - - } + }); Path root = new File(".").toPath(); DefaultImageBuilder imgbuilder = new DefaultImageBuilder(root); imgbuilder.storeFiles(pool); diff --git a/jdk/test/tools/jlink/plugins/LastSorterTest.java b/jdk/test/tools/jlink/plugins/LastSorterTest.java index 100ca1e4674..0dc27b44ec8 100644 --- a/jdk/test/tools/jlink/plugins/LastSorterTest.java +++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java @@ -26,6 +26,7 @@ * @summary Test last sorter property * @author Jean-Francois Denise * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink * @run main/othervm LastSorterTest */ @@ -40,12 +41,12 @@ import java.util.Set; import jdk.tools.jlink.internal.ImagePluginConfiguration; import jdk.tools.jlink.internal.PluginRepository; import jdk.tools.jlink.internal.ImagePluginStack; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.Jlink; import jdk.tools.jlink.Jlink.PluginsConfiguration; import jdk.tools.jlink.plugin.Plugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class LastSorterTest { @@ -80,7 +81,7 @@ public class LastSorterTest { ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config); // check order - PoolImpl res = fillOutResourcePool(); + ModulePoolImpl res = fillOutResourceModulePool(); try { stack.visitResources(res); @@ -91,18 +92,18 @@ public class LastSorterTest { } } - private PoolImpl fillOutResourcePool() throws Exception { - PoolImpl res = new PoolImpl(); - res.add(Pool.newResource("/eee/bbb/res1.class", new byte[90])); - res.add(Pool.newResource("/aaaa/bbb/res2.class", new byte[90])); - res.add(Pool.newResource("/bbb/aa/res1.class", new byte[90])); - res.add(Pool.newResource("/aaaa/bbb/res3.class", new byte[90])); - res.add(Pool.newResource("/bbb/aa/res2.class", new byte[90])); - res.add(Pool.newResource("/fff/bbb/res1.class", new byte[90])); - res.add(Pool.newResource("/aaaa/bbb/res1.class", new byte[90])); - res.add(Pool.newResource("/bbb/aa/res3.class", new byte[90])); - res.add(Pool.newResource("/ccc/bbb/res1.class", new byte[90])); - res.add(Pool.newResource("/ddd/bbb/res1.class", new byte[90])); + private ModulePoolImpl fillOutResourceModulePool() throws Exception { + ModulePoolImpl res = new ModulePoolImpl(); + res.add(ModuleEntry.create("/eee/bbb/res1.class", new byte[90])); + res.add(ModuleEntry.create("/aaaa/bbb/res2.class", new byte[90])); + res.add(ModuleEntry.create("/bbb/aa/res1.class", new byte[90])); + res.add(ModuleEntry.create("/aaaa/bbb/res3.class", new byte[90])); + res.add(ModuleEntry.create("/bbb/aa/res2.class", new byte[90])); + res.add(ModuleEntry.create("/fff/bbb/res1.class", new byte[90])); + res.add(ModuleEntry.create("/aaaa/bbb/res1.class", new byte[90])); + res.add(ModuleEntry.create("/bbb/aa/res3.class", new byte[90])); + res.add(ModuleEntry.create("/ccc/bbb/res1.class", new byte[90])); + res.add(ModuleEntry.create("/ddd/bbb/res1.class", new byte[90])); return res; } @@ -124,7 +125,7 @@ public class LastSorterTest { ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config); // check order - PoolImpl res = fillOutResourcePool(); + ModulePoolImpl res = fillOutResourceModulePool(); stack.visitResources(res); } @@ -159,7 +160,7 @@ public class LastSorterTest { ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(config); // check order - PoolImpl res = fillOutResourcePool(); + ModulePoolImpl res = fillOutResourceModulePool(); try { stack.visitResources(res); throw new AssertionError("Order was changed after the last sorter, but no exception occurred"); @@ -178,17 +179,17 @@ public class LastSorterTest { } @Override - public void visit(Pool resources, Pool output) { - List paths = new ArrayList<>(); - for (ModuleData res : resources.getContent()) { + public void visit(ModulePool resources, ModulePool output) { + List paths = new ArrayList<>(); + resources.entries().forEach(res -> { if (res.getPath().startsWith(starts)) { paths.add(0, res); } else { paths.add(res); } - } + }); - for (ModuleData r : paths) { + for (ModuleEntry r : paths) { output.add(r); } } @@ -199,9 +200,9 @@ public class LastSorterTest { } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.TRANSFORMER); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.TRANSFORMER); return Collections.unmodifiableSet(set); } diff --git a/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java b/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java index cbf418669c0..701736139c6 100644 --- a/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java +++ b/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java @@ -36,11 +36,12 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Map; -import jdk.tools.jlink.internal.PoolImpl; +import java.util.stream.Collectors; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.plugins.OrderResourcesPlugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class OrderResourcesPluginTest { @@ -50,52 +51,52 @@ public class OrderResourcesPluginTest { } public void test() throws Exception { - ModuleData[] array = { - Pool.newResource("/module1/toto1.class", new byte[0]), - Pool.newResource("/module2/toto2.class", new byte[0]), - Pool.newResource("/module3/toto3.class", new byte[0]), - Pool.newResource("/module3/toto3/module-info.class", new byte[0]), - Pool.newResource("/zazou/toto.class", new byte[0]), - Pool.newResource("/module4/zazou.class", new byte[0]), - Pool.newResource("/module5/toto5.class", new byte[0]), - Pool.newResource("/module6/toto6/module-info.class", new byte[0]) + ModuleEntry[] array = { + ModuleEntry.create("/module1/toto1.class", new byte[0]), + ModuleEntry.create("/module2/toto2.class", new byte[0]), + ModuleEntry.create("/module3/toto3.class", new byte[0]), + ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]), + ModuleEntry.create("/zazou/toto.class", new byte[0]), + ModuleEntry.create("/module4/zazou.class", new byte[0]), + ModuleEntry.create("/module5/toto5.class", new byte[0]), + ModuleEntry.create("/module6/toto6/module-info.class", new byte[0]) }; - ModuleData[] sorted = { - Pool.newResource("/zazou/toto.class", new byte[0]), - Pool.newResource("/module3/toto3/module-info.class", new byte[0]), - Pool.newResource("/module6/toto6/module-info.class", new byte[0]), - Pool.newResource("/module1/toto1.class", new byte[0]), - Pool.newResource("/module2/toto2.class", new byte[0]), - Pool.newResource("/module3/toto3.class", new byte[0]), - Pool.newResource("/module4/zazou.class", new byte[0]), - Pool.newResource("/module5/toto5.class", new byte[0]) + ModuleEntry[] sorted = { + ModuleEntry.create("/zazou/toto.class", new byte[0]), + ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]), + ModuleEntry.create("/module6/toto6/module-info.class", new byte[0]), + ModuleEntry.create("/module1/toto1.class", new byte[0]), + ModuleEntry.create("/module2/toto2.class", new byte[0]), + ModuleEntry.create("/module3/toto3.class", new byte[0]), + ModuleEntry.create("/module4/zazou.class", new byte[0]), + ModuleEntry.create("/module5/toto5.class", new byte[0]) }; - ModuleData[] sorted2 = { - Pool.newResource("/module5/toto5.class", new byte[0]), - Pool.newResource("/module6/toto6/module-info.class", new byte[0]), - Pool.newResource("/module4/zazou.class", new byte[0]), - Pool.newResource("/module3/toto3.class", new byte[0]), - Pool.newResource("/module3/toto3/module-info.class", new byte[0]), - Pool.newResource("/module1/toto1.class", new byte[0]), - Pool.newResource("/module2/toto2.class", new byte[0]), - Pool.newResource("/zazou/toto.class", new byte[0]) + ModuleEntry[] sorted2 = { + ModuleEntry.create("/module5/toto5.class", new byte[0]), + ModuleEntry.create("/module6/toto6/module-info.class", new byte[0]), + ModuleEntry.create("/module4/zazou.class", new byte[0]), + ModuleEntry.create("/module3/toto3.class", new byte[0]), + ModuleEntry.create("/module3/toto3/module-info.class", new byte[0]), + ModuleEntry.create("/module1/toto1.class", new byte[0]), + ModuleEntry.create("/module2/toto2.class", new byte[0]), + ModuleEntry.create("/zazou/toto.class", new byte[0]) }; - Pool resources = new PoolImpl(); - for (ModuleData r : array) { + ModulePool resources = new ModulePoolImpl(); + for (ModuleEntry r : array) { resources.add(r); } { - Pool out = new PoolImpl(); + ModulePool out = new ModulePoolImpl(); Map config = new HashMap<>(); config.put(OrderResourcesPlugin.NAME, "/zazou/*,*/module-info.class"); TransformerPlugin p = new OrderResourcesPlugin(); p.configure(config); p.visit(resources, out); - check(out.getContent(), sorted); + check(out.entries().collect(Collectors.toList()), sorted); } { @@ -112,26 +113,26 @@ public class OrderResourcesPluginTest { } Files.write(order.toPath(), builder.toString().getBytes()); - Pool out = new PoolImpl(); + ModulePool out = new ModulePoolImpl(); Map config = new HashMap<>(); config.put(OrderResourcesPlugin.NAME, "@" + order.getAbsolutePath()); TransformerPlugin p = new OrderResourcesPlugin(); p.configure(config); p.visit(resources, out); - check(out.getContent(), sorted2); + check(out.entries().collect(Collectors.toList()), sorted2); } } - private void check(Collection outResources, - ModuleData[] sorted) { + private void check(Collection outResources, + ModuleEntry[] sorted) { if (outResources.size() != sorted.length) { throw new AssertionError("Wrong number of resources:\n" + "expected: " + Arrays.toString(sorted) + ",\n" + " got: " + outResources); } int i = 0; - for (ModuleData r : outResources) { + for (ModuleEntry r : outResources) { System.err.println("Resource: " + r); if (!sorted[i].getPath().equals(r.getPath())) { throw new AssertionError("Resource not properly sorted, difference at: " + i + "\n" diff --git a/jdk/test/tools/jlink/plugins/PluginOrderTest.java b/jdk/test/tools/jlink/plugins/PluginOrderTest.java index 42655d408fe..4c9f2c2241d 100644 --- a/jdk/test/tools/jlink/plugins/PluginOrderTest.java +++ b/jdk/test/tools/jlink/plugins/PluginOrderTest.java @@ -44,8 +44,8 @@ import java.util.Set; import jdk.tools.jlink.internal.PluginOrderingGraph; import jdk.tools.jlink.plugin.Plugin; -import jdk.tools.jlink.plugin.Plugin.CATEGORY; -import jdk.tools.jlink.plugin.Pool; +import jdk.tools.jlink.plugin.Plugin.Category; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class PluginOrderTest { @@ -96,8 +96,8 @@ public class PluginOrderTest { set.add("plug2"); List plugins = new ArrayList<>(); plugins.add(new Plug("plug2", Collections.emptySet(), Collections.emptySet(), - CATEGORY.TRANSFORMER)); - plugins.add(new Plug("plug1", set, Collections.emptySet(), CATEGORY.TRANSFORMER)); + Category.TRANSFORMER)); + plugins.add(new Plug("plug1", set, Collections.emptySet(), Category.TRANSFORMER)); List ordered = PluginOrderingGraph.sort(plugins); if (ordered.get(0) != plugins.get(1) || ordered.get(1) != plugins.get(0)) { throw new Exception("Invalid sorting"); @@ -108,32 +108,32 @@ public class PluginOrderTest { Set lst1 = new HashSet<>(); lst1.add("plug2"); lst1.add("plug3"); - Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), Category.TRANSFORMER); - Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); Set lst3 = new HashSet<>(); lst3.add("plug4"); lst3.add("plug6"); - Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), Category.TRANSFORMER); - Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); Set lst5 = new HashSet<>(); lst5.add("plug3"); lst5.add("plug1"); lst5.add("plug2"); lst5.add("plug6"); - Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), Category.TRANSFORMER); Set lst6 = new HashSet<>(); lst6.add("plug4"); lst6.add("plug2"); - Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), Category.TRANSFORMER); - Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); - Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); List plugins = new ArrayList<>(); plugins.add(p1); @@ -153,11 +153,11 @@ public class PluginOrderTest { set2.add("plug1"); List plugins = new ArrayList<>(); plugins.add(new Plug("plug2", set2, Collections.emptySet(), - CATEGORY.TRANSFORMER)); + Category.TRANSFORMER)); Set set1 = new HashSet<>(); set1.add("plug2"); - plugins.add(new Plug("plug1", set1, Collections.emptySet(), CATEGORY.TRANSFORMER)); + plugins.add(new Plug("plug1", set1, Collections.emptySet(), Category.TRANSFORMER)); PluginOrderingGraph.sort(plugins); } @@ -166,31 +166,31 @@ public class PluginOrderTest { Set lst1 = new HashSet<>(); lst1.add("plug2"); lst1.add("plug3"); - Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p1 = new Plug("plug1", lst1, Collections.emptySet(), Category.TRANSFORMER); - Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); Set lst3 = new HashSet<>(); lst3.add("plug4"); lst3.add("plug6"); - Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p3 = new Plug("plug3", lst3, Collections.emptySet(), Category.TRANSFORMER); - Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p4 = new Plug("plug4", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); Set lst5 = new HashSet<>(); lst5.add("plug3"); lst5.add("plug1"); lst5.add("plug2"); - Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p5 = new Plug("plug5", lst5, Collections.emptySet(), Category.TRANSFORMER); Set lst6 = new HashSet<>(); lst6.add("plug4"); lst6.add("plug1"); - Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p6 = new Plug("plug6", lst6, Collections.emptySet(), Category.TRANSFORMER); - Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p7 = new Plug("plug7", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); - Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p8 = new Plug("plug8", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); List plugins = new ArrayList<>(); plugins.add(p1); @@ -208,8 +208,8 @@ public class PluginOrderTest { Set lst1 = new HashSet<>(); lst1.add("plug2"); lst1.add("plug3"); - Plugin p = new Plug("plug1", lst1, Collections.emptySet(), CATEGORY.TRANSFORMER); - Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), CATEGORY.TRANSFORMER); + Plugin p = new Plug("plug1", lst1, Collections.emptySet(), Category.TRANSFORMER); + Plugin p2 = new Plug("plug2", Collections.emptySet(), Collections.emptySet(), Category.TRANSFORMER); Set lst3 = new HashSet<>(); lst3.add("plug2"); @@ -217,7 +217,7 @@ public class PluginOrderTest { Set lst4 = new HashSet<>(); lst4.add("plug1"); - Plugin p3 = new Plug("plug3", lst4, lst3, CATEGORY.TRANSFORMER); + Plugin p3 = new Plug("plug3", lst4, lst3, Category.TRANSFORMER); List plugins = new ArrayList<>(); plugins.add(p); plugins.add(p2); @@ -229,10 +229,10 @@ public class PluginOrderTest { private final Set isBefore; private final Set isAfter; - private final CATEGORY category; + private final Category category; private final String name; - private Plug(String name, Set isBefore, Set isAfter, CATEGORY category) { + private Plug(String name, Set isBefore, Set isAfter, Category category) { this.name = name; this.isBefore = isBefore; this.isAfter = isAfter; @@ -255,12 +255,12 @@ public class PluginOrderTest { } @Override - public void visit(Pool in, Pool out) { + public void visit(ModulePool in, ModulePool out) { } @Override - public Set getType() { + public Set getType() { return Collections.singleton(category); } diff --git a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java index 525fb0b5ce2..5b8ed2d6c83 100644 --- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java +++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java @@ -26,6 +26,7 @@ * @summary Negative test for ImagePluginStack. * @author Andrei Eremeev * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink * @run main/othervm PluginsNegativeTest */ import java.lang.reflect.Layer; @@ -39,11 +40,12 @@ import java.util.Set; import jdk.tools.jlink.internal.ImagePluginConfiguration; import jdk.tools.jlink.internal.PluginRepository; import jdk.tools.jlink.internal.ImagePluginStack; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.Jlink; import jdk.tools.jlink.Jlink.PluginsConfiguration; import jdk.tools.jlink.plugin.Plugin; -import jdk.tools.jlink.plugin.Pool; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class PluginsNegativeTest { @@ -96,8 +98,8 @@ public class PluginsNegativeTest { plugins.add(createPlugin("plugin")); ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new PluginsConfiguration(plugins, null, null)); - PoolImpl inResources = new PoolImpl(); - inResources.add(Pool.newResource("/aaa/bbb/A", new byte[10])); + ModulePoolImpl inResources = new ModulePoolImpl(); + inResources.add(ModuleEntry.create("/aaa/bbb/A", new byte[10])); try { stack.visitResources(inResources); throw new AssertionError("Exception expected when output resource is empty"); @@ -110,8 +112,8 @@ public class PluginsNegativeTest { plugins.add(createPlugin("plugin")); ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new PluginsConfiguration(plugins, null, null)); - PoolImpl inResources = new PoolImpl(); - PoolImpl outResources = (PoolImpl) stack.visitResources(inResources); + ModulePoolImpl inResources = new ModulePoolImpl(); + ModulePoolImpl outResources = (ModulePoolImpl) stack.visitResources(inResources); if (!outResources.isEmpty()) { throw new AssertionError("Output resource is not empty"); } @@ -126,7 +128,7 @@ public class PluginsNegativeTest { } @Override - public void visit(Pool inResources, Pool outResources) { + public void visit(ModulePool inResources, ModulePool outResources) { // do nothing } @@ -136,9 +138,9 @@ public class PluginsNegativeTest { } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.TRANSFORMER); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.TRANSFORMER); return Collections.unmodifiableSet(set); } diff --git a/jdk/test/tools/jlink/plugins/PrevisitorTest.java b/jdk/test/tools/jlink/plugins/PrevisitorTest.java index 16d79f0c068..1f721d66d5f 100644 --- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java +++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java @@ -26,6 +26,7 @@ * @summary Test previsitor * @author Andrei Eremeev * @modules jdk.jlink/jdk.tools.jlink.internal + * jdk.jlink/jdk.tools.jlink * @run main/othervm PrevisitorTest */ import java.nio.ByteOrder; @@ -36,19 +37,20 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import jdk.tools.jlink.internal.ImagePluginConfiguration; import jdk.tools.jlink.internal.PluginRepository; import jdk.tools.jlink.internal.ImagePluginStack; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.ResourcePrevisitor; import jdk.tools.jlink.internal.StringTable; import jdk.tools.jlink.Jlink; import jdk.tools.jlink.plugin.Plugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; public class PrevisitorTest { @@ -68,17 +70,17 @@ public class PrevisitorTest { plugins.add(createPlugin(CustomPlugin.NAME)); ImagePluginStack stack = ImagePluginConfiguration.parseConfiguration(new Jlink.PluginsConfiguration(plugins, null, null)); - PoolImpl inResources = new PoolImpl(ByteOrder.nativeOrder(), new CustomStringTable()); - inResources.add(Pool.newResource("/aaa/bbb/res1.class", new byte[90])); - inResources.add(Pool.newResource("/aaa/bbb/res2.class", new byte[90])); - inResources.add(Pool.newResource("/aaa/bbb/res3.class", new byte[90])); - inResources.add(Pool.newResource("/aaa/ddd/res1.class", new byte[90])); - inResources.add(Pool.newResource("/aaa/res1.class", new byte[90])); - Pool outResources = stack.visitResources(inResources); - Collection input = inResources.getContent().stream() + ModulePoolImpl inResources = new ModulePoolImpl(ByteOrder.nativeOrder(), new CustomStringTable()); + inResources.add(ModuleEntry.create("/aaa/bbb/res1.class", new byte[90])); + inResources.add(ModuleEntry.create("/aaa/bbb/res2.class", new byte[90])); + inResources.add(ModuleEntry.create("/aaa/bbb/res3.class", new byte[90])); + inResources.add(ModuleEntry.create("/aaa/ddd/res1.class", new byte[90])); + inResources.add(ModuleEntry.create("/aaa/res1.class", new byte[90])); + ModulePool outResources = stack.visitResources(inResources); + Collection input = inResources.entries() .map(Object::toString) .collect(Collectors.toList()); - Collection output = outResources.getContent().stream() + Collection output = outResources.entries() .map(Object::toString) .collect(Collectors.toList()); if (!input.equals(output)) { @@ -114,19 +116,20 @@ public class PrevisitorTest { private boolean isPrevisitCalled = false; @Override - public void visit(Pool inResources, Pool outResources) { + public void visit(ModulePool inResources, ModulePool outResources) { if (!isPrevisitCalled) { throw new AssertionError("Previsit was not called"); } CustomStringTable table = (CustomStringTable) - ((PoolImpl) inResources).getStringTable(); + ((ModulePoolImpl) inResources).getStringTable(); if (table.size() == 0) { throw new AssertionError("Table is empty"); } Map count = new HashMap<>(); for (int i = 0; i < table.size(); ++i) { String s = table.getString(i); - if (inResources.get(s) != null) { + Optional e = inResources.findEntry(s); + if (e.isPresent()) { throw new AssertionError(); } count.compute(s, (k, c) -> 1 + (c == null ? 0 : c)); @@ -136,9 +139,9 @@ public class PrevisitorTest { throw new AssertionError("Expected one entry in the table, got: " + v + " for " + k); } }); - for (ModuleData r : inResources.getContent()) { + inResources.entries().forEach(r -> { outResources.add(r); - } + }); } @Override @@ -147,21 +150,21 @@ public class PrevisitorTest { } @Override - public void previsit(Pool resources, StringTable strings) { + public void previsit(ModulePool resources, StringTable strings) { isPrevisitCalled = true; - for (ModuleData r : resources.getContent()) { + resources.entries().forEach(r -> { String s = r.getPath(); int lastIndexOf = s.lastIndexOf('/'); if (lastIndexOf >= 0) { strings.addString(s.substring(0, lastIndexOf)); } - } + }); } @Override - public Set getType() { - Set set = new HashSet<>(); - set.add(CATEGORY.TRANSFORMER); + public Set getType() { + Set set = new HashSet<>(); + set.add(Category.TRANSFORMER); return Collections.unmodifiableSet(set); } } diff --git a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java index 786da460990..c02a8e6db0c 100644 --- a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java +++ b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java @@ -38,6 +38,8 @@ * @run main StringSharingPluginTest */ +import java.io.IOException; +import java.io.UncheckedIOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.file.Files; @@ -50,11 +52,11 @@ import java.util.function.Consumer; import jdk.internal.jimage.decompressor.CompressedResourceHeader; import jdk.internal.jimage.decompressor.StringSharingDecompressor; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.StringTable; import jdk.tools.jlink.internal.plugins.StringSharingPlugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; import tests.Helper; import tests.JImageValidator; @@ -78,7 +80,7 @@ public class StringSharingPluginTest { Map map = new HashMap<>(); Map reversedMap = new HashMap<>(); - PoolImpl resources = new PoolImpl(ByteOrder.nativeOrder(), new StringTable() { + ModulePoolImpl resources = new ModulePoolImpl(ByteOrder.nativeOrder(), new StringTable() { @Override public int addString(String str) { Integer id = map.get(str); @@ -104,7 +106,7 @@ public class StringSharingPluginTest { byte[] content = Files.readAllBytes(p); String path = p.toString().replace('\\', '/'); path = path.substring("/modules".length()); - ModuleData res = Pool.newResource(path, content); + ModuleEntry res = ModuleEntry.create(path, content); resources.add(res); } catch (Exception ex) { throw new RuntimeException(ex); @@ -115,19 +117,23 @@ public class StringSharingPluginTest { stream.forEach(c); } TransformerPlugin plugin = new StringSharingPlugin(); - PoolImpl result = new PoolImpl(resources.getByteOrder(), resources.getStringTable()); + ModulePoolImpl result = new ModulePoolImpl(resources.getByteOrder(), resources.getStringTable()); plugin.visit(resources, result); if (result.isEmpty()) { throw new AssertionError("No result"); } - for (ModuleData res : result.getContent()) { + result.entries().forEach(res -> { if (res.getPath().endsWith(".class")) { - byte[] uncompacted = StringSharingDecompressor.normalize(reversedMap::get, res.getBytes(), + try { + byte[] uncompacted = StringSharingDecompressor.normalize(reversedMap::get, res.getBytes(), CompressedResourceHeader.getSize()); - JImageValidator.readClass(uncompacted); + JImageValidator.readClass(uncompacted); + } catch (IOException exp) { + throw new UncheckedIOException(exp); + } } - } + }); } } diff --git a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java index fd8acae896c..d3617db6f8a 100644 --- a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java +++ b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java @@ -54,10 +54,10 @@ import com.sun.tools.classfile.ConstantPoolException; import com.sun.tools.classfile.Method; import java.util.HashMap; import java.util.Map; -import jdk.tools.jlink.internal.PoolImpl; +import jdk.tools.jlink.internal.ModulePoolImpl; import jdk.tools.jlink.internal.plugins.StripDebugPlugin; -import jdk.tools.jlink.plugin.Pool; -import jdk.tools.jlink.plugin.Pool.ModuleData; +import jdk.tools.jlink.plugin.ModuleEntry; +import jdk.tools.jlink.plugin.ModulePool; import jdk.tools.jlink.plugin.TransformerPlugin; import tests.Helper; @@ -106,7 +106,7 @@ public class StripDebugPluginTest { path = path.replace('\\', '/'); StripDebugPlugin debug = new StripDebugPlugin(); debug.configure(new HashMap<>()); - ModuleData result1 = stripDebug(debug, Pool.newResource(path,content), path, infoPath, moduleInfo); + ModuleEntry result1 = stripDebug(debug, ModuleEntry.create(path,content), path, infoPath, moduleInfo); if (!path.endsWith("module-info.class")) { if (result1.getLength() >= content.length) { @@ -116,7 +116,7 @@ public class StripDebugPluginTest { checkDebugAttributes(result1.getBytes()); } - ModuleData result2 = stripDebug(debug, result1, path, infoPath, moduleInfo); + ModuleEntry result2 = stripDebug(debug, result1, path, infoPath, moduleInfo); if (result1.getLength() != result2.getLength()) { throw new AssertionError("removing debug info twice reduces class size of " + path); @@ -124,18 +124,18 @@ public class StripDebugPluginTest { checkDebugAttributes(result1.getBytes()); } - private ModuleData stripDebug(TransformerPlugin debug, ModuleData classResource, + private ModuleEntry stripDebug(TransformerPlugin debug, ModuleEntry classResource, String path, String infoPath, byte[] moduleInfo) throws Exception { - Pool resources = new PoolImpl(); + ModulePool resources = new ModulePoolImpl(); resources.add(classResource); if (!path.endsWith("module-info.class")) { - ModuleData res2 = Pool.newResource(infoPath, moduleInfo); + ModuleEntry res2 = ModuleEntry.create(infoPath, moduleInfo); resources.add(res2); } - Pool results = new PoolImpl(); + ModulePool results = new ModulePoolImpl(); debug.visit(resources, results); System.out.println(classResource.getPath()); - return results.get(classResource.getPath()); + return results.findEntry(classResource.getPath()).get(); } private void checkDebugAttributes(byte[] strippedClassFile) throws IOException, ConstantPoolException { diff --git a/jdk/test/tools/launcher/FXLauncherTest.java b/jdk/test/tools/launcher/FXLauncherTest.java index 0ee9d981cda..7fec8d59d36 100644 --- a/jdk/test/tools/launcher/FXLauncherTest.java +++ b/jdk/test/tools/launcher/FXLauncherTest.java @@ -29,6 +29,7 @@ * jfx app class, a main-class for the manifest, a bogus one and none. * All should execute except the incorrect fx app class entries. * @run main/othervm FXLauncherTest + * @key intermittent */ import java.io.File; import java.io.IOException; diff --git a/jdk/test/tools/launcher/modules/patch/PatchTest.java b/jdk/test/tools/launcher/modules/patch/basic/PatchTest.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/PatchTest.java rename to jdk/test/tools/launcher/modules/patch/basic/PatchTest.java diff --git a/jdk/test/tools/launcher/modules/patch/src/test/jdk/test/Main.java b/jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src/test/jdk/test/Main.java rename to jdk/test/tools/launcher/modules/patch/basic/src/test/jdk/test/Main.java diff --git a/jdk/test/tools/launcher/modules/patch/src/test/module-info.java b/jdk/test/tools/launcher/modules/patch/basic/src/test/module-info.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src/test/module-info.java rename to jdk/test/tools/launcher/modules/patch/basic/src/test/module-info.java diff --git a/jdk/test/tools/launcher/modules/patch/src1/java.base/java/text/Annotation.java b/jdk/test/tools/launcher/modules/patch/basic/src1/java.base/java/text/Annotation.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src1/java.base/java/text/Annotation.java rename to jdk/test/tools/launcher/modules/patch/basic/src1/java.base/java/text/Annotation.java diff --git a/jdk/test/tools/launcher/modules/patch/src1/java.base/java/text/AnnotationBuddy.java b/jdk/test/tools/launcher/modules/patch/basic/src1/java.base/java/text/AnnotationBuddy.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src1/java.base/java/text/AnnotationBuddy.java rename to jdk/test/tools/launcher/modules/patch/basic/src1/java.base/java/text/AnnotationBuddy.java diff --git a/jdk/test/tools/launcher/modules/patch/src1/jdk.compiler/com/sun/tools/javac/Main.java b/jdk/test/tools/launcher/modules/patch/basic/src1/jdk.compiler/com/sun/tools/javac/Main.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src1/jdk.compiler/com/sun/tools/javac/Main.java rename to jdk/test/tools/launcher/modules/patch/basic/src1/jdk.compiler/com/sun/tools/javac/Main.java diff --git a/jdk/test/tools/launcher/modules/patch/src1/jdk.compiler/com/sun/tools/javac/MainBuddy.java b/jdk/test/tools/launcher/modules/patch/basic/src1/jdk.compiler/com/sun/tools/javac/MainBuddy.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src1/jdk.compiler/com/sun/tools/javac/MainBuddy.java rename to jdk/test/tools/launcher/modules/patch/basic/src1/jdk.compiler/com/sun/tools/javac/MainBuddy.java diff --git a/jdk/test/tools/launcher/modules/patch/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClient.java b/jdk/test/tools/launcher/modules/patch/basic/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClient.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClient.java rename to jdk/test/tools/launcher/modules/patch/basic/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClient.java diff --git a/jdk/test/tools/launcher/modules/patch/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClientBuddy.java b/jdk/test/tools/launcher/modules/patch/basic/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClientBuddy.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClientBuddy.java rename to jdk/test/tools/launcher/modules/patch/basic/src1/jdk.naming.dns/com/sun/jndi/dns/DnsClientBuddy.java diff --git a/jdk/test/tools/launcher/modules/patch/src2/java.base/java/lang2/Object.java b/jdk/test/tools/launcher/modules/patch/basic/src2/java.base/java/lang2/Object.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src2/java.base/java/lang2/Object.java rename to jdk/test/tools/launcher/modules/patch/basic/src2/java.base/java/lang2/Object.java diff --git a/jdk/test/tools/launcher/modules/patch/src2/jdk.compiler/com/sun/tools/javac2/Main.java b/jdk/test/tools/launcher/modules/patch/basic/src2/jdk.compiler/com/sun/tools/javac2/Main.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src2/jdk.compiler/com/sun/tools/javac2/Main.java rename to jdk/test/tools/launcher/modules/patch/basic/src2/jdk.compiler/com/sun/tools/javac2/Main.java diff --git a/jdk/test/tools/launcher/modules/patch/src2/jdk.naming.dns/com/sun/jndi/dns2/Zone.java b/jdk/test/tools/launcher/modules/patch/basic/src2/jdk.naming.dns/com/sun/jndi/dns2/Zone.java similarity index 100% rename from jdk/test/tools/launcher/modules/patch/src2/jdk.naming.dns/com/sun/jndi/dns2/Zone.java rename to jdk/test/tools/launcher/modules/patch/basic/src2/jdk.naming.dns/com/sun/jndi/dns2/Zone.java diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java b/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java new file mode 100644 index 00000000000..0e5345aefb3 --- /dev/null +++ b/jdk/test/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java @@ -0,0 +1,225 @@ +/** + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8157068 + * @summary Patch java.base and user module with Hashes attribute tied with + * other module. + * @library /lib/testlibrary + * @modules jdk.compiler + * @build CompilerUtils + * @run testng PatchSystemModules + */ + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; + +import jdk.testlibrary.FileUtils; +import jdk.testlibrary.JDKToolFinder; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +import static jdk.testlibrary.ProcessTools.executeCommand; +import static org.testng.Assert.*; + +public class PatchSystemModules { + private static final String JAVA_HOME = System.getProperty("java.home"); + + private static final Path TEST_SRC = Paths.get(System.getProperty("test.src")); + private static final Path PATCH_SRC_DIR = TEST_SRC.resolve("src1"); + + private static final Path JMODS = Paths.get(JAVA_HOME, "jmods"); + private static final Path MODS_DIR = Paths.get("mods"); + private static final Path JARS_DIR = Paths.get("jars"); + private static final Path PATCH_DIR = Paths.get("patches"); + private static final Path IMAGE = Paths.get("image"); + + private static final String JAVA_BASE = "java.base"; + private final String[] modules = new String[] { "m1", "m2" }; + + @BeforeTest + private void setup() throws Throwable { + Path src = TEST_SRC.resolve("src"); + for (String name : modules) { + assertTrue(CompilerUtils.compile(src.resolve(name), + MODS_DIR, + "-modulesourcepath", src.toString())); + } + + // compile patched source + assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve(JAVA_BASE), + PATCH_DIR.resolve(JAVA_BASE), + "-Xmodule:java.base")); + assertTrue(CompilerUtils.compile(PATCH_SRC_DIR.resolve("m2"), + PATCH_DIR.resolve("m2"))); + + // create an image with only m1 and m2 + if (Files.exists(JMODS)) { + // create an image with m1,m2 + createImage(); + } + } + + @Test + public void test() throws Throwable { + Path patchedJavaBase = PATCH_DIR.resolve(JAVA_BASE); + Path patchedM2 = PATCH_DIR.resolve("m2"); + + Path home = Paths.get(JAVA_HOME); + runTest(home, + "-mp", MODS_DIR.toString(), + "-m", "m1/p1.Main", "1"); + runTest(home, + "-Xpatch:java.base=" + patchedJavaBase.toString(), + "-mp", MODS_DIR.toString(), + "-m", "m1/p1.Main", "1"); + + runTest(home, + "-Xpatch:m2=" + patchedM2.toString(), + "-mp", MODS_DIR.toString(), + "-m", "m1/p1.Main", "2"); + } + + @Test + public void testImage() throws Throwable { + if (Files.notExists(JMODS)) + return; + + Path patchedJavaBase = PATCH_DIR.resolve(JAVA_BASE); + Path patchedM2 = PATCH_DIR.resolve("m2"); + + runTest(IMAGE, + "-m", "m1/p1.Main", "1"); + runTest(IMAGE, + "-Xpatch:java.base=" + patchedJavaBase.toString(), + "-m", "m1/p1.Main", "1"); + runTest(IMAGE, + "-Xpatch:m2=" + patchedM2.toString(), + "-m", "m1/p1.Main", "2"); + } + + @Test + public void upgradeTiedModule() throws Throwable { + if (Files.notExists(JMODS)) + return; + + Path m1 = MODS_DIR.resolve("m1.jar"); + + // create another m1.jar + jar("--create", + "--file=" + m1.toString(), + "-C", MODS_DIR.resolve("m1").toString(), "."); + + // Fail to upgrade m1.jar with mismatched hash + runTestWithExitCode(getJava(IMAGE), + "-upgrademodulepath", m1.toString(), + "-m", "m1/p1.Main"); + + runTestWithExitCode(getJava(IMAGE), + "-Xpatch:java.base=" + PATCH_DIR.resolve(JAVA_BASE).toString(), + "-upgrademodulepath", m1.toString(), + "-m", "m1/p1.Main", "1"); + } + + private void runTestWithExitCode(String... options) throws Throwable { + assertTrue(executeCommand(options) + .outputTo(System.out) + .errorTo(System.out) + .shouldContain("differs to expected hash") + .getExitValue() != 0); + } + + private void runTest(Path image, String... opts) throws Throwable { + String[] options = + Stream.concat(Stream.of(getJava(image)), + Stream.of(opts)) + .toArray(String[]::new); + + ProcessBuilder pb = new ProcessBuilder(options); + int exitValue = executeCommand(pb) + .outputTo(System.out) + .errorTo(System.out) + .getExitValue(); + + assertTrue(exitValue == 0); + } + + static void createImage() throws Throwable { + FileUtils.deleteFileTreeUnchecked(JARS_DIR); + FileUtils.deleteFileTreeUnchecked(IMAGE); + + Files.createDirectories(JARS_DIR); + Path m1 = JARS_DIR.resolve("m1.jar"); + Path m2 = JARS_DIR.resolve("m2.jar"); + + // hash m1 in m2's Hashes attribute + jar("--create", + "--file=" + m1.toString(), + "-C", MODS_DIR.resolve("m1").toString(), "."); + + jar("--create", + "--file=" + m2.toString(), + "--modulepath", JARS_DIR.toString(), + "--hash-modules", "m1", + "-C", MODS_DIR.resolve("m2").toString(), "."); + + + String mpath = JARS_DIR.toString() + File.pathSeparator + JMODS.toString(); + execTool("jlink", "--modulepath", mpath, + "--addmods", "m1", + "--output", IMAGE.toString()); + } + + static void jar(String... args) throws Throwable { + execTool("jar", args); + } + + static void execTool(String tool, String... args) throws Throwable { + String path = JDKToolFinder.getJDKTool(tool); + List commands = new ArrayList<>(); + commands.add(path); + Stream.of(args).forEach(commands::add); + ProcessBuilder pb = new ProcessBuilder(commands); + int exitValue = executeCommand(pb) + .outputTo(System.out) + .errorTo(System.out) + .shouldNotContain("no module is recorded in hash") + .getExitValue(); + + assertTrue(exitValue == 0); + } + + static String getJava(Path image) { + boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("win"); + Path java = image.resolve("bin").resolve(isWindows ? "java.exe" : "java"); + if (Files.notExists(java)) + throw new RuntimeException(java + " not found"); + return java.toAbsolutePath().toString(); + } +} diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/src/m1/module-info.java b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m1/module-info.java new file mode 100644 index 00000000000..d23aeb1669b --- /dev/null +++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m1/module-info.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m1 { + requires m2; +} diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/src/m1/p1/Main.java b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m1/p1/Main.java new file mode 100644 index 00000000000..2329905a0f0 --- /dev/null +++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m1/p1/Main.java @@ -0,0 +1,34 @@ +/** + * 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 p1; + +public class Main { + public static void main(String[] args) throws Exception { + int version = p2.Lib.version(); + int expected = args.length == 0 ? 1 : Integer.parseInt(args[0]); + + if (version != expected) + throw new RuntimeException(version + " != " + expected + " (expected)"); + } +} diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/src/m2/module-info.java b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m2/module-info.java new file mode 100644 index 00000000000..bc0f12b2204 --- /dev/null +++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m2/module-info.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module m2 { + exports p2; +} diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/src/m2/p2/Lib.java b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m2/p2/Lib.java new file mode 100644 index 00000000000..1d43aedc718 --- /dev/null +++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src/m2/p2/Lib.java @@ -0,0 +1,30 @@ +/** + * 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 p2; + +public class Lib { + public static int version() { + return 1; + } +} diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/src1/java.base/jdk/internal/modules/SystemModules.java b/jdk/test/tools/launcher/modules/patch/systemmodules/src1/java.base/jdk/internal/modules/SystemModules.java new file mode 100644 index 00000000000..e30761204e1 --- /dev/null +++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src1/java.base/jdk/internal/modules/SystemModules.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jdk.internal.module; + +/* + * Test -Xpatch:java.base=jdk/modules/java.base to override + * java.base with an exploded image + */ +public final class SystemModules { + public static final String[] MODULE_NAMES = new String[0]; +} diff --git a/jdk/test/tools/launcher/modules/patch/systemmodules/src1/m2/p2/Lib.java b/jdk/test/tools/launcher/modules/patch/systemmodules/src1/m2/p2/Lib.java new file mode 100644 index 00000000000..5313c7e7aed --- /dev/null +++ b/jdk/test/tools/launcher/modules/patch/systemmodules/src1/m2/p2/Lib.java @@ -0,0 +1,30 @@ +/** + * 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 p2; + +public class Lib { + public static int version() { + return 2; + } +} diff --git a/jdk/test/tools/pack200/TestNormal.java b/jdk/test/tools/pack200/TestNormal.java index 0172a5e65b6..a85a9d4040f 100644 --- a/jdk/test/tools/pack200/TestNormal.java +++ b/jdk/test/tools/pack200/TestNormal.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,85 +25,37 @@ /* * @test * @run main/timeout=600 TestNormal - * @bug 8020802 + * @bug 8020802 8156807 * @summary Need an ability to create jar files that are invariant to the pack200 packing/unpacking * @author Alexander Zuev */ import java.io.*; -import java.util.Collections; -import java.util.Properties; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; public class TestNormal { private static String FS = File.separator; public static void main(String args[]) throws Exception { - Properties p = System.getProperties(); - String java_home = p.getProperty("test.jdk"); String testdir = Utils.TEST_CLS_DIR.getAbsolutePath(); try { - execJavaCommand(java_home, "jar cnf normalized.jar -C " + testdir + " ."); - execJavaCommand(java_home, "jar cf original.jar -C " + testdir + " ."); - execJavaCommand(java_home, "pack200 -r repacked.jar original.jar"); - compareJars(new JarFile("normalized.jar"), new JarFile("repacked.jar")); + String jarCmd = Utils.getJarCmd(); + String packCmd = Utils.getPack200Cmd(); + + // create the original jar + Utils.runExec(jarCmd, "cf", "original.jar", "-C", testdir, "."); + + // create the reference jar + Utils.runExec(packCmd, "-r", "repacked.jar", "original.jar"); + + // create the normalized jar using jar(1) + Utils.runExec(jarCmd, "cnf", "normalized.jar", "-C", testdir, "."); + + // compare archive contents bit wise, these should be identical! + Utils.doCompareBitWise(new File("repacked.jar"), + new File("normalized.jar")); } finally { - String[] cleanupList = {"normalized.jar", "original.jar", "repacked.jar"}; - for (String s : cleanupList) { - delete(new File(s)); - } - } - } - - public static void execJavaCommand(String java_home, String cmd) throws Exception { - Process proc = Runtime.getRuntime().exec(java_home + FS + "bin" + FS + cmd); - String s; - BufferedReader stdInput = - new BufferedReader(new InputStreamReader(proc.getInputStream())); - BufferedReader stdError = - new BufferedReader(new InputStreamReader(proc.getErrorStream())); - while ((s = stdInput.readLine()) != null) { - System.out.println(s); - } - while ((s = stdError.readLine()) != null) { - System.err.println(s); - } - } - - public static void compareJars(JarFile jf1, JarFile jf2) throws Exception { - try { - if (jf1.size() != jf2.size()) { - throw new Exception("Jars " + jf1.getName() + " and " + jf2.getName() - + " have different number of entries"); - } - for (JarEntry elem1 : Collections.list(jf1.entries())) { - JarEntry elem2 = jf2.getJarEntry(elem1.getName()); - if (elem2 == null) { - throw new Exception("Element " + elem1.getName() + " is missing from " + jf2.getName()); - } - if (!elem1.isDirectory() && elem1.getCrc() != elem2.getCrc()) { - throw new Exception("The crc of " + elem1.getName() + " is different."); - } - } - } finally { - jf1.close(); - jf2.close(); - } - } - - static void delete(File f) throws IOException { - if (!f.exists()) { - return; - } - if (f.isDirectory()) { - for (File c : f.listFiles()) { - delete(c); - } - } - if (!f.delete()) { - throw new FileNotFoundException("Failed to delete file: " + f); + Utils.cleanup(); } } } diff --git a/jdk/test/tools/pack200/Utils.java b/jdk/test/tools/pack200/Utils.java index f4641987e73..45e09c37abc 100644 --- a/jdk/test/tools/pack200/Utils.java +++ b/jdk/test/tools/pack200/Utils.java @@ -33,7 +33,6 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.URI; -import java.net.URL; import java.nio.charset.Charset; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.FileSystem; @@ -483,9 +482,15 @@ class Utils { } return out; } + + static List runExec(String... cmds) { + return runExec(Arrays.asList(cmds)); + } + static List runExec(List cmdsList) { return runExec(cmdsList, null); } + static List runExec(List cmdsList, Map penv) { ArrayList alist = new ArrayList(); ProcessBuilder pb = diff --git a/make/Bundles.gmk b/make/Bundles.gmk new file mode 100644 index 00000000000..140f31afcf2 --- /dev/null +++ b/make/Bundles.gmk @@ -0,0 +1,300 @@ +# +# 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. 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. +# + +default: all + +include $(SPEC) +include MakeBase.gmk + +PRODUCT_TARGETS := +TEST_TARGETS := +DOCS_TARGETS := + +# On Windows tar frequently complains that "file changed as we read it" for +# some random source files. This seems to be cause by anti virus scanners and +# is most likely safe to ignore. When it happens, tar returns '1'. +ifeq ($(OPENJDK_BUILD_OS), windows) + TAR_IGNORE_EXIT_VALUE := || test "$$$$?" = "1" +endif + +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, , Bundles-pre.gmk)) +################################################################################ +# BUNDLE : Name of bundle to create +# FILES : Files in BASE_DIR to add to bundle +# SPECIAL_INCLUDES : List of directories inside BASE_DIR to look for additional +# files in. These files will not get proper dependency handling. Use when +# files or directories may contain spaces. +# BASE_DIR : Base directory for the root dir in the bundle. +# SUBDIR : Optional name of root dir in bundle. +SetupBundleFile = $(NamedParamsMacroTemplate) +define SetupBundleFileBody + + $1_RELATIVE_FILES := $$(patsubst $$($1_BASE_DIR)/%, ./%, $$($1_FILES)) + + ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), ) + $1_TYPE := tar.gz + else ifneq ($$(filter %.zip, $$($1_BUNDLE_NAME)), ) + $1_TYPE := zip + else + $$(error Unknown bundle type $$($1_BUNDLE_NAME)) + endif + + $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false) + + $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES) + $$(eval $$(call ListPathsSafely, \ + $1_RELATIVE_FILES, \ + $(SUPPORT_OUTPUTDIR)/bundles/_$1_files)) + $$(call MakeDir, $$(@D)) + ifneq ($$($1_SPECIAL_INCLUDES), ) + $$(foreach i, $$($1_SPECIAL_INCLUDES), \ + ($(CD) $$($1_BASE_DIR) && $(FIND) ./$$i \ + >> $(SUPPORT_OUTPUTDIR)/bundles/_$1_files ) ; ) + endif + ifneq ($$($1_SUBDIR), ) + ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO), tar.gz-true-false) + $(CD) $$($1_BASE_DIR) \ + && ( $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \ + --transform 's|^|$$($1_SUBDIR)/|' $(TAR_IGNORE_EXIT_VALUE) ) \ + | $(GZIP) > $$@ + else + # If a subdir has been specified, copy all files into a temporary + # location with this subdir before creating the tar file + $(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) + $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) + ( $(CD) $$($1_BASE_DIR) \ + && $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \ + $(TAR_IGNORE_EXIT_VALUE) ) \ + | ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - ) + # Unzip any zipped debuginfo files + ifeq ($$($1_UNZIP_DEBUGINFO), true) + for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \ + $(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \ + done + endif + ifeq ($$($1_TYPE), tar.gz) + $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \ + ( $(TAR) cf - $$($1_SUBDIR) $(TAR_IGNORE_EXIT_VALUE) ) | $(GZIP) > $$@ + else ifeq ($$($1_TYPE), zip) + $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIP) -qr $$@ . + endif + endif + else + ifeq ($$($1_TYPE), tar.gz) + $(CD) $$($1_BASE_DIR) \ + && ( $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \ + $(TAR_IGNORE_EXIT_VALUE) ) \ + | $(GZIP) > $$@ + else ifeq ($$($1_TYPE), zip) + $(CD) $$($1_BASE_DIR) \ + && $(ZIP) -qr $$@ . -i@$(SUPPORT_OUTPUTDIR)/bundles/_$1_files + endif + endif + + $1 += $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME) + +endef + +################################################################################ + +# On Macosx, we bundle up the macosx specific images which already have the +# correct base directories. +ifeq ($(OPENJDK_TARGET_OS)-$(DEBUG_LEVEL), macosx-release) + JDK_IMAGE_DIR := $(JDK_MACOSX_BUNDLE_DIR) + JRE_IMAGE_DIR := $(JRE_MACOSX_BUNDLE_DIR) + JDK_IMAGE_HOMEDIR := $(JDK_MACOSX_CONTENTS_DIR)/Home + JRE_IMAGE_HOMEDIR := $(JRE_MACOSX_CONTENTS_DIR)/Home + JDK_BUNDLE_SUBDIR := + JRE_BUNDLE_SUBDIR := +else + JDK_IMAGE_HOMEDIR := $(JDK_IMAGE_DIR) + JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR) + JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER) + JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER) + ifneq ($(DEBUG_LEVEL), release) + JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL) + JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL) + endif +endif + +################################################################################ + +ifneq ($(filter product-bundles, $(MAKECMDGOALS)), ) + $(eval $(call FillCacheFind, $(IMAGES_OUTPUTDIR))) + + SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.pdb %.map + + ALL_JDK_FILES := $(call CacheFind, $(JDK_IMAGE_DIR)) + + # Create special filter rules when dealing with unzipped .dSYM directories on + # macosx + ifeq ($(OPENJDK_TARGET_OS), macosx) + ifeq ($(ZIP_DEBUGINFO_FILES), false) + JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \ + $(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, $(ALL_JDK_FILES)))) + endif + endif + + JDK_BUNDLE_FILES := \ + $(filter-out \ + $(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) \ + , \ + $(ALL_JDK_FILES) \ + ) \ + $(call CacheFind, $(SYMBOLS_IMAGE_DIR)) + + ALL_JRE_FILES := $(call CacheFind, $(JRE_IMAGE_DIR)) + + # Create special filter rules when dealing with unzipped .dSYM directories on + # macosx + ifeq ($(OPENJDK_TARGET_OS), macosx) + ifeq ($(ZIP_DEBUGINFO_FILES), false) + JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \ + $(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES)))) + endif + endif + + JRE_BUNDLE_FILES := $(filter-out \ + $(JRE_SYMBOLS_EXCLUDE_PATTERN) \ + $(SYMBOLS_EXCLUDE_PATTERN), \ + $(ALL_JRE_FILES)) + JRE_SYMBOLS_BUNDLE_FILES := $(filter \ + $(JRE_SYMBOLS_EXCLUDE_PATTERN) \ + $(SYMBOLS_EXCLUDE_PATTERN), \ + $(ALL_JRE_FILES)) + + $(eval $(call SetupBundleFile, BUILD_JDK_BUNDLE, \ + BUNDLE_NAME := $(JDK_BUNDLE_NAME), \ + FILES := $(JDK_BUNDLE_FILES), \ + SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \ + BASE_DIR := $(JDK_IMAGE_DIR), \ + SUBDIR := $(JDK_BUNDLE_SUBDIR), \ + )) + + PRODUCT_TARGETS += $(BUILD_JDK_BUNDLE) + + $(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \ + BUNDLE_NAME := $(JRE_BUNDLE_NAME), \ + FILES := $(JRE_BUNDLE_FILES), \ + BASE_DIR := $(JRE_IMAGE_DIR), \ + SUBDIR := $(JRE_BUNDLE_SUBDIR), \ + )) + + PRODUCT_TARGETS += $(BUILD_JRE_BUNDLE) + + $(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \ + BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \ + FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \ + BASE_DIR := $(JDK_IMAGE_DIR), \ + SUBDIR := $(JDK_BUNDLE_SUBDIR), \ + UNZIP_DEBUGINFO := true, \ + )) + + PRODUCT_TARGETS += $(BUILD_JDK_SYMBOLS_BUNDLE) + + $(eval $(call SetupBundleFile, BUILD_JRE_SYMBOLS_BUNDLE, \ + BUNDLE_NAME := $(JRE_SYMBOLS_BUNDLE_NAME), \ + FILES := $(JRE_SYMBOLS_BUNDLE_FILES), \ + BASE_DIR := $(JRE_IMAGE_DIR), \ + SUBDIR := $(JRE_BUNDLE_SUBDIR), \ + UNZIP_DEBUGINFO := true, \ + )) + + PRODUCT_TARGETS += $(BUILD_JRE_SYMBOLS_BUNDLE) + + $(eval $(call SetupBundleFile, BUILD_DEMOS_BUNDLE, \ + BUNDLE_NAME := $(DEMOS_BUNDLE_NAME), \ + FILES := $(call DoubleDollar, $(DEMOS_BUNDLE_FILES)), \ + BASE_DIR := $(JDK_IMAGE_DIR), \ + SUBDIR := $(JDK_BUNDLE_SUBDIR), \ + )) + + PRODUCT_TARGETS += $(BUILD_DEMOS_BUNDLE) +endif + +################################################################################ + +ifneq ($(filter test-bundles, $(MAKECMDGOALS)), ) + TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR)) + + $(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \ + BUNDLE_NAME := $(TEST_BUNDLE_NAME), \ + FILES := $(call DoubleDollar, $(TEST_BUNDLE_FILES)), \ + BASE_DIR := $(TEST_IMAGE_DIR), \ + )) + + TEST_TARGETS += $(BUILD_TEST_BUNDLE) +endif + +################################################################################ + +ifneq ($(filter docs-bundles, $(MAKECMDGOALS)), ) + DOCS_BUNDLE_FILES := $(call CacheFind, $(DOCS_IMAGE_DIR)) + + $(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \ + BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \ + FILES := $(DOCS_BUNDLE_FILES), \ + BASE_DIR := $(DOCS_IMAGE_DIR), \ + SUBDIR := docs, \ + )) + + DOCS_TARGETS += $(BUILD_DOCS_BUNDLE) +endif + +################################################################################ + +# Hook to include the corresponding custom file, if present. +$(eval $(call IncludeCustomExtension, , Bundles.gmk)) + +################################################################################ + +product-bundles: $(PRODUCT_TARGETS) +test-bundles: $(TEST_TARGETS) +docs-bundles: $(DOCS_TARGETS) + +.PHONY: all default product-bundles test-bundles docs-bundles diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index 394888c4970..40900ff91a9 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -69,21 +69,13 @@ endif # Add dependencies on other jmod files. Only java.base needs access to other # jmods. ifeq ($(MODULE), java.base) + ALL_UPGRADEABLE_MODULES = $(call FindAllUpgradeableModules) # When creating a BUILDJDK, we don't need to add hashes to java.base ifneq ($(CREATING_BUILDJDK), true) DEPS += $(patsubst %, $(JMODS_DIR)/%.jmod, \ - $(filter-out java.base, $(call FindAllModules))) + $(filter-out java.base $(ALL_UPGRADEABLE_MODULES), $(call FindAllModules))) - # TODO: find modules that directly and indirectly depend on upgradeable - # modules - EXCLUDE_HASH_MODULES := $(UPGRADEABLE_MODULES) \ - java.se.ee \ - jdk.rmic \ - jdk.xml.bind \ - jdk.xml.ws \ - # - - EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(EXCLUDE_HASH_MODULES)))) + EXCLUDE_PATTERN := $(strip $(subst $(SPACE),|,$(strip $(ALL_UPGRADEABLE_MODULES)))) JMOD_FLAGS += --modulepath $(JMODS_DIR) \ --hash-modules '^(?!$(EXCLUDE_PATTERN))' diff --git a/make/GensrcModuleInfo.gmk b/make/GensrcModuleInfo.gmk index 2fbcdc6ab24..f3487b4339d 100644 --- a/make/GensrcModuleInfo.gmk +++ b/make/GensrcModuleInfo.gmk @@ -85,21 +85,41 @@ ifneq ($(MOD_FILES), ) MODS_REST := $(filter-out $(MODS_QUALIFIED_EXPORTS), $(MOD_FILE_CONTENTS)) # Filter the contents for modules that are actually being built - MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES))) - MODIFICATIONS := $(filter $(MODULES_FILTER), $(MODS_QUALIFIED_EXPORTS)) \ + ALL_MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES))) + MODIFICATIONS := $(filter $(ALL_MODULES_FILTER), $(MODS_QUALIFIED_EXPORTS)) \ $(MODS_REST) + # Returns non empty if the package exists in the current module + # Param 1 - Name of package with dots + PackageExists = \ + $(strip $(wildcard $(addsuffix $(subst .,/,/$(strip $1)), \ + $(MODULE_CLASSES_DIRS) \ + $(addsuffix /$(MODULE), $(IMPORT_MODULES_CLASSES)) \ + ))) + # Convert the modification lines into arguments for the modification tool. # Filter out modifications for non existing to-modules. $(foreach line, $(MODIFICATIONS), \ $(eval split_line := $(subst /,$(SPACE),$(line))) \ $(eval command := $(word 1, $(split_line))) \ - $(eval package := $(patsubst %;,%,$(word 2, $(split_line)))) \ - $(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \ - $(if $(to_module), \ - $(eval ARGS += -$(command) $(package)/$(to_module)) \ + $(if $(filter $(command), exports), \ + $(eval package := $(patsubst %;,%,$(word 2, $(split_line)))) \ + $(if $(call PackageExists, $(package)), \ + $(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \ + $(if $(to_module), \ + $(eval ARGS += -$(command) $(package)/$(to_module)) \ + , \ + $(eval ARGS += -$(command) $(package)) \ + ) \ + ) \ , \ - $(eval ARGS += -$(command) $(package)) \ + $(if $(filter $(command), provides), \ + $(eval provider := $(patsubst %;,%,$(word 2, $(split_line)))) \ + $(eval class := $(patsubst %;,%,$(word 4, $(split_line)))) \ + $(eval ARGS += -$(command) $(provider)/$(class)) \ + , \ + $(error A module-info.extra in $(MODULE) contains invalid command $(command)) \ + ) \ ) \ ) diff --git a/make/HotspotWrapper.gmk b/make/HotspotWrapper.gmk deleted file mode 100644 index 663215525a3..00000000000 --- a/make/HotspotWrapper.gmk +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. 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. -# - -# Include the legacy hotspot-spec.gmk (which in turns includes spec.gmk) -BASE_SPEC:=$(SPEC) -# Assign to HOTSPOT_SPEC so that the variable HOTSPOT_SPEC can be -# overridden when building the buildjdk. -HOTSPOT_SPEC := $(dir $(SPEC))hotspot-spec.gmk -include $(HOTSPOT_SPEC) -include MakeBase.gmk - -# Inclusion of this pseudo-target will cause make to execute this file -# serially, regardless of -j. Recursively called makefiles will not be -# affected, however. This is required for correct dependency management. -.NOTPARALLEL: - -default: all - -# Get all files in src, make or agent subdirs in hotspot directory and -# filter out .hg. This skips the test directory. -HOTSPOT_FILES := $(shell $(FIND) -L \ - $(HOTSPOT_TOPDIR)/src $(HOTSPOT_TOPDIR)/make \ - -name ".hg" -prune -o -print) - -# The old build creates hotspot output dir before calling hotspot and -# not doing it breaks builds on msys. -$(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES) - @$(MKDIR) -p $(HOTSPOT_OUTPUTDIR) - ($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) \ - LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC)) - $(TOUCH) $@ - -hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp - -all: hotspot - -.PHONY: default all hotspot diff --git a/make/Images.gmk b/make/Images.gmk index 564f2b27ddb..92adf3013db 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -43,8 +43,9 @@ ALL_MODULES := $(call FindAllModules) $(eval $(call ReadImportMetaData)) -JRE_MODULES += $(filter-out $(MODULES_FILTER), $(BOOT_MODULES) $(PLATFORM_MODULES) $(JRE_TOOL_MODULES)) -JDK_MODULES += $(filter-out $(MODULES_FILTER), $(ALL_MODULES)) +JRE_MODULES += $(filter $(ALL_MODULES), $(BOOT_MODULES) \ + $(PLATFORM_MODULES) $(JRE_TOOL_MODULES)) +JDK_MODULES += $(ALL_MODULES) # Compact builds have additional modules COMPACT1_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk index d1e85b4b746..d27caaf85f1 100644 --- a/make/Javadoc.gmk +++ b/make/Javadoc.gmk @@ -44,7 +44,7 @@ include NON_CORE_PKGS.gmk # Definitions for directories # -DOCSDIR := $(IMAGES_OUTPUTDIR)/docs +DOCSDIR := $(DOCS_IMAGE_DIR) DOCSTMPDIR = $(SUPPORT_OUTPUTDIR)/docs HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_OUTPUTDIR)/docs @@ -1437,7 +1437,6 @@ $(DYNALINKAPI_OPTIONS_FILE): $(call OptionPair,-windowtitle,$(DYNALINKAPI_WINDOWTITLE) $(DRAFT_WINTITLE)); \ $(call OptionPair,-header,$(DYNALINKAPI_HEADER)$(DRAFT_HEADER)) ; \ $(call OptionPair,-bottom,$(DYNALINKAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \ - $(call OptionTrip,-group,$(DYNALINKAPI_GROUPNAME),$(DYNALINKAPI_REGEXP)); \ $(call OptionTrip,-linkoffline,$(DYNALINKAPI2COREAPI),$(COREAPI_DOCSDIR)/); \ ) >> $@ @@ -1634,9 +1633,7 @@ JLINK_PLUGIN_DOCTITLE := JLink Plugin API - EXPERIMENTAL JLINK_PLUGIN_WINDOWTITLE := JLink Plugin API - EXPERIMENTAL JLINK_PLUGIN_HEADER := JLink Plugin API - EXPERIMENTAL JLINK_PLUGIN_BOTTOM := $(call CommonBottom,$(JLINK_PLUGIN_FIRST_COPYRIGHT_YEAR)) -JLINK_PLUGIN_PKGS = jdk.tools.jlink \ - jdk.tools.jlink.builder \ - jdk.tools.jlink.plugin +JLINK_PLUGIN_PKGS = jdk.tools.jlink.plugin JLINK_PLUGIN_INDEX_HTML = $(JLINK_PLUGIN_DOCDIR)/index.html JLINK_PLUGIN_OPTIONS_FILE = $(DOCSTMPDIR)/jlinkplugins.options diff --git a/make/Jprt.gmk b/make/Jprt.gmk index e82b84d5e11..09d6dc7ef7b 100644 --- a/make/Jprt.gmk +++ b/make/Jprt.gmk @@ -32,14 +32,6 @@ ifneq ($(CYGPATH), ) ifdef JPRT_ARCHIVE_BUNDLE override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE)) endif - ifdef JPRT_ARCHIVE_INSTALL_BUNDLE - override JPRT_ARCHIVE_INSTALL_BUNDLE := \ - $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE)) - endif - ifdef JPRT_ARCHIVE_MODULES_BUNDLE - override JPRT_ARCHIVE_MODULES_BUNDLE := \ - $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_MODULES_BUNDLE)) - endif ifdef JPRT_ARCHIVE_TEST_BUNDLE override JPRT_ARCHIVE_TEST_BUNDLE := \ $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_TEST_BUNDLE)) @@ -55,12 +47,6 @@ endif ifndef JPRT_ARCHIVE_BUNDLE JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/jdk-image.zip endif -ifndef JPRT_ARCHIVE_INSTALL_BUNDLE - JPRT_ARCHIVE_INSTALL_BUNDLE=/tmp/jprt_bundles/product-install.zip -endif -ifndef JPRT_ARCHIVE_MODULES_BUNDLE - JPRT_ARCHIVE_MODULES_BUNDLE=/tmp/jprt_bundles/modules.zip -endif ifndef JPRT_ARCHIVE_TEST_BUNDLE JPRT_ARCHIVE_TEST_BUNDLE=/tmp/jprt_bundles/test-image.zip endif @@ -72,94 +58,51 @@ ifeq ($(SKIP_BOOT_CYCLE), false) jprt_bundle: bootcycle-images endif -# This target must be called in the context of a SPEC file -jprt_bundle: $(JPRT_ARCHIVE_BUNDLE) $(JPRT_ARCHIVE_TEST_BUNDLE) \ - $(JPRT_ARCHIVE_MODULES_BUNDLE) +################################################################################ +# JPRT specific bundling targets +JPRT_TARGET ?= $(DEFAULT_MAKE_TARGET) +ifeq ($(JPRT_TARGET), $(DEFAULT_MAKE_TARGET)) + jprt_bundle: $(DEFAULT_MAKE_TARGET) $(JPRT_ARCHIVE_BUNDLE) \ + $(JPRT_ARCHIVE_TEST_BUNDLE) -ifeq ($(GCOV_ENABLED), true) - jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE) -endif + SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR) + SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR) -# This target must be called in the context of a SPEC file -$(JPRT_ARCHIVE_BUNDLE): bundles - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip $@ + # This target must be called in the context of a SPEC file + $(JPRT_ARCHIVE_BUNDLE): product-images + $(call MakeDir, $(@D)) + $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r $@ . -$(JPRT_ARCHIVE_MODULES_BUNDLE): bundles - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $(BUILD_OUTPUT)/bundles/modules.zip $@ + $(JPRT_ARCHIVE_TEST_BUNDLE): test-image + $(call MakeDir, $(@D)) + $(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r $@ . -$(JPRT_ARCHIVE_TEST_BUNDLE): bundles - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip $@ + ############################################################################## + # Optional symbols bundle + ifeq ($(GCOV_ENABLED), true) + jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE) + zip-bundles: $(SYMBOLS_ZIP_BUNDLE) -$(JPRT_ARCHIVE_SYMBOLS_BUNDLE): bundles - $(MKDIR) -p $(@D) - $(RM) $@ - $(CP) $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip $@ + $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images + $(call MakeDir, $(@D)) + $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r $@ . -SRC_JDK_IMAGE_DIR := $(JDK_IMAGE_DIR) -SRC_JRE_IMAGE_DIR := $(JRE_IMAGE_DIR) -SRC_TEST_IMAGE_DIR := $(TEST_IMAGE_DIR) -SRC_JDK_MACOSX_BUNDLE_DIR := $(JDK_MACOSX_BUNDLE_DIR) -SRC_JRE_MACOSX_BUNDLE_DIR := $(JRE_MACOSX_BUNDLE_DIR) + endif + + ############################################################################## -# Bundle up the images -JPRT_TARGET ?= default -ifeq ($(JPRT_TARGET), default) - bundles: $(JPRT_TARGET) - @$(call TargetEnter) - $(MKDIR) -p $(BUILD_OUTPUT)/bundles - $(CD) $(SRC_JDK_IMAGE_DIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip . - $(CD) $(SRC_JRE_IMAGE_DIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip . - $(CD) $(SRC_TEST_IMAGE_DIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip . - $(CD) $(IMAGES_OUTPUTDIR)/jmods && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/modules.zip . - if [ -d $(BUILD_OUTPUT)/install/bundles ] ; then \ - $(CD) $(BUILD_OUTPUT)/install/bundles && $(ZIP) -y -q -r \ - $(JPRT_ARCHIVE_INSTALL_BUNDLE) . ; \ - fi - if [ -d $(SYMBOLS_IMAGE_DIR) ] ; then \ - $(CD) $(SYMBOLS_IMAGE_DIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/$(SYMBOLS_IMAGE_SUBDIR).zip . ; \ - fi - @$(call TargetExit) else - # Just fake the bundles - bundles: $(JPRT_TARGET) + # Just fake the main bundle to satisfy JPRT + jprt_bundle: $(JPRT_TARGET) @$(call TargetEnter) $(MKDIR) -p $(BUILD_OUTPUT)/bundles - $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/$(JDK_IMAGE_SUBDIR).zip README - $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/$(JRE_IMAGE_SUBDIR).zip README - $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/$(TEST_IMAGE_SUBDIR).zip README - $(CD) $(TOPDIR) && $(ZIP) -y -q -r \ - $(BUILD_OUTPUT)/bundles/modules.zip README + $(CD) $(TOPDIR) && $(TAR) cf - README | $(GZIP) > \ + $(JPRT_ARCHIVE_BUNDLE) @$(call TargetExit) endif -# Copy images to one unified location regardless of platform etc. -final-images: $(JPRT_TARGET) - @$(call TargetEnter) - $(RM) -r $(BUILD_OUTPUT)/final-images - $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR) - $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR) - $(CP) -R -P $(SRC_JDK_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_IMAGE_SUBDIR)/ - $(CP) -R -P $(SRC_JRE_IMAGE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_IMAGE_SUBDIR)/ - ifeq ($(OPENJDK_TARGET_OS),macosx) - $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR) - $(MKDIR) -p $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR) - $(CP) -R -P $(SRC_JDK_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JDK_MACOSX_BUNDLE_SUBDIR)/ - $(CP) -R -P $(SRC_JRE_MACOSX_BUNDLE_DIR)/* $(BUILD_OUTPUT)/final-images/$(JRE_MACOSX_BUNDLE_SUBDIR)/ - endif - @$(call TargetExit) +ALL_TARGETS += jprt_bundle -ALL_TARGETS += jprt_bundle bundles final-images +################################################################################ + +$(eval $(call IncludeCustomExtension, , Jprt.gmk)) diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk index ea8913eded5..f860e5e074a 100644 --- a/make/MacBundles.gmk +++ b/make/MacBundles.gmk @@ -34,7 +34,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) bundles: jre-bundle jdk-bundle - # JDK_MACOSX_BUNDLE_DIR and JRE_MACOSX_BUNDLE_DIR are defined in SPEC. + # JDK_MACOSX_CONTENTS_DIR and JRE_MACOSX_CONTENTS_DIR are defined in SPEC. MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle @@ -52,27 +52,27 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR)) JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR)) - JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_MACOSX_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST)) - JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_MACOSX_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST)) + JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_MACOSX_CONTENTS_DIR)/Home/,$(JDK_FILE_LIST)) + JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_MACOSX_CONTENTS_DIR)/Home/,$(JRE_FILE_LIST)) # Copy empty directories (jre/lib/applet). - $(JDK_MACOSX_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/% + $(JDK_MACOSX_CONTENTS_DIR)/Home/%: $(JDK_IMAGE_DIR)/% $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)) $(MKDIR) -p $(@D) if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi - $(JRE_MACOSX_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/% + $(JRE_MACOSX_CONTENTS_DIR)/Home/%: $(JRE_IMAGE_DIR)/% $(call LogInfo, Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)) $(MKDIR) -p $(@D) if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi - $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib: + $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib: $(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)) $(MKDIR) -p $(@D) $(RM) $@ $(LN) -s ../Home/lib/jli/libjli.dylib $@ - $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib: + $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib: $(call LogInfo, Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)) $(MKDIR) -p $(@D) $(RM) $@ @@ -80,7 +80,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) $(eval $(call SetupTextFileProcessing, BUILD_JDK_PLIST, \ SOURCE_FILES := $(MACOSX_PLIST_SRC)/JDK-Info.plist, \ - OUTPUT_FILE := $(JDK_MACOSX_BUNDLE_DIR)/Info.plist, \ + OUTPUT_FILE := $(JDK_MACOSX_CONTENTS_DIR)/Info.plist, \ REPLACEMENTS := \ @@ID@@ => $(BUNDLE_ID).jdk ; \ @@NAME@@ => $(BUNDLE_NAME) ; \ @@ -92,7 +92,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) $(eval $(call SetupTextFileProcessing, BUILD_JRE_PLIST, \ SOURCE_FILES := $(MACOSX_PLIST_SRC)/JRE-Info.plist, \ - OUTPUT_FILE := $(JRE_MACOSX_BUNDLE_DIR)/Info.plist, \ + OUTPUT_FILE := $(JRE_MACOSX_CONTENTS_DIR)/Info.plist, \ REPLACEMENTS := \ @@ID@@ => $(BUNDLE_ID).jre ; \ @@NAME@@ => $(BUNDLE_NAME) ; \ @@ -102,13 +102,13 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) @@VENDOR@@ => $(BUNDLE_VENDOR) , \ )) - jdk-bundle: $(JDK_TARGET_LIST) $(JDK_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib \ + jdk-bundle: $(JDK_TARGET_LIST) $(JDK_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \ $(BUILD_JDK_PLIST) - $(SETFILE) -a B $(dir $(JDK_MACOSX_BUNDLE_DIR)) + $(SETFILE) -a B $(dir $(JDK_MACOSX_CONTENTS_DIR)) - jre-bundle: $(JRE_TARGET_LIST) $(JRE_MACOSX_BUNDLE_DIR)/MacOS/libjli.dylib \ + jre-bundle: $(JRE_TARGET_LIST) $(JRE_MACOSX_CONTENTS_DIR)/MacOS/libjli.dylib \ $(BUILD_JRE_PLIST) - $(SETFILE) -a B $(dir $(JRE_MACOSX_BUNDLE_DIR)) + $(SETFILE) -a B $(dir $(JRE_MACOSX_CONTENTS_DIR)) else # Not macosx diff --git a/make/Main.gmk b/make/Main.gmk index b1700f367ea..cbde81f552c 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -228,16 +228,12 @@ ALL_TARGETS += $(LAUNCHER_TARGETS) # Build hotspot target ifeq ($(BUILD_HOTSPOT),true) - hotspot: - ifeq ($(USE_NEW_HOTSPOT_BUILD), true) - +($(CD) $(HOTSPOT_TOPDIR)/makefiles && $(MAKE) $(MAKE_ARGS) -f BuildHotspot.gmk) - else - +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f HotspotWrapper.gmk) - endif +hotspot: + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildHotspot.gmk) endif hotspot-ide-project: - +($(CD) $(HOTSPOT_TOPDIR)/makefiles && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) + +($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f ide/CreateVSProject.gmk) ALL_TARGETS += hotspot hotspot-ide-project @@ -306,9 +302,13 @@ $(SUPPORT_OUTPUTDIR)/source_tips: FRC BOOTCYCLE_TARGET := product-images bootcycle-images: - @$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image - +$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ - JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main + ifneq ($(COMPILE_TYPE), cross) + $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image) + +$(MAKE) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \ + JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main + else + $(call LogWarn, Boot cycle build disabled when cross compiling) + endif zip-security: +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk) @@ -402,6 +402,11 @@ test-image-jdk-jtreg-native: +($(CD) $(JDK_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNative.gmk \ test-image-jdk-jtreg-native) +ifeq ($(BUILD_GTEST), true) + test-image-hotspot-gtest: + +($(CD) $(HOTSPOT_TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f GtestImage.gmk) +endif + build-test-lib: +($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f BuildTestLib.gmk) @@ -425,32 +430,49 @@ endif ALL_TARGETS += prepare-test-image build-test-hotspot-jtreg-native \ test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \ test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \ - test-failure-handler test-image-failure-handler + test-failure-handler test-image-failure-handler test-image-hotspot-gtest ################################################################################ # Run tests # Run tests specified by $(TEST), or the default test set. test: - $(call RunTests, $(TEST)) + $(call RunTests, $(TEST), $(JDK_IMAGE_DIR)) test-hotspot-jtreg: - $(call RunTests, "hotspot_all") + $(call RunTests, "hotspot_all", $(JDK_IMAGE_DIR)) test-hotspot-jtreg-native: - $(call RunTests, "hotspot_native_sanity") + $(call RunTests, "hotspot_native_sanity", $(JDK_IMAGE_DIR)) test-hotspot-internal: - $(call RunTests, "hotspot_internal") + $(call RunTests, "hotspot_internal", $(JDK_OUTPUTDIR)) + +test-hotspot-gtest: + $(call RunTests, "hotspot_gtest", $(JDK_OUTPUTDIR)) test-jdk-jtreg-native: - $(call RunTests, "jdk_native_sanity") + $(call RunTests, "jdk_native_sanity", $(JDK_IMAGE_DIR)) test-make: ($(CD) $(SRC_ROOT)/test/make && $(MAKE) $(MAKE_ARGS) -f TestMake.gmk $(TEST_TARGET)) ALL_TARGETS += test test-hotspot-jtreg test-hotspot-jtreg-native \ - test-hotspot-internal test-jdk-jtreg-native test-make + test-hotspot-internal test-hotspot-gtest test-jdk-jtreg-native test-make + +################################################################################ +# Bundles + +product-bundles: + +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk product-bundles) + +test-bundles: + +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk test-bundles) + +docs-bundles: + +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk docs-bundles) + +ALL_TARGETS += product-bundles test-bundles docs-bundles ################################################################################ # Install targets @@ -578,7 +600,8 @@ else # When creating a BUILDJDK, we don't need to add hashes to java.base, thus # we don't need to depend on all other jmods ifneq ($(CREATING_BUILDJDK), true) - java.base-jmod: $(filter-out java.base-jmod, $(JMOD_TARGETS)) + java.base-jmod: $(filter-out java.base-jmod \ + $(addsuffix -jmod, $(call FindAllUpgradeableModules)), $(JMOD_TARGETS)) endif # Declare dependencies from -jmod to all other module targets @@ -669,12 +692,22 @@ else test-image-jdk-jtreg-native: build-test-jdk-jtreg-native + test-image-hotspot-gtest: hotspot + test-hotspot-internal: exploded-image test-hotspot-jtreg: jimages test-image + test-hotspot-gtest: exploded-image test-image-hotspot-gtest + install: product-images + product-bundles: product-images + + test-bundles: test-image + + docs-bundles: docs-image + generate-summary: jmods endif @@ -753,14 +786,18 @@ docs-image: docs-javadoc docs-jvmtidoc # This target builds the test image test-image: prepare-test-image test-image-hotspot-jtreg-native \ - test-image-jdk-jtreg-native test-image-failure-handler + test-image-jdk-jtreg-native test-image-failure-handler test-image-hotspot-gtest -# all-images is the top-most target, it builds all our deliverables ("images"). +# all-images builds all our deliverables as images. all-images: product-images test-image docs-image +# all-bundles packages all our deliverables as tar.gz bundles. +all-bundles: product-bundles test-bundles docs-bundles + ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers jmods \ jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples exploded-image \ - create-buildjdk mac-bundles product-images docs-image test-image all-images + create-buildjdk mac-bundles product-images docs-image test-image all-images \ + all-bundles ################################################################################ @@ -771,9 +808,10 @@ default: $(DEFAULT_MAKE_TARGET) jdk: exploded-image images: product-images docs: docs-image +bundles: all-bundles all: all-images -ALL_TARGETS += default jdk images docs all +ALL_TARGETS += default jdk images docs bundles all ################################################################################ ################################################################################ diff --git a/make/MainSupport.gmk b/make/MainSupport.gmk index d09331a0962..7683cfeb2af 100644 --- a/make/MainSupport.gmk +++ b/make/MainSupport.gmk @@ -30,10 +30,10 @@ ifndef _MAINSUPPORT_GMK _MAINSUPPORT_GMK := 1 -# Run the tests specified by $1. +# Run the tests specified by $1, with PRODUCT_HOME specified by $2 define RunTests ($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \ - JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \ + JT_HOME=$(JT_HOME) PRODUCT_HOME=$(strip $2) \ TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \ ALT_OUTPUTDIR=$(OUTPUT_ROOT) TEST_JOBS=$(TEST_JOBS) \ JOBS=$(JOBS) $1) || true diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 1a33d69f3bb..3665297d036 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -145,7 +145,7 @@ ifeq ($(HAS_FILE_FUNCTION), true) $$(strip $2),$$(subst $$(SPACE),$$(NEWLINE),$$(strip $$($$(strip $1))))) endef -else # HAS_FILE_FUNCTION +else # HAS_FILE_FUNCTION = false $(eval compress_paths = \ $(strip $(shell $(CAT) $(SRC_ROOT)/make/common/support/ListPathsSafely-pre-compress.incl))) @@ -172,8 +172,8 @@ else # HAS_FILE_FUNCTION # Param 2 - File to print to # Param 3 - Set to true to append to file instead of overwriting define ListPathsSafely - ifneq (,$$(word 10001,$$($1))) - $$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!) + ifneq (,$$(word 30001,$$($$(strip $1)))) + $$(error Cannot list safely more than 30000 paths. $1 has $$(words $$($$(strip $1))) paths!) endif $$(call MakeDir, $$(dir $2)) ifneq ($$(strip $3), true) @@ -229,6 +229,106 @@ else # HAS_FILE_FUNCTION $$(call ListPathsSafely_IfPrintf,$1,$2,9251,9500) $$(call ListPathsSafely_IfPrintf,$1,$2,9501,9750) $$(call ListPathsSafely_IfPrintf,$1,$2,9751,10000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,10001,10250) + $$(call ListPathsSafely_IfPrintf,$1,$2,10251,10500) + $$(call ListPathsSafely_IfPrintf,$1,$2,10501,10750) + $$(call ListPathsSafely_IfPrintf,$1,$2,10751,11000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,11001,11250) + $$(call ListPathsSafely_IfPrintf,$1,$2,11251,11500) + $$(call ListPathsSafely_IfPrintf,$1,$2,11501,11750) + $$(call ListPathsSafely_IfPrintf,$1,$2,11751,12000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,12001,12250) + $$(call ListPathsSafely_IfPrintf,$1,$2,12251,12500) + $$(call ListPathsSafely_IfPrintf,$1,$2,12501,12750) + $$(call ListPathsSafely_IfPrintf,$1,$2,12751,13000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,13001,13250) + $$(call ListPathsSafely_IfPrintf,$1,$2,13251,13500) + $$(call ListPathsSafely_IfPrintf,$1,$2,13501,13750) + $$(call ListPathsSafely_IfPrintf,$1,$2,13751,14000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,14001,14250) + $$(call ListPathsSafely_IfPrintf,$1,$2,14251,14500) + $$(call ListPathsSafely_IfPrintf,$1,$2,14501,14750) + $$(call ListPathsSafely_IfPrintf,$1,$2,14751,15000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,15001,15250) + $$(call ListPathsSafely_IfPrintf,$1,$2,15251,15500) + $$(call ListPathsSafely_IfPrintf,$1,$2,15501,15750) + $$(call ListPathsSafely_IfPrintf,$1,$2,15751,16000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,16001,16250) + $$(call ListPathsSafely_IfPrintf,$1,$2,16251,16500) + $$(call ListPathsSafely_IfPrintf,$1,$2,16501,16750) + $$(call ListPathsSafely_IfPrintf,$1,$2,16751,17000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,17001,17250) + $$(call ListPathsSafely_IfPrintf,$1,$2,17251,17500) + $$(call ListPathsSafely_IfPrintf,$1,$2,17501,17750) + $$(call ListPathsSafely_IfPrintf,$1,$2,17751,18000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,18001,18250) + $$(call ListPathsSafely_IfPrintf,$1,$2,18251,18500) + $$(call ListPathsSafely_IfPrintf,$1,$2,18501,18750) + $$(call ListPathsSafely_IfPrintf,$1,$2,18751,19000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,19001,19250) + $$(call ListPathsSafely_IfPrintf,$1,$2,19251,19500) + $$(call ListPathsSafely_IfPrintf,$1,$2,19501,19750) + $$(call ListPathsSafely_IfPrintf,$1,$2,19751,20000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,20001,20250) + $$(call ListPathsSafely_IfPrintf,$1,$2,20251,20500) + $$(call ListPathsSafely_IfPrintf,$1,$2,20501,20750) + $$(call ListPathsSafely_IfPrintf,$1,$2,20751,21000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,21001,21250) + $$(call ListPathsSafely_IfPrintf,$1,$2,21251,21500) + $$(call ListPathsSafely_IfPrintf,$1,$2,21501,21750) + $$(call ListPathsSafely_IfPrintf,$1,$2,21751,22000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,22001,22250) + $$(call ListPathsSafely_IfPrintf,$1,$2,22251,22500) + $$(call ListPathsSafely_IfPrintf,$1,$2,22501,22750) + $$(call ListPathsSafely_IfPrintf,$1,$2,22751,23000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,23001,23250) + $$(call ListPathsSafely_IfPrintf,$1,$2,23251,23500) + $$(call ListPathsSafely_IfPrintf,$1,$2,23501,23750) + $$(call ListPathsSafely_IfPrintf,$1,$2,23751,24000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,24001,24250) + $$(call ListPathsSafely_IfPrintf,$1,$2,24251,24500) + $$(call ListPathsSafely_IfPrintf,$1,$2,24501,24750) + $$(call ListPathsSafely_IfPrintf,$1,$2,24751,25000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,25001,25250) + $$(call ListPathsSafely_IfPrintf,$1,$2,25251,25500) + $$(call ListPathsSafely_IfPrintf,$1,$2,25501,25750) + $$(call ListPathsSafely_IfPrintf,$1,$2,25751,26000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,26001,26250) + $$(call ListPathsSafely_IfPrintf,$1,$2,26251,26500) + $$(call ListPathsSafely_IfPrintf,$1,$2,26501,26750) + $$(call ListPathsSafely_IfPrintf,$1,$2,26751,27000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,27001,27250) + $$(call ListPathsSafely_IfPrintf,$1,$2,27251,27500) + $$(call ListPathsSafely_IfPrintf,$1,$2,27501,27750) + $$(call ListPathsSafely_IfPrintf,$1,$2,27751,28000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,28001,28250) + $$(call ListPathsSafely_IfPrintf,$1,$2,28251,28500) + $$(call ListPathsSafely_IfPrintf,$1,$2,28501,28750) + $$(call ListPathsSafely_IfPrintf,$1,$2,28751,29000) + + $$(call ListPathsSafely_IfPrintf,$1,$2,29001,29250) + $$(call ListPathsSafely_IfPrintf,$1,$2,29251,29500) + $$(call ListPathsSafely_IfPrintf,$1,$2,29501,29750) + $$(call ListPathsSafely_IfPrintf,$1,$2,29751,30000) endef endif # HAS_FILE_FUNCTION @@ -420,8 +520,12 @@ else ifeq ($(OPENJDK_TARGET_OS),macosx) # set. Some files get their write permissions removed after being copied to the # output dir. When these are copied again to images, xattr would fail. By only clearing # attributes when they are present, failing on this is avoided. + # + # If copying a soft link to a directory, need to delete the target first to avoid + # weird errors. define install-file $(MKDIR) -p '$(@D)' + $(RM) '$@' $(CP) -fRP '$<' '$@' if [ -n "`$(XATTR) -l '$@'`" ]; then $(XATTR) -c '$@'; fi endef diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk index ba1f82e5d5b..90469d073fd 100644 --- a/make/common/Modules.gmk +++ b/make/common/Modules.gmk @@ -72,7 +72,6 @@ BOOT_MODULES += \ # to be deprivileged BOOT_MODULES += \ - java.scripting \ java.sql.rowset \ java.smartcardio \ jdk.naming.rmi \ @@ -87,6 +86,10 @@ UPGRADEABLE_MODULES += \ java.xml.ws \ # +# Modules explicitly declared as not being upgradeable even though they require +# an upgradeable module. +NON_UPGRADEABLE_MODULES += + AGGREGATOR_MODULES += \ java.compact1 \ java.compact2 \ @@ -102,6 +105,7 @@ PLATFORM_MODULES += \ PLATFORM_MODULES += \ java.compiler \ + java.scripting \ jdk.accessibility \ jdk.charsets \ jdk.crypto.ec \ @@ -245,6 +249,19 @@ FindTransitiveDepsForModule = \ $(foreach n, $(call FindDepsForModule, $m), \ $(call FindDepsForModule, $n)))) +# Upgradeable modules are those that are either defined as upgradeable or that +# require an upradeable module. +FindAllUpgradeableModules = \ + $(filter-out $(MODULES_FILTER) $(NON_UPGRADEABLE_MODULES), \ + $(sort $(UPGRADEABLE_MODULES) $(foreach m, \ + $(filter-out $(UPGRADEABLE_MODULES), $(call FindAllModules)), \ + $(if $(filter $(UPGRADEABLE_MODULES), \ + $(call FindTransitiveDepsForModule, $m)), \ + $m \ + ) \ + )) \ + ) + ################################################################################ # Param 1 - Name of module diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index db09eb5bbf3..cb2f96e0ddf 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -372,6 +372,9 @@ endef # toolchain when compiling C++ code # STRIP_SYMBOLS Set to true to strip the final binary if the toolchain allows for it # DEBUG_SYMBOLS Set to false to disable generation of debug symbols +# COPY_DEBUG_SYMBOLS Set to false to override global setting of debug symbol copying +# ZIP_EXTERNAL_DEBUG_SYMBOLS Set to false to override global setting of debug symbol +# zipping # CFLAGS_DEBUG_SYMBOLS Overrides the default cflags for enabling debug symbols # CXXFLAGS_DEBUG_SYMBOLS Overrides the default cxxflags for enabling debug symbols # STRIPFLAGS Optionally change the flags given to the strip command @@ -814,7 +817,15 @@ define SetupNativeCompilationBody # Need to make sure TARGET is first on list $1 := $$($1_TARGET) - ifeq ($(COPY_DEBUG_SYMBOLS), true) + ifneq ($$($1_COPY_DEBUG_SYMBOLS), false) + $1_COPY_DEBUG_SYMBOLS := $(COPY_DEBUG_SYMBOLS) + endif + + ifneq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), false) + $1_ZIP_EXTERNAL_DEBUG_SYMBOLS := $(ZIP_EXTERNAL_DEBUG_SYMBOLS) + endif + + ifeq ($$($1_COPY_DEBUG_SYMBOLS), true) ifneq ($$($1_DEBUG_SYMBOLS), false) # Only copy debug symbols for dynamic libraries and programs. ifeq ($$($1_STATIC_LIBRARY), ) @@ -861,7 +872,7 @@ define SetupNativeCompilationBody $$($1_TARGET): $$($1_DEBUGINFO_FILES) $$($1_DEBUGINFO_FILES): $$($1_ALL_OBJS) - ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), true) + ifeq ($$($1_ZIP_EXTERNAL_DEBUG_SYMBOLS), true) $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP)) diff --git a/make/idea/idea.gmk b/make/idea/idea.gmk index 329c01cd5ea..299ffe805bc 100644 --- a/make/idea/idea.gmk +++ b/make/idea/idea.gmk @@ -35,5 +35,6 @@ else #with SPEC $(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT) $(ECHO) "CYGPATH=\"$(CYGPATH)\"" >> $(OUT) $(ECHO) "SPEC=\"$(SPEC)\"" >> $(OUT) + $(ECHO) "JT_HOME=\"$(JT_HOME)\"" >> $(OUT) endif diff --git a/make/idea/template/ant.xml b/make/idea/template/ant.xml index 6e72e478cbc..f5274deb5bb 100644 --- a/make/idea/template/ant.xml +++ b/make/idea/template/ant.xml @@ -5,9 +5,8 @@ - + - diff --git a/make/idea/template/build.xml b/make/idea/template/build.xml index ed62f296726..b10490f77f1 100644 --- a/make/idea/template/build.xml +++ b/make/idea/template/build.xml @@ -16,6 +16,10 @@ + + + + @@ -29,26 +33,6 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/make/idea/template/src/idea/JdkIdeaAntLogger.java b/make/idea/template/src/idea/JdkIdeaAntLogger.java index 9913499e7a0..22d42a93805 100644 --- a/make/idea/template/src/idea/JdkIdeaAntLogger.java +++ b/make/idea/template/src/idea/JdkIdeaAntLogger.java @@ -99,7 +99,9 @@ public final class JdkIdeaAntLogger extends DefaultLogger { /** jtreg test failure */ JTREG_TEST_FAILED(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "FAILED: "), /** jtreg test error */ - JTREG_TEST_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "Error: "); + JTREG_TEST_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "Error: "), + /** jtreg report */ + JTREG_TEST_REPORT(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "Report written"); StringBinaryPredicate sbp; int priority; @@ -132,7 +134,7 @@ public final class JdkIdeaAntLogger extends DefaultLogger { MAKE("exec", MessageKind.MAKE_ERROR, MessageKind.MAKE_WARNING, MessageKind.MAKE_NOTE, MessageKind.MAKE_OTHER, MessageKind.JAVAC_CRASH), /** jtreg task - invoked during test execution */ - JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR), + JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR, MessageKind.JTREG_TEST_REPORT), /** initial synthetic task when the logger is created */ ROOT("") { @Override diff --git a/make/idea/template/workspace.xml b/make/idea/template/workspace.xml index 2423c3d41fb..e6377dd53a2 100644 --- a/make/idea/template/workspace.xml +++ b/make/idea/template/workspace.xml @@ -8,6 +8,14 @@ + + + + + + +